forked from x/icebergs
add rc_local.sh
This commit is contained in:
parent
37186f3cf4
commit
67cfeb5e04
@ -154,6 +154,8 @@ func init() {
|
||||
}, mdb.HashAction(mdb.SHORT, mdb.TEXT, mdb.FIELD, "time,hash,size,type,name,text,file", ctx.ACTION, WATCH), ice.RenderAction(ice.RENDER_DOWNLOAD)), Hand: func(m *ice.Message, arg ...string) {
|
||||
if mdb.HashSelect(m, arg...); len(arg) == 0 || m.R != nil && m.R.Method == http.MethodGet {
|
||||
m.Option(ice.MSG_ACTION, "")
|
||||
} else if m.Length() == 0 {
|
||||
return
|
||||
} else if m.Append(nfs.FILE) == "" {
|
||||
m.PushScript(mdb.TEXT, m.Append(mdb.TEXT))
|
||||
} else {
|
||||
@ -171,7 +173,9 @@ func init() {
|
||||
action.Hand = ice.MergeHand(func(m *ice.Message, arg ...string) {
|
||||
up := Upload(m)
|
||||
m.Assert(len(up) > 1)
|
||||
m.Cmd(CACHE, m.Option(ice.MSG_UPLOAD)).Table(func(value ice.Maps) { m.Options(value) })
|
||||
if m.Cmd(CACHE, m.Option(ice.MSG_UPLOAD)).Table(func(value ice.Maps) { m.Options(value) }).Length() == 0 {
|
||||
SpideCache(m.Spawn(), kit.MergeURL2(m.Option(ice.MSG_USERWEB), SHARE_CACHE+up[0]))
|
||||
}
|
||||
if m.Options(mdb.HASH, up[0], mdb.NAME, up[1]); watch {
|
||||
m.Cmdy(CACHE, WATCH, m.Option(mdb.HASH), path.Join(m.Option(nfs.PATH), up[1]))
|
||||
}
|
||||
|
@ -137,6 +137,16 @@ const DREAM = "dream"
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
DREAM: {Name: "dream name@key auto create repos startall stopall publish cmd cat", Help: "梦想家", Icon: "Launchpad.png", Actions: ice.MergeActions(ice.Actions{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m = m.Spawn()
|
||||
m.GoSleep("10s", func() {
|
||||
mdb.HashSelects(m).Table(func(value ice.Maps) {
|
||||
if value[cli.RESTART] == "always" && nfs.Exists(m, path.Join(ice.USR_LOCAL_WORK+value[mdb.NAME])) {
|
||||
m.Cmd(DREAM, cli.START, kit.Dict(mdb.NAME, value[mdb.NAME]))
|
||||
}
|
||||
})
|
||||
})
|
||||
}},
|
||||
ctx.CONFIG: {Hand: func(m *ice.Message, arg ...string) {
|
||||
for _, cmd := range kit.Reverse(arg) {
|
||||
m.Cmd(gdb.EVENT, gdb.LISTEN, gdb.EVENT, DREAM_TABLES, ice.CMD, cmd)
|
||||
@ -262,7 +272,8 @@ func init() {
|
||||
PushStats(m, kit.Keys(m.CommandKey(), mdb.TOTAL), msg.Length(), "")
|
||||
}
|
||||
}},
|
||||
}, aaa.RoleAction(), StatsAction(), DreamAction(), mdb.ImportantHashAction(ctx.TOOLS, "web.space,web.route,web.code.git.search", mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,icon,repos,binary,template")), Hand: func(m *ice.Message, arg ...string) {
|
||||
}, aaa.RoleAction(), StatsAction(), DreamAction(), mdb.ImportantHashAction(ctx.TOOLS, "web.space,web.route,web.code.git.search",
|
||||
mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,icon,repos,binary,template,restart")), Hand: func(m *ice.Message, arg ...string) {
|
||||
if ice.Info.NodeType == WORKER {
|
||||
return
|
||||
}
|
||||
|
@ -132,12 +132,18 @@ func RenderCmds(m *ice.Message, cmds ...ice.Any) {
|
||||
}
|
||||
func RenderPodCmd(m *ice.Message, pod, cmd string, arg ...ice.Any) {
|
||||
msg := m.Cmd(Space(m, pod), ctx.COMMAND, kit.Select(m.PrefixKey(), cmd))
|
||||
if msg.Length() == 0 {
|
||||
RenderResult(m, kit.Format("not found command %s", cmd))
|
||||
return
|
||||
}
|
||||
RenderCmds(m, kit.Dict(msg.AppendSimple(mdb.NAME, mdb.HELP),
|
||||
ctx.INDEX, msg.Append(ctx.INDEX), ctx.ARGS, kit.Simple(arg), ctx.DISPLAY, m.Option(ice.MSG_DISPLAY),
|
||||
mdb.LIST, kit.UnMarshal(msg.Append(mdb.LIST)), mdb.META, kit.UnMarshal(msg.Append(mdb.META)),
|
||||
))
|
||||
}
|
||||
func RenderCmd(m *ice.Message, cmd string, arg ...ice.Any) { RenderPodCmd(m, "", cmd, arg...) }
|
||||
func RenderCmd(m *ice.Message, cmd string, arg ...ice.Any) {
|
||||
RenderPodCmd(m, "", cmd, arg...)
|
||||
}
|
||||
|
||||
func RenderVersion(m *ice.Message) string {
|
||||
if ice.Info.Make.Hash == "" {
|
||||
|
@ -169,6 +169,7 @@ func _serve_auth(m *ice.Message, key string, cmds []string, w http.ResponseWrite
|
||||
cmds = append(kit.Split(cmds[0], ","), cmds[1:]...)
|
||||
}
|
||||
if r.URL.Path == PP(SPACE) {
|
||||
aaa.SessCheck(m, m.Option(ice.MSG_SESSID))
|
||||
return cmds, true
|
||||
}
|
||||
defer func() { m.Options(ice.MSG_CMDS, "", ice.MSG_SESSID, "") }()
|
||||
|
@ -401,6 +401,9 @@ func SpideDelete(m *ice.Message, arg ...ice.Any) ice.Any {
|
||||
func SpideSave(m *ice.Message, file, link string, cb func(count, total, value int)) *ice.Message {
|
||||
return m.Cmd(Prefix(SPIDE), ice.DEV, SPIDE_SAVE, file, http.MethodGet, link, cb)
|
||||
}
|
||||
func SpideCache(m *ice.Message, link string) *ice.Message {
|
||||
return m.Cmd(Prefix(SPIDE), ice.DEV, SPIDE_CACHE, http.MethodGet, link)
|
||||
}
|
||||
func SpideOrigin(m *ice.Message, name string) string {
|
||||
return m.Cmdv("web.spide", name, CLIENT_ORIGIN)
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package chat
|
||||
import (
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/web"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
const CMD = "cmd"
|
||||
@ -10,15 +11,7 @@ const CMD = "cmd"
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
CMD: {Help: "命令", Actions: web.ApiWhiteAction(), Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg[0]) == 0 || arg[0] == "" {
|
||||
web.RenderMain(m)
|
||||
} else {
|
||||
if m.IsCliUA() {
|
||||
m.Cmdy(arg, m.Optionv(ice.ARG)).RenderResult()
|
||||
} else {
|
||||
web.RenderCmd(m, arg[0], arg[1:])
|
||||
}
|
||||
}
|
||||
web.RenderCmd(m, kit.Select(web.WIKI_WORD, arg, 0), kit.Slice(arg, 1))
|
||||
}},
|
||||
})
|
||||
}
|
||||
|
@ -161,10 +161,14 @@ func init() {
|
||||
}},
|
||||
}, chat.FavorAction(), ctx.ProcessAction(), mdb.HashAction(mdb.FIELD, "time,hash,type,name,text,path")), Hand: func(m *ice.Message, arg ...string) {
|
||||
if mdb.HashSelect(m, arg...); len(arg) == 0 {
|
||||
m.Action(mdb.CREATE, mdb.PRUNES, ice.APP)
|
||||
if web.IsLocalHost(m) {
|
||||
m.Action(mdb.CREATE, mdb.PRUNES, ice.APP)
|
||||
} else {
|
||||
m.Action(mdb.CREATE, mdb.PRUNES)
|
||||
}
|
||||
} else {
|
||||
kit.If(m.Length() == 0, func() { arg[0] = m.Cmdx("", mdb.CREATE, arg); mdb.HashSelect(m, arg[0]) })
|
||||
m.Push(mdb.HASH, arg[0]).Action(html.OUTPUT, ice.APP)
|
||||
m.Push(mdb.HASH, arg[0])
|
||||
ctx.DisplayLocal(m, "")
|
||||
}
|
||||
}},
|
||||
|
@ -42,8 +42,8 @@ body.dark fieldset.web.wiki.portal>div.output>div.header div.story[data-name=nav
|
||||
body.white fieldset.web.wiki.portal>div.output>div.header { color:silver; }
|
||||
body.light fieldset.web.wiki.portal>div.output>div.header { color:white; }
|
||||
body.light fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] { --hover-fg-color:black; }
|
||||
body.light fieldset.web.wiki.portal>div.output>div.header div.list { display:flex; }
|
||||
fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] { --hover-fg-color:white; }
|
||||
fieldset.web.wiki.portal>div.output>div.header div.list { display:flex; }
|
||||
|
||||
body.mobile fieldset.web.wiki.portal { --portal-main-padding:10px; --legend-padding:10px; }
|
||||
body.mobile fieldset.web.wiki.portal>div.output>div.layout { display:block; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user