forked from x/icebergs
add some
This commit is contained in:
parent
15a4603a18
commit
618218247b
@ -142,6 +142,7 @@ const (
|
|||||||
VENDOR = "vendor"
|
VENDOR = "vendor"
|
||||||
PRUNE = "prune"
|
PRUNE = "prune"
|
||||||
TABLE = "table"
|
TABLE = "table"
|
||||||
|
CLASS = "class"
|
||||||
|
|
||||||
PAGE = "page"
|
PAGE = "page"
|
||||||
NEXT = "next"
|
NEXT = "next"
|
||||||
|
@ -193,6 +193,7 @@ const (
|
|||||||
VIMER = "vimer"
|
VIMER = "vimer"
|
||||||
XTERM = "xterm"
|
XTERM = "xterm"
|
||||||
GRANT = "grant"
|
GRANT = "grant"
|
||||||
|
OAUTH = "oauth"
|
||||||
DESKTOP = "desktop"
|
DESKTOP = "desktop"
|
||||||
MESSAGE = "message"
|
MESSAGE = "message"
|
||||||
|
|
||||||
@ -222,6 +223,7 @@ const (
|
|||||||
WIKI_PORTAL = "web.wiki.portal"
|
WIKI_PORTAL = "web.wiki.portal"
|
||||||
CHAT_OAUTH_CLIENT = "web.chat.oauth.client"
|
CHAT_OAUTH_CLIENT = "web.chat.oauth.client"
|
||||||
CHAT_WX_ACCESS = "web.chat.wx.access"
|
CHAT_WX_ACCESS = "web.chat.wx.access"
|
||||||
|
CHAT_WX_AGENT = "web.chat.wx.agent"
|
||||||
CHAT_WX_TEMPLATE = "web.chat.wx.template"
|
CHAT_WX_TEMPLATE = "web.chat.wx.template"
|
||||||
CHAT_WX_OCR = "web.chat.wx.ocr"
|
CHAT_WX_OCR = "web.chat.wx.ocr"
|
||||||
CHAT_MESSAGE = "web.chat.message"
|
CHAT_MESSAGE = "web.chat.message"
|
||||||
|
@ -215,14 +215,11 @@ func _serve_domain(m *ice.Message) string {
|
|||||||
}
|
}
|
||||||
func _serve_auth(m *ice.Message, key string, cmds []string, w http.ResponseWriter, r *http.Request) ([]string, bool) {
|
func _serve_auth(m *ice.Message, key string, cmds []string, w http.ResponseWriter, r *http.Request) ([]string, bool) {
|
||||||
kit.If(len(cmds) > 0, func() { cmds = append(kit.Split(cmds[0], ","), cmds[1:]...) })
|
kit.If(len(cmds) > 0, func() { cmds = append(kit.Split(cmds[0], ","), cmds[1:]...) })
|
||||||
|
kit.If(!aaa.IsTechOrRoot(m), func() { m.Option("user_uid", "") })
|
||||||
if r.URL.Path == PP(SPACE) {
|
if r.URL.Path == PP(SPACE) {
|
||||||
aaa.SessCheck(m, m.Option(ice.MSG_SESSID))
|
aaa.SessCheck(m, m.Option(ice.MSG_SESSID))
|
||||||
return cmds, true
|
return cmds, true
|
||||||
}
|
}
|
||||||
if !aaa.IsTechOrRoot(m) {
|
|
||||||
m.Option("user_uid", "")
|
|
||||||
}
|
|
||||||
m.Option("user_uid", "261eb6bf52005d6f8f4889d36efd1424")
|
|
||||||
defer func() { m.Options(ice.MSG_CMDS, "") }()
|
defer func() { m.Options(ice.MSG_CMDS, "") }()
|
||||||
if strings.Contains(m.Option(ice.MSG_SESSID), " ") {
|
if strings.Contains(m.Option(ice.MSG_SESSID), " ") {
|
||||||
m.Cmdy(kit.Split(m.Option(ice.MSG_SESSID)))
|
m.Cmdy(kit.Split(m.Option(ice.MSG_SESSID)))
|
||||||
|
@ -415,7 +415,8 @@ func init() {
|
|||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
nfs.TemplateText = func(m *ice.Message, p string) string {
|
nfs.TemplateText = func(m *ice.Message, p string) string {
|
||||||
if p := kit.Select(nfs.TemplatePath(m, path.Base(p)), m.Option("_template")); kit.HasPrefix(p, nfs.P, nfs.REQUIRE, ice.HTTP) {
|
// if p := kit.Select(nfs.TemplatePath(m, path.Base(p)), m.Option("_template")); kit.HasPrefix(p, nfs.P, nfs.REQUIRE, ice.HTTP) {
|
||||||
|
if p := kit.Select(nfs.TemplatePath(m, p), m.Option("_template")); kit.HasPrefix(p, nfs.P, nfs.REQUIRE, ice.HTTP) {
|
||||||
return m.Cmdx(SPIDE, ice.OPS, SPIDE_RAW, http.MethodGet, p)
|
return m.Cmdx(SPIDE, ice.OPS, SPIDE_RAW, http.MethodGet, p)
|
||||||
} else if p == "" {
|
} else if p == "" {
|
||||||
return ""
|
return ""
|
||||||
|
@ -36,6 +36,9 @@ func install(m *ice.Message, cmd, icon, index string, arg ...string) string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
name := kit.TrimExt(path.Base(icon), nfs.PNG, nfs.JPG, nfs.JPEG)
|
name := kit.TrimExt(path.Base(icon), nfs.PNG, nfs.JPG, nfs.JPEG)
|
||||||
|
if !strings.HasPrefix(icon, nfs.USR_ICONS) {
|
||||||
|
name = kit.Select("", kit.Split(index, "."), -1)
|
||||||
|
}
|
||||||
m.Cmd(Prefix(cmd), mdb.CREATE, mdb.NAME, name, mdb.ICON, icon, ctx.INDEX, index, arg)
|
m.Cmd(Prefix(cmd), mdb.CREATE, mdb.NAME, name, mdb.ICON, icon, ctx.INDEX, index, arg)
|
||||||
return icon
|
return icon
|
||||||
}
|
}
|
||||||
|
@ -74,9 +74,9 @@ func _autogen_version(m *ice.Message) string {
|
|||||||
defer m.Cmd(REPOS, ADD, kit.Dict(nfs.REPOS, path.Base(mod), nfs.FILE, nfs.SRC))
|
defer m.Cmd(REPOS, ADD, kit.Dict(nfs.REPOS, path.Base(mod), nfs.FILE, nfs.SRC))
|
||||||
}
|
}
|
||||||
m.Cmd(nfs.DEFS, ".gitignore", nfs.Template(m, "gitignore"))
|
m.Cmd(nfs.DEFS, ".gitignore", nfs.Template(m, "gitignore"))
|
||||||
m.Cmd(nfs.DEFS, ice.SRC_BINPACK_USR_GO, nfs.Template(m, ice.SRC_BINPACK_GO))
|
m.Cmd(nfs.DEFS, ice.SRC_BINPACK_USR_GO, nfs.Template(m, "binpack.go"))
|
||||||
m.Cmd(nfs.DEFS, ice.SRC_BINPACK_GO, nfs.Template(m, ice.SRC_BINPACK_GO))
|
m.Cmd(nfs.DEFS, ice.SRC_BINPACK_GO, nfs.Template(m, "binpack.go"))
|
||||||
m.Cmd(nfs.SAVE, ice.SRC_VERSION_GO, kit.Format(nfs.Template(m, ice.SRC_VERSION_GO), _autogen_gits(m)))
|
m.Cmd(nfs.SAVE, ice.SRC_VERSION_GO, kit.Format(nfs.Template(m, "version.go"), _autogen_gits(m)))
|
||||||
m.Cmdy(nfs.DIR, ice.SRC_BINPACK_USR_GO)
|
m.Cmdy(nfs.DIR, ice.SRC_BINPACK_USR_GO)
|
||||||
m.Cmdy(nfs.DIR, ice.SRC_BINPACK_GO)
|
m.Cmdy(nfs.DIR, ice.SRC_BINPACK_GO)
|
||||||
m.Cmdy(nfs.DIR, ice.SRC_VERSION_GO)
|
m.Cmdy(nfs.DIR, ice.SRC_VERSION_GO)
|
||||||
@ -214,3 +214,9 @@ func init() {
|
|||||||
func isReleaseContexts(m *ice.Message) bool {
|
func isReleaseContexts(m *ice.Message) bool {
|
||||||
return nfs.Exists(m, ice.USR_RELEASE) && nfs.Exists(m, ice.USR_VOLCANOS) && nfs.Exists(m, ice.USR_INTSHELL) && ice.Info.Make.Module == "shylinux.com/x/contexts"
|
return nfs.Exists(m, ice.USR_RELEASE) && nfs.Exists(m, ice.USR_VOLCANOS) && nfs.Exists(m, ice.USR_INTSHELL) && ice.Info.Make.Module == "shylinux.com/x/contexts"
|
||||||
}
|
}
|
||||||
|
func AutogenMod(m *ice.Message) string {
|
||||||
|
return _autogen_mod(m, ice.GO_MOD)
|
||||||
|
}
|
||||||
|
func AutogenImport(m *ice.Message, zone string) {
|
||||||
|
_autogen_import(m, ice.SRC_MAIN_GO, zone, _autogen_mod(m, ice.GO_MOD))
|
||||||
|
}
|
||||||
|
@ -52,7 +52,7 @@ func _binpack_usr(m *ice.Message) {
|
|||||||
m.Assert(e)
|
m.Assert(e)
|
||||||
defer w.Close()
|
defer w.Close()
|
||||||
defer m.Echo(p)
|
defer m.Echo(p)
|
||||||
fmt.Fprintln(w, nfs.Template(m, ice.SRC_BINPACK_GO))
|
fmt.Fprintln(w, nfs.Template(m, "binpack.go"))
|
||||||
defer fmt.Fprintln(w, nfs.Template(m, "binpack_end.go"))
|
defer fmt.Fprintln(w, nfs.Template(m, "binpack_end.go"))
|
||||||
defer fmt.Fprint(w, lex.TB)
|
defer fmt.Fprint(w, lex.TB)
|
||||||
nfs.OptionFiles(m, nfs.DiskFile)
|
nfs.OptionFiles(m, nfs.DiskFile)
|
||||||
@ -92,7 +92,7 @@ func _binpack_src(m *ice.Message) {
|
|||||||
m.Assert(e)
|
m.Assert(e)
|
||||||
defer w.Close()
|
defer w.Close()
|
||||||
defer m.Echo(p)
|
defer m.Echo(p)
|
||||||
fmt.Fprintln(w, nfs.Template(m, ice.SRC_BINPACK_GO))
|
fmt.Fprintln(w, nfs.Template(m, "binpack.go"))
|
||||||
defer fmt.Fprintln(w, nfs.Template(m, "binpack_end.go"))
|
defer fmt.Fprintln(w, nfs.Template(m, "binpack_end.go"))
|
||||||
defer fmt.Fprint(w, lex.TB)
|
defer fmt.Fprint(w, lex.TB)
|
||||||
nfs.OptionFiles(m, nfs.DiskFile)
|
nfs.OptionFiles(m, nfs.DiskFile)
|
||||||
|
9
exec.go
9
exec.go
@ -117,10 +117,11 @@ func (m *Message) CmdHand(cmd *Command, key string, arg ...string) *Message {
|
|||||||
if m._cmd, m._key, m._sub = cmd, key, LIST; cmd == nil {
|
if m._cmd, m._key, m._sub = cmd, key, LIST; cmd == nil {
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
level := LOG_CMDS
|
||||||
if m._target = cmd.FileLines(); key == SELECT {
|
if m._target = cmd.FileLines(); key == SELECT {
|
||||||
m.Log(LOG_CMDS, "%s.%s %v %v", m.Target().Name, key, formatArg(arg...), m.Optionv(MSG_FIELDS), logs.FileLineMeta(m._fileline()))
|
m.Log(level, "%s.%s %v %v", m.Target().Name, key, formatArg(arg...), m.Optionv(MSG_FIELDS), logs.FileLineMeta(m._fileline()))
|
||||||
} else {
|
} else {
|
||||||
m.Log(LOG_CMDS, "%s.%s %v", m.Target().Name, key, formatArg(arg...), logs.FileLineMeta(m._fileline()))
|
m.Log(level, "%s.%s %v", m.Target().Name, key, formatArg(arg...), logs.FileLineMeta(m._fileline()))
|
||||||
}
|
}
|
||||||
if cmd.Hand != nil {
|
if cmd.Hand != nil {
|
||||||
cmd.Hand(m, arg...)
|
cmd.Hand(m, arg...)
|
||||||
@ -233,7 +234,9 @@ func (c *Context) _action(m *Message, cmd *Command, key string, sub string, h *A
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
m._target = kit.Select(logs.FileLine(h.Hand), cmd.FileLines(), cmd.RawHand != nil)
|
m._target = kit.Select(logs.FileLine(h.Hand), cmd.FileLines(), cmd.RawHand != nil)
|
||||||
m.Log(LOG_CMDS, "%s.%s %s %v", c.Name, key, sub, formatArg(arg...), logs.FileLineMeta(m._fileline()))
|
level := LOG_CMDS
|
||||||
|
kit.If(key == "role" && sub == "right", func() { level = LOG_AUTH })
|
||||||
|
m.Log(level, "%s.%s %s %v", c.Name, key, sub, formatArg(arg...), logs.FileLineMeta(m._fileline()))
|
||||||
h.Hand(m, arg...)
|
h.Hand(m, arg...)
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
@ -107,6 +107,7 @@ func init() {
|
|||||||
"grant_url", "/sns/oauth2/access_token",
|
"grant_url", "/sns/oauth2/access_token",
|
||||||
"token_url", "/sns/oauth2/refresh_token",
|
"token_url", "/sns/oauth2/refresh_token",
|
||||||
"users_url", "/sns/userinfo", "user_key", "openid", "nick_key", "nickname", "icon_key", "headimgurl",
|
"users_url", "/sns/userinfo", "user_key", "openid", "nick_key", "nickname", "icon_key", "headimgurl",
|
||||||
|
m.OptionSimple("user_cmd", "sess_cmd"),
|
||||||
)
|
)
|
||||||
m.Cmd(AGENT, OAUTH, m.Cmdx("web.chat.oauth.client", web.LINK, oauth))
|
m.Cmd(AGENT, OAUTH, m.Cmdx("web.chat.oauth.client", web.LINK, oauth))
|
||||||
}},
|
}},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user