1
0
forked from x/icebergs
This commit is contained in:
IT 老营长 @云轩领航-创始人 2023-07-11 11:04:53 +08:00
parent f2766ce969
commit 19d6bb332e
20 changed files with 111 additions and 38 deletions

View File

@ -12,6 +12,7 @@ import (
"shylinux.com/x/icebergs/base/lex"
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/nfs"
"shylinux.com/x/icebergs/base/tcp"
kit "shylinux.com/x/toolkits"
)
@ -146,6 +147,9 @@ func init() {
})
}
func Opens(m *ice.Message, arg ...string) {
if !tcp.IsLocalHost(m, m.Option(ice.MSG_USERIP)) {
return
}
if len(arg) == 0 || arg[0] == "" {
return
}

View File

@ -15,6 +15,7 @@ import (
"shylinux.com/x/icebergs/base/lex"
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/nfs"
"shylinux.com/x/icebergs/base/tcp"
kit "shylinux.com/x/toolkits"
)
@ -146,7 +147,7 @@ const RUNTIME = "runtime"
func init() {
Index.MergeCommands(ice.Commands{
RUNTIME: {Name: "runtime info=bootinfo,ifconfig,diskinfo,hostinfo,userinfo,procstat,procinfo,bootinfo,api,cli,cmd,mod,env,path,chain,routine auto", Help: "运行环境", Actions: ice.MergeActions(ice.Actions{
RUNTIME: {Name: "runtime info=bootinfo,ifconfig,diskinfo,hostinfo,userinfo,procstat,procinfo,bootinfo,role,api,cli,cmd,mod,env,path,chain,routine auto dark system finder docker monitor terminal", Help: "运行环境", Actions: ice.MergeActions(ice.Actions{
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
aaa.White(m, ice.ETC_PATH)
aaa.White(m, ice.LICENSE)
@ -230,6 +231,21 @@ func init() {
kit.For(_path_split(os.Getenv(PATH)), func(p string) { m.Push(nfs.PATH, p) })
}},
"chain": {Hand: func(m *ice.Message, arg ...string) { m.Echo(m.FormatChain()) }},
aaa.ROLE: {Hand: func(m *ice.Message, arg ...string) {
m.Cmd(aaa.ROLE, func(value ice.Maps) { m.Push(mdb.KEY, kit.Keys(value[aaa.ROLE], value[mdb.ZONE], value[mdb.KEY])) })
ctx.DisplayStorySpide(m.Options(nfs.DIR_ROOT, "ice."), mdb.FIELD, mdb.KEY, lex.SPLIT, nfs.PT)
}},
"terminal": {Help: "终端", Hand: func(m *ice.Message, arg ...string) { Opens(m, "Terminal.app") }},
"monitor": {Help: "监控", Hand: func(m *ice.Message, arg ...string) { Opens(m, "Activity Monitor.app") }},
"docker": {Help: "容器", Hand: func(m *ice.Message, arg ...string) { Opens(m, "Docker Desktop.app") }},
"finder": {Help: "资源", Hand: func(m *ice.Message, arg ...string) { Opens(m, "Finder.app") }},
"system": {Help: "系统", Hand: func(m *ice.Message, arg ...string) { Opens(m, "System Settings.app") }},
"dark": {Help: "主题", Hand: func(m *ice.Message, arg ...string) {
if !tcp.IsLocalHost(m, m.Option(ice.MSG_USERIP)) {
return
}
m.Cmd(SYSTEM, "osascript", "-e", `tell app "System Events" to tell appearance preferences to set dark mode to not dark mode`)
}},
}, ctx.CmdAction(), ctx.ConfAction("")), Hand: func(m *ice.Message, arg ...string) {
kit.If(len(arg) > 0 && arg[0] == BOOTINFO, func() { arg = arg[1:] })
m.Cmdy(ctx.CONFIG, RUNTIME, arg)

View File

@ -154,6 +154,12 @@ 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))) }},
"button": {Hand: func(m *ice.Message, arg ...string) {
for _, cmd := range kit.Reverse(arg) {
m.Cmd(gdb.EVENT, gdb.LISTEN, gdb.EVENT, DREAM_TABLES, ice.CMD, cmd)
m.Cmd(gdb.EVENT, gdb.LISTEN, gdb.EVENT, DREAM_ACTION, ice.CMD, cmd)
}
}},
}, 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)

8
base/web/html/html.go Normal file
View File

@ -0,0 +1,8 @@
package html
const (
DARK = "dark"
LIGHT = "light"
WHITE = "white"
BLACK = "black"
)

View File

@ -99,6 +99,12 @@ func Toast(m *ice.Message, text string, arg ...ice.Any) { // [title [duration [p
}
}
}
if len(arg) == 0 {
arg = append(arg, m.PrefixKey())
}
if len(arg) > 0 {
arg[0] = kit.Select(m.PrefixKey(), arg[0])
}
PushNoticeToast(m, text, arg)
}
func ToastFailure(m *ice.Message, arg ...ice.Any) { Toast(m, ice.FAILURE, arg...) }

