mirror of
https://shylinux.com/x/icebergs
synced 2025-04-25 09:08:06 +08:00
add some
This commit is contained in:
parent
ee93cfe5f4
commit
3b2299b51f
@ -317,15 +317,16 @@ func ParseUA(m *ice.Message) (res []string) {
|
||||
}
|
||||
return append(res, aaa.IP, m.Option(ice.MSG_USERIP), aaa.UA, m.Option(ice.MSG_USERUA))
|
||||
}
|
||||
func ProxyDomain(m *ice.Message, name string) string {
|
||||
domain := ""
|
||||
m.Cmd(nfs.CAT, path.Join(PROXY_PATH, "conf/portal", name, "server.conf"), func(ls []string) {
|
||||
kit.If(ls[0] == "server_name", func() { domain = ls[1] })
|
||||
})
|
||||
if domain == "" {
|
||||
func ProxyDomain(m *ice.Message, name string) (domain string) {
|
||||
p := path.Join(PROXY_PATH, "conf/portal", name, "server.conf")
|
||||
if !nfs.Exists(m, p) {
|
||||
return ""
|
||||
}
|
||||
return "https://" + domain
|
||||
m.Cmd(nfs.CAT, p, func(ls []string) { kit.If(ls[0] == "server_name", func() { domain = ls[1] }) })
|
||||
if domain != "" {
|
||||
return "https://" + domain
|
||||
}
|
||||
return
|
||||
}
|
||||
func Script(m *ice.Message, str string, arg ...ice.Any) string {
|
||||
return ice.Render(m, ice.RENDER_SCRIPT, kit.Format(str, arg...))
|
||||
|
@ -338,6 +338,14 @@ func init() {
|
||||
ProcessIframe(m, m.Option(mdb.NAME), m.MergePod(m.Option(mdb.NAME)), arg...)
|
||||
}
|
||||
}},
|
||||
"info": {Role: aaa.VOID, Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Push(mdb.TIME, ice.Info.Make.Time)
|
||||
m.Push(mdb.NAME, ice.Info.NodeName)
|
||||
m.Push(mdb.ICONS, kit.Select(mdb.Config(m, mdb.ICONS)))
|
||||
m.Push(nfs.MODULE, ice.Info.Make.Module)
|
||||
m.Push(nfs.VERSION, ice.Info.Make.Versions())
|
||||
m.Push(ORIGIN, m.Option(ice.MSG_USERHOST))
|
||||
}},
|
||||
nfs.PS: {Hand: func(m *ice.Message, arg ...string) { _space_fork(m) }},
|
||||
}, gdb.EventsAction(SPACE_LOGIN), mdb.HashAction(
|
||||
mdb.ICONS, "src/main.ico",
|
||||
|
@ -24,7 +24,7 @@ import (
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
func _spide_create(m *ice.Message, name, link, types, icons, token string) {
|
||||
func _spide_create(m *ice.Message, link, types, name, icons, token string) {
|
||||
if u, e := url.Parse(link); !m.WarnNotValid(e != nil || link == "", link) {
|
||||
dir, file := path.Split(u.EscapedPath())
|
||||
m.Logs(mdb.INSERT, SPIDE, name, LINK, link)
|
||||
@ -284,12 +284,12 @@ func init() {
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
conf := mdb.Confm(m, cli.RUNTIME, cli.CONF)
|
||||
dev := kit.Select("https://2021.shylinux.com", ice.Info.Make.Domain, conf[cli.CTX_DEV])
|
||||
m.Cmd("", mdb.CREATE, ice.SHY, kit.Select("https://shylinux.com", conf[cli.CTX_SHY]), nfs.REPOS)
|
||||
m.Cmd("", mdb.CREATE, ice.DEV, dev, nfs.REPOS, ice.SRC_MAIN_ICO)
|
||||
m.Cmd("", mdb.CREATE, ice.DEV_IP, kit.Select(dev, os.Getenv("ctx_dev_ip")))
|
||||
m.Cmd("", mdb.CREATE, ice.OPS, kit.Select("http://localhost:9020", conf[cli.CTX_OPS]), nfs.REPOS, nfs.USR_ICONS_CONTEXTS)
|
||||
m.Cmd("", mdb.CREATE, ice.DEMO, kit.Select("http://localhost:20000", conf[cli.CTX_DEMO]), "", nfs.USR_ICONS_VOLCANOS)
|
||||
m.Cmd("", mdb.CREATE, ice.MAIL, kit.Select("https://mail.shylinux.com", conf[cli.CTX_MAIL]), "", "usr/icons/Mail.png")
|
||||
m.Cmd("", mdb.CREATE, kit.Select("https://shylinux.com", conf[cli.CTX_SHY]), ice.SHY, "", nfs.REPOS)
|
||||
m.Cmd("", mdb.CREATE, dev, ice.DEV, ice.SRC_MAIN_ICO, nfs.REPOS)
|
||||
m.Cmd("", mdb.CREATE, kit.Select(dev, os.Getenv("ctx_dev_ip")), ice.DEV_IP)
|
||||
m.Cmd("", mdb.CREATE, kit.Select("http://localhost:9020", conf[cli.CTX_OPS]), ice.OPS, nfs.USR_ICONS_CONTEXTS, nfs.REPOS)
|
||||
m.Cmd("", mdb.CREATE, kit.Select("http://localhost:20000", conf[cli.CTX_DEMO]), ice.DEMO, nfs.USR_ICONS_VOLCANOS)
|
||||
m.Cmd("", mdb.CREATE, kit.Select("https://mail.shylinux.com", conf[cli.CTX_MAIL]), ice.MAIL, "usr/icons/Mail.png")
|
||||
}},
|
||||
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if mdb.IsSearchPreview(m, arg) {
|
||||
@ -318,7 +318,8 @@ func init() {
|
||||
m.Sort(arg[0])
|
||||
default:
|
||||
switch arg[0] {
|
||||
case mdb.ICON, mdb.ICONS:
|
||||
case mdb.NAME, mdb.ICONS:
|
||||
m.SplitIndex(m.Cmdx(SPIDE, ice.DEV, kit.MergeURL2(m.Option(ORIGIN), C(SPACE, "info")))).Cut(arg[0])
|
||||
mdb.HashInputs(m, arg)
|
||||
default:
|
||||
mdb.HashSelectValue(m.Spawn(), func(value ice.Map) {
|
||||
@ -328,8 +329,20 @@ func init() {
|
||||
}
|
||||
}
|
||||
}},
|
||||
mdb.CREATE: {Name: "create name origin* type icons token", Hand: func(m *ice.Message, arg ...string) {
|
||||
_spide_create(m, m.Option(mdb.NAME), m.Option(ORIGIN), m.Option(mdb.TYPE), m.OptionDefault(mdb.ICONS, nfs.USR_ICONS_VOLCANOS), m.Option(TOKEN))
|
||||
mdb.CREATE: {Name: "create origin* name icons type token", Hand: func(m *ice.Message, arg ...string) {
|
||||
if m.Option(mdb.NAME) == "" && m.Option(mdb.ICONS) == "" {
|
||||
msg := m.Spawn().SplitIndex(m.Cmdx(SPIDE, ice.DEV, kit.MergeURL2(m.Option(ORIGIN), C(SPACE, "info"))))
|
||||
m.Option(mdb.ICONS, m.Resource(msg.Append(mdb.ICONS), msg.Append(ORIGIN)))
|
||||
m.Option(mdb.NAME, msg.Append(mdb.NAME))
|
||||
m.OptionDefault(mdb.TYPE, nfs.REPOS)
|
||||
}
|
||||
if u, e := url.Parse(m.Option(ORIGIN)); m.Warn(e != nil || u.Host == "", ice.ErrNotValid, m.Option(ORIGIN)) {
|
||||
return
|
||||
} else {
|
||||
m.OptionDefault(mdb.NAME, kit.Split(u.Host, ".:")[0])
|
||||
kit.If(u.Query().Get(TOKEN), func(p string) { m.OptionDefault(TOKEN, p) })
|
||||
}
|
||||
_spide_create(m, m.Option(ORIGIN), m.Option(mdb.TYPE), m.Option(mdb.NAME), m.OptionDefault(mdb.ICONS, nfs.USR_ICONS_VOLCANOS), m.Option(TOKEN))
|
||||
}},
|
||||
COOKIE: {Name: "cookie key* value", Help: "状态量", Hand: func(m *ice.Message, arg ...string) {
|
||||
mdb.HashModify(m, m.OptionSimple(CLIENT_NAME), kit.Keys(COOKIE, m.Option(mdb.KEY)), m.Option(mdb.VALUE))
|
||||
|
@ -21,7 +21,7 @@ func init() {
|
||||
STORE: {Name: "store refresh", Help: "商店", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(SPIDE, mdb.INPUTS, arg) }},
|
||||
mdb.CREATE: {Name: "create origin* name icons", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(SPIDE, mdb.CREATE, m.OptionSimple("name,origin,icons"), mdb.TYPE, nfs.REPOS)
|
||||
m.Cmd(SPIDE, mdb.CREATE, m.OptionSimple("origin,name,icons"), mdb.TYPE, nfs.REPOS)
|
||||
}},
|
||||
mdb.REMOVE: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(SPIDE, mdb.REMOVE, CLIENT_NAME, m.Option(mdb.NAME))
|
||||
|
@ -1,27 +1,25 @@
|
||||
Volcanos(chat.ONIMPORT, {
|
||||
_init: function(can, msg) { can.ui = can.onappend.layout(can), can.onimport.__project(can, msg) },
|
||||
__project: function(can, msg) { var select, current = can.sup.db._zone||can.db.hash[0]||(can.user.info.nodetype == web.WORKER? ice.OPS: ice.DEV)
|
||||
_init: function(can, msg) { can.ui = can.onappend.layout(can), can.onimport._project(can, msg) },
|
||||
_project: function(can, msg) { var select, current = can.sup.db._zone||can.db.hash[0]||(can.user.info.nodetype == web.WORKER? ice.OPS: ice.DEV)
|
||||
msg.Table(function(value) {
|
||||
var _target = can.onimport.item(can, value, function(event) {
|
||||
var _target = can.onimport.item(can, value, function(event, value) {
|
||||
can.onimport.dream(event, can, value, _target)
|
||||
}, null, can.ui.project); select = (value.name == current? _target: select)||_target
|
||||
}), select && select.click(), can.onmotion.orderShow(can, can.ui.project)
|
||||
can.onappend.style(can, "output card", can.ui.content), can.onmotion.delay(can, function() { can.onimport.layout(can) })
|
||||
}, __content: function(can, msg, dev, target) { var list = []
|
||||
can.onimport.card(can, msg, null, function(value) {
|
||||
value.icons = can.misc.Resource(can, value.icons, "", value.origin)
|
||||
if (value.type == web.SERVER) {
|
||||
list.push(value); return true } })
|
||||
},
|
||||
_content: function(can, msg, dev, target) { var list = []
|
||||
can.onimport.card(can, msg, null, function(value) { value.icons = can.misc.Resource(can, value.icons, "", value.origin); if (value.type == web.SERVER) { list.push(value); return true } })
|
||||
can.onimport.itemlist(can, list, function(event, value) {
|
||||
can.onimport.dream(event, can, value, event.currentTarget) }, null, target)
|
||||
value.key = can.core.Keys(dev, value.name)
|
||||
can.onimport.dream(event, can, value, event.currentTarget)
|
||||
}, null, target)
|
||||
},
|
||||
dream: function(event, can, value, target) { can.isCmdMode()? can.misc.SearchHash(can, value.name): can.sup.db._zone = value.name
|
||||
can.page.Select(can, can.ui.project, html.DIV_ITEM, function(_target) {
|
||||
can.page.ClassList.set(can, _target, html.SELECT, _target == target)
|
||||
})
|
||||
if (can.onmotion.cache(can, function() { return value.name }, can.ui.content, can._status)) { return can.onimport.layout(can) }
|
||||
can.page.Select(can, can.ui.project, html.DIV_ITEM, function(_target) { can.page.ClassList.set(can, _target, html.SELECT, _target == target) })
|
||||
if (can.onmotion.cache(can, function() { return value.key||value.name }, can.ui.content, can._status)) { return can.onimport.layout(can) }
|
||||
can.run(can.request(event, {_toast: ice.PROCESS}), [value.origin], function(msg) {
|
||||
can.onimport.__content(can, msg, value.name, target), can.onappend._status(can, msg), can.onimport.layout(can)
|
||||
can.onimport._content(can, msg, value.name, target), can.onappend._status(can, msg), can.onimport.layout(can)
|
||||
})
|
||||
},
|
||||
}, [""])
|
||||
|
@ -32,7 +32,7 @@ func init() {
|
||||
chat.Index.MergeCommands(ice.Commands{
|
||||
TMAP: {Help: "腾讯地图", Actions: ice.Actions{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(web.SPIDE, mdb.CREATE, TMAP, "https://apis.map.qq.com/ws/", "", "usr/icons/Maps.png")
|
||||
m.Cmd(web.SPIDE, mdb.CREATE, "https://apis.map.qq.com/ws/", TMAP, "usr/icons/Maps.png")
|
||||
}},
|
||||
DISTRICT: {Help: "地区", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Echo(get(m, "district/v1/getchildren", m.OptionSimple(mdb.ID)))
|
||||
|
@ -21,7 +21,7 @@ func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
GEOAREA: {Name: "geoarea path auto", Help: "地区", Actions: ice.Actions{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(web.SPIDE, mdb.CREATE, GEOAREA, "https://geo.datav.aliyun.com/areas_v3/bound/")
|
||||
m.Cmd(web.SPIDE, mdb.CREATE, "https://geo.datav.aliyun.com/areas_v3/bound/", GEOAREA)
|
||||
}},
|
||||
nfs.PS: {Hand: func(m *ice.Message, arg ...string) {
|
||||
p := path.Join(ice.USR_GEOAREA, path.Join(arg...))
|
||||
|
@ -35,7 +35,7 @@ func init() {
|
||||
}
|
||||
}
|
||||
func (s Client) Init(m *ice.Message, arg ...string) {
|
||||
m.Cmd(web.SPIDE, mdb.CREATE, BAIDU, AUTH_URL, "", "usr/icons/netdisk.png")
|
||||
m.Cmd(web.SPIDE, mdb.CREATE, AUTH_URL, BAIDU, "usr/icons/netdisk.png")
|
||||
s.Hash.Init(m, arg...)
|
||||
}
|
||||
func (s Client) Login(m *ice.Message, arg ...string) {
|
||||
|
@ -154,7 +154,7 @@ func init() {
|
||||
m.WarnNotValid(_service_repos(m, arg...))
|
||||
}}})
|
||||
Index.MergeCommands(ice.Commands{
|
||||
SERVICE: {Name: "service repos branch commit file auto", Help: "代码源", Actions: ice.MergeActions(ice.Actions{
|
||||
SERVICE: {Name: "service repos branch commit file auto", Help: "代码源", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(nfs.DIR, ice.USR_LOCAL_REPOS, func(value ice.Maps) { _repos_insert(m, value[nfs.PATH]) })
|
||||
}},
|
||||
@ -184,6 +184,10 @@ func init() {
|
||||
})
|
||||
}},
|
||||
}, web.DreamAction(), mdb.HashAction(mdb.SHORT, REPOS, mdb.FIELD, "time,repos,branch,version,message", ice.CMD, GIT), mdb.ClearOnExitHashAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||
if !aaa.IsTechOrRoot(m) {
|
||||
mdb.HashSelect(m)
|
||||
return
|
||||
}
|
||||
if len(arg) == 0 {
|
||||
mdb.HashSelect(m, arg...).Table(func(value ice.Maps) {
|
||||
m.Push(nfs.SIZE, kit.Split(m.Cmdx(cli.SYSTEM, "du", "-sh", path.Join(ice.USR_LOCAL_REPOS, value[REPOS])))[0])
|
||||
|
@ -22,7 +22,9 @@ const APP = "app"
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
APP: {Name: "app appid auto token login", Help: "应用", Actions: ice.MergeActions(ice.Actions{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { m.Cmd(web.SPIDE, mdb.CREATE, LARK, mdb.Config(m, tcp.SERVER)) }},
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(web.SPIDE, mdb.CREATE, mdb.Config(m, tcp.SERVER), LARK)
|
||||
}},
|
||||
LOGIN: {Name: "login appid* appmm* duty", Help: "登录", Hand: func(m *ice.Message, arg ...string) {
|
||||
mdb.HashCreate(m, m.OptionSimple(APPID, APPMM, DUTY))
|
||||
}},
|
||||
|
@ -42,7 +42,7 @@ func init() {
|
||||
}},
|
||||
BOT: {Name: "bot name chat text:textarea auto create", Help: "机器人", Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.CREATE: {Name: "create name token ekey hook", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(web.SPIDE, mdb.CREATE, m.Option("name"), m.Option("hook"))
|
||||
m.Cmd(web.SPIDE, mdb.CREATE, m.Option("hook"), m.Option("name"))
|
||||
m.Cmdy(mdb.INSERT, m.PrefixKey(), "", mdb.HASH, arg)
|
||||
}},
|
||||
}, mdb.HashAction(mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,token,ekey,hook")), Hand: func(m *ice.Message, arg ...string) {
|
||||
|
@ -52,7 +52,7 @@ func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
ACCESS: {Help: "认证", Meta: Meta(), Actions: ice.MergeActions(ice.Actions{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(web.SPIDE, mdb.CREATE, WX, mdb.Config(m, tcp.SERVER), "", "usr/icons/wechat.png")
|
||||
m.Cmd(web.SPIDE, mdb.CREATE, mdb.Config(m, tcp.SERVER), WX, "usr/icons/wechat.png")
|
||||
}},
|
||||
mdb.CREATE: {Name: "create type=web,app usernick access* appid* secret* token* icons qrcode", Hand: func(m *ice.Message, arg ...string) {
|
||||
mdb.HashCreate(m, m.OptionSimple(mdb.TYPE, aaa.USERNICK, ACCESS, APPID, SECRET, TOKEN, mdb.ICONS, cli.QRCODE))
|
||||
|
13
render.go
13
render.go
@ -254,7 +254,18 @@ func (m *Message) Display(file string, arg ...Any) *Message {
|
||||
m.Option(MSG_DISPLAY, kit.MergeURL(kit.ExtChange(m.resource(file), JS), arg...))
|
||||
return m
|
||||
}
|
||||
func (m *Message) Resource(file string) string { return m.resource(file) }
|
||||
func (m *Message) Resource(file string, arg ...string) string {
|
||||
if len(arg) > 0 && arg[0] != "" {
|
||||
if strings.HasPrefix(file, HTTP) {
|
||||
return file
|
||||
} else if strings.HasPrefix(file, PS) {
|
||||
return arg[0] + file
|
||||
} else if kit.HasPrefix(file, "src", "usr") {
|
||||
return arg[0] + "/require/" + file
|
||||
}
|
||||
}
|
||||
return m.resource(file)
|
||||
}
|
||||
func (m *Message) resource(file string) string {
|
||||
p := kit.FileLines(3)
|
||||
kit.If(file == "", func() { p = kit.ExtChange(p, JS) }, func() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user