From 70dfec6da677db1e11d60bb36bad47e26160252a Mon Sep 17 00:00:00 2001 From: shy Date: Sat, 24 Feb 2024 12:32:41 +0800 Subject: [PATCH] add some --- base/nfs/dir.go | 2 +- core/chat/header.go | 5 ++++- core/wiki/word.go | 2 ++ misc/ssh/connect.go | 5 +++++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/base/nfs/dir.go b/base/nfs/dir.go index fd4ae29e..eab24c01 100644 --- a/base/nfs/dir.go +++ b/base/nfs/dir.go @@ -228,7 +228,7 @@ func init() { func Relative(m *ice.Message, p string) string { if _p := kit.ExtChange(p, JS); Exists(m, _p) { return _p - } else if _p := kit.ExtChange(path.Join(ice.USR_VOLCANOS, ice.PLUGIN_LOCAL, path.Join(kit.Slice(kit.Split(p, PS), -2)...)), JS); Exists(m, _p) { + } else if _p := kit.ExtChange(path.Join(ice.USR_VOLCANOS, ice.PLUGIN_LOCAL, path.Join(kit.Slice(kit.Split(p, PS), -2)...)), JS); Exists(m, kit.Split(_p, "?")[0]) { return _p } else { return p diff --git a/core/chat/header.go b/core/chat/header.go index ff1e9438..598cd1e2 100644 --- a/core/chat/header.go +++ b/core/chat/header.go @@ -124,7 +124,10 @@ func init() { if ice.Info.NodeType == web.WORKER { return } - kit.If(m.Option(ice.MSG_USERPOD), func(p string) { m.Option(ice.MSG_NODETYPE, m.Cmdx(web.SPACE, p, cli.RUNTIME, ice.MSG_NODETYPE)) }) + m.Option(ice.MSG_NODETYPE, ice.Info.NodeType) + kit.If(m.Option(ice.MSG_USERPOD), func(p string) { + m.Option(ice.MSG_NODETYPE, m.Cmdx(web.SPACE, p, cli.RUNTIME, ice.MSG_NODETYPE)) + }) m.Option(aaa.LANGUAGE, strings.ReplaceAll(strings.ToLower(kit.Select("", kit.Split(kit.GetValid( func() string { return kit.Select("", "zh-cn", strings.Contains(m.Option(ice.MSG_USERUA), "zh_CN")) }, func() string { return kit.Select("", kit.Split(m.R.Header.Get(html.AcceptLanguage), ",;"), 0) }, diff --git a/core/wiki/word.go b/core/wiki/word.go index db2886e2..500b191c 100644 --- a/core/wiki/word.go +++ b/core/wiki/word.go @@ -82,6 +82,8 @@ func init() { defer web.ToastProcess(m)() defer m.StatusTime(web.SPACE, m.Option(web.SPACE, ls[0])) } + m.Info("what %v", arg) + m.Info("what %v", arg) if len(arg) == 0 { m.Option(nfs.DIR_DEEP, ice.TRUE) arg = append(arg, nfs.SRC) diff --git a/misc/ssh/connect.go b/misc/ssh/connect.go index fc8d9a79..6e3c19ea 100644 --- a/misc/ssh/connect.go +++ b/misc/ssh/connect.go @@ -298,3 +298,8 @@ func PushShell(m *ice.Message, cmds []string, cb func(string)) { } }) } +func RunConnect(arg ...string) string { + defer func() { recover() }() + kit.If(len(arg) == 0, func() { arg = append(arg, os.Args...) }) + return ice.Run(kit.Simple("ssh.connect", "open", "authfile", kit.HomePath(".ssh/", path.Base(arg[0])+".json"), arg[1:])...) +}