1
0
mirror of https://shylinux.com/x/icebergs synced 2025-06-26 10:27:31 +08:00
This commit is contained in:
IT 老营长 @云轩领航-创始人 2023-05-22 15:48:16 +08:00
parent 2c84b1f8fa
commit ee6e5d4248
12 changed files with 38 additions and 20 deletions

View File

@ -38,7 +38,7 @@ func init() {
_sess_create(m, m.Option(USERNAME), UA, m.Option(ice.MSG_USERUA), IP, m.Option(ice.MSG_USERIP))
}},
CHECK: {Name: "check sessid*", Hand: func(m *ice.Message, arg ...string) { _sess_check(m, m.Option(ice.MSG_SESSID)) }},
}, mdb.HashAction(mdb.EXPIRE, mdb.MONTH, mdb.SHORT, mdb.UNIQ, mdb.FIELD, "time,hash,usernick,username,userrole,ua,ip"), mdb.ImportantHashAction())},
}, mdb.ImportantHashAction(mdb.EXPIRE, mdb.MONTH, mdb.SHORT, mdb.UNIQ, mdb.FIELD, "time,hash,usernick,username,userrole,ua,ip"))},
})
}

View File

@ -48,7 +48,7 @@ func init() {
mdb.CREATE: {Name: "create usernick username* userrole=void,tech userzone background", Hand: func(m *ice.Message, arg ...string) {
_user_create(m, m.Option(USERNAME), m.OptionSimple(USERNICK, USERROLE, USERZONE, BACKGROUND)...)
}},
}, mdb.HashAction(mdb.SHORT, USERNAME, mdb.FIELD, "time,usernick,username,userrole,userzone"), mdb.ImportantHashAction())},
}, mdb.ImportantHashAction(mdb.SHORT, USERNAME, mdb.FIELD, "time,usernick,username,userrole,userzone"))},
})
}

View File

