diff --git a/base/web/web.go b/base/web/web.go index 627509e3..f4585cc6 100644 --- a/base/web/web.go +++ b/base/web/web.go @@ -159,7 +159,7 @@ func (web *Frame) HandleWSS(m *ice.Message, safe bool, c *websocket.Conn, name s socket, msg := c, m.Spawns(b) target := kit.Simple(msg.Optionv(ice.MSG_TARGET)) source := kit.Simple(msg.Optionv(ice.MSG_SOURCE), name) - msg.Info("recv %v<-%v %v", target, source, msg.Format("meta")) + msg.Info("recv %v<-%v %s %v", target, source, msg.Detailv(), msg.Format("meta")) if len(target) == 0 { msg.Option(ice.MSG_USERROLE, msg.Cmdx(ice.AAA_ROLE, "check", msg.Option(ice.MSG_USERNAME))) @@ -204,6 +204,7 @@ func (web *Frame) HandleWSS(m *ice.Message, safe bool, c *websocket.Conn, name s msg.Optionv(ice.MSG_SOURCE, source) msg.Optionv(ice.MSG_TARGET, target) socket.WriteMessage(t, []byte(msg.Format("meta"))) + target = append([]string{name}, target...) msg.Info("send %v %v->%v %v", t, source, target, msg.Format("meta")) msg.Cost("%v->%v %v %v", source, target, msg.Detailv(), msg.Format("append")) } diff --git a/core/wiki/inner.go b/core/wiki/inner.go index 49c687d9..1ab664c6 100644 --- a/core/wiki/inner.go +++ b/core/wiki/inner.go @@ -14,8 +14,18 @@ const INNER = "inner" const QRCODE = "qrcode" const VEDIO = "vedio" +func _inner_ext(name string) string { + return kit.Select(path.Base(name), strings.TrimPrefix(path.Ext(name), ".")) +} +func _inner_binary(m *ice.Message, name string) bool { + p := _inner_ext(name) + if m.Conf(INNER, kit.Keys("meta.binary", p)) == "true" { + return true + } + return false +} func _inner_protect(m *ice.Message, name string) bool { - if ls := strings.Split(name, "/"); m.Conf(INNER, kit.Keys("meta.protect", ls[0])) == "true" { + if ls := strings.Split(name, "/"); !m.Right(ls) && m.Conf(INNER, kit.Keys("meta.protect", ls[0])) == "true" { return true } return false @@ -27,12 +37,13 @@ func _inner_list(m *ice.Message, name string) { return } - p := strings.TrimPrefix(path.Ext(name), ".") + p := _inner_ext(name) + m.Logs("info", "type", p) if m.Cmdy(kit.Keys(p, "list"), name); len(m.Resultv()) > 0 { return } - if strings.HasSuffix(name, "/") || m.Conf(INNER, kit.Keys("meta.source", p)) == "true" { + if strings.HasSuffix(name, "/") || !_inner_binary(m, name) { m.Cmdy("nfs.dir", name, "file size time") } else { m.Echo(name) @@ -56,7 +67,7 @@ func _inner_save(m *ice.Message, name, text string) { } } func _inner_plug(m *ice.Message, name string) { - p := strings.TrimPrefix(path.Ext(name), ".") + p := _inner_ext(name) if msg := m.Cmd(kit.Keys(p, "plug"), name); m != msg && msg.Hand { m.Copy(msg) return @@ -75,7 +86,7 @@ func _inner_show(m *ice.Message, name string) { return } - p := strings.TrimPrefix(path.Ext(name), ".") + p := _inner_ext(name) if msg := m.Cmd(kit.Keys(p, "show"), name); m != msg && msg.Hand { m.Copy(msg) return @@ -102,10 +113,7 @@ func init() { Configs: map[string]*ice.Config{ INNER: {Name: "inner", Help: "编辑器", Value: kit.Data( "protect", kit.Dict("etc", "true", "var", "true", "usr", "true"), - "source", kit.Dict( - "sh", "true", "shy", "true", "py", "true", - "js", "true", "go", "true", "c", "true", - ), + "binary", kit.Dict("bin", "true", "gz", "true"), "plug", kit.Dict( "py", kit.Dict("display", true, "profile", true), "md", kit.Dict("display", true, "profile", true), diff --git a/info.go b/info.go index 95c725f2..1d9845ee 100644 --- a/info.go +++ b/info.go @@ -26,14 +26,14 @@ func (m *Message) log(level string, str string, arg ...interface{}) *Message { case LOG_CMDS, LOG_START, LOG_SERVE: prefix, suffix = "\033[32m", "\033[0m" - case LOG_COST: + case LOG_AUTH, LOG_COST: prefix, suffix = "\033[33m", "\033[0m" case LOG_WARN, LOG_ERROR, LOG_CLOSE: prefix, suffix = "\033[31m", "\033[0m" } switch level { - case LOG_CMDS, LOG_INFO, LOG_WARN, LOG_COST: + case LOG_CMDS, LOG_INFO, LOG_WARN, LOG_AUTH, LOG_COST: default: _, file, line, _ := runtime.Caller(2) ls := strings.Split(file, "/") diff --git a/type.go b/type.go index 1a7aac52..53f04d84 100644 --- a/type.go +++ b/type.go @@ -687,7 +687,7 @@ func (m *Message) Cmd(arg ...interface{}) *Message { }) if m.Warn(m.Hand == false, "not found %v", list) { - // return m.Set(MSG_RESULT).Cmd(CLI_SYSTEM, list) + return m.Set(MSG_RESULT).Cmd(CLI_SYSTEM, list) } return m }