diff --git a/core/chat/oauth/client.go b/core/chat/oauth/client.go index 747e119f..bc85c20c 100644 --- a/core/chat/oauth/client.go +++ b/core/chat/oauth/client.go @@ -15,6 +15,7 @@ import ( ) const ( + DOMAIN = "domain" CLIENT_ID = "client_id" CLIENT_SECRET = "client_secret" @@ -183,3 +184,7 @@ func (s Client) request(m *ice.Message, hash, api string, arg ...string) []strin kit.If(api == "", func() { api = path.Join(msg.Append(API_PREFIX), m.ActionKey()) }) return kit.Simple(kit.MergeURL2(msg.Append(web.DOMAIN), api), arg) } + +func ClientCreate(m *ice.Message, domain, client_id, client_secret string, arg ...string) { + m.AdminCmd("web.chat.oauth.client", mdb.CREATE, DOMAIN, domain, CLIENT_ID, client_id, CLIENT_SECRET, client_secret, arg) +} diff --git a/core/code/autogen.go b/core/code/autogen.go index 08236290..6255f784 100644 --- a/core/code/autogen.go +++ b/core/code/autogen.go @@ -131,8 +131,15 @@ func init() { switch arg[0] { case cli.MAIN: m.Cmdy(nfs.DIR, nfs.PWD, nfs.PATH, kit.Dict(nfs.DIR_ROOT, ice.SRC, nfs.DIR_REG, kit.ExtReg(GO))) - case mdb.ZONE, mdb.NAME: + case mdb.NAME: m.Cmdy(nfs.DIR, nfs.PWD, mdb.NAME, kit.Dict(nfs.DIR_ROOT, ice.SRC, nfs.DIR_TYPE, nfs.DIR)) + case mdb.ZONE: + m.Push(arg[0], path.Dir(m.Option(nfs.FILE))) + m.Cmd(nfs.DIR, nfs.PWD, nfs.PATH, kit.Dict(nfs.DIR_ROOT, ice.SRC, nfs.DIR_TYPE, nfs.DIR, nfs.DIR_DEEP, ice.TRUE)).Table(func(value ice.Maps) { + if !kit.HasPrefix(value[nfs.PATH], "template/", "document/") { + m.Push(arg[0], path.Join(value[nfs.PATH])) + } + }) case mdb.KEY: kit.For([]string{"code", "wiki", "chat", "team", "mall"}, func(p string) { m.Push(arg[0], kit.Keys("web", p, m.Option(mdb.ZONE), m.Option(mdb.NAME))) diff --git a/core/code/json.go b/core/code/json.go new file mode 100644 index 00000000..e3af1a64 --- /dev/null +++ b/core/code/json.go @@ -0,0 +1,26 @@ +package code + +import ( + ice "shylinux.com/x/icebergs" + "shylinux.com/x/icebergs/base/mdb" + "shylinux.com/x/icebergs/base/nfs" + kit "shylinux.com/x/toolkits" +) + +const ( + DEMO_JSON = "demo.json" +) + +const JSON = "json" + +func init() { + Index.MergeCommands(ice.Commands{ + JSON: {Actions: ice.MergeActions(ice.Actions{ + mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) {}}, + mdb.ENGINE: {Hand: func(m *ice.Message, arg ...string) {}}, + TEMPLATE: {Hand: func(m *ice.Message, arg ...string) { + m.Echo(kit.Format(nfs.Template(m, DEMO_JSON))) + }}, + }, PlugAction())}, + }) +} diff --git a/core/code/vimer.go b/core/code/vimer.go index edb84815..70c2bc19 100644 --- a/core/code/vimer.go +++ b/core/code/vimer.go @@ -94,9 +94,10 @@ func init() { if strings.HasSuffix(m.Option(nfs.FILE), nfs.PS) { m.Option(nfs.FILE, path.Join(m.Option(nfs.FILE), path.Base(strings.TrimSuffix(m.Option(nfs.FILE), nfs.PS)+".go"))) } - kit.For([]string{SH, SHY, PY, JS, CSS, HTML}, func(ext string) { + kit.For([]string{JS, CSS, SHY}, func(ext string) { m.Push(nfs.PATH, kit.ExtChange(m.Option(nfs.FILE), ext)) }) + m.Push(nfs.PATH, path.Join(path.Dir(m.Option(nfs.FILE)), "trans.json")) m.Option(nfs.DIR_REG, kit.ExtReg(SH, SHY, PY, JS, CSS, HTML)) nfs.DirDeepAll(m, nfs.SRC, nfs.PWD, nil, nfs.PATH) case web.DREAM, XTERM, AUTOGEN: diff --git a/meta.go b/meta.go index d387d08e..af3098a2 100644 --- a/meta.go +++ b/meta.go @@ -408,6 +408,9 @@ func (m *Message) Append(key string, arg ...Any) string { } func (m *Message) Appendv(key string, arg ...Any) []string { if m.FieldsIsDetail() { + if key == KEY { + return m.value(key) + } for i, k := range m.value(KEY) { if k == key || k == kit.Keys(EXTRA, key) { kit.If(len(arg) > 0, func() { m.index(VALUE, i, kit.Format(arg[0])) })