forked from x/icebergs
opt some
This commit is contained in:
parent
4057e30de7
commit
9dc442755d
@ -43,7 +43,14 @@ func init() {
|
||||
func() string { return m.Cmdx(nfs.CAT, kit.Path(os.Args[0], "../../", ice.VAR_LOG_ICE_PORT)) },
|
||||
func() string { return "9020" },
|
||||
)))
|
||||
m.Cmdy(SPIDE, ice.OPS, SPIDE_RAW, http.MethodPost, C(path.Join(arg...)), "pwd", kit.Path(""))
|
||||
args := []string{}
|
||||
for i := range arg {
|
||||
if arg[i] == "--" {
|
||||
arg, args = arg[:i], arg[i+1:]
|
||||
break
|
||||
}
|
||||
}
|
||||
m.Cmdy(SPIDE, ice.OPS, SPIDE_RAW, http.MethodPost, C(path.Join(arg...)), "pwd", kit.Path(""), args)
|
||||
}
|
||||
}},
|
||||
})
|
||||
|
@ -134,7 +134,15 @@ func _serve_handle(key string, cmd *ice.Command, m *ice.Message, w http.Response
|
||||
m.Options(ice.MSG_USERUA, r.Header.Get(html.UserAgent), ice.MSG_USERIP, r.Header.Get(ice.MSG_USERIP))
|
||||
m.Options(ice.MSG_SESSID, kit.Select(m.Option(ice.MSG_SESSID), m.Option(CookieName(m.Option(ice.MSG_USERWEB)))))
|
||||
kit.If(m.Optionv(ice.MSG_CMDS) == nil, func() {
|
||||
kit.If(strings.TrimPrefix(r.URL.Path, key), func(p string) { m.Optionv(ice.MSG_CMDS, strings.Split(p, nfs.PS)) })
|
||||
kit.If(strings.TrimPrefix(r.URL.Path, key), func(p string) {
|
||||
arg := strings.Split(p, nfs.PS)
|
||||
for i, v := range arg {
|
||||
if p, err := url.PathUnescape(v); err == nil {
|
||||
arg[i] = p
|
||||
}
|
||||
}
|
||||
m.Optionv(ice.MSG_CMDS, arg)
|
||||
})
|
||||
})
|
||||
UserHost(m)
|
||||
m.W.Header().Add(strings.ReplaceAll(ice.LOG_TRACEID, ".", "-"), m.Option(ice.LOG_TRACEID))
|
||||
|
@ -75,7 +75,7 @@ func init() {
|
||||
mdb.CREATE: {Name: "create type name text", Hand: func(m *ice.Message, arg ...string) {
|
||||
// kit.If(m.Option(mdb.TYPE) == LOGIN, func() { arg = append(arg, mdb.TEXT, tcp.PublishLocalhost(m, m.Option(mdb.TEXT))) })
|
||||
kit.If(m.Option(mdb.TYPE) == LOGIN && m.Option(mdb.TEXT) == "", func() { arg = append(arg, mdb.TEXT, tcp.PublishLocalhost(m, m.Option(ice.MSG_USERWEB))) })
|
||||
mdb.HashCreate(m, arg, SPACE, m.Option(ice.MSG_USERPOD), aaa.USERNICK, m.Option(ice.MSG_USERNICK), aaa.USERNAME, m.Option(ice.MSG_USERNAME), aaa.USERROLE, m.Option(ice.MSG_USERROLE))
|
||||
mdb.HashCreate(m, m.OptionSimple(mdb.TEXT), arg, SPACE, m.Option(ice.MSG_USERPOD), aaa.USERNICK, m.Option(ice.MSG_USERNICK), aaa.USERNAME, m.Option(ice.MSG_USERNAME), aaa.USERROLE, m.Option(ice.MSG_USERROLE))
|
||||
m.Option(mdb.LINK, tcp.PublishLocalhost(m, m.MergeLink(P(SHARE, m.Result()))))
|
||||
}},
|
||||
LOGIN: {Help: "登录", Hand: func(m *ice.Message, arg ...string) {
|
||||
|
@ -1,7 +1,6 @@
|
||||
package relay
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
@ -285,16 +284,6 @@ func (s relay) Pushbin(m *ice.Message, arg ...string) {
|
||||
s.shell(m, m.Template(PUSHBIN_SH), arg...)
|
||||
s.Modify(m, kit.Simple(m.OptionSimple(MACHINE, web.DREAM))...)
|
||||
}
|
||||
func (s relay) Grant(m *ice.Message, arg ...string) {
|
||||
m.Options(s.Hash.List(m.Spawn(), m.Option(MACHINE)).AppendSimple())
|
||||
ssh.CombinedOutput(m.Message, s.admins(m, kit.JoinWord(web.SHARE,
|
||||
mdb.CREATE, mdb.TYPE, aaa.LOGIN, mdb.TEXT, kit.Format("%q", m.Option("back")))), func(res string) {
|
||||
m.Debug("what %v", url.PathEscape(m.Option("back")))
|
||||
m.Cmd(web.SPIDE, ice.DEV, web.C(web.DREAM, path.Join("text", url.PathEscape(m.Option("back")))))
|
||||
m.ProcessReplace(MergeURL2(m, m.Option("back"), "/share/"+strings.TrimSpace(res)))
|
||||
m.Debug("what %v", res)
|
||||
})
|
||||
}
|
||||
func (s relay) Install(m *ice.Message, arg ...string) {
|
||||
m.Options(web.DOMAIN, "https://shylinux.com", ice.MSG_USERPOD, m.Option(web.DREAM))
|
||||
m.Options(nfs.SOURCE, kit.Value(kit.UnMarshal(web.AdminCmd(m.Message, cli.RUNTIME)), "make.remote"))
|
||||
@ -379,20 +368,3 @@ func (s relay) admin(m *ice.Message, arg ...string) string {
|
||||
func (s relay) admins(m *ice.Message, arg ...string) string {
|
||||
return kit.Select(ice.CONTEXTS, m.Option(web.DREAM)) + nfs.PS + s.admin(m, arg...)
|
||||
}
|
||||
func MergeURL2(m *ice.Message, str string, uri string, arg ...ice.Any) string {
|
||||
raw, err := url.Parse(str)
|
||||
m.Debug("what %v", err)
|
||||
if err != nil {
|
||||
return kit.MergeURL(uri, arg...)
|
||||
}
|
||||
get, err := url.Parse(uri)
|
||||
m.Debug("what %v", err)
|
||||
if err != nil {
|
||||
return kit.MergeURL(str, arg...)
|
||||
}
|
||||
p := get.Path
|
||||
m.Debug("what %v", p)
|
||||
kit.If(!strings.HasPrefix(p, nfs.PS), func() { p = path.Join(raw.Path, get.Path) })
|
||||
kit.If(p == nfs.PS, func() { p = "" })
|
||||
return kit.MergeURL(kit.Select(raw.Scheme, get.Scheme)+"://"+kit.Select(raw.Host, get.Host)+p+"?"+kit.Select(raw.RawQuery, get.RawQuery), arg...)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user