forked from x/icebergs
add some
This commit is contained in:
parent
23abaae36b
commit
b00e5d8fb3
@ -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)
|
||||
}
|
||||
|
@ -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)))
|
||||
|
26
core/code/json.go
Normal file
26
core/code/json.go
Normal file
@ -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())},
|
||||
})
|
||||
}
|
@ -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:
|
||||
|
3
meta.go
3
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])) })
|
||||
|
Loading…
x
Reference in New Issue
Block a user