forked from x/icebergs
opt footer.js
This commit is contained in:
parent
1a79b2edcd
commit
eed11c051a
@ -51,35 +51,39 @@ func _action_exec(m *ice.Message, river, storm, index string, arg ...string) {
|
|||||||
m.Cmdy(cmds, arg) // 执行命令
|
m.Cmdy(cmds, arg) // 执行命令
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
func _action_auth(m, msg *ice.Message) bool {
|
||||||
|
if m.Warn(kit.Time() > kit.Time(msg.Append(mdb.TIME)), ice.ErrNotValid) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
m.Log_AUTH(
|
||||||
|
aaa.USERROLE, m.Option(ice.MSG_USERROLE, msg.Append(aaa.USERROLE)),
|
||||||
|
aaa.USERNAME, m.Option(ice.MSG_USERNAME, msg.Append(aaa.USERNAME)),
|
||||||
|
aaa.USERNICK, m.Option(ice.MSG_USERNICK, msg.Append(aaa.USERNICK)),
|
||||||
|
RIVER, m.Option(ice.MSG_RIVER, msg.Append(RIVER)),
|
||||||
|
STORM, m.Option(ice.MSG_STORM, msg.Append(STORM)),
|
||||||
|
)
|
||||||
|
return _action_right(m, msg.Append(web.RIVER), msg.Append(web.STORM))
|
||||||
|
}
|
||||||
func _action_share(m *ice.Message, arg ...string) {
|
func _action_share(m *ice.Message, arg ...string) {
|
||||||
switch msg := m.Cmd(web.SHARE, arg[0]); msg.Append(mdb.TYPE) {
|
switch msg := m.Cmd(web.SHARE, arg[0]); msg.Append(mdb.TYPE) {
|
||||||
case web.STORM:
|
case web.STORM:
|
||||||
if m.Warn(kit.Time() > kit.Time(msg.Append(mdb.TIME)), ice.ErrNotValid, arg) {
|
if !_action_auth(m, msg) {
|
||||||
break // 分享超时
|
break // 没有授权
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(arg) == 1 {
|
if len(arg) == 1 {
|
||||||
_action_list(m, msg.Append(web.RIVER), msg.Append(web.STORM))
|
_action_list(m, msg.Append(web.RIVER), msg.Append(web.STORM))
|
||||||
break // 命令列表
|
break // 命令列表
|
||||||
}
|
}
|
||||||
|
|
||||||
m.Log_AUTH(
|
|
||||||
aaa.USERROLE, m.Option(ice.MSG_USERROLE, msg.Append(aaa.USERROLE)),
|
|
||||||
aaa.USERNAME, m.Option(ice.MSG_USERNAME, msg.Append(aaa.USERNAME)),
|
|
||||||
aaa.USERNICK, m.Option(ice.MSG_USERNICK, msg.Append(aaa.USERNICK)),
|
|
||||||
RIVER, m.Option(ice.MSG_RIVER, msg.Append(RIVER)),
|
|
||||||
STORM, m.Option(ice.MSG_STORM, msg.Append(STORM)),
|
|
||||||
)
|
|
||||||
if !_action_right(m, msg.Append(web.RIVER), msg.Append(web.STORM)) {
|
|
||||||
break // 没有授权
|
|
||||||
}
|
|
||||||
|
|
||||||
// 执行命令
|
// 执行命令
|
||||||
_action_exec(m, msg.Append(web.RIVER), msg.Append(web.STORM), arg[1], arg[2:]...)
|
_action_exec(m, msg.Append(web.RIVER), msg.Append(web.STORM), arg[1], arg[2:]...)
|
||||||
|
|
||||||
case web.FIELD:
|
case web.FIELD:
|
||||||
if m.Warn(kit.Time() > kit.Time(msg.Append(mdb.TIME)), ice.ErrNotValid, arg) {
|
if !_action_auth(m, msg) {
|
||||||
break // 分享超时
|
break // 没有授权
|
||||||
}
|
}
|
||||||
|
|
||||||
if arg[0] = msg.Append(mdb.NAME); len(arg) == 1 {
|
if arg[0] = msg.Append(mdb.NAME); len(arg) == 1 {
|
||||||
m.Push(TITLE, msg.Append(TITLE))
|
m.Push(TITLE, msg.Append(TITLE))
|
||||||
m.Push(TOPIC, msg.Append(TOPIC))
|
m.Push(TOPIC, msg.Append(TOPIC))
|
||||||
@ -88,17 +92,6 @@ func _action_share(m *ice.Message, arg ...string) {
|
|||||||
break // 命令列表
|
break // 命令列表
|
||||||
}
|
}
|
||||||
|
|
||||||
m.Log_AUTH(
|
|
||||||
aaa.USERROLE, m.Option(ice.MSG_USERROLE, msg.Append(aaa.USERROLE)),
|
|
||||||
aaa.USERNAME, m.Option(ice.MSG_USERNAME, msg.Append(aaa.USERNAME)),
|
|
||||||
aaa.USERNICK, m.Option(ice.MSG_USERNICK, msg.Append(aaa.USERNICK)),
|
|
||||||
RIVER, m.Option(ice.MSG_RIVER, msg.Append(RIVER)),
|
|
||||||
STORM, m.Option(ice.MSG_STORM, msg.Append(STORM)),
|
|
||||||
)
|
|
||||||
if !_action_right(m, msg.Append(web.RIVER), msg.Append(web.STORM)) {
|
|
||||||
break // 没有授权
|
|
||||||
}
|
|
||||||
|
|
||||||
if _action_domain(m, arg[1]); m.Option(ice.MSG_UPLOAD) != "" {
|
if _action_domain(m, arg[1]); m.Option(ice.MSG_UPLOAD) != "" {
|
||||||
_action_upload(m) // 上传文件
|
_action_upload(m) // 上传文件
|
||||||
}
|
}
|
||||||
@ -153,10 +146,8 @@ const (
|
|||||||
const ACTION = "action"
|
const ACTION = "action"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
||||||
ACTION: {Name: ACTION, Help: "应用", Value: kit.Data(nfs.PATH, ice.USR_LOCAL_RIVER)},
|
web.P(ACTION): {Name: "/action river storm action arg...", Help: "工作台", Action: ice.MergeAction(map[string]*ice.Action{
|
||||||
}, Commands: map[string]*ice.Command{
|
|
||||||
"/action": {Name: "/action river storm action arg...", Help: "工作台", Action: ice.MergeAction(map[string]*ice.Action{
|
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
for _, cmd := range []string{
|
for _, cmd := range []string{
|
||||||
"web.chat.meet.miss",
|
"web.chat.meet.miss",
|
||||||
@ -185,7 +176,7 @@ func init() {
|
|||||||
"_share": {Name: "_share", Help: "共享", Hand: func(m *ice.Message, arg ...string) {
|
"_share": {Name: "_share", Help: "共享", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_action_share(m, arg...)
|
_action_share(m, arg...)
|
||||||
}},
|
}},
|
||||||
}, ctx.CmdAction()), Hand: func(m *ice.Message, arg ...string) {
|
}, ctx.CmdAction(nfs.PATH, ice.USR_LOCAL_RIVER)), 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 // 没有登录
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ 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/ctx"
|
||||||
|
"shylinux.com/x/icebergs/base/web"
|
||||||
kit "shylinux.com/x/toolkits"
|
kit "shylinux.com/x/toolkits"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -14,11 +15,9 @@ const FOOTER = "footer"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
||||||
FOOTER: {Name: FOOTER, Help: "状态栏", Value: kit.Dict(
|
FOOTER: {Name: FOOTER, Help: "状态栏", Value: kit.Dict(LEGAL, kit.List(`<a href="mailto:shylinuxc@gmail.com">shylinuxc@gmail.com</a>`))},
|
||||||
LEGAL, kit.List(`<a href="mailto:shylinuxc@gmail.com">shylinuxc@gmail.com</a>`),
|
|
||||||
)},
|
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: map[string]*ice.Command{
|
||||||
"/footer": {Name: "/footer", Help: "状态栏", Action: ice.MergeAction(map[string]*ice.Action{
|
web.P(FOOTER): {Name: "/footer", Help: "状态栏", Action: ice.MergeAction(map[string]*ice.Action{
|
||||||
ice.RUN: {Name: "run", Help: "执行", Hand: func(m *ice.Message, arg ...string) {
|
ice.RUN: {Name: "run", Help: "执行", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if m.Cmdy(arg); m.Result(1) == ice.ErrNotFound {
|
if m.Cmdy(arg); m.Result(1) == ice.ErrNotFound {
|
||||||
m.Set(ice.MSG_RESULT).Cmdy(cli.SYSTEM, arg)
|
m.Set(ice.MSG_RESULT).Cmdy(cli.SYSTEM, arg)
|
||||||
|
@ -85,7 +85,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
m.Warn(m.Option(ice.MSG_USERNAME) == "", ice.ErrNotLogin, arg)
|
m.Warn(m.Option(ice.MSG_USERNAME) == "", ice.ErrNotLogin, arg)
|
||||||
}},
|
}},
|
||||||
"/header": {Name: "/header", Help: "标题栏", Action: map[string]*ice.Action{
|
web.P(HEADER): {Name: "/header", Help: "标题栏", Action: map[string]*ice.Action{
|
||||||
AGENT: {Name: "agent", Help: "宿主应用", Hand: func(m *ice.Message, arg ...string) {
|
AGENT: {Name: "agent", Help: "宿主应用", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_header_agent(m, arg...)
|
_header_agent(m, arg...)
|
||||||
}},
|
}},
|
||||||
@ -159,8 +159,6 @@ func init() {
|
|||||||
GRANT: {Name: "grant space", Help: "授权", Hand: func(m *ice.Message, arg ...string) {
|
GRANT: {Name: "grant space", Help: "授权", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_header_grant(m, arg...)
|
_header_grant(m, arg...)
|
||||||
}},
|
}},
|
||||||
}, Hand: func(m *ice.Message, arg ...string) {
|
}, Hand: func(m *ice.Message, arg ...string) {}},
|
||||||
|
|
||||||
}},
|
|
||||||
}})
|
}})
|
||||||
}
|
}
|
||||||
|
@ -1,41 +1,18 @@
|
|||||||
package chat
|
package chat
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strings"
|
|
||||||
|
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
"shylinux.com/x/icebergs/base/ctx"
|
"shylinux.com/x/icebergs/base/ctx"
|
||||||
"shylinux.com/x/icebergs/base/mdb"
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
kit "shylinux.com/x/toolkits"
|
"shylinux.com/x/icebergs/base/web"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const SEARCH = "search"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
||||||
"search": {Name: "search", Help: "搜索", Value: kit.Data(mdb.SHORT, mdb.NAME)},
|
web.P(SEARCH): {Name: "/search", Help: "搜索引擎", Action: ctx.CmdAction(mdb.SHORT, mdb.NAME), Hand: func(m *ice.Message, arg ...string) {
|
||||||
}, Commands: map[string]*ice.Command{
|
m.Cmdy(m.Space(m.Option(ice.POD)), mdb.SEARCH, arg).StatusTimeCount()
|
||||||
"/search": {Name: "/search", Help: "搜索引擎", Action: ice.MergeAction(map[string]*ice.Action{
|
|
||||||
mdb.SEARCH: {Name: "search type name text", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
m.Richs("/search", "", mdb.FOREACH, func(key string, value ice.Map) {
|
|
||||||
if value = kit.GetMeta(value); arg[1] != "" && !kit.Contains(value[mdb.NAME], arg[1]) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
m.PushSearch(ice.CMD, "/search", value)
|
|
||||||
})
|
|
||||||
}},
|
|
||||||
mdb.RENDER: {Name: "render", Help: "渲染", Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
m.Cmdy(m.Space(m.Option(ice.POD)), mdb.RENDER, arg[1:])
|
|
||||||
}},
|
|
||||||
}, ctx.CmdAction()), Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
if kit.Contains(arg[1], ";") {
|
|
||||||
arg = kit.Split(arg[1], ";", ";", ";")
|
|
||||||
}
|
|
||||||
defer m.StatusTimeCount()
|
|
||||||
arg[1] = strings.TrimSpace(arg[1])
|
|
||||||
if m.Cmdy(m.Space(m.Option(ice.POD)), mdb.SEARCH, arg); arg[1] == "" {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
m.Cmd(mdb.INSERT, m.PrefixKey(), "", mdb.HASH,
|
|
||||||
mdb.NAME, arg[1], mdb.TYPE, arg[0], mdb.TEXT, kit.Select("", arg, 2))
|
|
||||||
}},
|
}},
|
||||||
}})
|
}})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user