forked from x/icebergs
add some
This commit is contained in:
parent
8811c44c6a
commit
03b074c909
@ -147,15 +147,12 @@ func init() {
|
||||
})
|
||||
}
|
||||
func Opens(m *ice.Message, arg ...string) {
|
||||
m.Debug("what %v", arg)
|
||||
if !tcp.IsLocalHost(m, m.Option(ice.MSG_USERIP)) {
|
||||
return
|
||||
}
|
||||
m.Debug("what %v", arg)
|
||||
if len(arg) == 0 || arg[0] == "" {
|
||||
return
|
||||
}
|
||||
m.Debug("what %v", arg)
|
||||
switch runtime.GOOS {
|
||||
case DARWIN:
|
||||
if kit.Ext(arg[0]) == "app" {
|
||||
|
@ -90,13 +90,9 @@ func _system_exec(m *ice.Message, cmd *exec.Cmd) {
|
||||
cmd.Stdout, cmd.Stderr = out, err
|
||||
defer func() {
|
||||
m.Push(CMD_OUT, out.String()).Push(CMD_ERR, err.String())
|
||||
// m.Echo(strings.TrimRight(out.String(), lex.NL))
|
||||
m.Echo(out.String())
|
||||
m.Echo(err.String())
|
||||
if m.IsErr() {
|
||||
if m.Echo(out.String()).Echo(err.String()); m.IsErr() {
|
||||
m.Option(ice.MSG_ARGS, kit.Simple(http.StatusBadRequest, cmd.Args, err.String()))
|
||||
m.Echo(strings.TrimRight(err.String(), lex.NL))
|
||||
m.Debug("%s %s", err, out)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
@ -53,6 +53,7 @@ func init() {
|
||||
if runtime.GOOS == "windows" {
|
||||
return
|
||||
}
|
||||
_signal_listen(m, 1, mdb.NAME, "挂起", ice.CMD, "runtime")
|
||||
_signal_listen(m, 2, mdb.NAME, "重启", ice.CMD, "exit 1")
|
||||
_signal_listen(m, 3, mdb.NAME, "退出", ice.CMD, "exit 0")
|
||||
}},
|
||||
|
@ -10,7 +10,7 @@ func init() {
|
||||
"admin": {Name: "admin", Help: "管理", Hand: func(m *ice.Message, arg ...string) {
|
||||
args := []string{}
|
||||
kit.For(arg[1:], func(v string) { args = append(args, ice.ARG, v) })
|
||||
m.Cmdy(SPIDE, ice.OPS, SPIDE_RAW, "/chat/cmd/"+arg[0], args)
|
||||
m.Cmdy(SPIDE, ice.OPS, SPIDE_RAW, "/chat/cmd/"+arg[0]+"?debug=true", SPIDE_FORM, args)
|
||||
}},
|
||||
})
|
||||
}
|
||||
|
@ -75,7 +75,9 @@ func _serve_main(m *ice.Message, w http.ResponseWriter, r *http.Request) bool {
|
||||
}
|
||||
func _serve_handle(key string, cmd *ice.Command, m *ice.Message, w http.ResponseWriter, r *http.Request) {
|
||||
debug := strings.Contains(r.URL.String(), "debug=true") || strings.Contains(r.Header.Get(Referer), "debug=true")
|
||||
debug = true
|
||||
_log := func(level string, arg ...ice.Any) *ice.Message {
|
||||
return m.Logs(strings.Title(level), arg...)
|
||||
if debug || arg[0] == "cmds" {
|
||||
return m.Logs(strings.Title(level), arg...)
|
||||
}
|
||||
|
@ -64,14 +64,12 @@ func _binpack_all(m *ice.Message) {
|
||||
}
|
||||
list, cache := map[string]string{}, GoCache(m)
|
||||
for k := range ice.Info.File {
|
||||
m.Debug("what %v", k)
|
||||
switch ls := kit.Split(k, nfs.PS); ls[1] {
|
||||
case ice.SRC:
|
||||
case ice.USR:
|
||||
list[path.Join(kit.Slice(ls, 1, -1)...)] = ""
|
||||
default:
|
||||
p := path.Join(cache, path.Join(kit.Slice(ls, 1, -1)...))
|
||||
m.Debug("what %v %v", ls, p)
|
||||
list[path.Join(nfs.USR, strings.Split(ls[3], mdb.AT)[0], path.Join(kit.Slice(ls, 4)...))] = p
|
||||
}
|
||||
}
|
||||
|
2
logs.go
2
logs.go
@ -151,10 +151,8 @@ func (m *Message) IsErrNotFound() bool {
|
||||
return m.IsErr(ErrNotFound)
|
||||
}
|
||||
func (m *Message) Debug(str string, arg ...Any) {
|
||||
// if m.Option("debug") == TRUE || !Info.Important {
|
||||
kit.Format(str == "", func() { str = m.FormatMeta() })
|
||||
m.log(LOG_DEBUG, str, arg...)
|
||||
// }
|
||||
}
|
||||
|
||||
func (m *Message) FormatPrefix() string {
|
||||
|
@ -37,6 +37,7 @@ func init() {
|
||||
SET: {Hand: func(m *ice.Message, arg ...string) {
|
||||
host, list := ice.Map{kit.ParseURL(m.Option(TOKEN)).Host: true}, []string{m.Option(TOKEN)}
|
||||
m.Cmd(nfs.CAT, kit.HomePath(FILE), func(line string) {
|
||||
line = strings.ReplaceAll(line, "%3a", ":")
|
||||
kit.IfNoKey(host, kit.ParseURL(line).Host, func(p string) { list = append(list, line) })
|
||||
}).Cmd(nfs.SAVE, kit.HomePath(FILE), strings.Join(list, lex.NL)+lex.NL)
|
||||
m.ProcessClose()
|
||||
|
Loading…
x
Reference in New Issue
Block a user