mirror of
https://shylinux.com/x/icebergs
synced 2025-04-28 10:12:02 +08:00
opt some
This commit is contained in:
parent
21e4ce710f
commit
7401127852
@ -159,7 +159,7 @@ func (web *Frame) HandleWSS(m *ice.Message, safe bool, c *websocket.Conn, name s
|
|||||||
socket, msg := c, m.Spawns(b)
|
socket, msg := c, m.Spawns(b)
|
||||||
target := kit.Simple(msg.Optionv(ice.MSG_TARGET))
|
target := kit.Simple(msg.Optionv(ice.MSG_TARGET))
|
||||||
source := kit.Simple(msg.Optionv(ice.MSG_SOURCE), name)
|
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 {
|
if len(target) == 0 {
|
||||||
msg.Option(ice.MSG_USERROLE, msg.Cmdx(ice.AAA_ROLE, "check", msg.Option(ice.MSG_USERNAME)))
|
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_SOURCE, source)
|
||||||
msg.Optionv(ice.MSG_TARGET, target)
|
msg.Optionv(ice.MSG_TARGET, target)
|
||||||
socket.WriteMessage(t, []byte(msg.Format("meta")))
|
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.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"))
|
msg.Cost("%v->%v %v %v", source, target, msg.Detailv(), msg.Format("append"))
|
||||||
}
|
}
|
||||||
|
@ -14,8 +14,18 @@ const INNER = "inner"
|
|||||||
const QRCODE = "qrcode"
|
const QRCODE = "qrcode"
|
||||||
const VEDIO = "vedio"
|
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 {
|
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 true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
@ -27,12 +37,13 @@ func _inner_list(m *ice.Message, name string) {
|
|||||||
return
|
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 {
|
if m.Cmdy(kit.Keys(p, "list"), name); len(m.Resultv()) > 0 {
|
||||||
return
|
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")
|
m.Cmdy("nfs.dir", name, "file size time")
|
||||||
} else {
|
} else {
|
||||||
m.Echo(name)
|
m.Echo(name)
|
||||||
@ -56,7 +67,7 @@ func _inner_save(m *ice.Message, name, text string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
func _inner_plug(m *ice.Message, name 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 {
|
if msg := m.Cmd(kit.Keys(p, "plug"), name); m != msg && msg.Hand {
|
||||||
m.Copy(msg)
|
m.Copy(msg)
|
||||||
return
|
return
|
||||||
@ -75,7 +86,7 @@ func _inner_show(m *ice.Message, name string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
p := strings.TrimPrefix(path.Ext(name), ".")
|
p := _inner_ext(name)
|
||||||
if msg := m.Cmd(kit.Keys(p, "show"), name); m != msg && msg.Hand {
|
if msg := m.Cmd(kit.Keys(p, "show"), name); m != msg && msg.Hand {
|
||||||
m.Copy(msg)
|
m.Copy(msg)
|
||||||
return
|
return
|
||||||
@ -102,10 +113,7 @@ func init() {
|
|||||||
Configs: map[string]*ice.Config{
|
Configs: map[string]*ice.Config{
|
||||||
INNER: {Name: "inner", Help: "编辑器", Value: kit.Data(
|
INNER: {Name: "inner", Help: "编辑器", Value: kit.Data(
|
||||||
"protect", kit.Dict("etc", "true", "var", "true", "usr", "true"),
|
"protect", kit.Dict("etc", "true", "var", "true", "usr", "true"),
|
||||||
"source", kit.Dict(
|
"binary", kit.Dict("bin", "true", "gz", "true"),
|
||||||
"sh", "true", "shy", "true", "py", "true",
|
|
||||||
"js", "true", "go", "true", "c", "true",
|
|
||||||
),
|
|
||||||
"plug", kit.Dict(
|
"plug", kit.Dict(
|
||||||
"py", kit.Dict("display", true, "profile", true),
|
"py", kit.Dict("display", true, "profile", true),
|
||||||
"md", kit.Dict("display", true, "profile", true),
|
"md", kit.Dict("display", true, "profile", true),
|
||||||
|
4
info.go
4
info.go
@ -26,14 +26,14 @@ func (m *Message) log(level string, str string, arg ...interface{}) *Message {
|
|||||||
|
|
||||||
case LOG_CMDS, LOG_START, LOG_SERVE:
|
case LOG_CMDS, LOG_START, LOG_SERVE:
|
||||||
prefix, suffix = "\033[32m", "\033[0m"
|
prefix, suffix = "\033[32m", "\033[0m"
|
||||||
case LOG_COST:
|
case LOG_AUTH, LOG_COST:
|
||||||
prefix, suffix = "\033[33m", "\033[0m"
|
prefix, suffix = "\033[33m", "\033[0m"
|
||||||
case LOG_WARN, LOG_ERROR, LOG_CLOSE:
|
case LOG_WARN, LOG_ERROR, LOG_CLOSE:
|
||||||
prefix, suffix = "\033[31m", "\033[0m"
|
prefix, suffix = "\033[31m", "\033[0m"
|
||||||
}
|
}
|
||||||
|
|
||||||
switch level {
|
switch level {
|
||||||
case LOG_CMDS, LOG_INFO, LOG_WARN, LOG_COST:
|
case LOG_CMDS, LOG_INFO, LOG_WARN, LOG_AUTH, LOG_COST:
|
||||||
default:
|
default:
|
||||||
_, file, line, _ := runtime.Caller(2)
|
_, file, line, _ := runtime.Caller(2)
|
||||||
ls := strings.Split(file, "/")
|
ls := strings.Split(file, "/")
|
||||||
|
2
type.go
2
type.go
@ -687,7 +687,7 @@ func (m *Message) Cmd(arg ...interface{}) *Message {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if m.Warn(m.Hand == false, "not found %v", list) {
|
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
|
return m
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user