1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-26 01:24:05 +08:00
This commit is contained in:
IT 老营长 @云轩领航-创始人 2023-05-26 15:51:32 +08:00
parent a86ca7b2d0
commit 30db24ab8b
16 changed files with 47 additions and 18 deletions

View File

@ -91,10 +91,14 @@ func _hash_prunes(m *ice.Message, prefix, chain string, arg ...string) {
func _hash_export(m *ice.Message, prefix, chain, file string) {
defer Lock(m, prefix, chain)()
count := len(Confm(m, prefix, kit.Keys(chain, HASH)))
p := kit.Keys(file, JSON)
if count == 0 {
if s, e := os.Stat(p); e == nil && !s.IsDir() {
os.Remove(p)
}
return
}
f, p, e := miss.CreateFile(kit.Keys(file, JSON))
f, p, e := miss.CreateFile(p)
m.Assert(e)
defer f.Close()
defer m.Echo(p)

View File

@ -118,7 +118,7 @@ func _dir_list(m *ice.Message, root string, dir string, level int, deep bool, di
}
if deep && isDir {
switch s.Name() {
case "node_modules", "pluged", "target", "trash":
case "node_modules", "pluged", "target", "trash", ice.VAR, ice.USR:
continue
}
_dir_list(m, root, pp, level+1, deep, dir_type, dir_reg, fields)

View File

@ -171,6 +171,9 @@ const SPACE = "space"
func init() {
Index.MergeCommands(ice.Commands{
SPACE: {Name: "space name cmds auto", Help: "空间站", Actions: ice.MergeActions(ice.Actions{
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
aaa.White(m, "space", "main")
}},
tcp.DIAL: {Name: "dial dev=ops name", Hand: func(m *ice.Message, arg ...string) {
if strings.HasPrefix(m.Option(ice.DEV), HTTP) {
m.Cmd(SPIDE, mdb.CREATE, m.OptionSimple(ice.DEV))

View File

@ -72,6 +72,7 @@ func init() {
web.P(HEADER): {Name: "/header", Help: "标题栏", Actions: ice.MergeActions(ice.Actions{
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { aaa.White(m, HEADER) }},
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {}},
aaa.LOGIN: {Hand: func(m *ice.Message, arg ...string) {}},
aaa.LOGOUT: {Hand: aaa.SessLogout},
aaa.PASSWORD: {Hand: _header_users},
aaa.USERNICK: {Hand: _header_users},

View File

@ -14,7 +14,8 @@ fieldset.macos.desktop>div.output>fieldset.macos.notifications>div.output>div.it
fieldset.macos.desktop>div.output>fieldset.macos.notifications div.item div.title { margin-top:10px; width:132px; overflow:hidden; }
fieldset.macos.desktop>div.output>fieldset.macos.notifications div.item div.time { font-size:12px; margin-top:10px; width:48px; }
fieldset.macos.desktop>div.output>fieldset.macos.notifications div.item div.content { width:180px; }
fieldset.macos.desktop>div.output>fieldset.macos.dock { border:#ffffff3d solid 1px; border-radius:20px; position:absolute; bottom:10px; z-index:11; transition:margin-left 0.3s; }
fieldset.macos.desktop>div.output>fieldset.macos.dock { border:#ffffff3d solid 1px; border-radius:20px; position:absolute; bottom:10px; transition:margin-left 0.3s; }
fieldset.macos.desktop.cmd>div.output>fieldset.macos.dock { z-index:11; }
fieldset.macos.desktop>div.output>div.desktop { padding-top:25px; }
fieldset.macos.desktop>div.output>div.desktop:not(.select) { display:none; }
fieldset.macos.desktop>div.output>div.desktop>div.item { position:absolute; text-align:center; }

View File

@ -9,7 +9,10 @@ const SESSION = "session"
func init() {
Index.MergeCommands(ice.Commands{
SESSION: {Actions: ice.MergeActions(CmdHashAction(mdb.NAME), mdb.ImportantHashAction()), Hand: func(m *ice.Message, arg ...string) {
SESSION: {Actions: ice.MergeActions(ice.Actions{
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { mdb.HashImport(m) }},
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) { mdb.HashExport(m) }},
}, 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

@ -3,6 +3,7 @@ package chat
import (
ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/aaa"
"shylinux.com/x/icebergs/base/ctx"
"shylinux.com/x/icebergs/base/gdb"
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/nfs"
@ -39,10 +40,22 @@ const RIVER = "river"
func init() {
Index.MergeCommands(ice.Commands{
web.P(RIVER): {Name: "/river", Help: "群组", Actions: ice.MergeActions(ice.Actions{
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { mdb.HashImport(m) }},
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) { mdb.HashExport(m) }},
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
switch arg[0] {
case nfs.TEMPLATE:
m.Cmdy(TEMPLATE).CutTo(RIVER, arg[0])
case web.SPACE:
m.Cmd(web.SPACE, func(value ice.Maps) {
kit.If(kit.IsIn(value[mdb.TYPE], web.WORKER), func() { m.Push(arg[0], value[mdb.NAME]) })
})
case ctx.INDEX:
if m.Option(web.SPACE) == "" {
m.Cmdy(ctx.COMMAND)
} else {
m.Cmdy(web.SPACE, m.Option(web.SPACE), ctx.COMMAND)
}
default:
mdb.HashInputs(m, arg)
}

View File

@ -27,6 +27,9 @@ func init() {
mdb.INSERT: {Name: "insert hash space index args style display", Hand: func(m *ice.Message, arg ...string) {
m.Cmdy(mdb.INSERT, RIVER, _storm_key(m), mdb.LIST, arg)
}},
mdb.DELETE: {Hand: func(m *ice.Message, arg ...string) {
m.Cmdy(mdb.MODIFY, RIVER, _storm_key(m), mdb.LIST, arg, "deleted", "true")
}},
mdb.MODIFY: {Hand: func(m *ice.Message, arg ...string) {
if len(arg) > 0 && arg[0] == mdb.ID {
m.Cmdy(mdb.MODIFY, RIVER, _storm_key(m), mdb.LIST, arg)
@ -38,7 +41,7 @@ func init() {
if m.Option(ice.MSG_STORM) == "" {
m.Cmdy(mdb.SELECT, RIVER, _river_key(m), mdb.HASH, ice.OptionFields("time,hash,name,text,count"))
} else if len(arg) == 0 || kit.Int(arg[0]) > 0 {
m.Cmdy(mdb.SELECT, RIVER, _storm_key(m), mdb.LIST, mdb.ID, arg, ice.OptionFields("time,id,space,index,args,style,display")).SortInt(mdb.ID)
m.Cmdy(mdb.SELECT, RIVER, _storm_key(m), mdb.LIST, mdb.ID, arg, ice.OptionFields("time,id,space,index,args,style,display,deleted")).SortInt(mdb.ID)
} else if aaa.Right(m, arg) {
m.Push(ctx.INDEX, arg[0])
}

View File

@ -52,7 +52,7 @@ func init() {
case SERVICE:
m.Push(arg[0], kit.MergeURL2(m.Cmd(web.SPIDE, ice.DEV).Append(web.CLIENT_ORIGIN), "/publish/"))
case VERSION:
m.Push(arg[0], "1.15.5", "1.17.3")
m.Push(arg[0], "1.13.5", "1.15.5", "1.17.3")
default:
m.Cmdy(nfs.DIR, ice.SRC, nfs.DIR_CLI_FIELDS, kit.Dict(nfs.DIR_REG, kit.ExtReg(GO)))
}
@ -60,7 +60,7 @@ func init() {
BINPACK: {Help: "版本", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(AUTOGEN, BINPACK) }},
WEBPACK: {Help: "打包", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(AUTOGEN, WEBPACK) }},
DEVPACK: {Help: "开发", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(AUTOGEN, DEVPACK) }},
INSTALL: {Name: "install service*='https://golang.google.cn/dl/' version*=1.15.5", Help: "安装", Hand: func(m *ice.Message, arg ...string) {
INSTALL: {Name: "install service*='https://golang.google.cn/dl/' version*=1.13.5", Help: "安装", Hand: func(m *ice.Message, arg ...string) {
m.Cmdy(INSTALL, web.DOWNLOAD, kit.Format("%s/go%s.%s-%s.%s", m.Option(SERVICE), m.Option(VERSION), runtime.GOOS, runtime.GOARCH, kit.Select("tar.gz", "zip", runtime.GOOS == cli.WINDOWS)), ice.USR_LOCAL)
}},
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) {

View File

@ -20,7 +20,7 @@ import (
func _xterm_get(m *ice.Message, h string) xterm.XTerm {
h = kit.Select(m.Option(mdb.HASH), h)
m.Assert(h != "")
mdb.HashModify(m, mdb.TIME, m.Time(), cli.DAEMON, m.Option(ice.MSG_DAEMON))
mdb.HashModify(m, mdb.TIME, m.Time(), cli.DAEMON, kit.Keys(m.Option("__target"), m.Option(ice.MSG_DAEMON)))
return mdb.HashSelectTarget(m, h, func(value ice.Maps) ice.Any {
text := strings.Split(value[mdb.TEXT], lex.NL)
ls := kit.Split(strings.Split(kit.Select(ISH, value[mdb.TYPE]), " # ")[0])

View File

@ -58,9 +58,6 @@ func init() {
PLAN: {Name: "plan scale=week,day,week,month,year,long begin_time@date list prev next", Help: "计划表", Actions: ice.MergeActions(ice.Actions{
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(TODO, mdb.INPUTS, arg) }},
mdb.PLUGIN: {Name: "plugin extra.index extra.args", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(TASK, mdb.MODIFY, arg) }},
mdb.INSERT: {Name: "insert zone* type=once,step,week name* text begin_time@date close_time@date", Hand: func(m *ice.Message, arg ...string) {
m.Cmdy(TASK, mdb.INSERT, arg)
}},
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
mdb.IsSearchForEach(m, arg, func() []string { return []string{web.LINK, m.CommandKey(), m.MergePodCmd("", "")} })
}},

View File

@ -76,7 +76,7 @@ func init() {
mdb.ZoneInputs(m, arg)
}
}},
mdb.INSERT: {Name: "insert zone type=once,step,week name text begin_time@date close_time@date", Hand: func(m *ice.Message, arg ...string) {
mdb.INSERT: {Name: "insert zone* type=once,step,week name* text begin_time@date close_time@date", Hand: func(m *ice.Message, arg ...string) {
mdb.ZoneInsert(m, arg[:2], BEGIN_TIME, m.Time(), STATUS, PREPARE, LEVEL, 3, SCORE, 3, arg[2:])
}},
mdb.MODIFY: {Hand: func(m *ice.Message, arg ...string) { _task_modify(m, arg[0], arg[1], arg[2:]...) }},

View File

@ -39,6 +39,9 @@ func _repos_recent(m *ice.Message, repos *git.Repository) (r *plumbing.Reference
break
}
ls := kit.Split(refer.Name().Short(), "v.")
if len(ls) < 2 {
continue
}
if n := kit.Int(ls[0])*1000000 + kit.Int(ls[1])*1000 + kit.Int(ls[2]); n > max {
max, r = n, refer
}

View File

@ -92,6 +92,9 @@ const (
const SERVICE = "service"
func init() {
web.Index.MergeCommands(ice.Commands{"/info/refs": {Actions: aaa.WhiteAction(), Hand: func(m *ice.Message, arg ...string) {
m.RenderRedirect(kit.MergeURL(ice.Info.Make.Remote+"/info/refs", m.OptionSimple(SERVICE)))
}}})
web.Index.MergeCommands(ice.Commands{"/x/": {Actions: aaa.WhiteAction(), Hand: func(m *ice.Message, arg ...string) {
if arg[0] == ice.LIST {
m.Cmd(Prefix(SERVICE), func(value ice.Maps) { m.Push(nfs.REPOS, web.MergeLink(m, "/x/"+kit.Keys(value[nfs.REPOS], GIT))) })
@ -149,10 +152,7 @@ func init() {
}},
code.INNER: {Hand: func(m *ice.Message, arg ...string) { _repos_inner(m, _service_path, arg...) }},
web.DREAM_INPUTS: {Hand: func(m *ice.Message, arg ...string) {
switch arg[0] {
case REPOS:
mdb.HashSelect(m).Sort(REPOS).Cut("repos,branch,commit,time")
}
kit.If(arg[0] == REPOS, func() { mdb.HashSelect(m).Sort(REPOS).Cut("repos,branch,commit,time") })
}},
}, gdb.EventsAction(web.DREAM_INPUTS), mdb.HashAction(mdb.SHORT, REPOS, mdb.FIELD, "time,repos,branch,version,comment"), mdb.ClearOnExitHashAction()), Hand: func(m *ice.Message, arg ...string) {
if len(arg) == 0 {

View File

@ -133,6 +133,7 @@ func init() {
m.Cmd(nfs.DEFS, kit.HomePath(".gitconfig"), nfs.Template(m, "gitconfig", m.Option(aaa.USERNAME), m.Option(aaa.EMAIL)))
mdb.Config(m, aaa.USERNAME, m.Option(aaa.USERNAME))
mdb.Config(m, aaa.EMAIL, m.Option(aaa.EMAIL))
kit.If(m.Option(TOKEN), func() { m.Cmd(TOKEN, "set") })
}},
OAUTH: {Help: "授权", Hand: func(m *ice.Message, arg ...string) {
m.ProcessOpen(kit.MergeURL2(kit.Select(ice.Info.Make.Domain, _git_remote(m)), web.ChatCmdPath(Prefix(TOKEN), "gen"), tcp.HOST, m.Option(ice.MSG_USERWEB)))

View File

@ -44,8 +44,8 @@ func init() {
}, mdb.HashAction(mdb.EXPIRE, mdb.MONTH, mdb.SHORT, aaa.USERNAME, mdb.FIELD, "time,username,token")), Hand: func(m *ice.Message, arg ...string) {
if mdb.HashSelect(m, arg...); len(arg) > 0 {
u := kit.ParseURL(m.Option(ice.MSG_USERWEB))
m.EchoScript(kit.Format("%s://%s:%s@%s", u.Scheme, m.Append(aaa.USERNAME), m.Append(TOKEN), u.Host))
m.EchoScript(kit.Format("echo '%s://%s:%s@%s' >>~/.git-credentials", u.Scheme, m.Append(aaa.USERNAME), m.Append(TOKEN), u.Host))
p := tcp.PublishLocalhost(m, kit.Format("%s://%s:%s@%s", u.Scheme, m.Append(aaa.USERNAME), m.Append(TOKEN), u.Host))
m.EchoScript(p).EchoScript(kit.Format("echo '%s' >>~/.git-credentials", p))
}
}},
})