View File

@ -143,6 +143,8 @@ func renderVersion(m *ice.Message) string {
}
const (
DARK = "dark"
LIGHT = "light"
BLACK = "black"
DISPLAY = "display"
RESIZE = "resize"

View File

@ -203,7 +203,7 @@ func init() {
}
}},
DOMAIN: {Hand: func(m *ice.Message, arg ...string) { m.Echo(_space_domain(m)) }},
LOGIN: {Hand: func(m *ice.Message, arg ...string) {
LOGIN: {Help: "授权", Hand: func(m *ice.Message, arg ...string) {
m.Option(ice.MSG_USERUA, m.Cmdv("", kit.Select(m.Option(mdb.NAME), arg, 0), ice.MSG_USERUA))
m.Cmd("", kit.Select(m.Option(mdb.NAME), arg, 0), ice.MSG_SESSID, aaa.SessCreate(m, m.Option(ice.MSG_USERNAME)))
}},
@ -222,13 +222,16 @@ func init() {
if kit.IsIn(value[mdb.TYPE], CHROME, "send") {
return
}
m.Push("", value, field)
m.Push("", value, kit.Split("time,type,name,text"))
if kit.IsIn(value[mdb.TYPE], SERVER, WORKER) {
m.Push(mdb.LINK, tcp.PublishLocalhost(m, m.MergePod(value[mdb.NAME])))
} else {
m.Push(mdb.LINK, "")
}
m.Debug("what %v", kit.Select(OPEN, LOGIN, value[mdb.TYPE] == LOGIN))
m.Debug("what %v", value)
m.PushButton(kit.Select(OPEN, LOGIN, value[mdb.TYPE] == LOGIN), mdb.REMOVE)
m.Debug("what %v", m.FormatMeta())
})
kit.If(!m.IsCliUA(), func() { m.Cmdy("web.code.publish", "contexts", "misc") })
kit.If(len(arg) == 1, func() { m.EchoIFrame(m.MergePod(arg[0])) })

View File

@ -3,11 +3,13 @@ package chat
import (
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/gdb"
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/tcp"
"shylinux.com/x/icebergs/base/web"
"shylinux.com/x/icebergs/base/web/html"
kit "shylinux.com/x/toolkits"
)
@ -76,6 +78,13 @@ func init() {
aaa.AVATAR: {Hand: _header_users},
web.SHARE: {Hand: _header_share},
"webpack": {Hand: ctx.CmdHandler("webpack", "build")},
"theme": {Hand: func(m *ice.Message, arg ...string) {
if !tcp.IsLocalHost(m, m.Option(ice.MSG_USERIP)) {
return
}
m.Cmd(cli.SYSTEM, "osascript", "-e", `tell app "System Events" to tell appearance preferences to set dark mode to `+
kit.Select(ice.FALSE, ice.TRUE, kit.IsIn(kit.Select(html.DARK, arg, 0), html.DARK, html.BLACK)))
}},
}, ctx.ConfAction(SSO, "", aaa.LANGUAGE, "zh")), Hand: func(m *ice.Message, arg ...string) {
if gdb.Event(m, HEADER_AGENT); !_header_check(m, arg...) {
return

View File

@ -42,12 +42,10 @@ fieldset.macos.desktop>div.output>div.desktop>fieldset.web.code.compile>form.opt
fieldset.macos.desktop>div.output>div.desktop>fieldset.web.chat.iframe>div.status { display:none; }
fieldset.macos.desktop>div.output>div.desktop>fieldset.web.chat.iframe>form.option>div.item.hash>input { width:360px; }
fieldset.macos.desktop>div.output>div.desktop>fieldset.web.chat.macos.finder>div.status { display:none; }
/* fieldset.macos.desktop>div.output>div.desktop>fieldset>div.output>fieldset>form.option>div.item { margin-right:0px; } */
/* fieldset.macos.desktop>div.output>div.desktop>fieldset>div.output>fieldset>div.action>div.item { margin-right:0px; } */
fieldset.macos.menu>div.output>div.item { padding:0 5px; float:right; cursor:pointer; }
fieldset.macos.menu>div.output>div.item.avatar>img { height:25px; }
fieldset.macos.menu>div.output>div.menu { float:left; padding:0 20px; cursor:pointer; }
fieldset.macos.menu>div.output>div.tabs { float:left; font-style:italic; }
fieldset.macos.menu>div.output>div.tabs { float:left; font-style:italic; padding:0 10px; }
fieldset.macos.menu>div.output>div.tabs.select { background-color:transparent; color:white; }
fieldset.macos.dock>div.output { height:80px; display:flex; overflow:auto; }
fieldset.macos.dock>div.output>div.space { background-color:#ececec36; margin:10px; height:calc(100% - 20px); width:2px; }

View File

@ -27,6 +27,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.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { web.DreamProcess(m, []string{}, arg...) }},
}, aaa.RoleAction(ctx.COMMAND, ctx.RUN), CmdHashAction(), mdb.ImportantHashAction())},
})
}