@ -265,8 +265,8 @@ func ImportantZoneAction() ice.Actions {
}},
}
}
func ImportantHashAction() ice.Actions {
return ice.Actions{
func ImportantHashAction(arg ...Any) ice.Actions {
return ice.MergeActions(ice.Actions{
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
Config(m, "important", ice.TRUE)
HashImport(m)
@ -274,7 +274,7 @@ func ImportantHashAction() ice.Actions {
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) {
HashExport(m)
}},
}
}, HashAction(arg...))
}
func saveImportant(m *ice.Message, key, sub string, arg ...string) {
kit.If(m.Conf(key, kit.Keys(META, "important")) == ice.TRUE, func() { ice.SaveImportant(m, arg...) })

View File

@ -20,21 +20,30 @@ import (
func _dream_list(m *ice.Message) *ice.Message {
list := m.CmdMap(SPACE, mdb.NAME)
m.Cmdy(nfs.DIR, ice.USR_LOCAL_WORK, "time,size,name").Table(func(value ice.Maps) {
stats := map[string]int{}
mdb.HashSelect(m).Table(func(value ice.Maps) {
if space, ok := list[value[mdb.NAME]]; ok {
msg := gdb.Event(m.Spawn(value, space), DREAM_TABLES).Copy(m.Spawn().PushButton(cli.STOP))
m.Push(mdb.TYPE, space[mdb.TYPE])
m.Push(cli.STATUS, cli.START)
m.Push(mdb.TEXT, msg.Append(mdb.TEXT))
m.PushButton(strings.Join(msg.Appendv(ctx.ACTION), ""))
} else {
stats[cli.START]++
} else if nfs.Exists(m, path.Join(ice.USR_LOCAL_WORK, value[mdb.NAME])) {
m.Push(mdb.TYPE, WORKER)
m.Push(cli.STATUS, cli.STOP)
m.Push(mdb.TEXT, "")
m.PushButton(cli.START, nfs.TRASH)
stats[cli.STOP]++
} else {
m.Push(mdb.TYPE, WORKER)
m.Push(cli.STATUS, cli.STOP)
m.Push(mdb.TEXT, "")
m.PushButton(cli.START, mdb.REMOVE)
stats[ice.INIT]++
}
})
return m.Sort("status,type,name", ice.STR, ice.STR, ice.STR_R).StatusTimeCount(cli.START, len(list))
return m.Sort("status,type,name", ice.STR, ice.STR, ice.STR_R).StatusTimeCount(stats)
}
func _dream_start(m *ice.Message, name string) {
if m.Warn(name == "", ice.ErrNotValid, mdb.NAME) {
@ -123,7 +132,8 @@ func init() {
}},
mdb.CREATE: {Name: "create name*=hi repos binary template", Hand: func(m *ice.Message, arg ...string) {
m.Option(nfs.REPOS, kit.Select("", kit.Slice(kit.Split(m.Option(nfs.REPOS)), -1), 0))
_dream_start(m, m.OptionDefault(mdb.NAME, path.Base(m.Option(nfs.REPOS))))
mdb.HashCreate(m)
// _dream_start(m, m.OptionDefault(mdb.NAME, path.Base(m.Option(nfs.REPOS))))
}},
cli.START: {Hand: func(m *ice.Message, arg ...string) { _dream_start(m, m.Option(mdb.NAME)) }},
cli.STOP: {Hand: func(m *ice.Message, arg ...string) {
@ -141,7 +151,7 @@ func init() {
kit.Switch(m.Option(mdb.TYPE), []string{SERVER, WORKER}, func() { m.PushButton(OPEN) })
}},
OPEN: {Hand: func(m *ice.Message, arg ...string) { ctx.ProcessOpen(m, m.MergePod(m.Option(mdb.NAME))) }},
}, ctx.CmdAction(), DreamAction()), Hand: func(m *ice.Message, arg ...string) {
}, ctx.CmdAction(), DreamAction(), mdb.ImportantHashAction(mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,repos,binary,template")), Hand: func(m *ice.Message, arg ...string) {
if len(arg) == 0 {
_dream_list(m)
ctx.DisplayTableCard(m)

View File

@ -69,7 +69,7 @@ func init() {
Index.MergeCommands(ice.Commands{
SHARE: {Name: "share hash auto login prunes", Help: "共享链", Actions: ice.MergeActions(ice.Actions{
mdb.CREATE: {Name: "create type name text", Hand: func(m *ice.Message, arg ...string) {
mdb.HashCreate(m, arg, aaa.USERNICK, m.Option(ice.MSG_USERNICK), aaa.USERNAME, m.Option(ice.MSG_USERNAME), aaa.USERROLE, m.Option(ice.MSG_USERROLE))
mdb.HashCreate(m, arg, m.OptionSimple(ice.CMD), aaa.USERNICK, m.Option(ice.MSG_USERNICK), aaa.USERNAME, m.Option(ice.MSG_USERNAME), aaa.USERROLE, m.Option(ice.MSG_USERROLE))
m.Option(mdb.LINK, _share_link(m, P(SHARE, m.Result())))
}},
LOGIN: {Hand: func(m *ice.Message, arg ...string) {
@ -86,9 +86,17 @@ func init() {
}
switch msg.Append(mdb.TYPE) {
case LOGIN:
m.RenderRedirect(nfs.PS, ice.MSG_SESSID, aaa.SessCreate(m, msg.Append(aaa.USERNAME)))
if msg.Append(ice.CMD) != "" {
m.RenderRedirect(m.MergePodCmd("", msg.Append(ice.CMD)), ice.MSG_SESSID, aaa.SessCreate(m, msg.Append(aaa.USERNAME)))
} else {
m.RenderRedirect(nfs.PS, ice.MSG_SESSID, aaa.SessCreate(m, msg.Append(aaa.USERNAME)))
}
default:
RenderMain(m)
if msg.Append(ice.CMD) != "" {
RenderCmd(m, msg.Append(ice.CMD))
} else {
RenderMain(m)
}
}
}},
}, mdb.HashAction(mdb.FIELD, "time,hash,type,name,text,river,storm,usernick,username,userrole", mdb.EXPIRE, mdb.DAYS), aaa.WhiteAction()), Hand: func(m *ice.Message, arg ...string) {

View File

@ -100,7 +100,7 @@ func init() {
m.Option(mdb.TYPE, mdb.HashSelects(m.Spawn(), m.Option(mdb.HASH)).Append(mdb.TYPE))
ctx.Run(m, arg...)
}},
}, ctx.CmdAction(), mdb.ImportantHashAction(), mdb.HashAction()), Hand: func(m *ice.Message, arg ...string) {
}, ctx.CmdAction(), mdb.ImportantHashAction()), Hand: func(m *ice.Message, arg ...string) {
if len(arg) > 0 && arg[0] == ctx.ACTION {
m.Option(mdb.TYPE, mdb.HashSelects(m.Spawn(), m.Option(mdb.HASH)).Append(mdb.TYPE))
gdb.Event(m, FAVOR_ACTION, arg)

View File

@ -25,7 +25,7 @@ func init() {
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) {
kit.Switch(m.Option(mdb.TYPE), kit.Simple(web.SERVER, web.WORKER), func() { m.PushButton(kit.Dict(m.CommandKey(), "桌面")) })
}},
}, web.DreamAction(), mdb.ImportantHashAction(), CmdHashAction())},
}, web.DreamAction(), CmdHashAction(), mdb.ImportantHashAction())},
})
}

