mirror of
https://shylinux.com/x/icebergs
synced 2025-04-25 17:18:05 +08:00
opt chat
This commit is contained in:
parent
b8a3304d8b
commit
4e9b49a970
@ -120,14 +120,15 @@ func Run(m *ice.Message, arg ...string) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if Upload(m); !PodCmd(m, arg) && aaa.Right(m, arg) {
|
||||
if !PodCmd(m, arg) && aaa.Right(m, arg) {
|
||||
m.Cmdy(arg)
|
||||
}
|
||||
}
|
||||
|
||||
var Upload = func(*ice.Message) {}
|
||||
var Upload = func(*ice.Message) []string { return nil }
|
||||
|
||||
func PodCmd(m *ice.Message, arg ...ice.Any) bool {
|
||||
Upload(m)
|
||||
if pod := m.Option(ice.POD); pod != "" {
|
||||
m.Option(ice.POD, "")
|
||||
m.Cmdy(append(kit.List(ice.SPACE, pod), arg...)...)
|
||||
|
@ -155,7 +155,7 @@ func init() {
|
||||
}
|
||||
watch := action.Hand == nil
|
||||
action.Hand = ice.MergeHand(func(m *ice.Message, arg ...string) {
|
||||
up := kit.Simple(m.Optionv(ice.MSG_UPLOAD))
|
||||
up := Upload(m)
|
||||
m.Assert(len(up) > 1)
|
||||
m.Cmd(CACHE, m.Option(ice.MSG_UPLOAD)).Tables(func(value ice.Maps) { m.Options(value) })
|
||||
if m.Options(mdb.HASH, up[0], mdb.NAME, up[1]); watch {
|
||||
@ -167,11 +167,14 @@ func init() {
|
||||
})
|
||||
ctx.Upload = Upload
|
||||
}
|
||||
func Upload(m *ice.Message) {
|
||||
func Upload(m *ice.Message) []string {
|
||||
if up := kit.Simple(m.Optionv(ice.MSG_UPLOAD)); len(up) == 1 {
|
||||
if m.Cmdy(CACHE, UPLOAD).Optionv(ice.MSG_UPLOAD, kit.Simple(m.Append(mdb.HASH), m.Append(mdb.NAME), m.Append(nfs.SIZE))); m.Option(ice.MSG_USERPOD) != "" {
|
||||
m.Cmd(SPACE, m.Option(ice.MSG_USERPOD), SPIDE, ice.DEV, SPIDE_CACHE, http.MethodGet, MergeURL2(m, path.Join(SHARE_CACHE, m.Append(mdb.HASH))))
|
||||
}
|
||||
return kit.Simple(m.Optionv(ice.MSG_UPLOAD))
|
||||
} else {
|
||||
return up
|
||||
}
|
||||
}
|
||||
func PushDisplay(m *ice.Message, mime, name, link string) {
|
||||
|
@ -21,13 +21,13 @@ func _action_exec(m *ice.Message, river, storm, index string, arg ...string) {
|
||||
}).Length() == 0, ice.ErrNotRight, index, arg) {
|
||||
return
|
||||
}
|
||||
if web.Upload(m); !ctx.PodCmd(m, index, arg) {
|
||||
if !ctx.PodCmd(m, index, arg) {
|
||||
m.Cmdy(index, arg)
|
||||
}
|
||||
}
|
||||
func _action_auth(m *ice.Message, share string) *ice.Message {
|
||||
msg := m.Cmd(web.SHARE, share)
|
||||
if m.Warn(msg.Append(mdb.TIME) < m.Time(), ice.ErrNotValid, share, msg.Append(mdb.TIME), m.Time()) {
|
||||
if web.IsNotValidShare(m, msg.Append(mdb.TIME)) {
|
||||
msg.Append(mdb.TYPE, "")
|
||||
return msg
|
||||
}
|
||||
@ -58,7 +58,6 @@ func _action_share(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(ctx.COMMAND, msg.Append(mdb.NAME))
|
||||
break
|
||||
}
|
||||
web.Upload(m)
|
||||
m.Cmdy(msg.Append(mdb.NAME), arg[2:])
|
||||
}
|
||||
}
|
||||
|
@ -28,8 +28,8 @@ func _cmd_file(m *ice.Message, arg ...string) bool {
|
||||
web.RenderCmd(m, kit.Select(ctx.CAN_PLUGIN, ctx.GetFileCmd(p)))
|
||||
default:
|
||||
if p = strings.TrimPrefix(p, ice.SRC+ice.PS); nfs.ExistsFile(m, path.Join(ice.SRC, p)) {
|
||||
if msg := m.Cmd(mdb.RENDER, kit.Ext(p)); msg.Length() > 0 {
|
||||
m.Cmdy(mdb.RENDER, kit.Ext(p), p, ice.SRC+ice.PS).RenderResult()
|
||||
if msg := m.Cmd(mdb.ENGINE, kit.Ext(p)); msg.Length() > 0 {
|
||||
m.Cmdy(mdb.ENGINE, kit.Ext(p), p, ice.SRC+ice.PS).RenderResult()
|
||||
break
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +0,0 @@
|
||||
package chat
|
||||
|
||||
import (
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/ctx"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
)
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
"demo-hash": {Actions: ice.MergeActions(mdb.HashAction(), ctx.CmdAction())},
|
||||
"demo-status-hash": {Actions: ice.MergeActions(mdb.StatusHashAction(), ctx.CmdAction())},
|
||||
"demo-list": {Actions: ice.MergeActions(mdb.ListAction(), ctx.CmdAction())},
|
||||
"demo-page-list": {Actions: ice.MergeActions(mdb.PageListAction(), ctx.CmdAction())},
|
||||
"demo-zone": {Actions: ice.MergeActions(mdb.ZoneAction(), ctx.CmdAction())},
|
||||
"demo-page-zone": {Actions: ice.MergeActions(mdb.PageZoneAction(), ctx.CmdAction())},
|
||||
})
|
||||
}
|
@ -113,7 +113,7 @@ func init() {
|
||||
<div class="output"></div>
|
||||
<div class="status"></div>
|
||||
</fieldset>`), ctx.CmdAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||
if arg[1] == ctx.ARGS {
|
||||
if kit.Select("", arg, 1) == ctx.ARGS {
|
||||
arg = kit.Simple("", arg)
|
||||
}
|
||||
if arg = _name(m, arg); strings.Contains(arg[1], ice.NL) {
|
||||
|
4
exec.go
4
exec.go
@ -18,8 +18,8 @@ func (m *Message) TryCatch(msg *Message, catch bool, cb ...func(msg *Message)) *
|
||||
default:
|
||||
fileline := m.FormatStack(2, 1)
|
||||
m.Log(LOG_WARN, "catch: %s %s", e, fileline).Log("chain", msg.FormatChain())
|
||||
m.Log(LOG_WARN, "catch: %s %s", e, fileline).Log("stack", m.FormatStack(1, 100))
|
||||
m.Log(LOG_WARN, "catch: %s %s", e, fileline).Result(ErrWarn, e, SP, m.FormatStack(1, 5))
|
||||
m.Log(LOG_WARN, "catch: %s %s", e, fileline).Log("stack", m.FormatStack(2, 100))
|
||||
m.Log(LOG_WARN, "catch: %s %s", e, fileline).Result(ErrWarn, e, SP, m.FormatStack(2, 5))
|
||||
if len(cb) > 1 {
|
||||
m.TryCatch(msg, catch, cb[1:]...)
|
||||
} else if !catch {
|
||||
|
Loading…
x
Reference in New Issue
Block a user