1
0
forked from x/icebergs
This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-08-09 00:04:14 +08:00
parent 15a4603a18
commit 618218247b
9 changed files with 27 additions and 13 deletions

View File

@ -142,6 +142,7 @@ const (
VENDOR = "vendor"
PRUNE = "prune"
TABLE = "table"
CLASS = "class"
PAGE = "page"
NEXT = "next"

View File

@ -193,6 +193,7 @@ const (
VIMER = "vimer"
XTERM = "xterm"
GRANT = "grant"
OAUTH = "oauth"
DESKTOP = "desktop"
MESSAGE = "message"
@ -222,6 +223,7 @@ const (
WIKI_PORTAL = "web.wiki.portal"
CHAT_OAUTH_CLIENT = "web.chat.oauth.client"
CHAT_WX_ACCESS = "web.chat.wx.access"
CHAT_WX_AGENT = "web.chat.wx.agent"
CHAT_WX_TEMPLATE = "web.chat.wx.template"
CHAT_WX_OCR = "web.chat.wx.ocr"
CHAT_MESSAGE = "web.chat.message"

View File

@ -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) {
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) {
aaa.SessCheck(m, m.Option(ice.MSG_SESSID))
return cmds, true
}
if !aaa.IsTechOrRoot(m) {
m.Option("user_uid", "")
}
m.Option("user_uid", "261eb6bf52005d6f8f4889d36efd1424")
defer func() { m.Options(ice.MSG_CMDS, "") }()
if strings.Contains(m.Option(ice.MSG_SESSID), " ") {
m.Cmdy(kit.Split(m.Option(ice.MSG_SESSID)))

View File

@ -415,7 +415,8 @@ func init() {
}},
})
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)
} else if p == "" {
return ""

View File

@ -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)
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)
return icon
}

View File

@ -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))
}
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_GO, nfs.Template(m, ice.SRC_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.DEFS, ice.SRC_BINPACK_USR_GO, nfs.Template(m, "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, "version.go"), _autogen_gits(m)))
m.Cmdy(nfs.DIR, ice.SRC_BINPACK_USR_GO)
m.Cmdy(nfs.DIR, ice.SRC_BINPACK_GO)
m.Cmdy(nfs.DIR, ice.SRC_VERSION_GO)
@ -214,3 +214,9 @@ func init() {
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"
}
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))
}

View File

@ -52,7 +52,7 @@ func _binpack_usr(m *ice.Message) {
m.Assert(e)
defer w.Close()
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.Fprint(w, lex.TB)
nfs.OptionFiles(m, nfs.DiskFile)
@ -92,7 +92,7 @@ func _binpack_src(m *ice.Message) {
m.Assert(e)
defer w.Close()
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.Fprint(w, lex.TB)
nfs.OptionFiles(m, nfs.DiskFile)

View File

@ -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 {
return m
}
level := LOG_CMDS
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 {
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 {
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.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...)
return m
}

View File

@ -107,6 +107,7 @@ func init() {
"grant_url", "/sns/oauth2/access_token",
"token_url", "/sns/oauth2/refresh_token",
"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))
}},