View File

@ -18,7 +18,7 @@ func init() {
DockAppend(m, "", web.CODE_VIMER)
}
}},
}, mdb.ImportantHashAction(), CmdHashAction())}})
}, CmdHashAction(), mdb.ImportantHashAction())}})
}
func DockAppend(m *ice.Message, name, index string, arg ...string) {

View File

@ -9,7 +9,7 @@ const MENU = "menu"
func init() {
Index.MergeCommands(ice.Commands{
MENU: {Actions: ice.MergeActions(mdb.ImportantHashAction(), CmdHashAction())},
MENU: {Actions: ice.MergeActions(CmdHashAction(), mdb.ImportantHashAction())},
})
}
func MenuAppend(m *ice.Message, name, index string, arg ...string) {

View File

@ -9,7 +9,7 @@ const SESSION = "session"
func init() {
Index.MergeCommands(ice.Commands{
SESSION: {Actions: ice.MergeActions(mdb.ImportantHashAction(), CmdHashAction(mdb.NAME)), Hand: func(m *ice.Message, arg ...string) {
SESSION: {Actions: ice.MergeActions(CmdHashAction(mdb.NAME), mdb.ImportantHashAction()), Hand: func(m *ice.Message, arg ...string) {
if mdb.HashSelect(m, arg...); len(arg) > 0 {
m.EchoIFrame(m.MergePodCmd("", DESKTOP, SESSION, arg[0]))
}

View File

@ -55,7 +55,7 @@ func init() {
}
gdb.Event(m, RIVER_CREATE, RIVER, m.Option(ice.MSG_RIVER, h), arg)
}},
}, mdb.ImportantHashAction(), mdb.HashAction(mdb.FIELD, "time,hash,type,name,text,template"), aaa.WhiteAction()), Hand: func(m *ice.Message, arg ...string) {
}, aaa.WhiteAction(), mdb.ImportantHashAction(mdb.FIELD, "time,hash,type,name,text,template")), Hand: func(m *ice.Message, arg ...string) {
if m.Warn(m.Option(ice.MSG_USERNAME) == "", ice.ErrNotLogin) || !aaa.Right(m, RIVER, arg) {
return
} else if len(arg) == 0 {

View File

@ -133,7 +133,7 @@ func init() {
ctx.PROCESS: {Hand: func(m *ice.Message, arg ...string) {
ctx.ProcessField(m, m.PrefixKey(), func() string { return m.Cmdx("", mdb.CREATE, arg) }, arg...)
}},
}, ctx.CmdAction(), ctx.ProcessAction(), web.DreamAction(), mdb.ImportantHashAction(), mdb.HashAction(mdb.FIELD, "time,hash,type,name,text,path,theme,daemon")), Hand: func(m *ice.Message, arg ...string) {
}, ctx.CmdAction(), ctx.ProcessAction(), web.DreamAction(), mdb.ImportantHashAction(mdb.FIELD, "time,hash,type,name,text,path,theme,daemon")), Hand: func(m *ice.Message, arg ...string) {
if mdb.HashSelect(m, arg...); len(arg) == 0 {
if m.Length() == 0 {
m.Action(mdb.CREATE)