mirror of
https://shylinux.com/x/icebergs
synced 2025-04-26 17:44:05 +08:00
opt git.server
This commit is contained in:
parent
8c5624f57a
commit
415b88bc39
@ -314,7 +314,7 @@ func init() {
|
|||||||
"login", true, "space", true, "share", true, "plugin", true, "publish", true, "intshell", true,
|
"login", true, "space", true, "share", true, "plugin", true, "publish", true, "intshell", true,
|
||||||
),
|
),
|
||||||
|
|
||||||
"static", kit.Dict("/", "usr/volcanos/"),
|
"static", kit.Dict("/gitrepos/", "usr/repos/", "/", "usr/volcanos/"),
|
||||||
|
|
||||||
"volcanos", kit.Dict("refresh", "5",
|
"volcanos", kit.Dict("refresh", "5",
|
||||||
"share", "usr/volcanos/page/share.html",
|
"share", "usr/volcanos/page/share.html",
|
||||||
|
@ -13,6 +13,7 @@ section "构建"
|
|||||||
spark shell `
|
spark shell `
|
||||||
yum install -y wget make gcc
|
yum install -y wget make gcc
|
||||||
yum install -y libcurl-devel.x86_64 openssl-devel.x86_64
|
yum install -y libcurl-devel.x86_64 openssl-devel.x86_64
|
||||||
|
yum install perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker
|
||||||
|
|
||||||
wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-1.8.3.1.tar.gz
|
wget https://mirrors.edge.kernel.org/pub/software/scm/git/git-1.8.3.1.tar.gz
|
||||||
tar xvf git-1.8.3.1.tar.gz && cd git-1.8.3.1
|
tar xvf git-1.8.3.1.tar.gz && cd git-1.8.3.1
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
package git
|
package git
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"github.com/AaronO/go-git-http"
|
||||||
"strings"
|
|
||||||
|
|
||||||
ice "github.com/shylinux/icebergs"
|
ice "github.com/shylinux/icebergs"
|
||||||
"github.com/shylinux/icebergs/base/cli"
|
|
||||||
"github.com/shylinux/icebergs/base/web"
|
"github.com/shylinux/icebergs/base/web"
|
||||||
kit "github.com/shylinux/toolkits"
|
kit "github.com/shylinux/toolkits"
|
||||||
)
|
)
|
||||||
@ -24,53 +22,13 @@ func init() {
|
|||||||
web.LOGIN: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
web.LOGIN: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
m.Option(ice.RENDER_OUTPUT, ice.RENDER_RESULT)
|
m.Option(ice.RENDER_OUTPUT, ice.RENDER_RESULT)
|
||||||
}},
|
}},
|
||||||
"/repos/": {Name: "repos", Help: "repos", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
"/github.com/": {Name: "github.com", Help: "github.com", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
m.Option(ice.MSG_USERNAME, "shy")
|
|
||||||
m.Option(cli.CMD_ENV,
|
|
||||||
"GIT_PROJECT_ROOT", kit.Path("./"),
|
|
||||||
"PATH_INFO", "/"+strings.Join(arg, "/"),
|
|
||||||
|
|
||||||
"REMOTE_USER", m.Option(ice.MSG_USERNAME),
|
|
||||||
"REMOTE_ADDR", m.Option(ice.MSG_USERNAME),
|
|
||||||
"GIT_COMMITTER_NAME", m.Option(ice.MSG_USERNAME),
|
|
||||||
"GIT_COMMITTER_EMAIL", m.Option(ice.MSG_USERNAME),
|
|
||||||
|
|
||||||
"REQUEST_METHOD", m.Option(ice.MSG_METHOD),
|
|
||||||
"CONTENT_TYPE", m.R.Header.Get(web.ContentType),
|
|
||||||
|
|
||||||
"GIT_HTTP_EXPORT_ALL", "true",
|
|
||||||
"QUERY_STRING", m.R.URL.RawQuery,
|
|
||||||
"PATH", "/Users/shaoying/miss/contexts/usr/install/git-1.8.3.1"+":"+os.Getenv("PATH"),
|
|
||||||
)
|
|
||||||
|
|
||||||
switch strings.Join(arg, "/") {
|
|
||||||
case "info/refs":
|
|
||||||
msg := m.Cmd(cli.SYSTEM, "/Users/shaoying/miss/contexts/usr/install/git-1.8.3.1"+"/"+"git-http-backend")
|
|
||||||
m.Cmd("nfs.file", "append", "hi.log", msg.Append(cli.CMD_ERR))
|
|
||||||
x := msg.Result()
|
|
||||||
|
|
||||||
ls := strings.Split(x, "\n")
|
|
||||||
for i, v := range ls {
|
|
||||||
vs := strings.SplitN(v, ": ", 2)
|
|
||||||
if strings.TrimSpace(v) == "" {
|
|
||||||
m.Echo(strings.Join(ls[i+1:], "\n") + "\n")
|
|
||||||
break
|
|
||||||
}
|
|
||||||
m.W.Header().Set(vs[0], vs[1])
|
|
||||||
}
|
|
||||||
case "git-upload-pack":
|
|
||||||
m.Option("input", m.R.Body)
|
|
||||||
defer m.R.Body.Close()
|
|
||||||
msg := m.Cmd(cli.SYSTEM, "/Users/shaoying/miss/contexts/usr/install/git-1.8.3.1"+"/"+"git-upload-pack", "--advertise-refs", kit.Path("./"))
|
|
||||||
m.Cmd("nfs.file", "append", "hi.log", msg.Append(cli.CMD_ERR))
|
|
||||||
x := msg.Result()
|
|
||||||
|
|
||||||
ls := strings.SplitN(x, "\n", 2)
|
|
||||||
m.Debug(" %v %v", len(x), x[:len(x)])
|
|
||||||
|
|
||||||
m.Render(ice.RENDER_OUTPUT, ice.RENDER_VOID)
|
m.Render(ice.RENDER_OUTPUT, ice.RENDER_VOID)
|
||||||
m.W.Write([]byte(ls[1]))
|
p := kit.Path(".ish/pluged")
|
||||||
}
|
m.Debug("what %v", p)
|
||||||
|
git := githttp.New(p)
|
||||||
|
m.Debug("what %v", p)
|
||||||
|
git.ServeHTTP(m.W, m.R)
|
||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user