forked from x/icebergs
opt chat
This commit is contained in:
parent
d9dcd6480c
commit
e84ecb049c
@ -1,5 +0,0 @@
|
|||||||
label `
|
|
||||||
ctx mdb web aaa
|
|
||||||
lex yac ssh gdb
|
|
||||||
tcp nfs cli log
|
|
||||||
`
|
|
@ -115,7 +115,7 @@ func Command(m *ice.Message, arg ...string) {
|
|||||||
kit.If(!PodCmd(m, COMMAND, arg), func() { m.Cmdy(COMMAND, arg) })
|
kit.If(!PodCmd(m, COMMAND, arg), func() { m.Cmdy(COMMAND, arg) })
|
||||||
}
|
}
|
||||||
func CmdAction(args ...ice.Any) ice.Actions {
|
func CmdAction(args ...ice.Any) ice.Actions {
|
||||||
return ice.Actions{ice.CTX_INIT: mdb.AutoConfig(args...), ice.RUN: {Hand: Run}, COMMAND: {Hand: Command}}
|
return ice.Actions{ice.CTX_INIT: mdb.AutoConfig(args...), RUN: {Hand: Run}, COMMAND: {Hand: Command}}
|
||||||
}
|
}
|
||||||
func CmdHandler(args ...ice.Any) ice.Handler {
|
func CmdHandler(args ...ice.Any) ice.Handler {
|
||||||
return func(m *ice.Message, arg ...string) { m.Cmdy(args...) }
|
return func(m *ice.Message, arg ...string) { m.Cmdy(args...) }
|
||||||
@ -123,7 +123,7 @@ func CmdHandler(args ...ice.Any) ice.Handler {
|
|||||||
func CmdList(m *ice.Message) *ice.Message {
|
func CmdList(m *ice.Message) *ice.Message {
|
||||||
return m.Cmdy(COMMAND, mdb.SEARCH, COMMAND, ice.OptionFields(INDEX))
|
return m.Cmdy(COMMAND, mdb.SEARCH, COMMAND, ice.OptionFields(INDEX))
|
||||||
}
|
}
|
||||||
func CmdInputs(m *ice.Message, arg ...string) {
|
func CmdInputs(m *ice.Message, arg ...string) *ice.Message {
|
||||||
switch arg[0] {
|
switch arg[0] {
|
||||||
case INDEX:
|
case INDEX:
|
||||||
m.Cmdy(COMMAND, mdb.SEARCH, COMMAND, ice.OptionFields(INDEX))
|
m.Cmdy(COMMAND, mdb.SEARCH, COMMAND, ice.OptionFields(INDEX))
|
||||||
@ -132,6 +132,7 @@ func CmdInputs(m *ice.Message, arg ...string) {
|
|||||||
m.Cmdy(m.Option(INDEX))
|
m.Cmdy(m.Option(INDEX))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsOrderCmd(key string) bool { return key[0] == '/' || key[0] == '_' }
|
func IsOrderCmd(key string) bool { return key[0] == '/' || key[0] == '_' }
|
||||||
|
@ -47,13 +47,13 @@ func Process(m *ice.Message, key string, args ice.Any, arg ...string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
func ProcessField(m *ice.Message, cmd string, args ice.Any, arg ...string) *ice.Message {
|
func ProcessField(m *ice.Message, cmd string, args ice.Any, arg ...string) *ice.Message {
|
||||||
if cmd = kit.Select(m.ActionKey(), cmd); !kit.HasPrefixList(arg, ice.RUN) {
|
if cmd = kit.Select(m.ActionKey(), cmd); !kit.HasPrefixList(arg, RUN) {
|
||||||
if PodCmd(m, COMMAND, cmd) {
|
if PodCmd(m, COMMAND, cmd) {
|
||||||
m.Push(ice.SPACE, m.Option(ice.MSG_USERPOD))
|
m.Push(ice.SPACE, m.Option(ice.MSG_USERPOD))
|
||||||
} else {
|
} else {
|
||||||
m.Cmdy(COMMAND, cmd)
|
m.Cmdy(COMMAND, cmd)
|
||||||
}
|
}
|
||||||
m.Push(ARGS, kit.Format(_process_args(m, args))).Options(ice.MSG_INDEX, m.PrefixKey()).ProcessField(ACTION, m.ActionKey(), ice.RUN)
|
m.Push(ARGS, kit.Format(_process_args(m, args))).Options(ice.MSG_INDEX, m.PrefixKey()).ProcessField(ACTION, m.ActionKey(), RUN)
|
||||||
} else {
|
} else {
|
||||||
if !PodCmd(m, cmd, arg[1:]) {
|
if !PodCmd(m, cmd, arg[1:]) {
|
||||||
kit.If(aaa.Right(m, cmd, arg[1:]), func() { m.Cmdy(cmd, arg[1:]) })
|
kit.If(aaa.Right(m, cmd, arg[1:]), func() { m.Cmdy(cmd, arg[1:]) })
|
||||||
@ -62,8 +62,8 @@ func ProcessField(m *ice.Message, cmd string, args ice.Any, arg ...string) *ice.
|
|||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
func ProcessCommand(m *ice.Message, cmd string, args []string, arg ...string) {
|
func ProcessCommand(m *ice.Message, cmd string, args []string, arg ...string) {
|
||||||
if !kit.HasPrefixList(arg, ice.RUN) {
|
if !kit.HasPrefixList(arg, RUN) {
|
||||||
m.Cmdy(COMMAND, cmd).Push(ice.ARG, kit.Format(args)).ProcessField(cmd, ice.RUN)
|
m.Cmdy(COMMAND, cmd).Push(ice.ARG, kit.Format(args)).ProcessField(cmd, RUN)
|
||||||
} else {
|
} else {
|
||||||
m.Cmdy(cmd, arg[1:])
|
m.Cmdy(cmd, arg[1:])
|
||||||
}
|
}
|
||||||
|
@ -306,13 +306,13 @@ func DreamAction() ice.Actions {
|
|||||||
}, gdb.EventsAction(DREAM_OPEN, DREAM_CLOSE, DREAM_INPUTS, DREAM_CREATE, DREAM_TABLES, DREAM_ACTION))
|
}, gdb.EventsAction(DREAM_OPEN, DREAM_CLOSE, DREAM_INPUTS, DREAM_CREATE, DREAM_TABLES, DREAM_ACTION))
|
||||||
}
|
}
|
||||||
func DreamProcess(m *ice.Message, args ice.Any, arg ...string) {
|
func DreamProcess(m *ice.Message, args ice.Any, arg ...string) {
|
||||||
if kit.HasPrefixList(arg, ice.RUN) {
|
if kit.HasPrefixList(arg, ctx.RUN) {
|
||||||
ctx.ProcessField(m, m.PrefixKey(), args, kit.Slice(arg, 1)...)
|
ctx.ProcessField(m, m.PrefixKey(), args, kit.Slice(arg, 1)...)
|
||||||
} else if kit.HasPrefixList(arg, ctx.ACTION, m.PrefixKey()) || kit.HasPrefixList(arg, ctx.ACTION, m.CommandKey()) {
|
} else if kit.HasPrefixList(arg, ctx.ACTION, m.PrefixKey()) || kit.HasPrefixList(arg, ctx.ACTION, m.CommandKey()) {
|
||||||
if arg = kit.Slice(arg, 2); kit.HasPrefixList(arg, DREAM) {
|
if arg = kit.Slice(arg, 2); kit.HasPrefixList(arg, DREAM) {
|
||||||
m.Cmdy(SPACE, m.Option(ice.MSG_USERPOD, arg[1]), m.PrefixKey(), ctx.ACTION, DREAM_ACTION, ice.RUN, arg[2:])
|
m.Cmdy(SPACE, m.Option(ice.MSG_USERPOD, arg[1]), m.PrefixKey(), ctx.ACTION, DREAM_ACTION, ctx.RUN, arg[2:])
|
||||||
} else if dream := m.Option(mdb.NAME); dream != "" {
|
} else if dream := m.Option(mdb.NAME); dream != "" {
|
||||||
m.Cmdy(SPACE, dream, m.PrefixKey(), ctx.ACTION, DREAM_ACTION, ice.RUN, arg).Optionv(ice.FIELD_PREFIX, kit.Simple(ctx.ACTION, m.PrefixKey(), DREAM, dream, ice.RUN))
|
m.Cmdy(SPACE, dream, m.PrefixKey(), ctx.ACTION, DREAM_ACTION, ctx.RUN, arg).Optionv(ice.FIELD_PREFIX, kit.Simple(ctx.ACTION, m.PrefixKey(), DREAM, dream, ctx.RUN))
|
||||||
m.Push("_space", dream)
|
m.Push("_space", dream)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -163,9 +163,11 @@ const (
|
|||||||
CODE_VIMER = "web.code.vimer"
|
CODE_VIMER = "web.code.vimer"
|
||||||
CODE_INNER = "web.code.inner"
|
CODE_INNER = "web.code.inner"
|
||||||
CODE_XTERM = "web.code.xterm"
|
CODE_XTERM = "web.code.xterm"
|
||||||
WIKI_WORD = "web.wiki.word"
|
|
||||||
WIKI_DRAW = "web.wiki.draw"
|
|
||||||
WIKI_FEEL = "web.wiki.feel"
|
WIKI_FEEL = "web.wiki.feel"
|
||||||
|
WIKI_DRAW = "web.wiki.draw"
|
||||||
|
WIKI_WORD = "web.wiki.word"
|
||||||
|
WIKI_PORTAL = "web.wiki.portal"
|
||||||
|
CHAT_PORTAL = "web.chat.portal"
|
||||||
CHAT_HEADER = "web.chat.header"
|
CHAT_HEADER = "web.chat.header"
|
||||||
CHAT_IFRAME = "web.chat.iframe"
|
CHAT_IFRAME = "web.chat.iframe"
|
||||||
CHAT_FAVOR = "web.chat.favor"
|
CHAT_FAVOR = "web.chat.favor"
|
||||||
|
@ -105,7 +105,7 @@ func _serve_handle(key string, cmd *ice.Command, m *ice.Message, w http.Response
|
|||||||
kit.For(r.PostForm, func(k string, v []string) { _log(FORM, k, kit.Join(v, lex.SP)).Optionv(k, v) })
|
kit.For(r.PostForm, func(k string, v []string) { _log(FORM, k, kit.Join(v, lex.SP)).Optionv(k, v) })
|
||||||
}
|
}
|
||||||
kit.For(r.Cookies(), func(k, v string) { m.Optionv(k, v) })
|
kit.For(r.Cookies(), func(k, v string) { m.Optionv(k, v) })
|
||||||
m.Options(ice.MSG_COUNT, "0")
|
m.Options(ice.MSG_METHOD, r.Method, ice.MSG_COUNT, "0")
|
||||||
m.Options(ice.MSG_USERWEB, _serve_domain(m), ice.MSG_USERPOD, m.Option(ice.POD))
|
m.Options(ice.MSG_USERWEB, _serve_domain(m), ice.MSG_USERPOD, m.Option(ice.POD))
|
||||||
m.Options(ice.MSG_USERUA, r.Header.Get(UserAgent), ice.MSG_USERIP, r.Header.Get(ice.MSG_USERIP))
|
m.Options(ice.MSG_USERUA, r.Header.Get(UserAgent), ice.MSG_USERIP, r.Header.Get(ice.MSG_USERIP))
|
||||||
m.Options(ice.MSG_SESSID, kit.Select(m.Option(ice.MSG_SESSID), m.Option(CookieName(m.Option(ice.MSG_USERWEB)))))
|
m.Options(ice.MSG_SESSID, kit.Select(m.Option(ice.MSG_SESSID), m.Option(CookieName(m.Option(ice.MSG_USERWEB)))))
|
||||||
|
2
conf.go
2
conf.go
@ -24,6 +24,7 @@ const (
|
|||||||
|
|
||||||
HTTPS = "https"
|
HTTPS = "https"
|
||||||
HTTP = "http"
|
HTTP = "http"
|
||||||
|
HELP = "help"
|
||||||
MAIN = "main"
|
MAIN = "main"
|
||||||
AUTO = "auto"
|
AUTO = "auto"
|
||||||
LIST = "list"
|
LIST = "list"
|
||||||
@ -177,6 +178,7 @@ const ( // MSG
|
|||||||
MSG_CMDS = "cmds"
|
MSG_CMDS = "cmds"
|
||||||
MSG_FIELDS = "fields"
|
MSG_FIELDS = "fields"
|
||||||
MSG_SESSID = "sessid"
|
MSG_SESSID = "sessid"
|
||||||
|
MSG_METHOD = "method"
|
||||||
|
|
||||||
MSG_DETAIL = "detail"
|
MSG_DETAIL = "detail"
|
||||||
MSG_OPTION = "option"
|
MSG_OPTION = "option"
|
||||||
|
@ -47,8 +47,7 @@ func _action_share(m *ice.Message, arg ...string) {
|
|||||||
switch msg := _action_auth(m, arg[0]); msg.Append(mdb.TYPE) {
|
switch msg := _action_auth(m, arg[0]); msg.Append(mdb.TYPE) {
|
||||||
case web.STORM:
|
case web.STORM:
|
||||||
if len(arg) == 1 {
|
if len(arg) == 1 {
|
||||||
m.Push(TITLE, msg.Append(TITLE))
|
m.Push(TITLE, msg.Append(TITLE)).Push(THEME, msg.Append(THEME))
|
||||||
m.Push(THEME, msg.Append(THEME))
|
|
||||||
_action_list(m, msg.Append(web.RIVER), msg.Append(web.STORM))
|
_action_list(m, msg.Append(web.RIVER), msg.Append(web.STORM))
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -56,42 +55,36 @@ func _action_share(m *ice.Message, arg ...string) {
|
|||||||
case web.FIELD:
|
case web.FIELD:
|
||||||
m.Option(ice.MSG_USERPOD, kit.Keys(m.Option(ice.MSG_USERPOD), msg.Append(ice.POD)))
|
m.Option(ice.MSG_USERPOD, kit.Keys(m.Option(ice.MSG_USERPOD), msg.Append(ice.POD)))
|
||||||
if len(arg) == 1 {
|
if len(arg) == 1 {
|
||||||
m.Push(TITLE, msg.Append(TITLE))
|
m.Push(TITLE, msg.Append(TITLE)).Push(THEME, msg.Append(THEME))
|
||||||
m.Push(THEME, msg.Append(THEME))
|
|
||||||
m.Push(ctx.ARGS, msg.Append(mdb.TEXT))
|
|
||||||
m.Cmdy(web.Space(m, msg.Append(ice.POD)), ctx.COMMAND, msg.Append(mdb.NAME))
|
m.Cmdy(web.Space(m, msg.Append(ice.POD)), ctx.COMMAND, msg.Append(mdb.NAME))
|
||||||
|
m.Push(ctx.ARGS, msg.Append(mdb.TEXT))
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
m.Cmdy(web.Space(m, msg.Append(ice.POD)), msg.Append(mdb.NAME), arg[2:])
|
m.Cmdy(web.Space(m, msg.Append(ice.POD)), msg.Append(mdb.NAME), arg[2:])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
|
||||||
THEME = "theme"
|
|
||||||
)
|
|
||||||
const ACTION = "action"
|
const ACTION = "action"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
ACTION: {Name: "action", Help: "工作台", Actions: ice.MergeActions(ice.Actions{
|
ACTION: {Actions: ice.MergeActions(ice.Actions{
|
||||||
mdb.MODIFY: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.MODIFY: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(mdb.MODIFY, RIVER, _storm_key(m), mdb.LIST, m.OptionSimple(mdb.ID), arg)
|
m.Cmdy(mdb.MODIFY, RIVER, _storm_key(m), mdb.LIST, m.OptionSimple(mdb.ID), arg)
|
||||||
}},
|
}},
|
||||||
web.SHARE: {Hand: func(m *ice.Message, arg ...string) { _action_share(m, arg...) }},
|
web.SHARE: {Hand: func(m *ice.Message, arg ...string) { _action_share(m, arg...) }},
|
||||||
"/": {Hand: func(m *ice.Message, arg ...string) {
|
}, web.ApiAction(), aaa.WhiteAction(web.SHARE, ctx.RUN, ctx.COMMAND), ctx.CmdAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if m.Warn(m.Option(ice.MSG_USERNAME) == "", ice.ErrNotLogin, arg) {
|
if m.Warn(m.Option(ice.MSG_USERNAME) == "", ice.ErrNotLogin, arg) {
|
||||||
return
|
return
|
||||||
}
|
} else if m.Warn(!_river_right(m, arg[0]), ice.ErrNotRight, arg) {
|
||||||
if m.Option(ice.MSG_USERPOD) == "" && m.Warn(!_river_right(m, arg[0]), ice.ErrNotRight, arg) {
|
return
|
||||||
return
|
}
|
||||||
}
|
if len(arg) == 2 {
|
||||||
if len(arg) == 2 {
|
ctx.OptionFromConfig(m, MENUS)
|
||||||
ctx.OptionFromConfig(m, MENUS)
|
_action_list(m, arg[0], arg[1])
|
||||||
_action_list(m, arg[0], arg[1])
|
} else {
|
||||||
} else {
|
_action_exec(m, arg[0], arg[1], arg[2], arg[3:]...)
|
||||||
_action_exec(m, arg[0], arg[1], arg[2], arg[3:]...)
|
}
|
||||||
}
|
}},
|
||||||
}},
|
|
||||||
}, ctx.CmdAction(), aaa.WhiteAction(web.SHARE, ctx.COMMAND, ice.RUN))},
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,27 @@
|
|||||||
header.go
|
|
||||||
action.go
|
|
||||||
footer.go
|
|
||||||
search.go
|
|
||||||
river.go
|
|
||||||
storm.go
|
|
||||||
favor.go
|
|
||||||
grant.go
|
|
||||||
sso.go
|
|
||||||
pod.go
|
|
||||||
cmd.go
|
|
||||||
chat.go
|
chat.go
|
||||||
chat.shy
|
chat.shy
|
||||||
|
header.go
|
||||||
trans.go
|
footer.go
|
||||||
|
river.go
|
||||||
|
storm.go
|
||||||
|
action.go
|
||||||
|
search.go
|
||||||
|
portal.go
|
||||||
iframe.go
|
iframe.go
|
||||||
|
icons.go
|
||||||
|
|
||||||
|
pod.go
|
||||||
|
cmd.go
|
||||||
|
sso.go
|
||||||
|
grant.go
|
||||||
|
oauth
|
||||||
|
|
||||||
|
macos
|
||||||
|
trans.go
|
||||||
|
favor.go
|
||||||
|
flows.go
|
||||||
|
flows.js
|
||||||
|
flows.css
|
||||||
keyboard.go
|
keyboard.go
|
||||||
location.go
|
location.go
|
||||||
location.shy
|
location.shy
|
||||||
template.go
|
|
||||||
oauth
|
|
||||||
|
@ -1,55 +1,24 @@
|
|||||||
package chat
|
package chat
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"path"
|
|
||||||
"strings"
|
|
||||||
|
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
"shylinux.com/x/icebergs/base/aaa"
|
"shylinux.com/x/icebergs/base/aaa"
|
||||||
"shylinux.com/x/icebergs/base/ctx"
|
"shylinux.com/x/icebergs/base/ctx"
|
||||||
"shylinux.com/x/icebergs/base/mdb"
|
|
||||||
"shylinux.com/x/icebergs/base/nfs"
|
|
||||||
"shylinux.com/x/icebergs/base/web"
|
"shylinux.com/x/icebergs/base/web"
|
||||||
kit "shylinux.com/x/toolkits"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func _cmd_file(m *ice.Message, arg ...string) bool {
|
|
||||||
switch p := path.Join(arg...); kit.Ext(p) {
|
|
||||||
// case nfs.SHY:
|
|
||||||
// web.RenderCmd(m, "web.wiki.word", p)
|
|
||||||
case nfs.GO:
|
|
||||||
web.RenderCmd(m, ctx.GetFileCmd(p))
|
|
||||||
case nfs.JS:
|
|
||||||
ctx.DisplayBase(m, ctx.FileURI(p))
|
|
||||||
web.RenderCmd(m, kit.Select(ice.CAN_PLUGIN, ctx.GetFileCmd(p)))
|
|
||||||
default:
|
|
||||||
if p = strings.TrimPrefix(p, ice.SRC+nfs.PS); nfs.Exists(m, path.Join(ice.SRC, p)) {
|
|
||||||
if msg := m.Cmd(mdb.ENGINE, kit.Ext(p)); msg.Length() > 0 {
|
|
||||||
m.Cmdy(mdb.ENGINE, kit.Ext(p), p, ice.SRC+nfs.PS).RenderResult()
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
const CMD = "cmd"
|
const CMD = "cmd"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
CMD: {Name: "cmd path auto upload up home", Help: "命令", Actions: ice.MergeActions(
|
CMD: {Actions: ice.MergeActions(web.ApiAction(), aaa.WhiteAction(ctx.RUN), ctx.CmdAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
mdb.HashAction(mdb.SHORT, mdb.TYPE, nfs.PATH, nfs.PWD), ctx.CmdAction(), web.ApiAction(), aaa.WhiteAction(ice.RUN),
|
if len(arg[0]) == 0 || arg[0] == "" {
|
||||||
), Hand: func(m *ice.Message, arg ...string) {
|
web.RenderMain(m)
|
||||||
if _cmd_file(m, arg...) {
|
|
||||||
return
|
|
||||||
} else if len(arg[0]) == 0 || arg[0] == "" {
|
|
||||||
return
|
|
||||||
} else if m.IsCliUA() {
|
} else if m.IsCliUA() {
|
||||||
m.Cmdy(arg, m.Optionv(ice.ARG)).RenderResult()
|
if aaa.Right(m, arg) {
|
||||||
return
|
m.Cmdy(arg, m.Optionv(ice.ARG)).RenderResult()
|
||||||
}
|
}
|
||||||
if arg[0] == "web.chat.portal" {
|
} else if arg[0] == web.CHAT_PORTAL {
|
||||||
web.RenderMain(m)
|
web.RenderMain(m)
|
||||||
} else if m.Cmdy(ctx.COMMAND, arg[0]); m.Length() > 0 {
|
} else if m.Cmdy(ctx.COMMAND, arg[0]); m.Length() > 0 {
|
||||||
web.RenderCmd(m, m.Append(ctx.INDEX), arg[1:])
|
web.RenderCmd(m, m.Append(ctx.INDEX), arg[1:])
|
||||||
|
@ -35,11 +35,9 @@ const FAVOR = "favor"
|
|||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
FAVOR: {Name: "favor hash auto create upload getClipboardData", Help: "收藏夹", Actions: ice.MergeActions(ice.Actions{
|
FAVOR: {Name: "favor hash auto create upload getClipboardData", Help: "收藏夹", Actions: ice.MergeActions(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { mdb.HashImport(m) }},
|
|
||||||
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) { mdb.HashExport(m) }},
|
|
||||||
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
if arg[0] == mdb.FOREACH {
|
if mdb.IsSearchPreview(m, arg) {
|
||||||
m.Cmd("", ice.OptionFields("")).Table(func(value ice.Maps) {
|
m.Cmds("", func(value ice.Maps) {
|
||||||
if arg[1] == "" || arg[1] == value[mdb.TYPE] || strings.Contains(value[mdb.TEXT], arg[1]) {
|
if arg[1] == "" || arg[1] == value[mdb.TYPE] || strings.Contains(value[mdb.TEXT], arg[1]) {
|
||||||
m.PushSearch(value)
|
m.PushSearch(value)
|
||||||
}
|
}
|
||||||
@ -53,7 +51,7 @@ func init() {
|
|||||||
case mdb.NAME:
|
case mdb.NAME:
|
||||||
switch m.Option(mdb.TYPE) {
|
switch m.Option(mdb.TYPE) {
|
||||||
case ctx.INDEX:
|
case ctx.INDEX:
|
||||||
m.Copy(m.Cmd(ctx.COMMAND, mdb.SEARCH, ctx.COMMAND, arg[1:], ice.OptionFields(ctx.INDEX)).RenameAppend(ctx.INDEX, arg[0]))
|
ctx.CmdInputs(m, m.Option(mdb.TYPE)).RenameAppend(ctx.INDEX, arg[0])
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -74,7 +72,7 @@ func init() {
|
|||||||
m.Cmd("", mdb.CREATE, m.OptionSimple(mdb.TYPE, mdb.NAME, mdb.TEXT))
|
m.Cmd("", mdb.CREATE, m.OptionSimple(mdb.TYPE, mdb.NAME, mdb.TEXT))
|
||||||
}},
|
}},
|
||||||
web.DOWNLOAD: {Hand: func(m *ice.Message, arg ...string) {
|
web.DOWNLOAD: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.ProcessOpen(web.MergeURL2(m, web.SHARE_LOCAL+m.Option(mdb.TEXT), "filename", m.Option(mdb.NAME)))
|
m.ProcessOpen(web.MergeURL2(m, web.SHARE_LOCAL+m.Option(mdb.TEXT), nfs.FILENAME, m.Option(mdb.NAME)))
|
||||||
}},
|
}},
|
||||||
ctx.DISPLAY: {Help: "预览", Hand: func(m *ice.Message, arg ...string) {
|
ctx.DISPLAY: {Help: "预览", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if link := web.SHARE_LOCAL + m.Option(mdb.TEXT); _favor_is_image(m, m.Option(mdb.NAME), m.Option(mdb.TYPE)) {
|
if link := web.SHARE_LOCAL + m.Option(mdb.TEXT); _favor_is_image(m, m.Option(mdb.NAME), m.Option(mdb.TYPE)) {
|
||||||
@ -86,23 +84,23 @@ func init() {
|
|||||||
}
|
}
|
||||||
m.ProcessInner()
|
m.ProcessInner()
|
||||||
}},
|
}},
|
||||||
ctx.INDEX: {Help: "命令", Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
msg := mdb.HashSelects(m.Spawn(), m.Option(mdb.HASH))
|
|
||||||
ls := kit.Split(msg.Option(mdb.TEXT))
|
|
||||||
ctx.ProcessField(m, ls[0], ls[1:], arg...)
|
|
||||||
}},
|
|
||||||
"vimer": {Help: "源码", Hand: func(m *ice.Message, arg ...string) {
|
"vimer": {Help: "源码", Hand: func(m *ice.Message, arg ...string) {
|
||||||
ctx.Process(m, "", nfs.SplitPath(m, m.Option(mdb.TEXT)), arg...)
|
ctx.Process(m, "", nfs.SplitPath(m, m.Option(mdb.TEXT)), arg...)
|
||||||
}},
|
}},
|
||||||
"xterm": {Help: "命令", Hand: func(m *ice.Message, arg ...string) {
|
"xterm": {Help: "命令", Hand: func(m *ice.Message, arg ...string) {
|
||||||
ctx.Process(m, "", []string{mdb.TYPE, m.Option(mdb.TEXT), mdb.NAME, m.Option(mdb.NAME), mdb.TEXT, ""}, arg...)
|
ctx.Process(m, "", []string{mdb.TYPE, m.Option(mdb.TEXT), mdb.NAME, m.Option(mdb.NAME), mdb.TEXT, ""}, arg...)
|
||||||
}},
|
}},
|
||||||
cli.OPENS: {Hand: func(m *ice.Message, arg ...string) { cli.Opens(m, m.Option(mdb.TEXT)) }},
|
ctx.INDEX: {Help: "命令", Hand: func(m *ice.Message, arg ...string) {
|
||||||
ice.RUN: {Hand: func(m *ice.Message, arg ...string) {
|
msg := mdb.HashSelects(m.Spawn(), m.Option(mdb.HASH))
|
||||||
|
ls := kit.Split(msg.Option(mdb.TEXT))
|
||||||
|
ctx.ProcessField(m, ls[0], ls[1:], arg...)
|
||||||
|
}},
|
||||||
|
ctx.RUN: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Option(mdb.TYPE, mdb.HashSelects(m.Spawn(), m.Option(mdb.HASH)).Append(mdb.TYPE))
|
m.Option(mdb.TYPE, mdb.HashSelects(m.Spawn(), m.Option(mdb.HASH)).Append(mdb.TYPE))
|
||||||
ctx.Run(m, arg...)
|
ctx.Run(m, arg...)
|
||||||
}},
|
}},
|
||||||
}, ctx.CmdAction(), mdb.ImportantHashAction()), Hand: func(m *ice.Message, arg ...string) {
|
cli.OPENS: {Hand: func(m *ice.Message, arg ...string) { cli.Opens(m, m.Option(mdb.TEXT)) }},
|
||||||
|
}, ctx.CmdAction(), mdb.ImportantHashAction(), mdb.ExportHashAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if len(arg) > 0 && arg[0] == ctx.ACTION {
|
if len(arg) > 0 && arg[0] == ctx.ACTION {
|
||||||
m.Option(mdb.TYPE, mdb.HashSelects(m.Spawn(), m.Option(mdb.HASH)).Append(mdb.TYPE))
|
m.Option(mdb.TYPE, mdb.HashSelects(m.Spawn(), m.Option(mdb.HASH)).Append(mdb.TYPE))
|
||||||
gdb.Event(m, FAVOR_ACTION, arg)
|
gdb.Event(m, FAVOR_ACTION, arg)
|
||||||
|
@ -15,13 +15,9 @@ const FOOTER = "footer"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
FOOTER: {Name: "footer", Help: "状态栏", Actions: ice.MergeActions(ice.Actions{
|
FOOTER: {Actions: ice.MergeActions(ice.Actions{
|
||||||
ice.RUN: {Hand: func(m *ice.Message, arg ...string) {
|
ice.HELP: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
if aaa.Right(m, arg) {
|
ctx.ProcessField(m, web.WIKI_WORD, []string{ice.SRC_DOCUMENT + arg[0] + "/list.shy"}, arg...)
|
||||||
if m.Cmdy(arg); m.IsErrNotFound() {
|
|
||||||
m.RenderResult(m.Cmdx(cli.SYSTEM, arg))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}},
|
}},
|
||||||
nfs.SCRIPT: {Hand: func(m *ice.Message, arg ...string) {
|
nfs.SCRIPT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
ctx.ProcessField(m, web.CODE_VIMER, func() []string {
|
ctx.ProcessField(m, web.CODE_VIMER, func() []string {
|
||||||
@ -34,12 +30,15 @@ func init() {
|
|||||||
ctx.CONFIG: {Hand: func(m *ice.Message, arg ...string) {
|
ctx.CONFIG: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
ctx.ProcessField(m, ctx.CONFIG, arg, arg...)
|
ctx.ProcessField(m, ctx.CONFIG, arg, arg...)
|
||||||
}},
|
}},
|
||||||
"help": {Hand: func(m *ice.Message, arg ...string) {
|
ctx.RUN: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
ctx.ProcessField(m, web.WIKI_WORD, []string{"src/document/" + arg[0] + "/list.shy"}, arg...)
|
if aaa.Right(m, arg) {
|
||||||
|
if m.Cmdy(arg); m.IsErrNotFound() {
|
||||||
|
m.RenderResult(m.Cmdx(cli.SYSTEM, arg))
|
||||||
|
}
|
||||||
|
}
|
||||||
}},
|
}},
|
||||||
"/": {Hand: func(m *ice.Message, arg ...string) {
|
}, web.ApiAction(), aaa.WhiteAction(ctx.RUN, ctx.COMMAND), ctx.CmdAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Result(kit.Select(mdb.Config(m, TITLE), ice.Info.Make.Email))
|
m.Result(kit.Select(ice.Info.Make.Email, mdb.Config(m, TITLE)))
|
||||||
}},
|
}},
|
||||||
}, ctx.CmdAction(), aaa.WhiteAction(ctx.COMMAND, ice.RUN))},
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package chat
|
package chat
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"path"
|
|
||||||
|
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
"shylinux.com/x/icebergs/base/aaa"
|
"shylinux.com/x/icebergs/base/aaa"
|
||||||
"shylinux.com/x/icebergs/base/cli"
|
"shylinux.com/x/icebergs/base/cli"
|
||||||
@ -21,8 +19,9 @@ func _header_users(m *ice.Message, arg ...string) {
|
|||||||
return
|
return
|
||||||
} else if m.Warn(m.Option(web.SHARE) != "", ice.ErrNotRight, "没有权限") {
|
} else if m.Warn(m.Option(web.SHARE) != "", ice.ErrNotRight, "没有权限") {
|
||||||
return
|
return
|
||||||
|
} else {
|
||||||
|
m.Cmdy(aaa.USER, mdb.MODIFY, aaa.USERNAME, m.Option(ice.MSG_USERNAME), m.ActionKey(), m.Option(m.ActionKey(), arg[0]))
|
||||||
}
|
}
|
||||||
m.Cmdy(aaa.USER, mdb.MODIFY, aaa.USERNAME, m.Option(ice.MSG_USERNAME), m.ActionKey(), m.Option(m.ActionKey(), arg[0]))
|
|
||||||
}
|
}
|
||||||
func _header_share(m *ice.Message, arg ...string) {
|
func _header_share(m *ice.Message, arg ...string) {
|
||||||
if m.Warn(m.Option(ice.MSG_USERNAME) == "", ice.ErrNotLogin, "没有登录") {
|
if m.Warn(m.Option(ice.MSG_USERNAME) == "", ice.ErrNotLogin, "没有登录") {
|
||||||
@ -35,7 +34,7 @@ func _header_share(m *ice.Message, arg ...string) {
|
|||||||
m.Push(mdb.NAME, m.Option(mdb.LINK)).PushQRCode(mdb.TEXT, m.Option(mdb.LINK))
|
m.Push(mdb.NAME, m.Option(mdb.LINK)).PushQRCode(mdb.TEXT, m.Option(mdb.LINK))
|
||||||
}
|
}
|
||||||
func _header_check(m *ice.Message, arg ...string) bool {
|
func _header_check(m *ice.Message, arg ...string) bool {
|
||||||
m.Option(ice.MAIN, mdb.Conf(m, "web.serve", kit.Keym(ice.MAIN)))
|
m.Option(ice.MAIN, mdb.Conf(m, web.SERVE, kit.Keym(ice.MAIN)))
|
||||||
if m.Option(ice.CMD) == aaa.OFFER && m.Option(mdb.HASH) != "" {
|
if m.Option(ice.CMD) == aaa.OFFER && m.Option(mdb.HASH) != "" {
|
||||||
m.Cmd(aaa.OFFER, m.Option(mdb.HASH), func(value ice.Maps) {
|
m.Cmd(aaa.OFFER, m.Option(mdb.HASH), func(value ice.Maps) {
|
||||||
aaa.SessAuth(m, kit.Dict(aaa.USERNAME, value[aaa.EMAIL], aaa.USERROLE, aaa.VOID))
|
aaa.SessAuth(m, kit.Dict(aaa.USERNAME, value[aaa.EMAIL], aaa.USERROLE, aaa.VOID))
|
||||||
@ -46,21 +45,22 @@ func _header_check(m *ice.Message, arg ...string) bool {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
switch value[mdb.TYPE] {
|
switch value[mdb.TYPE] {
|
||||||
case web.STORM, web.FIELD:
|
case web.FIELD, web.STORM:
|
||||||
aaa.SessAuth(m, kit.Dict(value))
|
aaa.SessAuth(m, kit.Dict(value))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if m.Option(ice.MSG_USERNAME) != "" {
|
if m.Option(ice.MSG_USERNAME) != "" {
|
||||||
return true
|
return true
|
||||||
} else if ctx.OptionFromConfig(m, SSO) == "" && ctx.OptionFromConfig(m, web.LOGIN) == "" {
|
} else if ctx.OptionFromConfig(m, SSO) == "" {
|
||||||
m.Option(SSO, kit.Format(kit.Dict("serve.icon", "usr/icons/icebergs.jpg", "serve.url", GetSSO(m))))
|
m.Option(SSO, kit.Format(kit.Dict("serve.icon", nfs.USR_ICONS_ICEBERGS, "serve.url", GetSSO(m))))
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
TITLE = "title"
|
TITLE = "title"
|
||||||
|
THEME = "theme"
|
||||||
MENUS = "menus"
|
MENUS = "menus"
|
||||||
|
|
||||||
HEADER_AGENT = "header.agent"
|
HEADER_AGENT = "header.agent"
|
||||||
@ -69,7 +69,7 @@ const HEADER = "header"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
HEADER: {Name: "header", Help: "标题栏", Actions: ice.Actions{
|
HEADER: {Actions: ice.MergeActions(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { aaa.White(m, HEADER) }},
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { aaa.White(m, HEADER) }},
|
||||||
aaa.LOGIN: {Hand: func(m *ice.Message, arg ...string) {}},
|
aaa.LOGIN: {Hand: func(m *ice.Message, arg ...string) {}},
|
||||||
aaa.LOGOUT: {Hand: aaa.SessLogout},
|
aaa.LOGOUT: {Hand: aaa.SessLogout},
|
||||||
@ -85,7 +85,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
aaa.EMAIL: {Name: "email to subject content", Hand: func(m *ice.Message, arg ...string) {
|
aaa.EMAIL: {Name: "email to subject content", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if m.Option("to") != aaa.UserEmail(m, "") && !aaa.Right(m, aaa.EMAIL, m.Option("to")) {
|
if m.Option(nfs.TO) != aaa.UserEmail(m, "") && !aaa.Right(m, aaa.EMAIL, m.Option(nfs.TO)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
m.Options("volcano", web.UserHost(m), nfs.VERSION, web.RenderVersion(m))
|
m.Options("volcano", web.UserHost(m), nfs.VERSION, web.RenderVersion(m))
|
||||||
@ -93,22 +93,20 @@ func init() {
|
|||||||
m.Cmdy(aaa.EMAIL, aaa.SEND, arg, aaa.CONTENT, nfs.Template(m, "email.html"))
|
m.Cmdy(aaa.EMAIL, aaa.SEND, arg, aaa.CONTENT, nfs.Template(m, "email.html"))
|
||||||
}},
|
}},
|
||||||
web.SHARE: {Hand: _header_share},
|
web.SHARE: {Hand: _header_share},
|
||||||
"webpack": {Hand: ctx.CmdHandler("webpack", "build")},
|
}, web.ApiAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
"/": {Hand: func(m *ice.Message, arg ...string) {
|
m.Option("language.list", m.Cmd(nfs.DIR, nfs.TemplatePath(m, aaa.LANGUAGE)+nfs.PS, nfs.FILE).Appendv(nfs.FILE))
|
||||||
m.Option("language.list", m.Cmd(nfs.DIR, path.Join(ice.SRC_TEMPLATE, m.PrefixKey(), aaa.LANGUAGE), nfs.FILE).Appendv(nfs.FILE))
|
m.Option("theme.list", m.Cmd(nfs.DIR, nfs.TemplatePath(m, aaa.THEME)+nfs.PS, nfs.FILE).Appendv(nfs.FILE))
|
||||||
m.Option("theme.list", m.Cmd(nfs.DIR, path.Join(ice.SRC_TEMPLATE, m.PrefixKey(), aaa.THEME), nfs.FILE).Appendv(nfs.FILE))
|
m.Option(nfs.REPOS, m.Cmdv(web.SPIDE, nfs.REPOS, web.CLIENT_URL))
|
||||||
m.Option(ICONS, mdb.Conf(m, "web.chat.icons", kit.Keym(nfs.PATH)))
|
m.Option(ICONS, mdb.Conf(m, ICONS, kit.Keym(nfs.PATH)))
|
||||||
m.Option(nfs.REPOS, m.Cmdv(web.SPIDE, ice.HUB, web.CLIENT_URL))
|
m.Option(MENUS, mdb.Config(m, MENUS))
|
||||||
if gdb.Event(m, HEADER_AGENT); !_header_check(m, arg...) {
|
m.Echo(mdb.Config(m, TITLE))
|
||||||
return
|
if gdb.Event(m, HEADER_AGENT); !_header_check(m, arg...) {
|
||||||
}
|
return
|
||||||
msg := m.Cmd(aaa.USER, m.Option(ice.MSG_USERNAME))
|
}
|
||||||
kit.For([]string{aaa.USERNICK, aaa.LANGUAGE, aaa.EMAIL}, func(k string) { m.Option(k, msg.Append(k)) })
|
msg := m.Cmd(aaa.USER, m.Option(ice.MSG_USERNAME))
|
||||||
kit.For([]string{aaa.AVATAR, aaa.BACKGROUND}, func(k string) { m.Option(k, web.RequireFile(m, msg.Append(k))) })
|
kit.For([]string{aaa.USERNICK, aaa.LANGUAGE, aaa.EMAIL}, func(k string) { m.Option(k, msg.Append(k)) })
|
||||||
kit.If(m.Option(aaa.LANGUAGE) == "", func() { m.Option(aaa.LANGUAGE, kit.Split(m.R.Header.Get(web.AcceptLanguage), ",;")[0]) })
|
kit.For([]string{aaa.AVATAR, aaa.BACKGROUND}, func(k string) { m.Option(k, web.RequireFile(m, msg.Append(k))) })
|
||||||
m.Option(MENUS, mdb.Config(m, MENUS))
|
kit.If(m.Option(aaa.LANGUAGE) == "", func() { m.Option(aaa.LANGUAGE, kit.Split(m.R.Header.Get(web.AcceptLanguage), ",;")[0]) })
|
||||||
m.Echo(mdb.Config(m, TITLE))
|
|
||||||
}},
|
|
||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ func init() {
|
|||||||
ICONS: {Actions: ctx.ConfAction(nfs.PATH, "bootstrap-icons/font/bootstrap-icons.css"), Hand: func(m *ice.Message, arg ...string) {
|
ICONS: {Actions: ctx.ConfAction(nfs.PATH, "bootstrap-icons/font/bootstrap-icons.css"), Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmd(lex.SPLIT, ice.USR_MODULES+mdb.Config(m, nfs.PATH), kit.Dict(lex.SPLIT_SPACE, " {:;}"), func(text string, ls []string) {
|
m.Cmd(lex.SPLIT, ice.USR_MODULES+mdb.Config(m, nfs.PATH), kit.Dict(lex.SPLIT_SPACE, " {:;}"), func(text string, ls []string) {
|
||||||
if len(ls) > 2 && ls[2] == nfs.CONTENT {
|
if len(ls) > 2 && ls[2] == nfs.CONTENT {
|
||||||
name := "bi " + strings.TrimPrefix(ls[0], ".")
|
name := "bi " + strings.TrimPrefix(ls[0], nfs.PT)
|
||||||
m.Push(mdb.NAME, name).Push(mdb.ICON, kit.Format(`<i class="%s"></i>`, name))
|
m.Push(mdb.NAME, name).Push(mdb.ICON, kit.Format(`<i class="%s"></i>`, name))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -14,19 +14,7 @@ const IFRAME = "iframe"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
IFRAME: {Name: "iframe hash@key auto safari", Icon: "usr/icons/Safari.png", Help: "浏览器", Actions: ice.MergeActions(ice.Actions{
|
IFRAME: {Name: "iframe hash@key auto safari", Help: "浏览器", Icon: "usr/icons/Safari.png", Actions: ice.MergeActions(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
if m.Cmd("").Length() == 0 {
|
|
||||||
m.Cmd(web.SPIDE, ice.OptionFields(web.CLIENT_NAME, web.CLIENT_ORIGIN), func(value ice.Maps) {
|
|
||||||
if kit.IsIn(value[web.CLIENT_NAME], "ops", "dev", "com", "shy") {
|
|
||||||
m.Cmd("", mdb.CREATE, kit.Dict(mdb.NAME, value[web.CLIENT_NAME], web.LINK, value[web.CLIENT_ORIGIN]))
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}},
|
|
||||||
mdb.CREATE: {Name: "create type name link", Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
m.ProcessRewrite(mdb.HASH, mdb.HashCreate(m, mdb.TYPE, web.LINK, mdb.NAME, kit.ParseURL(m.Option(web.LINK)).Host, m.OptionSimple()))
|
|
||||||
}},
|
|
||||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
switch mdb.HashInputs(m, arg); arg[0] {
|
switch mdb.HashInputs(m, arg); arg[0] {
|
||||||
case mdb.NAME:
|
case mdb.NAME:
|
||||||
@ -37,12 +25,14 @@ func init() {
|
|||||||
case mdb.HASH:
|
case mdb.HASH:
|
||||||
m.Cmd(mdb.SEARCH, mdb.FOREACH, "", "type,name,text", func(value ice.Maps) {
|
m.Cmd(mdb.SEARCH, mdb.FOREACH, "", "type,name,text", func(value ice.Maps) {
|
||||||
kit.If(value[mdb.TYPE] == web.LINK, func() {
|
kit.If(value[mdb.TYPE] == web.LINK, func() {
|
||||||
m.Push(arg[0], value[mdb.TEXT])
|
m.Push(arg[0], value[mdb.TEXT]).Push(mdb.NAME, value[mdb.NAME])
|
||||||
m.Push(mdb.NAME, value[mdb.NAME])
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
|
mdb.CREATE: {Name: "create type name link", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
m.ProcessRewrite(mdb.HASH, mdb.HashCreate(m, mdb.TYPE, web.LINK, mdb.NAME, kit.ParseURL(m.Option(web.LINK)).Host, m.OptionSimple()))
|
||||||
|
}},
|
||||||
FAVOR_INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
FAVOR_INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
switch arg[0] {
|
switch arg[0] {
|
||||||
case mdb.TYPE:
|
case mdb.TYPE:
|
||||||
@ -75,9 +65,6 @@ func init() {
|
|||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
web.OPEN: {Hand: func(m *ice.Message, arg ...string) { m.ProcessOpen(m.Option(web.LINK)) }},
|
web.OPEN: {Hand: func(m *ice.Message, arg ...string) { m.ProcessOpen(m.Option(web.LINK)) }},
|
||||||
web.DREAM_CREATE: {Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
m.Cmd("", mdb.CREATE, kit.Dict(web.LINK, m.MergePod(m.Option(mdb.NAME))))
|
|
||||||
}},
|
|
||||||
"safari": {Help: "本机", Hand: func(m *ice.Message, arg ...string) {
|
"safari": {Help: "本机", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if h := kit.Select(m.Option(mdb.HASH), arg, 0); h == "" {
|
if h := kit.Select(m.Option(mdb.HASH), arg, 0); h == "" {
|
||||||
cli.Opens(m, "Safari.app")
|
cli.Opens(m, "Safari.app")
|
||||||
@ -85,8 +72,8 @@ func init() {
|
|||||||
cli.Opens(m, m.Cmd("", h).Append(mdb.LINK))
|
cli.Opens(m, m.Cmd("", h).Append(mdb.LINK))
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
}, mdb.HashAction(mdb.SHORT, web.LINK, mdb.FIELD, "time,hash,type,name,link"), FavorAction()), Hand: func(m *ice.Message, arg ...string) {
|
}, FavorAction(), mdb.HashAction(mdb.SHORT, web.LINK, mdb.FIELD, "time,hash,type,name,link")), Hand: func(m *ice.Message, arg ...string) {
|
||||||
list := []string{m.MergePodCmd("", "web.wiki.portal", log.DEBUG, m.Option(log.DEBUG))}
|
list := []string{m.MergePodCmd("", web.WIKI_PORTAL, log.DEBUG, m.Option(log.DEBUG))}
|
||||||
list = append(list, web.MergeLink(m, "/chat/portal/", ice.POD, m.Option(ice.MSG_USERPOD), log.DEBUG, m.Option(log.DEBUG)))
|
list = append(list, web.MergeLink(m, "/chat/portal/", ice.POD, m.Option(ice.MSG_USERPOD), log.DEBUG, m.Option(log.DEBUG)))
|
||||||
if mdb.HashSelect(m, arg...); len(arg) == 0 {
|
if mdb.HashSelect(m, arg...); len(arg) == 0 {
|
||||||
for _, link := range list {
|
for _, link := range list {
|
||||||
|
@ -18,11 +18,11 @@ const POD = "pod"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
POD: {Actions: ice.MergeActions(ctx.CmdAction(), web.ApiAction(), aaa.WhiteAction()), Hand: func(m *ice.Message, arg ...string) {
|
POD: {Actions: ice.MergeActions(web.ApiAction(), aaa.WhiteAction(), ctx.CmdAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if len(arg) == 0 || kit.Select("", arg, 0) == "" {
|
if len(arg) == 0 || arg[0] == "" {
|
||||||
web.RenderCmd(m, web.SPACE)
|
web.RenderMain(m)
|
||||||
} else if strings.HasPrefix(m.Option(ice.MSG_USERUA), "git/") {
|
} else if strings.HasPrefix(m.Option(ice.MSG_USERUA), "git/") {
|
||||||
m.RenderRedirect(m.Cmdv(web.SPACE, arg[0], "web.code.git.repos", nfs.REMOTE, nfs.REMOTE) + "/info/refs?service=" + m.Option("service"))
|
m.RenderRedirect(kit.MergeURL2(m.Cmdv(web.SPACE, arg[0], web.CODE_GIT_REPOS, nfs.REMOTE, nfs.REMOTE), "/info/refs", m.OptionSimple("service")))
|
||||||
} else if m.Option(cli.GOOS) != "" && m.Option(cli.GOARCH) != "" {
|
} else if m.Option(cli.GOOS) != "" && m.Option(cli.GOARCH) != "" {
|
||||||
m.RenderDownload(path.Join(ice.USR_LOCAL_WORK, arg[0], ice.USR_PUBLISH, kit.Keys(ice.ICE, m.Option(cli.GOOS), m.Option(cli.GOARCH))))
|
m.RenderDownload(path.Join(ice.USR_LOCAL_WORK, arg[0], ice.USR_PUBLISH, kit.Keys(ice.ICE, m.Option(cli.GOOS), m.Option(cli.GOARCH))))
|
||||||
} else if m.IsCliUA() {
|
} else if m.IsCliUA() {
|
||||||
|
@ -2,7 +2,6 @@ package chat
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
"shylinux.com/x/icebergs/base/nfs"
|
|
||||||
"shylinux.com/x/icebergs/base/web"
|
"shylinux.com/x/icebergs/base/web"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -10,8 +9,8 @@ const PORTAL = "portal"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
PORTAL: {Name: "portal path auto", Help: "门户", Actions: ice.MergeActions(ice.Actions{
|
PORTAL: {Actions: web.ApiAction(), Hand: func(m *ice.Message, arg ...string) {
|
||||||
nfs.PS: {Hand: func(m *ice.Message, arg ...string) { web.RenderMain(m) }},
|
web.RenderMain(m)
|
||||||
}), Hand: func(m *ice.Message, arg ...string) { web.RenderMain(m) }},
|
}},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ import (
|
|||||||
"shylinux.com/x/icebergs/base/aaa"
|
"shylinux.com/x/icebergs/base/aaa"
|
||||||
"shylinux.com/x/icebergs/base/gdb"
|
"shylinux.com/x/icebergs/base/gdb"
|
||||||
"shylinux.com/x/icebergs/base/mdb"
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
"shylinux.com/x/icebergs/base/nfs"
|
|
||||||
"shylinux.com/x/icebergs/base/web"
|
"shylinux.com/x/icebergs/base/web"
|
||||||
kit "shylinux.com/x/toolkits"
|
kit "shylinux.com/x/toolkits"
|
||||||
)
|
)
|
||||||
@ -22,7 +21,7 @@ func _river_key(m *ice.Message, key ...ice.Any) string {
|
|||||||
func _river_list(m *ice.Message) {
|
func _river_list(m *ice.Message) {
|
||||||
if m.Option(web.SHARE) != "" {
|
if m.Option(web.SHARE) != "" {
|
||||||
switch msg := m.Cmd(web.SHARE, m.Option(web.SHARE)); msg.Append(mdb.TYPE) {
|
switch msg := m.Cmd(web.SHARE, m.Option(web.SHARE)); msg.Append(mdb.TYPE) {
|
||||||
case web.STORM, web.FIELD:
|
case web.FIELD, web.STORM:
|
||||||
m.Option(ice.MSG_RIVER, web.SHARE)
|
m.Option(ice.MSG_RIVER, web.SHARE)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -40,36 +39,23 @@ const RIVER = "river"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
RIVER: {Name: "river", Help: "群组", Actions: ice.MergeActions(ice.Actions{
|
RIVER: {Actions: ice.MergeActions(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { mdb.HashImport(m) }},
|
|
||||||
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) { mdb.HashExport(m) }},
|
|
||||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
switch arg[0] {
|
|
||||||
case nfs.TEMPLATE:
|
|
||||||
m.Cmdy(TEMPLATE).CutTo(RIVER, arg[0])
|
|
||||||
default:
|
|
||||||
mdb.HashInputs(m, arg)
|
|
||||||
}
|
|
||||||
}},
|
|
||||||
mdb.CREATE: {Name: "create type=void,tech,root name=hi text=hello template=base", Hand: func(m *ice.Message, arg ...string) {
|
mdb.CREATE: {Name: "create type=void,tech,root name=hi text=hello template=base", Hand: func(m *ice.Message, arg ...string) {
|
||||||
h := mdb.HashCreate(m, arg)
|
h := mdb.HashCreate(m, arg)
|
||||||
defer m.Result(h)
|
defer m.Result(h)
|
||||||
if m.Option(mdb.TYPE) == aaa.VOID {
|
kit.If(m.Option(mdb.TYPE) == aaa.VOID, func() { m.Cmd(aaa.ROLE, aaa.WHITE, aaa.VOID, kit.Keys(RIVER, h)) })
|
||||||
m.Cmd(aaa.ROLE, aaa.WHITE, aaa.VOID, kit.Keys(RIVER, h))
|
|
||||||
}
|
|
||||||
gdb.Event(m, RIVER_CREATE, RIVER, m.Option(ice.MSG_RIVER, h), arg)
|
gdb.Event(m, RIVER_CREATE, RIVER, m.Option(ice.MSG_RIVER, h), arg)
|
||||||
}},
|
}},
|
||||||
"/": {Hand: func(m *ice.Message, arg ...string) {
|
}, web.ApiAction(), aaa.WhiteAction(), mdb.ImportantHashAction(mdb.FIELD, "time,hash,type,icon,name,text,template"), mdb.ExportHashAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if m.Warn(m.Option(ice.MSG_USERNAME) == "", ice.ErrNotLogin) || !aaa.Right(m, RIVER, arg) {
|
if m.Warn(m.Option(ice.MSG_USERNAME) == "", ice.ErrNotLogin) || !aaa.Right(m, RIVER, arg) {
|
||||||
return
|
return
|
||||||
} else if len(arg) == 0 {
|
} else if len(arg) == 0 {
|
||||||
_river_list(m)
|
_river_list(m)
|
||||||
} else if len(arg) > 1 && arg[1] == STORM {
|
} else if len(arg) > 1 && arg[1] == STORM {
|
||||||
m.Cmdy(arg[1], arg[2:], kit.Dict(ice.MSG_RIVER, arg[0]))
|
m.Cmdy(arg[1], arg[2:], kit.Dict(ice.MSG_RIVER, arg[0]))
|
||||||
} else if len(arg) > 2 && arg[2] == STORM {
|
} else if len(arg) > 2 && arg[2] == STORM {
|
||||||
m.Cmdy(arg[2], arg[3:], kit.Dict(ice.MSG_RIVER, arg[0], ice.MSG_STORM, arg[1]))
|
m.Cmdy(arg[2], arg[3:], kit.Dict(ice.MSG_RIVER, arg[0], ice.MSG_STORM, arg[1]))
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
}, aaa.WhiteAction(), mdb.ImportantHashAction(mdb.FIELD, "time,hash,type,icon,name,text,template"))},
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -11,13 +11,10 @@ const SEARCH = "search"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
SEARCH: {Name: "search", Help: "搜索框", Actions: ice.MergeActions(ice.Actions{
|
SEARCH: {Actions: ice.MergeActions(ice.Actions{
|
||||||
cli.OPENS: {Hand: func(m *ice.Message, arg ...string) { cli.Opens(m, arg...) }},
|
cli.OPENS: {Hand: func(m *ice.Message, arg ...string) { cli.Opens(m, arg...) }},
|
||||||
"/": {Hand: func(m *ice.Message, arg ...string) {
|
}, web.ApiAction(), ctx.CmdAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(web.Space(m, m.Option(ice.POD)), "mdb.search", arg).StatusTimeCount()
|
m.Cmdy(web.Space(m, m.Option(ice.POD)), "mdb.search", arg).StatusTimeCount()
|
||||||
}},
|
|
||||||
}, ctx.CmdAction()), Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
m.Cmdy("mdb.search", arg)
|
|
||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,8 @@ const SSO = "sso"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
web.P(SSO): {Name: "/sso", Help: "授权", Actions: aaa.WhiteAction(), Hand: func(m *ice.Message, arg ...string) {
|
SSO: {Actions: ice.MergeActions(web.ApiAction(), aaa.WhiteAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if m.Warn(m.Option(ice.MSG_USERNAME) == "", ice.ErrNotLogin) || m.Warn(m.Option(cli.BACK) == "", ice.ErrNotValid) {
|
if m.Warn(m.Option(ice.MSG_USERNAME) == "", ice.ErrNotLogin) || m.Warn(m.Option(web.SPACE) == "", ice.ErrNotValid) || m.Warn(m.Option(cli.BACK) == "", ice.ErrNotValid) {
|
||||||
web.RenderMain(m)
|
web.RenderMain(m)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -34,5 +34,5 @@ func GetSSO(m *ice.Message) string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
ls := strings.Split(kit.ParseURL(link).Path, nfs.PS)
|
ls := strings.Split(kit.ParseURL(link).Path, nfs.PS)
|
||||||
return kit.MergeURL2(link, web.P(CHAT, SSO), web.SPACE, kit.Select("", ls, 3), cli.BACK, m.R.Header.Get(web.Referer))
|
return kit.MergeURL2(link, web.PP(CHAT, SSO), web.SPACE, kit.Select("", ls, 3), cli.BACK, m.R.Header.Get(web.Referer))
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,6 @@ const STORM = "storm"
|
|||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
STORM: {Name: "storm hash id auto insert create", Help: "应用", Actions: ice.Actions{
|
STORM: {Name: "storm hash id auto insert create", Help: "应用", Actions: ice.Actions{
|
||||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {}},
|
|
||||||
mdb.CREATE: {Name: "create name=hi text=hello", Hand: func(m *ice.Message, arg ...string) {
|
mdb.CREATE: {Name: "create name=hi text=hello", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(mdb.INSERT, RIVER, _river_key(m), mdb.HASH, arg)
|
m.Cmdy(mdb.INSERT, RIVER, _river_key(m), mdb.HASH, arg)
|
||||||
}},
|
}},
|
||||||
@ -28,7 +27,7 @@ func init() {
|
|||||||
m.Cmdy(mdb.INSERT, RIVER, _storm_key(m), mdb.LIST, arg)
|
m.Cmdy(mdb.INSERT, RIVER, _storm_key(m), mdb.LIST, arg)
|
||||||
}},
|
}},
|
||||||
mdb.DELETE: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.DELETE: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(mdb.MODIFY, RIVER, _storm_key(m), mdb.LIST, arg, "deleted", "true")
|
m.Cmdy(mdb.MODIFY, RIVER, _storm_key(m), mdb.LIST, arg, "deleted", ice.TRUE)
|
||||||
}},
|
}},
|
||||||
mdb.MODIFY: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.MODIFY: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
if len(arg) > 0 && arg[0] == mdb.ID {
|
if len(arg) > 0 && arg[0] == mdb.ID {
|
||||||
|
@ -1,98 +0,0 @@
|
|||||||
package chat
|
|
||||||
|
|
||||||
import (
|
|
||||||
ice "shylinux.com/x/icebergs"
|
|
||||||
"shylinux.com/x/icebergs/base/ctx"
|
|
||||||
"shylinux.com/x/icebergs/base/gdb"
|
|
||||||
"shylinux.com/x/icebergs/base/mdb"
|
|
||||||
kit "shylinux.com/x/toolkits"
|
|
||||||
)
|
|
||||||
|
|
||||||
const TEMPLATE = "template"
|
|
||||||
|
|
||||||
func init() {
|
|
||||||
Index.MergeCommands(ice.Commands{
|
|
||||||
TEMPLATE: {Name: "template river storm index auto 删除配置 查看配置", Help: "模板", Actions: ice.MergeActions(ice.Actions{
|
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
return
|
|
||||||
if gdb.Watch(m, RIVER_CREATE); m.Cmd("").Length() == 0 {
|
|
||||||
kit.For(_river_template, func(river string, value ice.Any) {
|
|
||||||
m.Cmd("", mdb.CREATE, RIVER, river)
|
|
||||||
kit.For(value, func(storm string, value ice.Any) {
|
|
||||||
m.Cmd("", mdb.INSERT, RIVER, river, STORM, storm)
|
|
||||||
kit.For(value, func(index int, value ice.Any) {
|
|
||||||
m.Cmd("", "add", RIVER, river, STORM, storm, ctx.INDEX, value)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}},
|
|
||||||
RIVER_CREATE: {Name: "river.create river template", Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
m.Cmd("", m.Option(TEMPLATE), ice.OptionFields(STORM), func(value ice.Maps) {
|
|
||||||
m.Option(ice.MSG_STORM, m.Cmdx(STORM, mdb.CREATE, mdb.NAME, value[STORM]))
|
|
||||||
m.Cmd("", m.Option(TEMPLATE), value[STORM], ice.OptionFields(ctx.INDEX), func(value ice.Maps) {
|
|
||||||
m.Cmd(STORM, mdb.INSERT, ctx.INDEX, value[ctx.INDEX])
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}},
|
|
||||||
mdb.CREATE: {Name: "create river", Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
m.Cmd(mdb.INSERT, m.PrefixKey(), "", mdb.HASH, m.OptionSimple(RIVER), kit.Dict(mdb.SHORT, RIVER))
|
|
||||||
}},
|
|
||||||
mdb.INSERT: {Name: "insert river storm", Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
m.Cmd(mdb.INSERT, m.PrefixKey(), kit.KeyHash(m.Option(RIVER)), mdb.HASH, arg[2:], kit.Dict(mdb.SHORT, STORM))
|
|
||||||
}},
|
|
||||||
"add": {Name: "add river storm index", Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
m.Cmd(mdb.INSERT, m.PrefixKey(), kit.KeyHash(m.Option(RIVER), kit.KeyHash(m.Option(STORM))), mdb.LIST, arg[4:])
|
|
||||||
}},
|
|
||||||
mdb.REMOVE: {Name: "remove", Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
if m.Option(STORM) == "" {
|
|
||||||
m.Cmd(mdb.DELETE, m.PrefixKey(), "", mdb.HASH, m.OptionSimple(RIVER))
|
|
||||||
} else {
|
|
||||||
m.Cmd(mdb.DELETE, m.PrefixKey(), kit.KeyHash(m.Option(RIVER)), mdb.HASH, m.OptionSimple(STORM))
|
|
||||||
}
|
|
||||||
}},
|
|
||||||
}, mdb.ClearOnExitHashAction()), Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
switch len(arg) {
|
|
||||||
case 0:
|
|
||||||
m.Cmdy(mdb.SELECT, m.PrefixKey(), "", mdb.HASH, ice.OptionFields("time,river"))
|
|
||||||
m.PushAction(mdb.REMOVE).Action(mdb.CREATE)
|
|
||||||
case 1:
|
|
||||||
m.Cmdy(mdb.SELECT, m.PrefixKey(), kit.KeyHash(arg[0]), mdb.HASH, ice.OptionFields("time,storm"))
|
|
||||||
m.PushAction(mdb.REMOVE).Action(mdb.INSERT)
|
|
||||||
case 2:
|
|
||||||
m.Cmdy(mdb.SELECT, m.PrefixKey(), kit.KeyHash(arg[0], kit.KeyHash(arg[1])), mdb.LIST, ice.OptionFields("time,index"))
|
|
||||||
m.Action("add")
|
|
||||||
}
|
|
||||||
}},
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
var _river_template = kit.Dict(
|
|
||||||
"base", kit.Dict(
|
|
||||||
"draw", kit.List(
|
|
||||||
"web.wiki.draw",
|
|
||||||
"web.wiki.data",
|
|
||||||
"web.wiki.word",
|
|
||||||
),
|
|
||||||
"term", kit.List(
|
|
||||||
"web.code.xterm",
|
|
||||||
"web.code.vimer",
|
|
||||||
"web.chat.iframe",
|
|
||||||
),
|
|
||||||
"task", kit.List(
|
|
||||||
"web.team.task",
|
|
||||||
"web.team.plan",
|
|
||||||
"web.mall.asset",
|
|
||||||
"web.mall.salary",
|
|
||||||
"web.wiki.word",
|
|
||||||
),
|
|
||||||
"scan", kit.List(
|
|
||||||
"web.chat.scan",
|
|
||||||
"web.chat.paste",
|
|
||||||
"web.chat.files",
|
|
||||||
"web.chat.location",
|
|
||||||
"web.chat.meet.miss",
|
|
||||||
"web.wiki.feel",
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
@ -30,7 +30,7 @@ func init() {
|
|||||||
).ProcessHold()
|
).ProcessHold()
|
||||||
web.ToastSuccess(m, SEND)
|
web.ToastSuccess(m, SEND)
|
||||||
}},
|
}},
|
||||||
ice.RUN: {Name: "run", Help: "执行", Hand: func(m *ice.Message, arg ...string) {
|
ctx.RUN: {Name: "run", Help: "执行", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Option(ice.POD, m.Option("_pod"))
|
m.Option(ice.POD, m.Option("_pod"))
|
||||||
m.Option(ice.MSG_USERPOD, m.Option("_pod"))
|
m.Option(ice.MSG_USERPOD, m.Option("_pod"))
|
||||||
if aaa.Right(m, arg) && !ctx.PodCmd(m, arg) {
|
if aaa.Right(m, arg) && !ctx.PodCmd(m, arg) {
|
||||||
|
@ -8,6 +8,7 @@ import (
|
|||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
|
"shylinux.com/x/icebergs/base/ctx"
|
||||||
"shylinux.com/x/icebergs/base/lex"
|
"shylinux.com/x/icebergs/base/lex"
|
||||||
"shylinux.com/x/icebergs/base/mdb"
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
"shylinux.com/x/icebergs/base/nfs"
|
"shylinux.com/x/icebergs/base/nfs"
|
||||||
@ -59,7 +60,7 @@ func init() {
|
|||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
BENCH: {Name: "bench zone id auto insert", Help: "压测", Actions: ice.MergeActions(ice.Actions{
|
BENCH: {Name: "bench zone id auto insert", Help: "压测", Actions: ice.MergeActions(ice.Actions{
|
||||||
mdb.INSERT: {Name: "insert zone*=demo type*=http,redis name=demo text*='http://localhost:9020/chat/cmd/run/web.chat.favor' nconn=10 nreqs=100"},
|
mdb.INSERT: {Name: "insert zone*=demo type*=http,redis name=demo text*='http://localhost:9020/chat/cmd/run/web.chat.favor' nconn=10 nreqs=100"},
|
||||||
ice.RUN: {Hand: func(m *ice.Message, arg ...string) {
|
ctx.RUN: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
switch m.Option(mdb.TYPE) {
|
switch m.Option(mdb.TYPE) {
|
||||||
case HTTP:
|
case HTTP:
|
||||||
_bench_http(m, m.Option(mdb.TEXT))
|
_bench_http(m, m.Option(mdb.TEXT))
|
||||||
@ -68,7 +69,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
}, mdb.ZoneAction(mdb.FIELD, "time,id,type,name,text,nconn,nreqs")), Hand: func(m *ice.Message, arg ...string) {
|
}, mdb.ZoneAction(mdb.FIELD, "time,id,type,name,text,nconn,nreqs")), Hand: func(m *ice.Message, arg ...string) {
|
||||||
mdb.ZoneSelect(m, arg...).PushAction(kit.Select(ice.RUN, mdb.REMOVE, len(arg) == 0))
|
mdb.ZoneSelect(m, arg...).PushAction(kit.Select(ctx.RUN, mdb.REMOVE, len(arg) == 0))
|
||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package code
|
|||||||
import (
|
import (
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
"shylinux.com/x/icebergs/base/cli"
|
"shylinux.com/x/icebergs/base/cli"
|
||||||
|
"shylinux.com/x/icebergs/base/ctx"
|
||||||
"shylinux.com/x/icebergs/base/mdb"
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
"shylinux.com/x/icebergs/base/nfs"
|
"shylinux.com/x/icebergs/base/nfs"
|
||||||
"shylinux.com/x/icebergs/base/web"
|
"shylinux.com/x/icebergs/base/web"
|
||||||
@ -33,7 +34,7 @@ func init() {
|
|||||||
m.StatusTimeCount(ice.SUCCESS, success)
|
m.StatusTimeCount(ice.SUCCESS, success)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if res := kit.UnMarshal(m.Cmdx("", ice.RUN)); m.Option(ice.RES) != "" {
|
if res := kit.UnMarshal(m.Cmdx("", ctx.RUN)); m.Option(ice.RES) != "" {
|
||||||
for k, v := range kit.KeyValue(nil, "", kit.UnMarshal(m.Option(ice.RES))) {
|
for k, v := range kit.KeyValue(nil, "", kit.UnMarshal(m.Option(ice.RES))) {
|
||||||
if v != kit.Value(res, k) {
|
if v != kit.Value(res, k) {
|
||||||
m.Echo(kit.Formats(res))
|
m.Echo(kit.Formats(res))
|
||||||
@ -43,7 +44,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
m.Echo(ice.OK)
|
m.Echo(ice.OK)
|
||||||
}},
|
}},
|
||||||
ice.RUN: {Hand: func(m *ice.Message, arg ...string) {
|
ctx.RUN: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Option(web.SPIDE_HEADER, web.ContentType, web.ApplicationJSON, web.UserAgent, "Mozilla/5.0")
|
m.Option(web.SPIDE_HEADER, web.ContentType, web.ApplicationJSON, web.UserAgent, "Mozilla/5.0")
|
||||||
m.Cmdy(web.SPIDE, m.Option(ice.DEV), web.SPIDE_RAW, m.Option(ice.CMD), m.Option(cli.API), web.SPIDE_DATA, m.Option(ice.ARG)).ProcessInner()
|
m.Cmdy(web.SPIDE, m.Option(ice.DEV), web.SPIDE_RAW, m.Option(ice.CMD), m.Option(cli.API), web.SPIDE_DATA, m.Option(ice.ARG)).ProcessInner()
|
||||||
m.StatusTime(nfs.SCRIPT, `curl "`+kit.MergeURL2(m.Cmd(web.SPIDE, m.Option(ice.DEV)).Append(web.CLIENT_ORIGIN), m.Option(cli.API))+`" -H "Content-Type: application/json"`+` -d '`+m.Option(ice.ARG)+`'`)
|
m.StatusTime(nfs.SCRIPT, `curl "`+kit.MergeURL2(m.Cmd(web.SPIDE, m.Option(ice.DEV)).Append(web.CLIENT_ORIGIN), m.Option(cli.API))+`" -H "Content-Type: application/json"`+` -d '`+m.Option(ice.ARG)+`'`)
|
||||||
@ -52,7 +53,7 @@ func init() {
|
|||||||
if len(arg) == 0 {
|
if len(arg) == 0 {
|
||||||
m.Cmdy(web.SPIDE).RenameAppend(web.CLIENT_NAME, ice.DEV, web.CLIENT_URL, "address")
|
m.Cmdy(web.SPIDE).RenameAppend(web.CLIENT_NAME, ice.DEV, web.CLIENT_URL, "address")
|
||||||
} else if mdb.ZoneSelect(m, arg[1:]...); len(arg) > 1 {
|
} else if mdb.ZoneSelect(m, arg[1:]...); len(arg) > 1 {
|
||||||
m.PushAction(ice.RUN, cli.CHECK).Action(cli.CHECK)
|
m.PushAction(ctx.RUN, cli.CHECK).Action(cli.CHECK)
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
|
@ -58,8 +58,8 @@ func init() {
|
|||||||
PLAN: {Name: "plan scale=month,day,week,month,year,long begin_time@date list prev next", Icon: "usr/icons/Calendar.png", Help: "计划表", Actions: ice.MergeActions(ice.Actions{
|
PLAN: {Name: "plan scale=month,day,week,month,year,long begin_time@date list prev next", Icon: "usr/icons/Calendar.png", Help: "计划表", Actions: ice.MergeActions(ice.Actions{
|
||||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(TODO, mdb.INPUTS, arg) }},
|
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(TODO, mdb.INPUTS, arg) }},
|
||||||
mdb.PLUGIN: {Name: "plugin extra.index extra.args", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(TASK, mdb.MODIFY, arg) }},
|
mdb.PLUGIN: {Name: "plugin extra.index extra.args", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(TASK, mdb.MODIFY, arg) }},
|
||||||
ice.RUN: {Hand: func(m *ice.Message, arg ...string) {
|
ctx.RUN: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
if m.RenameOption(TASK_POD, ice.POD); ctx.PodCmd(m, m.PrefixKey(), ice.RUN, arg) {
|
if m.RenameOption(TASK_POD, ice.POD); ctx.PodCmd(m, m.PrefixKey(), ctx.RUN, arg) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if cmd := m.CmdAppend(TASK, kit.Slice(arg, 0, 2), ctx.INDEX); cmd != "" {
|
if cmd := m.CmdAppend(TASK, kit.Slice(arg, 0, 2), ctx.INDEX); cmd != "" {
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
|
"shylinux.com/x/icebergs/base/ctx"
|
||||||
kit "shylinux.com/x/toolkits"
|
kit "shylinux.com/x/toolkits"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -50,7 +51,7 @@ const TABLE = "table"
|
|||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
TABLE: {Name: "table text", Help: "表格", Actions: ice.MergeActions(ice.Actions{
|
TABLE: {Name: "table text", Help: "表格", Actions: ice.MergeActions(ice.Actions{
|
||||||
ice.RUN: {Hand: func(m *ice.Message, arg ...string) { _table_run(m, arg...) }},
|
ctx.RUN: {Hand: func(m *ice.Message, arg ...string) { _table_run(m, arg...) }},
|
||||||
}), Hand: func(m *ice.Message, arg ...string) { _table_show(m, arg[0], arg[1:]...) }},
|
}), Hand: func(m *ice.Message, arg ...string) { _table_show(m, arg[0], arg[1:]...) }},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ func init() {
|
|||||||
FAVOR: {Name: "favor zone id auto insert", Help: "收藏夹", Actions: ice.MergeActions(ice.Actions{
|
FAVOR: {Name: "favor zone id auto insert", Help: "收藏夹", Actions: ice.MergeActions(ice.Actions{
|
||||||
mdb.INSERT: {Name: "insert zone*=demo type=shell name=1 text=pwd pwd=/home"},
|
mdb.INSERT: {Name: "insert zone*=demo type=shell name=1 text=pwd pwd=/home"},
|
||||||
cli.SYSTEM: {Hand: func(m *ice.Message, arg ...string) {
|
cli.SYSTEM: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
if len(arg) > 0 && arg[0] == ice.RUN {
|
if len(arg) > 0 && arg[0] == ctx.RUN {
|
||||||
if msg := mdb.ZoneSelect(m.Spawn(), m.Option(mdb.ZONE), m.Option(mdb.ID)); nfs.Exists(m, msg.Append(cli.PWD)) {
|
if msg := mdb.ZoneSelect(m.Spawn(), m.Option(mdb.ZONE), m.Option(mdb.ID)); nfs.Exists(m, msg.Append(cli.PWD)) {
|
||||||
m.Option(cli.CMD_DIR, msg.Append(cli.PWD))
|
m.Option(cli.CMD_DIR, msg.Append(cli.PWD))
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ func init() {
|
|||||||
_run_action(m, cmd, m.Results(), arg...)
|
_run_action(m, cmd, m.Results(), arg...)
|
||||||
})
|
})
|
||||||
}},
|
}},
|
||||||
ice.RUN: {Hand: func(m *ice.Message, arg ...string) {
|
ctx.RUN: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
if !ctx.PodCmd(m, arg) && aaa.Right(m, arg) {
|
if !ctx.PodCmd(m, arg) && aaa.Right(m, arg) {
|
||||||
m.Cmdy(arg)
|
m.Cmdy(arg)
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ func init() {
|
|||||||
SYNC: {Name: "sync id auto page export import", Help: "同步流", Actions: ice.MergeActions(ice.Actions{
|
SYNC: {Name: "sync id auto page export import", Help: "同步流", Actions: ice.MergeActions(ice.Actions{
|
||||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(FAVOR, mdb.INPUTS, arg) }},
|
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(FAVOR, mdb.INPUTS, arg) }},
|
||||||
cli.SYSTEM: {Hand: func(m *ice.Message, arg ...string) {
|
cli.SYSTEM: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
if len(arg) > 0 && arg[0] == ice.RUN {
|
if len(arg) > 0 && arg[0] == ctx.RUN {
|
||||||
if msg := mdb.ListSelect(m.Spawn(), m.Option(mdb.ID)); nfs.Exists(m, msg.Append(cli.PWD)) {
|
if msg := mdb.ListSelect(m.Spawn(), m.Option(mdb.ID)); nfs.Exists(m, msg.Append(cli.PWD)) {
|
||||||
m.Option(cli.CMD_DIR, msg.Append(cli.PWD))
|
m.Option(cli.CMD_DIR, msg.Append(cli.PWD))
|
||||||
}
|
}
|
||||||
|
@ -304,7 +304,7 @@ func _repos_total(m *ice.Message, p string, repos *git.Repository, stats map[str
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func _repos_inner(m *ice.Message, _repos_path func(m *ice.Message, p string, arg ...string) string, arg ...string) {
|
func _repos_inner(m *ice.Message, _repos_path func(m *ice.Message, p string, arg ...string) string, arg ...string) {
|
||||||
if len(arg) == 0 || arg[0] != ice.RUN {
|
if len(arg) == 0 || arg[0] != ctx.RUN {
|
||||||
arg = []string{path.Join(arg[:3]...) + nfs.PS, kit.Select("README.md", arg, 3)}
|
arg = []string{path.Join(arg[:3]...) + nfs.PS, kit.Select("README.md", arg, 3)}
|
||||||
} else if kit.Select("", arg, 1) != ctx.ACTION {
|
} else if kit.Select("", arg, 1) != ctx.ACTION {
|
||||||
if ls := kit.Split(path.Join(m.Option(nfs.DIR_ROOT), arg[1]), nfs.PS); len(ls) < 2 || ls[2] == INDEX {
|
if ls := kit.Split(path.Join(m.Option(nfs.DIR_ROOT), arg[1]), nfs.PS); len(ls) < 2 || ls[2] == INDEX {
|
||||||
|
2
type.go
2
type.go
@ -174,7 +174,7 @@ func (c *Context) Merge(s *Context) *Context {
|
|||||||
kit.If(action.List == nil, func() { action.List = SplitCmd(action.Name, nil) })
|
kit.If(action.List == nil, func() { action.List = SplitCmd(action.Name, nil) })
|
||||||
kit.If(len(action.List) > 0, func() { cmd.Meta[sub] = action.List })
|
kit.If(len(action.List) > 0, func() { cmd.Meta[sub] = action.List })
|
||||||
}
|
}
|
||||||
kit.If(cmd.Name == "", func() { cmd.Name = "list list" })
|
kit.If(cmd.Name == "", func() { cmd.Name = "list auto" })
|
||||||
kit.If(strings.HasPrefix(cmd.Name, "list"), func() { cmd.Name = strings.Replace(cmd.Name, "list", key, 1) })
|
kit.If(strings.HasPrefix(cmd.Name, "list"), func() { cmd.Name = strings.Replace(cmd.Name, "list", key, 1) })
|
||||||
kit.If(cmd.List == nil, func() { cmd.List = SplitCmd(cmd.Name, cmd.Actions) })
|
kit.If(cmd.List == nil, func() { cmd.List = SplitCmd(cmd.Name, cmd.Actions) })
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user