1
0
forked from x/icebergs
This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-02-23 22:43:20 +08:00
parent 880631418c
commit 8c8238ceb9
10 changed files with 29 additions and 19 deletions

View File

@ -37,7 +37,7 @@ func _qrcode_web(m *ice.Message, text string) string {
sc.ForegroundColor = ParseColor(m.Option(FG))
sc.BackgroundColor = ParseColor(m.Option(BG))
if data, err := sc.PNG(kit.Int(m.Option(SIZE))); m.Assert(err) {
m.Echo(`<img src="data:image/png;base64,%s" title='%s'>`, base64.StdEncoding.EncodeToString(data), text)
m.Echo(`<img class="qrcode" src="data:image/png;base64,%s" title='%s'>`, base64.StdEncoding.EncodeToString(data), text)
}
return text
}

View File

@ -117,7 +117,8 @@ func _dream_start(m *ice.Message, name string) {
return
}
if !m.IsCliUA() {
defer m.ProcessOpen(m.MergePod(name))
// defer m.ProcessOpen(m.MergePod(name))
defer m.ProcessOpenAndRefresh(m.MergePod(name))
defer ToastProcess(m, mdb.CREATE, name)()
}
defer mdb.Lock(m, m.PrefixKey(), cli.START, name)()
@ -334,7 +335,7 @@ func init() {
DreamEach(m, m.Option(mdb.NAME), "", func(name string) {
m.Cmd(SPACE, name, AUTOGEN, BINPACK)
kit.For(list, func(goos string) {
PushNoticeRich(m, mdb.NAME, name, msg.Cmd(SPACE, name, COMPILE, goos, cli.AMD64, kit.Dict(ice.MSG_USERPOD, name)).AppendSimple())
PushNoticeRich(m.Options(ice.MSG_COUNT, "0", ice.LOG_DISABLE, ice.TRUE), mdb.NAME, name, msg.Cmd(SPACE, name, COMPILE, goos, cli.AMD64, kit.Dict(ice.MSG_USERPOD, name)).AppendSimple())
})
}).ProcessHold()
}},

View File