View File

@ -18,7 +18,7 @@ var Index = &ice.Context{Name: MACOS, Commands: ice.Commands{ice.CTX_INIT: {Hand
ice.Info.Load(m).Cmd(FINDER, ice.CTX_INIT)
}}}}
func init() { chat.Index.Register(Index, nil, DESKTOP) }
func init() { chat.Index.Register(Index, nil, DESKTOP, APPLICATIONS) }
func Prefix(arg ...string) string { return chat.Prefix(MACOS, kit.Keys(arg)) }

View File

@ -67,12 +67,13 @@ func init() {
kit.Switch(m.Option(mdb.TYPE), kit.Simple(web.SERVER, web.WORKER), func() {
kit.If(cli.SystemFind(m, GO), func() {
kit.If(nfs.Exists(m, path.Join(ice.USR_LOCAL_WORK, m.Option(mdb.NAME), "src/main.go")), func() {
m.PushButton(kit.Dict(m.CommandKey(), "编译"))
m.PushButton(kit.Dict(m.CommandKey(), "构建"))
})
})
})
}},
}, web.DreamAction(), 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) {
web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { web.DreamProcess(m, []string{}, arg...) }},
}, 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) {
defer web.ToastProcess(m)()
main, file, goos, arch := _compile_target(m, arg...)
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)

View File

@ -173,9 +173,10 @@ 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(), "码")) })
kit.Switch(m.Option(mdb.TYPE), kit.Simple(web.SERVER, web.WORKER), func() { m.PushButton(kit.Dict(m.CommandKey(), "码")) })
}},
}, aaa.RoleAction(ctx.COMMAND), web.DreamAction(), mdb.HashAction(mdb.SHORT, nfs.PATH, mdb.FIELD, "time,path")), Hand: func(m *ice.Message, arg ...string) {
web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { web.DreamProcess(m, []string{}, arg...) }},
}, aaa.RoleAction(ctx.COMMAND), mdb.HashAction(mdb.SHORT, nfs.PATH, mdb.FIELD, "time,path")), Hand: func(m *ice.Message, arg ...string) {
if m.Cmdy(INNER, arg); arg[0] != ctx.ACTION {
kit.If(len(arg) > 1, func() { mdb.HashCreate(m.Spawn(), nfs.PATH, path.Join(kit.Slice(arg, 0, 2)...)) })
m.Action(nfs.SAVE, COMPILE, "show", "exec")

View File

@ -123,16 +123,14 @@ func init() {
web.OUTPUT: {Help: "全屏", Hand: func(m *ice.Message, arg ...string) {
web.ProcessPodCmd(m, "", "", m.OptionSimple(mdb.HASH), ctx.STYLE, web.OUTPUT)
}},
web.DREAM_CREATE: {Hand: func(m *ice.Message, arg ...string) {
m.Cmd("", mdb.CREATE, mdb.TYPE, BASH, m.OptionSimple(mdb.NAME), nfs.PATH, path.Join(ice.USR_LOCAL_WORK, m.Option(mdb.NAME))+nfs.PS)
}},
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.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { web.DreamProcess(m, []string{}, arg...) }},
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.FIELD, "time,hash,type,name,text,path,theme,daemon")), Hand: func(m *ice.Message, arg ...string) {
}, ctx.CmdAction(), ctx.ProcessAction(), 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)

