forked from x/icebergs
add some
This commit is contained in:
parent
cc503e37b9
commit
9baed62ec9
@ -152,13 +152,13 @@ const (
|
|||||||
SRC_TEMPLATE = ice.SRC_TEMPLATE
|
SRC_TEMPLATE = ice.SRC_TEMPLATE
|
||||||
USR_PACKAGE = "usr/package.json"
|
USR_PACKAGE = "usr/package.json"
|
||||||
USR_MODULES = "usr/node_modules/"
|
USR_MODULES = "usr/node_modules/"
|
||||||
SHARE_LOCAL = "/share/local/"
|
|
||||||
REQUIRE_MODULES = "/require/modules/"
|
REQUIRE_MODULES = "/require/modules/"
|
||||||
REQUIRE_SRC = "/require/src/"
|
REQUIRE_SRC = "/require/src/"
|
||||||
REQUIRE_USR = "/require/usr/"
|
REQUIRE_USR = "/require/usr/"
|
||||||
REQUIRE = "/require/"
|
REQUIRE = "/require/"
|
||||||
VOLCANOS = "/volcanos/"
|
VOLCANOS = "/volcanos/"
|
||||||
INTSHELL = "/intshell/"
|
INTSHELL = "/intshell/"
|
||||||
|
SHARE_LOCAL = "/share/local/"
|
||||||
PATHNAME = "pathname"
|
PATHNAME = "pathname"
|
||||||
FILENAME = "filename"
|
FILENAME = "filename"
|
||||||
|
|
||||||
|
@ -5,6 +5,8 @@ import (
|
|||||||
"path"
|
"path"
|
||||||
|
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
|
"shylinux.com/x/icebergs/base/ctx"
|
||||||
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
kit "shylinux.com/x/toolkits"
|
kit "shylinux.com/x/toolkits"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -12,9 +14,21 @@ const ADMIN = "admin"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
ADMIN: {Name: "admin index list", Help: "管理", Hand: func(m *ice.Message, arg ...string) {
|
ADMIN: {Name: "admin index list", Help: "管理", Actions: ice.Actions{
|
||||||
kit.If(len(arg) == 0, func() { arg = append(arg, SPACE, DOMAIN) })
|
DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) { m.PushButton(kit.Dict(ADMIN, "后台")) }},
|
||||||
m.Cmdy(SPIDE, ice.OPS, SPIDE_RAW, http.MethodPost, CHAT_CMD+path.Join(arg...), "pwd", kit.Path(""))
|
DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
if kit.HasPrefixList(arg, ctx.ACTION, ADMIN) && len(arg) == 2 {
|
||||||
|
ctx.ProcessField(m, CHAT_IFRAME, m.MergePodCmd(m.Option(mdb.NAME), ""), arg...)
|
||||||
|
m.ProcessField(ctx.ACTION, ctx.RUN, CHAT_IFRAME)
|
||||||
|
}
|
||||||
|
}},
|
||||||
|
}, Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
if m.Option(ice.MSG_SOURCE) != "" {
|
||||||
|
RenderMain(m)
|
||||||
|
} else {
|
||||||
|
kit.If(len(arg) == 0, func() { arg = append(arg, SPACE, DOMAIN) })
|
||||||
|
m.Cmdy(SPIDE, ice.OPS, SPIDE_RAW, http.MethodPost, C(path.Join(arg...)), "pwd", kit.Path(""))
|
||||||
|
}
|
||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -75,6 +75,7 @@ func _dream_start(m *ice.Message, name string) {
|
|||||||
cli.CTX_ROOT, kit.Path(""), cli.PATH, cli.BinPath(p, ""), cli.USER, ice.Info.Username,
|
cli.CTX_ROOT, kit.Path(""), cli.PATH, cli.BinPath(p, ""), cli.USER, ice.Info.Username,
|
||||||
)...), cli.CMD_OUTPUT, path.Join(p, ice.VAR_LOG_BOOT_LOG), mdb.CACHE_CLEAR_ONEXIT, ice.TRUE)
|
)...), cli.CMD_OUTPUT, path.Join(p, ice.VAR_LOG_BOOT_LOG), mdb.CACHE_CLEAR_ONEXIT, ice.TRUE)
|
||||||
gdb.Event(m, DREAM_CREATE, m.OptionSimple(mdb.NAME, mdb.TYPE, cli.CMD_DIR))
|
gdb.Event(m, DREAM_CREATE, m.OptionSimple(mdb.NAME, mdb.TYPE, cli.CMD_DIR))
|
||||||
|
kit.If(m.Option(nfs.BINARY) == "", func(p string) { m.Option(nfs.BINARY, SpideOrigin(m, ice.DEV)+S(name)) })
|
||||||
kit.If(m.Option(nfs.BINARY), func(p string) { _dream_binary(m, p) })
|
kit.If(m.Option(nfs.BINARY), func(p string) { _dream_binary(m, p) })
|
||||||
kit.If(m.Option(nfs.TEMPLATE), func(p string) { _dream_template(m, p) })
|
kit.If(m.Option(nfs.TEMPLATE), func(p string) { _dream_template(m, p) })
|
||||||
bin := kit.Select(kit.Path(os.Args[0]), cli.SystemFind(m, ice.ICE_BIN, nfs.PWD+path.Join(p, ice.BIN), nfs.PWD+ice.BIN))
|
bin := kit.Select(kit.Path(os.Args[0]), cli.SystemFind(m, ice.ICE_BIN, nfs.PWD+path.Join(p, ice.BIN), nfs.PWD+ice.BIN))
|
||||||
@ -141,7 +142,7 @@ const DREAM = "dream"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
DREAM: {Name: "dream name@key auto create startall stopall build publish", Help: "梦想家", Icon: "Launchpad.png", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{
|
DREAM: {Name: "dream refresh", Help: "梦想家", Icon: "Launchpad.png", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m = m.Spawn()
|
m = m.Spawn()
|
||||||
m.GoSleep("10s", func() {
|
m.GoSleep("10s", func() {
|
||||||
@ -228,15 +229,15 @@ func init() {
|
|||||||
m.Cmd("", cli.STOP, ice.Maps{mdb.NAME: name, ice.MSG_DAEMON: ""})
|
m.Cmd("", cli.STOP, ice.Maps{mdb.NAME: name, ice.MSG_DAEMON: ""})
|
||||||
})
|
})
|
||||||
}},
|
}},
|
||||||
cli.BUILD: {Hand: func(m *ice.Message, arg ...string) {
|
cli.BUILD: {Name: "build name", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmd("", FOR_FLOW, kit.JoinWord(cli.SH, ice.ETC_MISS_SH))
|
m.Cmd("", FOR_FLOW, m.Option(mdb.NAME), kit.JoinWord(cli.SH, ice.ETC_MISS_SH))
|
||||||
m.Sleep3s().Cmdy(ROUTE, cli.BUILD).ProcessInner()
|
m.Sleep3s().Cmdy(ROUTE, cli.BUILD).ProcessInner()
|
||||||
}},
|
}},
|
||||||
PUBLISH: {Name: "publish name", Help: "发布", Icon: "bi bi-send-check", Hand: func(m *ice.Message, arg ...string) {
|
PUBLISH: {Name: "publish name", Help: "发布", Icon: "bi bi-send-check", Hand: func(m *ice.Message, arg ...string) {
|
||||||
defer ToastProcess(m)()
|
defer ToastProcess(m)()
|
||||||
m.Cmd(CODE_AUTOGEN, "binpack")
|
|
||||||
list := []string{cli.LINUX, cli.DARWIN, cli.WINDOWS}
|
list := []string{cli.LINUX, cli.DARWIN, cli.WINDOWS}
|
||||||
msg := m.Spawn(ice.Maps{ice.MSG_DAEMON: ""})
|
msg := m.Spawn(ice.Maps{ice.MSG_DAEMON: ""})
|
||||||
|
m.Cmd(CODE_AUTOGEN, "binpack")
|
||||||
kit.For(list, func(goos string) {
|
kit.For(list, func(goos string) {
|
||||||
PushNoticeRich(m, mdb.NAME, ice.Info.NodeName, msg.Cmd(CODE_COMPILE, goos, cli.AMD64).AppendSimple())
|
PushNoticeRich(m, mdb.NAME, ice.Info.NodeName, msg.Cmd(CODE_COMPILE, goos, cli.AMD64).AppendSimple())
|
||||||
})
|
})
|
||||||
@ -248,13 +249,13 @@ func init() {
|
|||||||
})
|
})
|
||||||
m.ProcessHold()
|
m.ProcessHold()
|
||||||
}},
|
}},
|
||||||
FOR_FLOW: {Name: "forFlow cmd*='sh etc/miss.sh'", Help: "流程", Icon: "bi bi-terminal", Hand: func(m *ice.Message, arg ...string) {
|
FOR_FLOW: {Name: "forFlow name cmd*='sh etc/miss.sh'", Help: "流程", Icon: "bi bi-terminal", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Options(ctx.DISPLAY, PLUGIN_XTERM, cli.CMD_OUTPUT, nfs.NewWriteCloser(func(buf []byte) (int, error) {
|
m.Options(ctx.DISPLAY, PLUGIN_XTERM, cli.CMD_OUTPUT, nfs.NewWriteCloser(func(buf []byte) (int, error) {
|
||||||
m.Option(ice.MSG_COUNT, "0")
|
m.Option(ice.MSG_COUNT, "0")
|
||||||
PushNoticeGrow(m, strings.ReplaceAll(string(buf), lex.NL, "\r\n"))
|
PushNoticeGrow(m, strings.ReplaceAll(string(buf), lex.NL, "\r\n"))
|
||||||
return len(buf), nil
|
return len(buf), nil
|
||||||
}, func() error { return nil }))
|
}, func() error { return nil }))
|
||||||
msg := mdb.HashSelects(m.Spawn())
|
msg := mdb.HashSelects(m.Spawn(), m.Option(mdb.NAME))
|
||||||
GoToast(m, "", func(toast func(string, int, int)) []string {
|
GoToast(m, "", func(toast func(string, int, int)) []string {
|
||||||
msg.Table(func(index int, value ice.Maps) {
|
msg.Table(func(index int, value ice.Maps) {
|
||||||
toast(value[mdb.NAME], index, msg.Length())
|
toast(value[mdb.NAME], index, msg.Length())
|
||||||
@ -318,7 +319,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
}, StatsAction(), DreamAction(), mdb.ImportantHashAction(
|
}, StatsAction(), DreamAction(), mdb.ImportantHashAction(
|
||||||
html.BUTTON, "web.wiki.portal web.chat.portal web.chat.macos.desktop web.code.git.status web.code.vimer web.code.xterm web.code.compile",
|
html.BUTTON, "web.wiki.portal web.admin web.chat.macos.desktop web.code.git.status web.code.vimer web.code.xterm web.code.compile",
|
||||||
ctx.TOOLS, "web.code.git.search,route", mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,icon,repos,binary,template,restart")), Hand: func(m *ice.Message, arg ...string) {
|
ctx.TOOLS, "web.code.git.search,route", mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,icon,repos,binary,template,restart")), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if len(arg) == 0 {
|
if len(arg) == 0 {
|
||||||
_dream_list(m).RewriteAppend(func(value, key string, index int) string {
|
_dream_list(m).RewriteAppend(func(value, key string, index int) string {
|
||||||
@ -334,8 +335,13 @@ func init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return value
|
return value
|
||||||
}).Option(ice.MSG_ACTION, "")
|
})
|
||||||
ctx.DisplayTableCard(m)
|
ctx.DisplayTableCard(m)
|
||||||
|
kit.If(cli.SystemFind(m, "go"), func() {
|
||||||
|
m.Action(mdb.CREATE, STARTALL, STOPALL, cli.BUILD, PUBLISH)
|
||||||
|
}, func() {
|
||||||
|
m.Action(mdb.CREATE, STARTALL, STOPALL)
|
||||||
|
})
|
||||||
return
|
return
|
||||||
m.Cmds(SPACE, func(value ice.Maps) {
|
m.Cmds(SPACE, func(value ice.Maps) {
|
||||||
if value[mdb.TYPE] == SERVER {
|
if value[mdb.TYPE] == SERVER {
|
||||||
|
@ -157,14 +157,7 @@ func RenderVersion(m *ice.Message) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
CHAT = "chat"
|
CHAT = "chat"
|
||||||
CHAT_POD = "/chat/pod/"
|
|
||||||
CHAT_CMD = "/chat/cmd/"
|
|
||||||
REQUIRE_SRC = "/require/src/"
|
|
||||||
REQUIRE_USR = "/require/usr/"
|
|
||||||
REQUIRE_MODULES = "/require/modules/"
|
|
||||||
VOLCANOS = "/volcanos/"
|
|
||||||
INTSHELL = "/intshell/"
|
|
||||||
|
|
||||||
CODE_GIT_SERVICE = "web.code.git.service"
|
CODE_GIT_SERVICE = "web.code.git.service"
|
||||||
CODE_GIT_SEARCH = "web.code.git.search"
|
CODE_GIT_SEARCH = "web.code.git.search"
|
||||||
@ -181,7 +174,6 @@ const (
|
|||||||
WIKI_DRAW = "web.wiki.draw"
|
WIKI_DRAW = "web.wiki.draw"
|
||||||
WIKI_WORD = "web.wiki.word"
|
WIKI_WORD = "web.wiki.word"
|
||||||
WIKI_PORTAL = "web.wiki.portal"
|
WIKI_PORTAL = "web.wiki.portal"
|
||||||
CHAT_PORTAL = "web.chat.portal"
|
|
||||||
CHAT_HEADER = "web.chat.header"
|
CHAT_HEADER = "web.chat.header"
|
||||||
CHAT_IFRAME = "web.chat.iframe"
|
CHAT_IFRAME = "web.chat.iframe"
|
||||||
CHAT_OAUTH_CLIENT = "web.chat.oauth.client"
|
CHAT_OAUTH_CLIENT = "web.chat.oauth.client"
|
||||||
|
@ -59,7 +59,7 @@ func _serve_main(m *ice.Message, w http.ResponseWriter, r *http.Request) bool {
|
|||||||
} else {
|
} else {
|
||||||
r.Header.Set(ice.MSG_USERIP, strings.Split(r.RemoteAddr, nfs.DF)[0])
|
r.Header.Set(ice.MSG_USERIP, strings.Split(r.RemoteAddr, nfs.DF)[0])
|
||||||
}
|
}
|
||||||
if !kit.HasPrefix(r.URL.String(), VOLCANOS, REQUIRE_MODULES, INTSHELL) {
|
if !kit.HasPrefix(r.URL.String(), nfs.VOLCANOS, nfs.REQUIRE_MODULES, nfs.INTSHELL) {
|
||||||
r.Header.Set(ice.LOG_TRACEID, log.Traceid())
|
r.Header.Set(ice.LOG_TRACEID, log.Traceid())
|
||||||
m.Logs(r.Header.Get(ice.MSG_USERIP), r.Method, r.URL.String(), logs.TraceidMeta(r.Header.Get(ice.LOG_TRACEID)))
|
m.Logs(r.Header.Get(ice.MSG_USERIP), r.Method, r.URL.String(), logs.TraceidMeta(r.Header.Get(ice.LOG_TRACEID)))
|
||||||
}
|
}
|
||||||
@ -85,7 +85,7 @@ func _serve_static(msg *ice.Message, w http.ResponseWriter, r *http.Request) boo
|
|||||||
} else if p = path.Join(nfs.USR, r.URL.Path); kit.HasPrefix(r.URL.Path, nfs.VOLCANOS, nfs.INTSHELL) && nfs.Exists(msg, p) {
|
} else if p = path.Join(nfs.USR, r.URL.Path); kit.HasPrefix(r.URL.Path, nfs.VOLCANOS, nfs.INTSHELL) && nfs.Exists(msg, p) {
|
||||||
return Render(msg, ice.RENDER_DOWNLOAD, p)
|
return Render(msg, ice.RENDER_DOWNLOAD, p)
|
||||||
} else if p = strings.TrimPrefix(r.URL.Path, nfs.REQUIRE); kit.HasPrefix(r.URL.Path, nfs.REQUIRE_SRC, nfs.REQUIRE+ice.USR_ICONS, nfs.REQUIRE+ice.USR_ICEBERGS) && nfs.Exists(msg, p) {
|
} else if p = strings.TrimPrefix(r.URL.Path, nfs.REQUIRE); kit.HasPrefix(r.URL.Path, nfs.REQUIRE_SRC, nfs.REQUIRE+ice.USR_ICONS, nfs.REQUIRE+ice.USR_ICEBERGS) && nfs.Exists(msg, p) {
|
||||||
ispod := kit.Contains(r.URL.String(), CHAT_POD, "pod=") || kit.Contains(r.Header.Get(html.Referer), CHAT_POD, "pod=")
|
ispod := kit.Contains(r.URL.String(), "/s/", "pod=") || kit.Contains(r.Header.Get(html.Referer), "/s/", "pod=")
|
||||||
return !ispod && Render(msg, ice.RENDER_DOWNLOAD, p)
|
return !ispod && Render(msg, ice.RENDER_DOWNLOAD, p)
|
||||||
} else if p = path.Join(nfs.USR_MODULES, strings.TrimPrefix(r.URL.Path, nfs.REQUIRE_MODULES)); kit.HasPrefix(r.URL.Path, nfs.REQUIRE_MODULES) && nfs.Exists(msg, p) {
|
} else if p = path.Join(nfs.USR_MODULES, strings.TrimPrefix(r.URL.Path, nfs.REQUIRE_MODULES)); kit.HasPrefix(r.URL.Path, nfs.REQUIRE_MODULES) && nfs.Exists(msg, p) {
|
||||||
return Render(msg, ice.RENDER_DOWNLOAD, p)
|
return Render(msg, ice.RENDER_DOWNLOAD, p)
|
||||||
@ -214,7 +214,7 @@ func init() {
|
|||||||
if m.Option(ctx.INDEX) == "" {
|
if m.Option(ctx.INDEX) == "" {
|
||||||
mdb.Config(m, ice.MAIN, "")
|
mdb.Config(m, ice.MAIN, "")
|
||||||
} else {
|
} else {
|
||||||
mdb.Config(m, ice.MAIN, CHAT_CMD+m.Option(ctx.INDEX)+nfs.PS)
|
mdb.Config(m, ice.MAIN, C(m.Option(ctx.INDEX)+nfs.PS))
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
log.TRACEID: {Help: "日志", Hand: func(m *ice.Message, arg ...string) {
|
log.TRACEID: {Help: "日志", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
@ -294,7 +294,7 @@ func init() {
|
|||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
conf := mdb.Confm(m, cli.RUNTIME, cli.CONF)
|
conf := mdb.Confm(m, cli.RUNTIME, cli.CONF)
|
||||||
m.Cmd("", mdb.CREATE, ice.SHY, kit.Select("https://shylinux.com", conf[cli.CTX_SHY]))
|
m.Cmd("", mdb.CREATE, ice.SHY, kit.Select("https://shylinux.com", conf[cli.CTX_SHY]))
|
||||||
m.Cmd("", mdb.CREATE, ice.DEV, kit.Select(kit.Select("https://2021.shylinux.com", ice.Info.Make.Domain), conf[cli.CTX_DEV]))
|
m.Cmd("", mdb.CREATE, ice.DEV, kit.Select("https://2021.shylinux.com", ice.Info.Make.Domain, conf[cli.CTX_DEV]))
|
||||||
m.Cmd("", mdb.CREATE, ice.OPS, kit.Select("http://localhost:9020", conf[cli.CTX_OPS]))
|
m.Cmd("", mdb.CREATE, ice.OPS, kit.Select("http://localhost:9020", conf[cli.CTX_OPS]))
|
||||||
m.Cmd("", mdb.CREATE, ice.DEMO, kit.Select("http://localhost:20000", conf[cli.CTX_DEMO]))
|
m.Cmd("", mdb.CREATE, ice.DEMO, kit.Select("http://localhost:20000", conf[cli.CTX_DEMO]))
|
||||||
m.Cmd("", mdb.CREATE, ice.MAIL, kit.Select("https://mail.shylinux.com", conf[cli.CTX_MAIL]))
|
m.Cmd("", mdb.CREATE, ice.MAIL, kit.Select("https://mail.shylinux.com", conf[cli.CTX_MAIL]))
|
||||||
|
@ -12,7 +12,7 @@ func init() {
|
|||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
CMD: {Help: "命令", Actions: web.ApiWhiteAction(), Hand: func(m *ice.Message, arg ...string) {
|
CMD: {Help: "命令", Actions: web.ApiWhiteAction(), Hand: func(m *ice.Message, arg ...string) {
|
||||||
switch cmd := kit.Select(web.WIKI_WORD, arg, 0); cmd {
|
switch cmd := kit.Select(web.WIKI_WORD, arg, 0); cmd {
|
||||||
case web.CHAT_PORTAL:
|
case web.ADMIN:
|
||||||
web.RenderMain(m)
|
web.RenderMain(m)
|
||||||
default:
|
default:
|
||||||
if m.IsCliUA() {
|
if m.IsCliUA() {
|
||||||
|
@ -24,7 +24,7 @@ func init() {
|
|||||||
m.Cmd(web.SPACE, m.Option(mdb.NAME), cli.PWD, m.Option(mdb.NAME), link, m.Cmdx(cli.QRCODE, link))
|
m.Cmd(web.SPACE, m.Option(mdb.NAME), cli.PWD, m.Option(mdb.NAME), link, m.Cmdx(cli.QRCODE, link))
|
||||||
})
|
})
|
||||||
}},
|
}},
|
||||||
web.HOME: {Help: "首页", Hand: func(m *ice.Message, arg ...string) { m.ProcessOpen(m.MergeLink(web.CHAT_PORTAL)) }},
|
web.HOME: {Help: "首页", Hand: func(m *ice.Message, arg ...string) { m.ProcessOpen(web.C(web.ADMIN)) }},
|
||||||
aaa.CONFIRM: {Help: "授权", Role: aaa.VOID, Hand: func(m *ice.Message, arg ...string) {
|
aaa.CONFIRM: {Help: "授权", Role: aaa.VOID, Hand: func(m *ice.Message, arg ...string) {
|
||||||
// if m.Warn(m.R.Method == http.MethodGet, ice.ErrNotAllow) {
|
// if m.Warn(m.R.Method == http.MethodGet, ice.ErrNotAllow) {
|
||||||
// return
|
// return
|
||||||
|
@ -65,7 +65,7 @@ func init() {
|
|||||||
}},
|
}},
|
||||||
}, FavorAction(), mdb.HashAction(mdb.SHORT, web.LINK, mdb.FIELD, "time,hash,type,name,link")), Hand: func(m *ice.Message, arg ...string) {
|
}, FavorAction(), mdb.HashAction(mdb.SHORT, web.LINK, mdb.FIELD, "time,hash,type,name,link")), Hand: func(m *ice.Message, arg ...string) {
|
||||||
list := []string{m.MergePodCmd("", web.WIKI_PORTAL)}
|
list := []string{m.MergePodCmd("", web.WIKI_PORTAL)}
|
||||||
list = append(list, m.MergePodCmd("", web.CHAT_PORTAL))
|
list = append(list, m.MergePodCmd("", web.ADMIN))
|
||||||
if mdb.HashSelect(m, arg...); len(arg) == 0 {
|
if mdb.HashSelect(m, arg...); len(arg) == 0 {
|
||||||
for _, link := range list {
|
for _, link := range list {
|
||||||
if u := kit.ParseURL(link); u != nil {
|
if u := kit.ParseURL(link); u != nil {
|
||||||
|
@ -45,7 +45,7 @@ func init() {
|
|||||||
if m.Option(ice.MSG_USERPOD, arg[0]); len(arg) == 1 {
|
if m.Option(ice.MSG_USERPOD, arg[0]); len(arg) == 1 {
|
||||||
m.Cmdy(web.SPACE, arg[0], web.SPACE, ice.MAIN)
|
m.Cmdy(web.SPACE, arg[0], web.SPACE, ice.MAIN)
|
||||||
} else if kit.IsIn(arg[1], CMD, "c") {
|
} else if kit.IsIn(arg[1], CMD, "c") {
|
||||||
if arg[2] == web.CHAT_PORTAL {
|
if kit.IsIn(arg[2], web.ADMIN) {
|
||||||
m.Cmdy(web.SPACE, arg[0], arg[2])
|
m.Cmdy(web.SPACE, arg[0], arg[2])
|
||||||
} else {
|
} else {
|
||||||
web.RenderPodCmd(m, arg[0], arg[2], arg[3:])
|
web.RenderPodCmd(m, arg[0], arg[2], arg[3:])
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
package chat
|
|
||||||
|
|
||||||
import (
|
|
||||||
ice "shylinux.com/x/icebergs"
|
|
||||||
"shylinux.com/x/icebergs/base/ctx"
|
|
||||||
"shylinux.com/x/icebergs/base/mdb"
|
|
||||||
"shylinux.com/x/icebergs/base/web"
|
|
||||||
kit "shylinux.com/x/toolkits"
|
|
||||||
)
|
|
||||||
|
|
||||||
const PORTAL = "portal"
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
Index.MergeCommands(ice.Commands{
|
|
||||||
PORTAL: {Help: "门户", Actions: ice.MergeActions(ice.Actions{
|
|
||||||
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) { m.PushButton(kit.Dict(web.ADMIN, "后台")) }},
|
|
||||||
web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
if kit.HasPrefixList(arg, ctx.ACTION, web.ADMIN) && len(arg) == 2 {
|
|
||||||
ctx.ProcessField(m, web.CHAT_IFRAME, m.MergePodCmd(m.Option(mdb.NAME), m.PrefixKey()), arg...)
|
|
||||||
m.ProcessField(ctx.ACTION, ctx.RUN, web.CHAT_IFRAME)
|
|
||||||
}
|
|
||||||
}},
|
|
||||||
}, web.ApiAction()), Hand: func(m *ice.Message, arg ...string) { web.RenderMain(m) }},
|
|
||||||
})
|
|
||||||
}
|
|
@ -43,7 +43,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
uri := "/publish/" + kit.Format(value[nfs.FILE])
|
uri := "/publish/" + kit.Format(value[nfs.FILE])
|
||||||
kit.If(os.Getenv(cli.CTX_POD), func(p string) {
|
kit.If(os.Getenv(cli.CTX_POD), func(p string) {
|
||||||
uri = kit.MergeURL2(os.Getenv(cli.CTX_DEV), web.CHAT_POD+p, cli.GOOS, runtime.GOOS, cli.GOARCH, runtime.GOARCH)
|
uri = kit.MergeURL2(os.Getenv(cli.CTX_DEV), web.S(p), cli.GOOS, runtime.GOOS, cli.GOARCH, runtime.GOARCH)
|
||||||
})
|
})
|
||||||
dir := path.Join(kit.Format(value[nfs.PATH]), kit.Format(value[nfs.FILE]))
|
dir := path.Join(kit.Format(value[nfs.PATH]), kit.Format(value[nfs.FILE]))
|
||||||
web.GoToast(m, m.PrefixKey(), func(toast func(name string, count, total int)) []string {
|
web.GoToast(m, m.PrefixKey(), func(toast func(name string, count, total int)) []string {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
Volcanos(chat.ONIMPORT, {
|
Volcanos(chat.ONIMPORT, {
|
||||||
_init: function(can, msg) { can.isCmdMode() && (can.user.toast = function() {})
|
_init: function(can, msg) { can.isCmdMode() && (can.user.toast = function() {})
|
||||||
var p = "/cmd/"+web.WIKI_PORTAL; can.db.prefix = location.pathname.indexOf(p) > -1? location.pathname.split(p)[0]+p: nfs.WIKI_PORTAL
|
var p = "/cmd/"+web.PORTAL; can.db.prefix = location.pathname.indexOf(p) > -1? location.pathname.split(p)[0]+p: nfs.WIKI_PORTAL
|
||||||
var p = "/c/"+web.WIKI_PORTAL; can.db.prefix = location.pathname.indexOf(p) > -1? location.pathname.split(p)[0]+p: nfs.WIKI_PORTAL
|
var p = "/c/"+web.PORTAL; can.db.prefix = location.pathname.indexOf(p) > -1? location.pathname.split(p)[0]+p: nfs.WIKI_PORTAL
|
||||||
can.db.current = can.isCmdMode()? can.base.trimPrefix(location.pathname, can.db.prefix+nfs.PS, can.db.prefix): can.Option(nfs.PATH)
|
can.db.current = can.isCmdMode()? can.base.trimPrefix(location.pathname, can.db.prefix+nfs.PS, can.db.prefix): can.Option(nfs.PATH)
|
||||||
can.sup.onexport.link = function() { return can.misc.MergeURL(can, {pod: can.ConfSpace(), cmd: can.ConfIndex()}) }
|
can.sup.onexport.link = function() { return can.misc.MergeURL(can, {pod: can.ConfSpace(), cmd: can.ConfIndex()}) }
|
||||||
can.require(["/plugin/local/wiki/word.js"])
|
can.require(["/plugin/local/wiki/word.js"])
|
||||||
|
@ -509,9 +509,9 @@ func init() {
|
|||||||
mdb.HashRemove(m, m.Option(REPOS))
|
mdb.HashRemove(m, m.Option(REPOS))
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
CLONE: {Name: "clone origin* name", Help: "克隆", Icon: "bi bi-copy", Hand: func(m *ice.Message, arg ...string) {
|
CLONE: {Name: "clone origin* name path", Help: "克隆", Icon: "bi bi-copy", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.OptionDefault(mdb.NAME, path.Base(m.Option(ORIGIN)))
|
m.OptionDefault(mdb.NAME, path.Base(m.Option(ORIGIN)))
|
||||||
m.Option(nfs.PATH, path.Join(nfs.USR, m.Option(mdb.NAME))+nfs.PS)
|
m.OptionDefault(nfs.PATH, path.Join(nfs.USR, m.Option(mdb.NAME))+nfs.PS)
|
||||||
defer m.Cmdy(nfs.DIR, m.Option(nfs.PATH))
|
defer m.Cmdy(nfs.DIR, m.Option(nfs.PATH))
|
||||||
if nfs.Exists(m, path.Join(m.Option(nfs.PATH), _GIT)) {
|
if nfs.Exists(m, path.Join(m.Option(nfs.PATH), _GIT)) {
|
||||||
return
|
return
|
||||||
|
@ -54,6 +54,7 @@ func init() {
|
|||||||
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
if !nfs.Exists(m, path.Join(ice.USR_LOCAL_WORK, m.Option(mdb.NAME), _GIT)) {
|
if !nfs.Exists(m, path.Join(ice.USR_LOCAL_WORK, m.Option(mdb.NAME), _GIT)) {
|
||||||
m.Push(mdb.TEXT, "")
|
m.Push(mdb.TEXT, "")
|
||||||
|
m.PushButton(kit.Dict(m.CommandKey(), "源码"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
text := []string{}
|
text := []string{}
|
||||||
|
@ -18,7 +18,7 @@ func (s npm) Init(m *ice.Message) {
|
|||||||
cli.IsRedhat(m.Message, NPM, "nodejs")
|
cli.IsRedhat(m.Message, NPM, "nodejs")
|
||||||
}
|
}
|
||||||
func (s npm) List(m *ice.Message) {
|
func (s npm) List(m *ice.Message) {
|
||||||
m.Cmdy(nfs.DIR, ice.USR_MODULES)
|
m.Cmdy(nfs.DIR, nfs.USR_MODULES)
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { ice.CodeCtxCmd(npm{}) }
|
func init() { ice.CodeCtxCmd(npm{}) }
|
||||||
|
@ -316,7 +316,7 @@ func (s relay) AdminCmd(m *ice.Message, arg ...string) {
|
|||||||
func (s relay) Xterm(m *ice.Message, arg ...string) { s.Code.Xterm(m, m.Option(MACHINE), arg...) }
|
func (s relay) Xterm(m *ice.Message, arg ...string) { s.Code.Xterm(m, m.Option(MACHINE), arg...) }
|
||||||
func (s relay) Repos(m *ice.Message, arg ...string) { s.iframeCmd(m, web.CODE_GIT_STATUS, arg...) }
|
func (s relay) Repos(m *ice.Message, arg ...string) { s.iframeCmd(m, web.CODE_GIT_STATUS, arg...) }
|
||||||
func (s relay) Vimer(m *ice.Message, arg ...string) { s.iframeCmd(m, web.CODE_VIMER, arg...) }
|
func (s relay) Vimer(m *ice.Message, arg ...string) { s.iframeCmd(m, web.CODE_VIMER, arg...) }
|
||||||
func (s relay) Admin(m *ice.Message, arg ...string) { s.iframeCmd(m, web.CHAT_PORTAL, arg...) }
|
func (s relay) Admin(m *ice.Message, arg ...string) { s.iframeCmd(m, web.ADMIN, arg...) }
|
||||||
|
|
||||||
func init() { ice.Cmd(SSH_RELAY, relay{}) }
|
func init() { ice.Cmd(SSH_RELAY, relay{}) }
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user