@ -73,7 +73,7 @@ func PushNotice(m *ice.Message, arg ...ice.Any) {
return
}
opts := ice.Map{ice.MSG_OPTION: []string{}, ice.MSG_OPTS: []string{}}
kit.For([]string{ctx.DISPLAY, ctx.STYLE, cli.DELAY, ice.MSG_TITLE, ice.MSG_STATUS, ice.LOG_DEBUG, ice.LOG_TRACEID}, func(key string) {
kit.For([]string{ctx.DISPLAY, ctx.STYLE, cli.DELAY, ice.MSG_TITLE, ice.MSG_STATUS, ice.LOG_DEBUG, ice.LOG_TRACEID, ice.LOG_DISABLE}, func(key string) {
opts[ice.MSG_OPTION], opts[key] = kit.Simple(opts[ice.MSG_OPTION], key), m.Option(key)
})
m.Cmd(SPACE, m.Option(ice.MSG_DAEMON), arg, opts)

View File

@ -32,7 +32,7 @@ func _serve_start(m *ice.Message) {
cli.NodeInfo(m, kit.Select(kit.Split(ice.Info.Hostname, nfs.PT)[0], m.Option(tcp.NODENAME)), SERVER)
m.Go(func() {
m.Cmd(SPIDE, ice.OPS, _serve_address(m)+"/exit", ice.Maps{CLIENT_TIMEOUT: cli.TIME_30ms, ice.LOG_DISABLE: ice.TRUE})
}).Sleep300ms()
}).Sleep(cli.TIME_1s)
m.Start("", m.OptionSimple(tcp.HOST, tcp.PORT)...)
m.Cmd(nfs.SAVE, ice.VAR_LOG_ICE_PORT, m.Option(tcp.PORT))
if m.Cmd(tcp.HOST).Length() == 0 {

View File

@ -205,10 +205,10 @@ func _space_send(m *ice.Message, name string, arg ...string) (h string) {
if target := kit.Split(name, nfs.PT, nfs.PT); !mdb.HashSelectDetail(m, target[0], func(value ice.Map) {
if c, ok := value[mdb.TARGET].(*websocket.Conn); !m.WarnNotValid(!ok, mdb.TARGET) {
kit.If(kit.Format(value[mdb.TYPE]) == MASTER, func() {
m.Options(ice.MSG_USERWEB, value[mdb.TEXT],
ice.MSG_USERPOD, "",
ice.MSG_USERPOD0, name,
ice.MSG_USERHOST, "")
m.Options(
ice.MSG_USERWEB0, m.Option(ice.MSG_USERWEB), ice.MSG_USERPOD0, name,
ice.MSG_USERWEB, value[mdb.TEXT], ice.MSG_USERPOD, "", ice.MSG_USERHOST, "",
)
})
kit.For([]string{ice.MSG_USERROLE, ice.LOG_TRACEID}, func(k string) { m.Optionv(k, m.Optionv(k)) })
kit.For(m.Optionv(ice.MSG_OPTS), func(k string) { m.Optionv(k, m.Optionv(k)) })

View File

@ -62,7 +62,7 @@ func ToastSuccess(m *ice.Message, arg ...ice.Any) {
Toast(m, toastContent(m, ice.SUCCESS, arg...), "", cli.TIME_3s)
}
func ToastFailure(m *ice.Message, arg ...ice.Any) {
Toast(m, toastContent(m, ice.FAILURE, arg...), "", m.OptionDefault(ice.TOAST_DURATION, cli.TIME_3s)).Sleep(m.OptionDefault(ice.TOAST_DURATION, cli.TIME_3s))
Toast(m, toastContent(m, ice.FAILURE, arg...), "", m.OptionDefault(ice.TOAST_DURATION, "-1")).Sleep(m.OptionDefault(ice.TOAST_DURATION, cli.TIME_3s))
}
func ToastProcess(m *ice.Message, arg ...ice.Any) func(...ice.Any) {
text := toastContent(m, ice.PROCESS, arg...)

View File

@ -211,6 +211,7 @@ const ( // MSG
MSG_USERWEB = "user.web"
MSG_USERPOD = "user.pod"
MSG_USERPOD0 = "user.pod0"
MSG_USERWEB0 = "user.web0"
MSG_USERHOST = "user.host"
MSG_USERADDR = "user.addr"
MSG_USERDATA = "user.data"

View File

@ -42,6 +42,7 @@ fieldset.macos.desktop>div.output>div.desktop>fieldset>form.option>div.icon { ma
fieldset.macos.desktop>div.output>div.desktop>fieldset>form.option>div.list.icons { margin:var(--button-margin) 0; }
fieldset.macos.desktop>div.output>div.desktop>fieldset>form.option>div.back.icons { margin:var(--button-margin) 0; }
fieldset.macos.desktop>div.output>div.desktop>fieldset>div.action>div.item:last-child { margin-right:100px; }
body:not(.mobile) fieldset.macos.desktop>div.output>div.desktop>fieldset>div.action:not(.hide) { display:contents; }
fieldset.macos.desktop>div.output>div.desktop>fieldset>div.action>* { margin:var(--button-margin) var(--input-margin); }
fieldset.macos.desktop>div.output>div.desktop>fieldset>div.action>div.tabs { display:none; }
fieldset.macos.desktop>div.output>div.desktop>fieldset>div.output { min-height:240px; }
@ -75,6 +76,7 @@ fieldset.macos.dock>div.output>div.item img { object-fit:contain; min-height:var
fieldset.macos.dock>div.output>div.item>div.name { display:none; }
fieldset.macos.finder>div.output div.content>div.item { text-align:center; float:left; }
fieldset.macos.finder>div.output div.content>div.item img { object-fit:contain; width:var(--desktop-icon-size); }
fieldset.macos.finder>div.output div.content>div.item img { object-fit:contain; width:var(--desktop-icon-size); height:var(--desktop-icon-size); }
fieldset.macos.finder>div.output div.content>div.item div.name { font-size:var(--code-font-size); text-align:center; }
body.dark fieldset.macos.desktop>div.output>fieldset.macos { background-color:#08234ad1; }
body.dark fieldset.macos.desktop>div.output>div.desktop fieldset table.content tbody tr:nth-child(odd):not(:hover) { background-color:#282B2F; }

View File

@ -1,5 +1,6 @@
Volcanos(chat.ONIMPORT, {
_init: function(can, msg) { can.isCmdMode() && (can.user.toast = function() {})
_init: function(can, msg) {
// can.isCmdMode() && (can.user.toast = function() {})
var p = "/cmd/"+web.PORTAL; can.db.prefix = location.pathname.indexOf(p) > -1? location.pathname.split(p)[0]+p: nfs.WIKI_PORTAL
var p = "/c/"+web.PORTAL; can.db.prefix = location.pathname.indexOf(p) > -1? location.pathname.split(p)[0]+p: nfs.WIKI_PORTAL
can.db.current = can.isCmdMode()? can.base.trimPrefix(location.pathname, can.db.prefix+nfs.PS, can.db.prefix): can.Option(nfs.PATH)

25
info.go
View File

@ -283,9 +283,10 @@ func Module(prefix string, arg ...Any) {
}
}
func (m *Message) FileURI(dir string) string {
if dir == "" {
return ""
} else if strings.Contains(dir, "/pkg/mod/") {
if dir == "" || kit.HasPrefix(dir, HTTP) {
return dir
}
if strings.Contains(dir, "/pkg/mod/") {
dir = strings.Split(dir, "/pkg/mod/")[1]
} else if Info.Make.Path != "" && strings.HasPrefix(dir, Info.Make.Path) {
dir = strings.TrimPrefix(dir, Info.Make.Path)
@ -293,12 +294,16 @@ func (m *Message) FileURI(dir string) string {
dir = strings.TrimPrefix(dir, kit.Path("")+PS)
} else if strings.HasPrefix(dir, ISH_PLUGED) {
dir = strings.TrimPrefix(dir, ISH_PLUGED)
} else if kit.HasPrefix(dir, PS, HTTP) {
}
if strings.HasPrefix(dir, PS) {
} else if strings.HasPrefix(dir, USR_VOLCANOS) {
dir = strings.TrimPrefix(dir, USR)
} else {
dir = kit.MergeURL(path.Join(PS, REQUIRE, dir), POD, m.Option(MSG_USERPOD))
}
if m.Option(MSG_USERWEB0) != "" {
dir = kit.MergeURL2(m.Option(MSG_USERWEB), dir)
}
return dir
}
if strings.HasPrefix(dir, USR_VOLCANOS) {
return strings.TrimPrefix(dir, USR)
} else {
return kit.MergeURL(path.Join(PS, REQUIRE, dir), POD, m.Option(MSG_USERPOD))
}
}