View File

@ -7,13 +7,15 @@ import (
"shylinux.com/x/icebergs/base/aaa"
"shylinux.com/x/icebergs/base/ctx"
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/web"
kit "shylinux.com/x/toolkits"
)
func _field_show(m *ice.Message, name, text string, arg ...string) {
meta := kit.Dict()
m.Search(text, func(key string, cmd *ice.Command) {
meta[mdb.META], meta[mdb.LIST], name = kit.Dict(cmd.Meta), cmd.List, kit.Select(cmd.Help, name)
meta[mdb.LIST], name = cmd.List, kit.Select(cmd.Help, name)
kit.For(cmd.Meta, func(k string, v ice.Any) { meta[kit.Keys(mdb.META, k)] = v })
})
if m.Warn(len(meta) == 0, ice.ErrNotFound, text) || !aaa.Right(m.Spawn(), text) {
return
@ -23,7 +25,7 @@ func _field_show(m *ice.Message, name, text string, arg ...string) {
kit.Value(meta, k, kit.Split(strings.TrimSuffix(strings.TrimPrefix(v, "["), "]")))
} else if k == ice.MSG_RESULT {
m.Option("output", strings.TrimSpace(v))
kit.Value(meta, "meta.mode", "result")
kit.Value(meta, "meta.mode", ice.MSG_RESULT)
kit.Value(meta, "msg", kit.Dict())
} else {
kit.Value(meta, k, v)
@ -39,9 +41,8 @@ func init() {
Index.MergeCommands(ice.Commands{
FIELD: {Name: "field name cmd", Help: "插件", Actions: ctx.CmdAction(), Hand: func(m *ice.Message, arg ...string) {
kit.If(kit.IsIn(kit.Select("", arg, 1), ctx.ARGS, ice.MSG_RESULT), func() { arg = kit.Simple("", arg) })
arg = _name(m, arg)
if arg[0] == "inner" {
arg = append([]string{"", "web.code.inner", "args", "src/ main.go", "result", arg[1], "meta.display", "/plugin/local/code/inner.js", "style", "output"}, arg[2:]...)
if arg = _name(m, arg); arg[0] == "inner" {
arg = append([]string{"", web.CODE_INNER, ctx.ARGS, "src/ main.go", ice.MSG_RESULT, arg[1], "meta.display", "/plugin/local/code/inner.js", ctx.STYLE, "output"}, arg[2:]...)
}
_field_show(m, arg[0], arg[1], arg[2:]...)
}},

View File

@ -3,6 +3,8 @@ fieldset.web.wiki.portal>div.output { padding:0; }
fieldset.web.wiki.portal>div.output>div.header { background-color:rgb(22 31 49); color:var(--code-fg-color); height:var(--portal-header-height); --hover-bg-color:var(--plugin-bg-color); }
fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] { display:flex; justify-content:center; }
fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] div.item { padding:20px; height:var(--portal-header-height); }
fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] div.item.select { background-color:var(--output-bg-color); }
fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] div.item:hover { background-color:var(--output-bg-color); }
fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] div.item.space { padding:0px; margin:0 40px; }
fieldset.web.wiki.portal>div.output>div.layout { display:flex; justify-content:center; }
fieldset.web.wiki.portal>div.output>div.layout>div.nav { padding:40px 40px; border-right:var(--plugin-border-color) solid 1px; min-width:230px; overflow:auto; }
@ -14,6 +16,8 @@ fieldset.web.wiki.portal>div.output>div.layout>div.aside div.item { padding:5px;
fieldset.web.wiki.portal>div.output>div.layout>div.aside div.item.section { padding-left:20px; }
body.dark fieldset.web.wiki.portal>div.output>div.layout { background-color:var(--plugin-bg-color); --code-bg-color:var(--output-bg-color); }
body.dark fieldset.web.wiki.portal>div.output>div.layout>div.nav { border-right:gray solid 1px; }
body.dark fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] div.item.select { background-color:var(--plugin-bg-color); }
body.dark fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] div.item:hover { background-color:var(--plugin-bg-color); }
fieldset.web.wiki.portal.home>div.output>div.layout>div.main p { white-space:pre-wrap; text-align:center; }
fieldset.web.wiki.portal>div.output>div.layout>div.main>* { margin:20px auto; }
fieldset.web.wiki.portal>div.output>div.layout>div.main h2 { margin-top:40px; }
@ -24,6 +28,9 @@ fieldset.web.wiki.portal>div.output>div.layout>div.main p code {
fieldset.web.wiki.portal>div.output>div.layout>div.main div.story[data-type=spark][data-name=shell] {
background-color:var(--code-bg-color); color:var(--code-fg-color); padding:10px; margin:10px auto;
}
fieldset.web.wiki.portal>div.output>div.layout>div.main div.story[data-type=spark][data-name=shell] kbd:hover {
background-color:white; color:black;
}
fieldset.web.wiki.portal>div.output>div.layout>div.main fieldset.inner.output div.content {
background-color:var(--code-bg-color); color:var(--code-fg-color); padding:10px 0;
--code-comment:silver; --code-keyword:orange; --code-package:silver;

View File

@ -35,11 +35,10 @@ 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(ice.Maps{PORTAL: "官网"})
})
kit.Switch(m.Option(mdb.TYPE), kit.Simple(web.SERVER, web.WORKER), func() { m.PushButton(ice.Maps{PORTAL: "官网"}) })
}},
}, aaa.WhiteAction(ctx.COMMAND, ctx.RUN), aaa.RoleAction(ctx.COMMAND, ctx.RUN), web.DreamAction(), ctx.CmdAction()), Hand: func(m *ice.Message, arg ...string) {
web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { web.DreamProcess(m, []string{}, arg...) }},
}, aaa.WhiteAction(ctx.COMMAND, ctx.RUN), aaa.RoleAction(ctx.COMMAND, ctx.RUN), ctx.CmdAction()), Hand: func(m *ice.Message, arg ...string) {
if m.Push(HEADER, m.Cmdx(WORD, path.Join(nfs.SRC_DOCUMENT, INDEX_SHY))); len(arg) > 0 {
m.Push(NAV, m.Cmdx(WORD, path.Join(nfs.SRC_DOCUMENT, path.Join(arg...), INDEX_SHY)))
}

View File

@ -1,5 +1,5 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { can.require(["/plugin/local/wiki/word.js"]), can.Conf(html.PADDING, 40)
_init: function(can, msg) { can.require(["/plugin/local/wiki/word.js"]), can.Conf(html.PADDING, can.user.isMobile? 10: 40)
can.db = {nav: {}}, can.sup.onexport.link = function() { return can.db.prefix }
can.db.prefix = location.pathname.indexOf("/chat/cmd/web.wiki.portal/") == 0? "/chat/cmd/web.wiki.portal/":
location.pathname.indexOf("/chat/cmd/web.wiki.portal") == 0? "/chat/cmd/web.wiki.portal": "/wiki/portal/"
@ -54,6 +54,10 @@ Volcanos(chat.ONIMPORT, {
layout: function(can, height, width) { can.onmotion.delay(can, function() { padding = can.Conf(html.PADDING)
if (can.isCmdMode()) { can.onappend.style(can, html.OUTPUT), can.ConfHeight(can.page.height()), can.ConfWidth(can.page.width()) }
can.ui.layout(height, width), can.ConfHeight(can.ui.main.offsetHeight), can.ConfWidth(can.ui.main.offsetWidth)
if (can.user.isMobile && can.isCmdMode()) {
can.page.style(can, can.ui.nav, html.HEIGHT, "", html.WIDTH, can.ConfWidth(can.page.width()))
can.page.style(can, can.ui.main, html.HEIGHT, "", html.WIDTH, can.ConfHeight(can.page.width()))
}
can.core.List(can._plugins, function(sub) { sub.onimport.size(sub, can.base.Min(can.ConfHeight()/2, 300, 600), sub.Conf("_width")||(can.ConfWidth()-2*padding), true) })
}, 100) },
}, [""])
@ -68,6 +72,7 @@ Volcanos(chat.ONACTION, {
var file = can.base.trimPrefix(link, can.db.current); can.isCmdMode() && can.user.jumps("#"+file)
if (can.onmotion.cache(can, function(cache, key) { cache[key] = can._plugins, can._plugins = cache[file]||[]; return file }, can.ui.main, can.ui.aside)) { return file }
can.onimport.content(can, file)
can.user.toast(can, "加载成功")
return link
},
})

View File

@ -568,12 +568,13 @@ 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() {
kit.If(nfs.Exists(m, path.Join(ice.USR_LOCAL_WORK, m.Option(mdb.NAME), ".git")), func() {
m.PushButton(kit.Dict(m.CommandKey(), "仓库"))
m.PushButton(kit.Dict(m.CommandKey(), "源码"))
})
})
}},
code.INNER: {Hand: func(m *ice.Message, arg ...string) { _repos_inner(m, _repos_path, arg...) }},
}, aaa.RoleAction(REMOTE), web.DreamAction(), mdb.ClearOnExitHashAction(), mdb.HashAction(mdb.SHORT, REPOS, mdb.FIELD, "time,repos,branch,version,comment,origin")), Hand: func(m *ice.Message, arg ...string) {
web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { web.DreamProcess(m, []string{}, arg...) }},
code.INNER: {Hand: func(m *ice.Message, arg ...string) { _repos_inner(m, _repos_path, arg...) }},
}, aaa.RoleAction(REMOTE), mdb.ClearOnExitHashAction(), mdb.HashAction(mdb.SHORT, REPOS, mdb.FIELD, "time,repos,branch,version,comment,origin")), Hand: func(m *ice.Message, arg ...string) {
if len(arg) == 0 {
mdb.HashSelect(m, arg...).Sort(REPOS).Action(CLONE, PULL, PUSH, STATUS)
m.PushAction(STATUS, mdb.REMOVE)

View File

@ -2,6 +2,7 @@ package ice
import (
"net/http"
"path"
"strings"
kit "shylinux.com/x/toolkits"
@ -210,15 +211,21 @@ func (m *Message) EchoDownload(arg ...string) *Message {
return m.Echo(Render(m, RENDER_DOWNLOAD, arg))
}
func (m *Message) Display(file string, arg ...Any) {
if file == "" {
file = strings.TrimPrefix(kit.FileLine(2, 100), Info.Make.Path)
file = strings.TrimPrefix(file, kit.Path("")+PS)
if strings.Contains(file, "/pkg/mod/") {
file = strings.Split(file, "/pkg/mod/")[1]
}
}
if !strings.HasPrefix(file, PS) && !strings.HasPrefix(file, HTTP) {
file = "/require/" + file
}
file = m.resource(file)
m.Option(MSG_DISPLAY, kit.MergeURL(kit.Select(kit.ExtChange(file, JS), file, strings.Contains(file, QS)), arg...))
}
func (m *Message) Resource(file string) string { return m.resource(file) }
func (m *Message) resource(file string) string {
if strings.HasPrefix(file, PS) || strings.HasPrefix(file, HTTP) {
return file
}
p := strings.TrimPrefix(kit.FileLines(3), Info.Make.Path)
p = strings.TrimPrefix(p, kit.Path("")+PS)
if strings.Contains(p, "/pkg/mod/") {
p = strings.Split(p, "/pkg/mod/")[1]
}
if file != "" {
p = path.Join(path.Dir(p), file)
}
return "/require/" + p
}