mirror of
https://shylinux.com/x/icebergs
synced 2025-04-25 17:18:05 +08:00
opt header
This commit is contained in:
parent
3c680d6f88
commit
0cf8512bb4
@ -33,6 +33,7 @@ func _runtime_init(m *ice.Message) {
|
||||
m.Conf(RUNTIME, kit.Keys(CONF, k), kit.Env(k))
|
||||
kit.If(k == CTX_PID, func() { ice.Info.PidPath = kit.Env(k) })
|
||||
})
|
||||
ice.Info.Lang = m.Conf(RUNTIME, kit.Keys(CONF, LANG))
|
||||
m.Conf(RUNTIME, kit.Keys(BOOT, HOSTNAME), kit.Env("HOSTNAME"))
|
||||
if name, e := os.Hostname(); e == nil && name != "" {
|
||||
m.Conf(RUNTIME, kit.Keys(BOOT, HOSTNAME), name)
|
||||
@ -124,18 +125,21 @@ const (
|
||||
TZ = "TZ"
|
||||
)
|
||||
const (
|
||||
CTX_SHY = "ctx_shy"
|
||||
CTX_COM = "ctx_com"
|
||||
CTX_HUB = "ctx_hub"
|
||||
CTX_DEV = "ctx_dev"
|
||||
CTX_OPS = "ctx_ops"
|
||||
CTX_SHY = "ctx_shy"
|
||||
CTX_DEV = "ctx_dev"
|
||||
CTX_HUB = "ctx_hub"
|
||||
CTX_COM = "ctx_com"
|
||||
CTX_OPS = "ctx_ops"
|
||||
CTX_DEMO = "ctx_demo"
|
||||
CTX_MAIL = "ctx_mail"
|
||||
|
||||
CTX_PID = "ctx_pid"
|
||||
CTX_LOG = "ctx_log"
|
||||
CTX_POD = "ctx_pod"
|
||||
CTX_ENV = "ctx_env"
|
||||
)
|
||||
|
||||
var ENV_LIST = []string{TZ, LANG, TERM, SHELL, CTX_SHY, CTX_HUB, CTX_COM, CTX_DEV, CTX_OPS, CTX_PID}
|
||||
var ENV_LIST = []string{TZ, LANG, TERM, SHELL, CTX_SHY, CTX_DEV, CTX_HUB, CTX_COM, CTX_OPS, CTX_DEMO, CTX_MAIL, CTX_PID}
|
||||
|
||||
const (
|
||||
HOSTNAME = "hostname"
|
||||
|
@ -13,7 +13,6 @@ import (
|
||||
"time"
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/aaa"
|
||||
"shylinux.com/x/icebergs/base/cli"
|
||||
"shylinux.com/x/icebergs/base/ctx"
|
||||
"shylinux.com/x/icebergs/base/log"
|
||||
@ -303,13 +302,14 @@ func init() {
|
||||
SPIDE: {Help: "蜘蛛侠", Actions: ice.MergeActions(ice.Actions{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
conf := mdb.Confm(m, cli.RUNTIME, cli.CONF)
|
||||
m.Cmd("", mdb.CREATE, ice.OPS, kit.Select("http://localhost:9020", conf[cli.CTX_OPS]))
|
||||
m.Cmd("", mdb.CREATE, ice.DEV, kit.Select(kit.Select("https://contexts.com.cn", ice.Info.Make.Domain), conf[cli.CTX_DEV]))
|
||||
m.Cmd("", mdb.CREATE, ice.SHY, kit.Select(kit.Select("https://shylinux.com", ice.Info.Make.Remote), conf[cli.CTX_SHY]))
|
||||
m.Cmd("", mdb.CREATE, ice.COM, kit.Select("https://2021.shylinux.com", conf[cli.CTX_COM]))
|
||||
m.Cmd("", mdb.CREATE, ice.DEV, kit.Select(kit.Select("https://contexts.com.cn", ice.Info.Make.Domain), conf[cli.CTX_DEV]))
|
||||
m.Cmd("", mdb.CREATE, ice.HUB, kit.Select("https://repos.shylinux.com", conf[cli.CTX_HUB]))
|
||||
m.Cmd("", mdb.CREATE, ice.COM, kit.Select("https://2021.shylinux.com", conf[cli.CTX_COM]))
|
||||
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.MAIL, kit.Select("https://mail.shylinux.com", conf[cli.CTX_MAIL]))
|
||||
m.Cmd("", mdb.CREATE, nfs.REPOS, kit.Select("https://repos.shylinux.com", conf[cli.CTX_HUB]))
|
||||
m.Cmd("", mdb.CREATE, aaa.EMAIL, "https://mail.shylinux.com")
|
||||
}},
|
||||
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if mdb.IsSearchPreview(m, arg) {
|
||||
|
14
conf.go
14
conf.go
@ -25,7 +25,6 @@ const (
|
||||
HTTPS = "https"
|
||||
HTTP = "http"
|
||||
HELP = "help"
|
||||
DEMO = "demo"
|
||||
MAIN = "main"
|
||||
AUTO = "auto"
|
||||
LIST = "list"
|
||||
@ -35,11 +34,14 @@ const (
|
||||
CORE = "core"
|
||||
MISC = "misc"
|
||||
|
||||
SHY = "shy"
|
||||
HUB = "hub"
|
||||
COM = "com"
|
||||
DEV = "dev"
|
||||
OPS = "ops"
|
||||
SHY = "shy"
|
||||
DEV = "dev"
|
||||
COM = "com"
|
||||
HUB = "hub"
|
||||
OPS = "ops"
|
||||
DEMO = "demo"
|
||||
MAIL = "mail"
|
||||
|
||||
APP = "app"
|
||||
ICE = "ice"
|
||||
CAN = "can"
|
||||
|
@ -72,6 +72,7 @@ func init() {
|
||||
aaa.Black(m, kit.Keys(HEADER, ctx.ACTION, mdb.CREATE))
|
||||
aaa.Black(m, kit.Keys(HEADER, ctx.ACTION, mdb.REMOVE))
|
||||
aaa.Black(m, kit.Keys(HEADER, ctx.ACTION, mdb.MODIFY))
|
||||
kit.If(mdb.HashSelect(m.Spawn()).Length() == 0, func() { m.Cmd("", mdb.CREATE, mdb.TYPE, cli.QRCODE, mdb.NAME, "扫码登录", mdb.ORDER, "1") })
|
||||
}},
|
||||
web.SHARE: {Hand: _header_share},
|
||||
aaa.LOGIN: {Hand: func(m *ice.Message, arg ...string) {}},
|
||||
@ -99,7 +100,7 @@ func init() {
|
||||
mdb.CREATE: {Name: "create type*=oauth,plugin,qrcode name* icons link order space index args", Hand: func(m *ice.Message, arg ...string) { mdb.HashCreate(m, m.OptionSimple()) }},
|
||||
mdb.REMOVE: {Hand: func(m *ice.Message, arg ...string) { mdb.HashRemove(m, m.OptionSimple(mdb.NAME)) }},
|
||||
mdb.MODIFY: {Hand: func(m *ice.Message, arg ...string) { mdb.HashModify(m, m.OptionSimple(mdb.NAME), arg) }},
|
||||
}, web.ApiAction(), mdb.ExportHashAction(mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,icons,type,link,order,space,index,args")), Hand: func(m *ice.Message, arg ...string) {
|
||||
}, web.ApiAction(), mdb.ImportantHashAction(mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,icons,type,link,order,space,index,args")), Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Option("language.list", m.Cmd(nfs.DIR, nfs.TemplatePath(m, aaa.LANGUAGE)+nfs.PS, nfs.FILE).Appendv(nfs.FILE))
|
||||
m.Option("theme.list", m.Cmd(nfs.DIR, nfs.TemplatePath(m, aaa.THEME)+nfs.PS, nfs.FILE).Appendv(nfs.FILE))
|
||||
m.Option(nfs.REPOS, m.Cmdv(web.SPIDE, nfs.REPOS, web.CLIENT_URL))
|
||||
@ -120,6 +121,7 @@ func init() {
|
||||
kit.If(m.Option(aaa.LANGUAGE) == "", func() {
|
||||
m.Option(aaa.LANGUAGE, kit.Select("", "zh-cn", strings.Contains(m.Option(ice.MSG_USERUA), "zh_CN")))
|
||||
kit.If(m.Option(aaa.LANGUAGE) == "", func() { m.Option(aaa.LANGUAGE, kit.Select("", kit.Split(m.R.Header.Get(web.AcceptLanguage), ",;"), 0)) })
|
||||
kit.If(m.Option(aaa.LANGUAGE) == "", func() { m.Option(aaa.LANGUAGE, ice.Info.Lang) })
|
||||
})
|
||||
}},
|
||||
})
|
||||
|
@ -126,6 +126,7 @@ func init() {
|
||||
m.Logs(nfs.SAVE, nfs.TARGET, file, nfs.SOURCE, main)
|
||||
m.Cmdy(nfs.DIR, file, "time,path,size,hash,link")
|
||||
kit.If(!m.IsCliUA() && strings.Contains(file, ice.ICE), func() {
|
||||
defer m.EchoScript(m.Cmdv(web.SPIDE, ice.DEMO, web.CLIENT_URL))
|
||||
defer m.EchoScript("docker run -p 20000:9020 -w /root -it alpine")
|
||||
m.Cmdy(PUBLISH, ice.CONTEXTS, ice.APP)
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user