From 1f0f42db7d18b4de7561187672cc5c5dda03effb Mon Sep 17 00:00:00 2001 From: shy Date: Sun, 13 Aug 2023 09:59:32 +0800 Subject: [PATCH] add some --- base/tcp/port.go | 11 +++++++++++ base/web/serve.go | 3 +++ core/chat/iframe.go | 2 +- core/chat/macos/desktop.js | 4 ++-- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/base/tcp/port.go b/base/tcp/port.go index 9e9e3e57..d2513d9b 100644 --- a/base/tcp/port.go +++ b/base/tcp/port.go @@ -49,6 +49,17 @@ func init() { m.Assert(m.Option(PORT) != "") nfs.Trash(m, path.Join(ice.USR_LOCAL_DAEMON, m.Option(PORT))) }}, + mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) { + switch arg[0] { + case "server": + m.Cmd(PORT, "socket", func(value ice.Maps) { + switch value["status"] { + case "LISTEN": + m.Push(arg[0], strings.Replace(value["local"], "0.0.0.0", "127.0.0.1", 1)) + } + }) + } + }}, "socket": {Hand: func(m *ice.Message, arg ...string) { parse := func(str string) int64 { port, _ := strconv.ParseInt(str, 16, 32) diff --git a/base/web/serve.go b/base/web/serve.go index f75d91f2..05ebfef6 100644 --- a/base/web/serve.go +++ b/base/web/serve.go @@ -104,6 +104,9 @@ func _serve_handle(key string, cmd *ice.Command, m *ice.Message, w http.Response m.OptionDefault(ice.MSG_HEIGHT, "480", ice.MSG_WIDTH, "320") m.Options(ice.MSG_USERWEB, _serve_domain(m), ice.MSG_USERPOD, m.Option(ice.POD)) m.Options(ice.MSG_USERUA, r.Header.Get(UserAgent), ice.MSG_USERIP, r.Header.Get(ice.MSG_USERIP)) + m.Debug("what %v", m.Option(ice.MSG_USERWEB)) + m.Debug("what %v", CookieName(m.Option(ice.MSG_USERWEB))) + m.Options(ice.MSG_SESSID, kit.Select(m.Option(ice.MSG_SESSID), m.Option(CookieName(m.Option(ice.MSG_USERWEB))))) kit.If(m.Optionv(ice.MSG_CMDS) == nil, func() { kit.If(strings.TrimPrefix(r.URL.Path, key), func(p string) { m.Optionv(ice.MSG_CMDS, strings.Split(p, nfs.PS)) }) diff --git a/core/chat/iframe.go b/core/chat/iframe.go index 5a5c5041..0f382c1d 100644 --- a/core/chat/iframe.go +++ b/core/chat/iframe.go @@ -13,7 +13,7 @@ const IFRAME = "iframe" func init() { Index.MergeCommands(ice.Commands{ - IFRAME: {Name: "iframe hash auto safari", Help: "浏览器", Actions: ice.MergeActions(ice.Actions{ + IFRAME: {Name: "iframe hash@key auto safari", Help: "浏览器", Actions: ice.MergeActions(ice.Actions{ ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { if m.Cmd("").Length() == 0 { m.Cmd(web.SPIDE, ice.OptionFields(web.CLIENT_NAME, web.CLIENT_ORIGIN), func(value ice.Maps) { diff --git a/core/chat/macos/desktop.js b/core/chat/macos/desktop.js index 03ae1dfa..1380a576 100644 --- a/core/chat/macos/desktop.js +++ b/core/chat/macos/desktop.js @@ -1,5 +1,5 @@ Volcanos(chat.ONIMPORT, { - _init: function(can, msg, cb) { if (can.isCmdMode()) { can.onappend.style(can, html.OUTPUT), can.ConfHeight(can.page.height()) } + _init: function(can, msg, cb) { if (can.isCmdMode()) { can.onappend.style(can, html.OUTPUT), can.ConfHeight(can.page.height()||912), can.ConfWidth(can.page.width()||1690) } (!can.page.ClassList.has(can, document.body, cli.BLACK) || can.isCmdMode()) && can.onlayout.background(can, can.user.info.background||"/require/usr/icons/background.jpg", can._fields) can.ui = {}, can.base.isFunc(cb) && cb(msg), can.onmotion.clear(can) can.onimport._menu(can), can.onimport._dock(can), can.onimport._searchs(can), can.onimport._notifications(can), can.onimport.layout(can) @@ -88,7 +88,7 @@ Volcanos(chat.ONIMPORT, { }, layout: function(can) { can.page.style(can, can._output, html.HEIGHT, can.ConfHeight(), html.WIDTH, can.ConfWidth()) - can.ui.dock && can.page.style(can, can.ui.dock._target, html.LEFT, can.base.Min((can.ConfWidth()-can.ui.dock._target.offsetWidth)/2, 0)) + can.ui.dock && can.page.style(can, can.ui.dock._target, html.LEFT, can.base.Min((can.ConfWidth()-(can.ui.dock._target.offsetWidth||502))/2, 0)) }, }, [""]) Volcanos(chat.ONACTION, {list: ["full"],