mirror of
https://shylinux.com/x/icebergs
synced 2025-06-26 18:37:29 +08:00
opt some
This commit is contained in:
parent
eaaa165065
commit
dcd559d99a
@ -1,19 +1,18 @@
|
|||||||
package ssh
|
package ssh
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
ice "github.com/shylinux/icebergs"
|
ice "github.com/shylinux/icebergs"
|
||||||
"github.com/shylinux/icebergs/base/aaa"
|
"github.com/shylinux/icebergs/base/aaa"
|
||||||
"github.com/shylinux/icebergs/base/mdb"
|
"github.com/shylinux/icebergs/base/mdb"
|
||||||
"github.com/shylinux/icebergs/base/nfs"
|
"github.com/shylinux/icebergs/base/nfs"
|
||||||
|
"github.com/shylinux/icebergs/base/tcp"
|
||||||
kit "github.com/shylinux/toolkits"
|
kit "github.com/shylinux/toolkits"
|
||||||
|
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
@ -21,6 +20,7 @@ import (
|
|||||||
"path"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
"time"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
"github.com/kr/pty"
|
"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
|
res = nil
|
||||||
|
}
|
||||||
return &ssh.Permissions{Extensions: meta}, res
|
return &ssh.Permissions{Extensions: meta}, res
|
||||||
},
|
},
|
||||||
PasswordCallback: func(conn ssh.ConnMetadata, password []byte) (*ssh.Permissions, error) {
|
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
|
export ctx_dev={{.Option "httphost"}}; curl $ctx_dev/publish/ice.sh | sh
|
||||||
bin/ice.sh`,
|
bin/ice.sh`,
|
||||||
"miss", `
|
"miss", `
|
||||||
touch ~/.ssh/config; [ -z "$(cat ~/.ssh/config|grep 'Host {{.Option "hostname"}}')" ] && echo -e "HOST {{.Option "hostname"}}\n Port 9030" >> ~/.ssh/config
|
yum install -y git vim make go
|
||||||
git clone {{.Option "user.name"}}@{{.Option "hostname"}}:{{.Option "hostpath"}} && cd contexts
|
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
|
||||||
git clone {{.Option "httphost"}}/code/git/proxy/shylinux/contexts && cd contexts
|
export ISH_CONF_HUB_PROXY={{.Option "userhost"}}:.ish/pluged/
|
||||||
source etc/miss.sh`,
|
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{
|
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) {
|
"contexts": {Name: "contexts item os", Help: "下载", Hand: func(m *ice.Message, arg ...string) {
|
||||||
u := kit.ParseURL(m.Option(ice.MSG_USERWEB))
|
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("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("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("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) {
|
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))
|
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) {
|
"/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)
|
m.Render(ice.RENDER_VOID)
|
||||||
}},
|
}},
|
||||||
"/serve/": {Name: "/repos/", Help: "缓存池", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
"/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)
|
m.Render(ice.RENDER_RESULT)
|
||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user