mirror of
https://shylinux.com/x/icebergs
synced 2025-06-26 10:27:31 +08:00
opt some
This commit is contained in:
parent
eaaa165065
commit
dcd559d99a
@ -1,19 +1,18 @@
|
||||
package ssh
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
ice "github.com/shylinux/icebergs"
|
||||
"github.com/shylinux/icebergs/base/aaa"
|
||||
"github.com/shylinux/icebergs/base/mdb"
|
||||
"github.com/shylinux/icebergs/base/nfs"
|
||||
"github.com/shylinux/icebergs/base/tcp"
|
||||
kit "github.com/shylinux/toolkits"
|
||||
|
||||
"bytes"
|
||||
"encoding/base64"
|
||||
"encoding/binary"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"net"
|
||||
"os"
|
||||
@ -21,6 +20,7 @@ import (
|
||||
"path"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
"unsafe"
|
||||
|
||||
"github.com/kr/pty"
|
||||
@ -218,7 +218,9 @@ func _ssh_config(m *ice.Message) *ssh.ServerConfig {
|
||||
}
|
||||
}
|
||||
})
|
||||
if tcp.IPIsLocal(m, strings.Split(conn.RemoteAddr().String(), ":")[0]) {
|
||||
res = nil
|
||||
}
|
||||
return &ssh.Permissions{Extensions: meta}, res
|
||||
},
|
||||
PasswordCallback: func(conn ssh.ConnMetadata, password []byte) (*ssh.Permissions, error) {
|
||||
|
@ -27,10 +27,16 @@ func init() {
|
||||
export ctx_dev={{.Option "httphost"}}; curl $ctx_dev/publish/ice.sh | sh
|
||||
bin/ice.sh`,
|
||||
"miss", `
|
||||
touch ~/.ssh/config; [ -z "$(cat ~/.ssh/config|grep 'Host {{.Option "hostname"}}')" ] && echo -e "HOST {{.Option "hostname"}}\n Port 9030" >> ~/.ssh/config
|
||||
git clone {{.Option "user.name"}}@{{.Option "hostname"}}:{{.Option "hostpath"}} && cd contexts
|
||||
git clone {{.Option "httphost"}}/code/git/proxy/shylinux/contexts && cd contexts
|
||||
source etc/miss.sh`,
|
||||
yum install -y git vim make go
|
||||
mkdir ~/.ssh &>/dev/null; touch ~/.ssh/config; [ -z "$(cat ~/.ssh/config|grep 'HOST {{.Option "hostname"}}')" ] && echo -e "HOST {{.Option "hostname"}}\n Port 9030" >> ~/.ssh/config
|
||||
export ISH_CONF_HUB_PROXY={{.Option "userhost"}}:.ish/pluged/
|
||||
git clone $ISH_CONF_HUB_PROXY/github.com/shylinux/contexts && cd contexts
|
||||
source etc/miss.sh
|
||||
|
||||
touch ~/.gitconfig; [ -z "$(cat ~/.gitconfig|grep '\[url \"{{.Option "userhost"}}')" ] && echo -e "[url \"{{.Option "userhost"}}:ish/pluged/\"]\n insteadOf=\"https://github.com/\"\n" >> ~/.gitconfig
|
||||
git clone https://github.com/shylinux/contexts && cd contexts
|
||||
source etc/miss.sh
|
||||
`,
|
||||
),
|
||||
)},
|
||||
},
|
||||
@ -38,10 +44,12 @@ source etc/miss.sh`,
|
||||
INSTALL: {Name: "install name=auto port=auto path=auto auto", Help: "安装", Meta: kit.Dict(), Action: map[string]*ice.Action{
|
||||
"contexts": {Name: "contexts item os", Help: "下载", Hand: func(m *ice.Message, arg ...string) {
|
||||
u := kit.ParseURL(m.Option(ice.MSG_USERWEB))
|
||||
m.Option("userhost", fmt.Sprintf("%s@%s", m.Option(ice.MSG_USERNAME), strings.Split(u.Host, ":")[0]))
|
||||
m.Option("hostpath", kit.Path("./.ish/pluged"))
|
||||
|
||||
m.Option("httphost", fmt.Sprintf("%s://%s:%s", u.Scheme, strings.Split(u.Host, ":")[0], kit.Select(kit.Select("80", "443", u.Scheme == "https"), strings.Split(u.Host, ":"), 1)))
|
||||
m.Option("hostport", fmt.Sprintf("%s:%s", strings.Split(u.Host, ":")[0], kit.Select(kit.Select("80", "443", u.Scheme == "https"), strings.Split(u.Host, ":"), 1)))
|
||||
m.Option("hostname", strings.Split(u.Host, ":")[0])
|
||||
m.Option("hostpath", kit.Path("./"))
|
||||
|
||||
if buf, err := kit.Render(m.Conf(INSTALL, kit.Keys("meta.contexts", kit.Select("base", arg, 0))), m); m.Assert(err) {
|
||||
m.Cmdy("web.wiki.spark", "shell", string(buf))
|
||||
|
@ -423,13 +423,9 @@ var Index = &ice.Context{Name: GIT, Help: "代码库",
|
||||
}},
|
||||
|
||||
"/proxy/": {Name: "/repos/", Help: "缓存池", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
s := &httpProxyServer{"http://127.0.0.1:9020/code/git/serve/" + path.Join(arg...)}
|
||||
s.infoRefsHandler(m.W, m.R)
|
||||
m.Render(ice.RENDER_VOID)
|
||||
}},
|
||||
"/serve/": {Name: "/repos/", Help: "缓存池", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
p := kit.Path(path.Join(".ish/pluged/github.com", path.Join(arg[:2]...)))
|
||||
m.Cmdy(cli.SYSTEM, "git-upload-pack", p)
|
||||
m.Render(ice.RENDER_RESULT)
|
||||
}},
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user