forked from x/icebergs
add some
This commit is contained in:
parent
cc0a5de7a0
commit
8b23ad92e0
@ -11,7 +11,7 @@ const PRODUCT = "product"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
PRODUCT: {Name: "product refresh", Help: "产品展示", Actions: mdb.HashAction(mdb.SHORT, "index", mdb.FIELD, "time,name,text,order,disable,index,args"), Hand: func(m *ice.Message, arg ...string) {
|
||||
PRODUCT: {Name: "product refresh", Help: "产品展示", Actions: mdb.HashAction(mdb.SHORT, "index", mdb.FIELD, "time,name,text,order,enable,index,args"), Hand: func(m *ice.Message, arg ...string) {
|
||||
mdb.HashSelect(m, arg...).SortInt(mdb.ORDER)
|
||||
}},
|
||||
})
|
||||
|
@ -39,8 +39,16 @@ func _serve_start(m *ice.Message) {
|
||||
return
|
||||
}
|
||||
kit.For(kit.Split(m.Option(ice.DEV)), func(dev string) {
|
||||
if m.Cmds(SPIDE, dev).Append(TOKEN) == "" {
|
||||
m.Sleep30ms(SPACE, tcp.DIAL, ice.DEV, dev, mdb.NAME, ice.Info.NodeName, m.OptionSimple(TOKEN))
|
||||
if strings.HasPrefix(dev, HTTP) {
|
||||
m.Cmd(SPIDE, mdb.CREATE, dev, ice.DEV, "", nfs.REPOS)
|
||||
dev = ice.DEV
|
||||
}
|
||||
if msg := m.Cmds(SPIDE, dev); msg.Append(TOKEN) == "" {
|
||||
if m.Option(TOKEN) != "" {
|
||||
m.Sleep30ms(SPACE, tcp.DIAL, ice.DEV, dev, TOKEN, m.Option(TOKEN))
|
||||
} else {
|
||||
m.Sleep30ms(SPACE, tcp.DIAL, ice.DEV, dev)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -261,6 +269,7 @@ func init() {
|
||||
if cb, ok := m.Optionv(SERVE_START).(func()); ok {
|
||||
cb()
|
||||
}
|
||||
ice.Info.Important = ice.HasVar()
|
||||
}},
|
||||
PROXY_CONF: {Name: "proxyConf name* port host path", Hand: func(m *ice.Message, arg ...string) {
|
||||
if dir := m.OptionDefault(nfs.PATH, PROXY_PATH, tcp.HOST, "127.0.0.1", tcp.PORT, tcp.PORT_9020); true || nfs.Exists(m, dir) {
|
||||
|
@ -112,7 +112,7 @@ func _space_fork(m *ice.Message) {
|
||||
defer gdb.EventDeferEvent(m, SPACE_OPEN, args)(SPACE_CLOSE, args)
|
||||
m.Go(func() {
|
||||
SpacePwd(m, name, "")
|
||||
SpaceEvent(m, OPS_SERVER_OPEN, name, args...)
|
||||
SpaceEvent(m.Spawn(ice.MSG_USERROLE, aaa.TECH), OPS_SERVER_OPEN, name, args...)
|
||||
})
|
||||
}
|
||||
_space_handle(m, safe, name, c)
|
||||
@ -129,7 +129,9 @@ func _space_handle(m *ice.Message, safe bool, name string, c *websocket.Conn) {
|
||||
}
|
||||
msg := m.Spawn(b)
|
||||
if safe && msg.Option(ice.MSG_UNSAFE) != ice.TRUE { // 下行权限
|
||||
msg.Option(ice.MSG_USERROLE, kit.Select(msg.Option(ice.MSG_USERROLE), aaa.UserRole(msg, msg.Option(ice.MSG_USERNAME))))
|
||||
if !aaa.IsTechOrRoot(msg) {
|
||||
msg.Option(ice.MSG_USERROLE, kit.Select(msg.Option(ice.MSG_USERROLE), aaa.UserRole(msg, msg.Option(ice.MSG_USERNAME))))
|
||||
}
|
||||
// kit.If(kit.IsIn(msg.Option(ice.MSG_USERROLE), "", aaa.VOID), func() { msg.Option(ice.MSG_USERROLE, aaa.UserRole(msg, msg.Option(ice.MSG_USERNAME))) })
|
||||
} else { // 上行权限
|
||||
msg.Option(ice.MSG_UNSAFE, ice.TRUE)
|
||||
@ -355,10 +357,6 @@ func init() {
|
||||
}},
|
||||
cli.START: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy("", tcp.DIAL, arg) }},
|
||||
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.Option(ice.DEV), ice.DEV)
|
||||
m.Option(ice.DEV, ice.DEV)
|
||||
}
|
||||
_space_dial(m, m.Option(ice.DEV), kit.Select(ice.Info.NodeName, m.Option(mdb.NAME)), arg...)
|
||||
}},
|
||||
cli.CLOSE: {Hand: func(m *ice.Message, arg ...string) { mdb.HashRemove(m, m.OptionSimple(mdb.NAME)) }},
|
||||
|
@ -25,7 +25,7 @@ func init() {
|
||||
}
|
||||
})
|
||||
}},
|
||||
}, mdb.HashAction(mdb.SHORT, mdb.UNIQ, mdb.EXPIRE, mdb.MONTH, html.CHECKBOX, ice.TRUE)), Hand: func(m *ice.Message, arg ...string) {
|
||||
}, mdb.ExportHashAction(mdb.SHORT, mdb.UNIQ, mdb.EXPIRE, mdb.MONTH, html.CHECKBOX, ice.TRUE)), Hand: func(m *ice.Message, arg ...string) {
|
||||
if mdb.HashSelect(m, arg...); len(arg) > 0 {
|
||||
m.EchoScript(kit.MergeURL2(m.Option(ice.MSG_USERWEB), nfs.PS, TOKEN, arg[0]))
|
||||
} else {
|
||||
|
@ -111,12 +111,11 @@ func init() {
|
||||
kit.If(cli.SystemFindGo(m), func() { m.PushButton(kit.Dict(m.CommandKey(), m.Commands("").Help)) })
|
||||
})
|
||||
}},
|
||||
}, web.DreamTablesAction(), ctx.ConfAction(cli.ENV, kit.Dict(GOPRIVATE, "shylinux.com,github.com", GOPROXY, "https://goproxy.cn,direct", CGO_ENABLED, "1"))), Hand: func(m *ice.Message, arg ...string) {
|
||||
}, web.DreamTablesAction(), ctx.ConfAction(cli.ENV, kit.Dict(GOPRIVATE, "shylinux.com,github.com", GOPROXY, "https://goproxy.cn,direct", CGO_ENABLED, "0"))), Hand: func(m *ice.Message, arg ...string) {
|
||||
main, file, goos, arch := _compile_target(m, arg...)
|
||||
defer web.ToastProcess(m, file)()
|
||||
env := kit.Simple(cli.PATH, cli.BinPath(), cli.HOME, kit.Select(kit.Path(""), kit.Env(cli.HOME)), mdb.Configv(m, cli.ENV), m.Optionv(cli.ENV), cli.GOOS, goos, cli.GOARCH, arch)
|
||||
kit.If(runtime.GOOS == cli.WINDOWS, func() { env = append(env, GOPATH, kit.HomePath(GO), GOCACHE, kit.HomePath("go/go-build")) })
|
||||
env = append(env, CGO_ENABLED, "1")
|
||||
m.Options(cli.CMD_ENV, env).Cmd(AUTOGEN, VERSION)
|
||||
_compile_get(m, main)
|
||||
defer m.StatusTime(VERSION, strings.TrimPrefix(GoVersion(m), "go version"))
|
||||
|
@ -34,7 +34,6 @@ func init() {
|
||||
res := m.Cmdx(nfs.CAT, path.Join(nfs.USR_LOCAL_WORK, m.Option(web.SPACE), ice.GO_MOD), func(ls []string, text string) string {
|
||||
if len(ls) > 1 {
|
||||
if v, ok := repos[ls[0]]; ok && !strings.Contains(v, "-") {
|
||||
m.Debug("what %v %v => %v", ls[0], ls[1], v)
|
||||
text = lex.TB + ls[0] + lex.SP + v
|
||||
}
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ open http://localhost:9020
|
||||
func _spark_product(m *ice.Message, arg ...string) {
|
||||
if len(arg) == 0 {
|
||||
m.Cmd("web.product").Table(func(value ice.Maps) {
|
||||
if value[mdb.DISABLE] != ice.FALSE {
|
||||
if value[mdb.ENABLE] == ice.TRUE {
|
||||
_spark_product(m, value[ctx.INDEX], value[mdb.NAME], value[mdb.TEXT])
|
||||
}
|
||||
})
|
||||
|
2
data.go
2
data.go
@ -70,6 +70,6 @@ func loadImportant(m *Message) {
|
||||
defer f.Close()
|
||||
kit.For(f, func(s string) { kit.If(s != "" && !strings.HasPrefix(s, "# "), func() { m.Cmd(kit.Split(s)) }) })
|
||||
}
|
||||
Info.Important = HasVar()
|
||||
// Info.Important = HasVar()
|
||||
}
|
||||
func removeImportant(m *Message) { os.Remove(VAR_DATA_IMPORTANT) }
|
||||
|
2
init.go
2
init.go
@ -26,7 +26,7 @@ func (s *Frame) Begin(m *Message, arg ...string) {
|
||||
func (s *Frame) Start(m *Message, arg ...string) {
|
||||
m.Cmd(INIT, arg)
|
||||
kit.For([]string{LOG, GDB, SSH}, func(k string) { m.Sleep30ms().Start(k) })
|
||||
Info.Important = HasVar()
|
||||
// Info.Important = HasVar()
|
||||
m.Sleep30ms().Cmd(arg)
|
||||
}
|
||||
func (s *Frame) Close(m *Message, arg ...string) {
|
||||
|
@ -569,7 +569,6 @@ func init() {
|
||||
}},
|
||||
STATUS: {Help: "状态", Icon: "bi bi-app-indicator", Hand: func(m *ice.Message, arg ...string) {
|
||||
if repos := kit.Select(m.Option(REPOS), arg, 0); repos != "" {
|
||||
m.Toast(kit.Format("what %v", repos))
|
||||
_repos_status(m, repos, _repos_open(m, repos))
|
||||
} else {
|
||||
last := ""
|
||||
|
@ -83,7 +83,6 @@ func init() {
|
||||
web.PP(LOGIN): {Actions: ice.MergeActions(ice.Actions{
|
||||
aaa.SESS: {Name: "sess code", Help: "会话", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Option(ice.MSG_USERZONE, WX)
|
||||
m.Option("what", kit.Format("what %v", mdb.Conf(m, "header", "meta.demo")))
|
||||
if mdb.Conf(m, "header", "meta.demo") == ice.TRUE {
|
||||
m.Echo(aaa.SessCreate(m.Spawn(), ice.Info.Username))
|
||||
return
|
||||
|
Loading…
x
Reference in New Issue
Block a user