1
0
forked from x/icebergs

opt search

This commit is contained in:
shylinux 2021-01-06 09:12:42 +08:00
parent 31258f51ca
commit 9c190ee746
21 changed files with 347 additions and 90 deletions

View File

@ -2,12 +2,28 @@ package ctx
import (
ice "github.com/shylinux/icebergs"
"github.com/shylinux/icebergs/base/mdb"
kit "github.com/shylinux/toolkits"
"sort"
"strings"
)
func _command_search(m *ice.Message, arg ...string) {
ice.Pulse.Travel(func(p *ice.Context, s *ice.Context, key string, cmd *ice.Command) {
if strings.HasPrefix(key, "_") || strings.HasPrefix(key, "/") {
return
}
if arg[1] != "" && arg[1] != key && arg[1] != s.Name {
return
}
if arg[2] != "" && !strings.Contains(kit.Format(cmd.Name), arg[2]) && !strings.Contains(kit.Format(cmd.Help), arg[2]) {
return
}
m.PushSearch("cmd", "command", "type", arg[0], "name", key, "text", s.Cap(ice.CTX_FOLLOW))
})
}
func _command_list(m *ice.Message, name string) {
p := m.Spawn(m.Source())
if name != "" {
@ -45,7 +61,11 @@ const COMMAND = "command"
func init() {
Index.Merge(&ice.Context{
Commands: map[string]*ice.Command{
COMMAND: {Name: "command key auto", Help: "命令", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
COMMAND: {Name: "command key auto", Help: "命令", Action: map[string]*ice.Action{
mdb.SEARCH: {Name: "search type name text", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
_command_search(m, arg[0], arg[1], arg[2])
}},
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
_command_list(m, strings.Join(arg, "."))
}},
},

View File

@ -3,52 +3,12 @@ package ctx
import (
ice "github.com/shylinux/icebergs"
"github.com/shylinux/icebergs/base/mdb"
kit "github.com/shylinux/toolkits"
"strings"
)
var Index = &ice.Context{Name: "ctx", Help: "配置模块",
Commands: map[string]*ice.Command{
ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
m.Cmd(mdb.SEARCH, mdb.CREATE, COMMAND, m.AddCmd(&ice.Command{Hand: func(m *ice.Message, c *ice.Context, cc string, arg ...string) {
arg = arg[1:]
fields := kit.Split(m.Option(mdb.FIELDS))
ice.Pulse.Travel(func(p *ice.Context, s *ice.Context, key string, cmd *ice.Command) {
if strings.HasPrefix(key, "_") || strings.HasPrefix(key, "/") {
return
}
if arg[1] != "" && arg[1] != key && arg[1] != s.Name {
return
}
if arg[2] != "" && !strings.Contains(kit.Format(cmd.Name), arg[2]) && !strings.Contains(kit.Format(cmd.Help), arg[2]) {
return
}
for _, k := range fields {
switch k {
case kit.SSH_POD:
m.Push(k, m.Option(ice.MSG_USERPOD))
case kit.SSH_CTX:
m.Push(k, m.Prefix())
case kit.SSH_CMD:
m.Push(k, "_")
case kit.MDB_TIME:
m.Push(k, m.Time())
case kit.MDB_SIZE:
m.Push(k, len(cmd.List))
case kit.MDB_TYPE:
m.Push(k, COMMAND)
case kit.MDB_NAME:
m.Push(k, key)
case kit.MDB_TEXT:
m.Push(k, s.Cap(ice.CTX_FOLLOW))
default:
m.Push(k, "")
}
}
})
}}))
m.Cmd(mdb.SEARCH, mdb.CREATE, COMMAND, m.Prefix(COMMAND))
}},
ice.CTX_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {}},
},

View File

@ -30,7 +30,7 @@ func init() {
if strings.Contains(arg[1], ";") {
arg = strings.Split(arg[1], ";")
}
m.Option(FIELDS, kit.Select("pod,ctx,cmd,time,size,type,name,text", m.Option(FIELDS)))
m.Option(FIELDS, kit.Select("pod,ctx,cmd,time,size,type,name,text", kit.Select(m.Option(FIELDS), arg, 2)))
for _, k := range strings.Split(arg[0], ",") {
m.Richs(SEARCH, nil, k, func(key string, value map[string]interface{}) {
m.Cmdy(kit.Keys(value[kit.MDB_TEXT], value[kit.MDB_NAME]), SEARCH, arg[0], arg[1], kit.Select("", arg, 2))

View File

@ -270,14 +270,7 @@ func _file_search(m *ice.Message, kind, name, text string, arg ...string) {
ext = value["type"]
}
m.Push("pod", m.Option("pod"))
m.Push("ctx", "nfs")
m.Push("cmd", FILE)
m.Push(kit.MDB_TIME, value["time"])
m.Push(kit.MDB_SIZE, value["size"])
m.Push(kit.MDB_TYPE, ext)
m.Push(kit.MDB_NAME, value["path"])
m.Push(kit.MDB_TEXT, "")
m.PushSearch("cmd", FILE, "time", value["time"], "size", value["size"], "type", ext, "name", value["path"], "text", "")
})
}
@ -353,6 +346,7 @@ var Index = &ice.Context{Name: "nfs", Help: "存储模块",
_file_list(m, arg[2], arg[1], 0, m.Option(DIR_DEEP) == "true", kit.Select(TYPE_BOTH, m.Option(DIR_TYPE)),
nil, []string{"time", "size", "type", "path"})
}},
"upload": {Name: "upload", Help: "上传", Hand: func(m *ice.Message, arg ...string) {
up := kit.Simple(m.Optionv(ice.MSG_UPLOAD))
@ -373,6 +367,13 @@ var Index = &ice.Context{Name: "nfs", Help: "存储模块",
m.Sort(kit.MDB_TIME, "time_r")
}},
FILE: {Name: "file path auto", Help: "文件", Action: map[string]*ice.Action{
mdb.SEARCH: {Name: "search type name text", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
_file_search(m, arg[0], arg[1], arg[2], arg[3:]...)
}},
mdb.RENDER: {Name: "render type name text", Help: "渲染", Hand: func(m *ice.Message, arg ...string) {
_file_show(m, path.Join(arg[2], arg[1]))
}},
"append": {Name: "append", Help: "追加", Hand: func(m *ice.Message, arg ...string) {
if strings.Contains(arg[0], "/") {
os.MkdirAll(path.Dir(arg[0]), ice.MOD_DIR)
@ -388,13 +389,6 @@ var Index = &ice.Context{Name: "nfs", Help: "存储模块",
}
}
}},
mdb.SEARCH: {Name: "search type name text", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
_file_search(m, arg[0], arg[1], arg[2], arg[3:]...)
}},
mdb.RENDER: {Name: "render type name text", Help: "渲染", Hand: func(m *ice.Message, arg ...string) {
_file_show(m, path.Join(arg[2], arg[1]))
}},
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
if len(arg) == 0 || strings.HasSuffix(arg[0], "/") {
m.Cmdy(DIR, arg)

View File

@ -174,7 +174,7 @@ func _space_handle(m *ice.Message, safe bool, send map[string]*ice.Message, c *w
func _space_search(m *ice.Message, kind, name, text string, arg ...string) {
m.Richs(SPACE, nil, kit.MDB_FOREACH, func(key string, val map[string]interface{}) {
if val = kit.GetMeta(val); strings.Contains(kit.Format(val["name"]), name) {
m.PushSearch("cmd", SPACE, val)
m.PushSearch("cmd", SPACE, "type", val["type"], "name", val["name"], "text", kit.MergeURL(m.Option(ice.MSG_USERWEB), "pod", val["name"]))
}
})
}

View File

@ -3,6 +3,7 @@ package chat
import (
ice "github.com/shylinux/icebergs"
"github.com/shylinux/icebergs/base/aaa"
"github.com/shylinux/icebergs/base/mdb"
"github.com/shylinux/icebergs/base/web"
kit "github.com/shylinux/toolkits"
)
@ -12,6 +13,7 @@ const CHAT = "chat"
var Index = &ice.Context{Name: CHAT, Help: "聊天中心",
Commands: map[string]*ice.Command{
ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
m.Cmd(mdb.SEARCH, mdb.CREATE, EMAIL, m.Prefix(EMAIL))
m.Load()
m.Cmd(web.SERVE, aaa.WHITE, "header", "river", "action", "footer")

27
core/chat/email.go Normal file
View File

@ -0,0 +1,27 @@
package chat
import (
ice "github.com/shylinux/icebergs"
"github.com/shylinux/icebergs/base/mdb"
kit "github.com/shylinux/toolkits"
)
func _email_show(m *ice.Message, name, text string, arg ...string) {
}
func _email_search(m *ice.Message, kind, name, text string) {
m.PushSearch("cmd", EMAIL, "type", "163", "name", name, "text", kit.MergeURL("https://mail.163.com"))
}
const EMAIL = "email"
func init() {
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
EMAIL: {Name: "email [name] word", Help: "百度", Action: map[string]*ice.Action{
mdb.SEARCH: {Name: "search type name text", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
_email_search(m, arg[0], arg[1], arg[2])
}},
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
_email_show(m, arg[0], kit.Select(arg[0], arg[1]), arg[2:]...)
}},
}})
}

View File

@ -36,6 +36,9 @@ func init() {
m.Echo(aaa.UserRole(m, m.Option("who")))
}},
"background": {Name: "background", Help: "背景图片", Hand: func(m *ice.Message, arg ...string) {
m.Option("background", m.Conf(HEADER, "background", arg[0]))
}},
"pack": {Name: "pack", Help: "打包", Hand: func(m *ice.Message, arg ...string) {
m.Cmdy("web.code.webpack", "create")
}},
@ -43,6 +46,7 @@ func init() {
m.Cmdy("web.chat.wx.access", "config")
}},
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
m.Option("background", m.Conf(HEADER, "background"))
m.Echo(m.Conf(HEADER, TITLE))
}},
},

54
core/code/csdn.go Normal file
View File

@ -0,0 +1,54 @@
package code
import (
ice "github.com/shylinux/icebergs"
"github.com/shylinux/icebergs/base/mdb"
kit "github.com/shylinux/toolkits"
"strings"
)
func _csdn_show(m *ice.Message, name, text string, arg ...string) {
}
func _csdn_search(m *ice.Message, kind, name, text string) {
if !strings.Contains(kind, "*") && !strings.Contains(kind, "csdn") {
return
}
m.PushSearch("cmd", CSDN, "type", "csdn", "name", name, "text",
kit.MergeURL("https://so.csdn.net/so/search/all", "q", name))
m.PushSearch("cmd", CSDN, "type", "juejin", "name", name, "text",
kit.MergeURL("https://juejin.cn/search?type=all", "query", name))
m.PushSearch("cmd", CSDN, "type", "51cto", "name", name, "text",
kit.MergeURL("http://so.51cto.com/?sort=time", "keywords", name))
m.PushSearch("cmd", CSDN, "type", "oschina", "name", name, "text",
kit.MergeURL("https://www.oschina.net/search?scope=project", "q", name))
m.PushSearch("cmd", CSDN, "type", "imooc", "name", name, "text",
kit.MergeURL("https://www.imooc.com/search/", "words", name))
m.PushSearch("cmd", CSDN, "type", "segmentfault", "name", name, "text",
kit.MergeURL("https://segmentfault.com/search", "q", name))
m.PushSearch("cmd", CSDN, "type", "nowcoder", "name", name, "text",
kit.MergeURL("https://www.nowcoder.com/search?type=all", "query", name))
m.PushSearch("cmd", CSDN, "type", "leetcode-cn", "name", name, "text",
kit.MergeURL("https://leetcode-cn.com/problemset/all/", "search", name))
}
const CSDN = "csdn"
func init() {
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
CSDN: {Name: "csdn [name] word", Help: "百度", Action: map[string]*ice.Action{
mdb.SEARCH: {Name: "search type name text", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
_csdn_search(m, arg[0], arg[1], arg[2])
}},
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
_csdn_show(m, arg[0], kit.Select(arg[0], arg[1]), arg[2:]...)
}},
}})
}

28
core/code/github.go Normal file
View File

@ -0,0 +1,28 @@
package code
import (
ice "github.com/shylinux/icebergs"
"github.com/shylinux/icebergs/base/mdb"
kit "github.com/shylinux/toolkits"
)
func _github_show(m *ice.Message, name, text string, arg ...string) {
}
func _github_search(m *ice.Message, kind, name, text string) {
m.PushSearch("cmd", GITHUB, "type", "github", "name", name, "text",
kit.MergeURL("https://github.com/search", "q", name))
}
const GITHUB = "github"
func init() {
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
GITHUB: {Name: "github [name] word", Help: "百度", Action: map[string]*ice.Action{
mdb.SEARCH: {Name: "search type name text", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
_github_search(m, arg[0], arg[1], arg[2])
}},
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
_github_show(m, arg[0], kit.Select(arg[0], arg[1]), arg[2:]...)
}},
}})
}

30
core/mall/beike.go Normal file
View File

@ -0,0 +1,30 @@
package mall
import (
ice "github.com/shylinux/icebergs"
"github.com/shylinux/icebergs/base/mdb"
kit "github.com/shylinux/toolkits"
"net/url"
)
func _beike_show(m *ice.Message, name, text string, arg ...string) {
}
func _beike_search(m *ice.Message, kind, name, text string) {
m.PushSearch("cmd", BEIKE, "type", kind, "name", name, "text",
kit.MergeURL("https://ke.com/ershoufang/rs"+url.QueryEscape(name)))
}
const BEIKE = "beike"
func init() {
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
BEIKE: {Name: "beike [name] word", Help: "百度", Action: map[string]*ice.Action{
mdb.SEARCH: {Name: "search type name text", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
_beike_search(m, arg[0], arg[1], arg[2])
}},
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
_beike_show(m, arg[0], kit.Select(arg[0], arg[1]), arg[2:]...)
}},
}})
}

View File

@ -9,7 +9,9 @@ const MALL = "mall"
var Index = &ice.Context{Name: MALL, Help: "贸易中心",
Commands: map[string]*ice.Command{
ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { m.Load() }},
ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
m.Load()
}},
ice.CTX_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { m.Save() }},
},
}

27
core/mall/taobao.go Normal file
View File

@ -0,0 +1,27 @@
package mall
import (
ice "github.com/shylinux/icebergs"
"github.com/shylinux/icebergs/base/mdb"
kit "github.com/shylinux/toolkits"
)
func _taobao_show(m *ice.Message, name, text string, arg ...string) {
}
func _taobao_search(m *ice.Message, kind, name, text string) {
m.PushSearch("cmd", TAOBAO, "type", kind, "name", name, "text", kit.MergeURL("https://s.taobao.com/search", "q", name))
}
const TAOBAO = "taobao"
func init() {
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
TAOBAO: {Name: "taobao [name] word", Help: "百度", Action: map[string]*ice.Action{
mdb.SEARCH: {Name: "search type name text", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
_taobao_search(m, arg[0], arg[1], arg[2])
}},
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
_taobao_show(m, arg[0], kit.Select(arg[0], arg[1]), arg[2:]...)
}},
}})
}

50
core/wiki/baidu.go Normal file
View File

@ -0,0 +1,50 @@
package wiki
import (
ice "github.com/shylinux/icebergs"
"github.com/shylinux/icebergs/base/mdb"
kit "github.com/shylinux/toolkits"
"net/url"
"strings"
)
func _baidu_show(m *ice.Message, name, text string, arg ...string) {
_option(m, BAIDU, name, text, arg...)
// m.Cmdy(mdb.RENDER, web.RENDER.Frame, kit.Format("https://baidu.com/s?wd=%s", text))
}
func _baidu_search(m *ice.Message, kind, name, text string) {
if !strings.Contains(kind, "*") && !strings.Contains(kind, "baidu") {
return
}
m.PushSearch("cmd", BAIDU, "type", "web", "name", name, "text",
kit.MergeURL("https://www.baidu.com/s", "wd", name))
m.PushSearch("cmd", BAIDU, "type", "map", "name", name, "text",
kit.MergeURL("https://map.baidu.com/search?querytype=s", "wd", name))
m.PushSearch("cmd", BAIDU, "type", "zhihu", "name", name, "text",
kit.MergeURL("https://www.zhihu.com/search?type=content", "q", name))
m.PushSearch("cmd", BAIDU, "type", "weibo", "name", name, "text",
kit.MergeURL("https://s.weibo.com/weibo/"+url.QueryEscape(name)))
m.PushSearch("cmd", BAIDU, "type", "taotiao", "name", name, "text",
kit.MergeURL("https://www.toutiao.com/search/", "keyword", name))
}
const BAIDU = "baidu"
func init() {
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
BAIDU: {Name: "baidu [name] word", Help: "百度", Action: map[string]*ice.Action{
mdb.SEARCH: {Name: "search type name text", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
_baidu_search(m, arg[0], arg[1], arg[2])
}},
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
arg = _name(m, arg)
_baidu_show(m, arg[0], kit.Select(arg[0], arg[1]), arg[2:]...)
}},
}})
}

View File

@ -16,12 +16,15 @@ func init() {
)},
},
Commands: map[string]*ice.Command{
FEEL: {Name: "feel path auto choose@chooseImage upload 上一页 下一页 下载 参数", Help: "影音媒体", Meta: kit.Dict(
FEEL: {Name: "feel path auto choose@chooseImage upload 上一页 下一页 下载 参数 background", Help: "影音媒体", Meta: kit.Dict(
"display", "/plugin/local/wiki/feel.js",
), Action: map[string]*ice.Action{
"choose": {Name: "choose", Help: "本机照片", Hand: func(m *ice.Message, arg ...string) {
_wiki_upload(m, FEEL, m.Option(kit.MDB_PATH))
}},
"background": {Name: "background", Help: "背景", Hand: func(m *ice.Message, arg ...string) {
m.Conf("web.chat.header", "background")
}},
web.UPLOAD: {Name: "upload", Help: "上传", Hand: func(m *ice.Message, arg ...string) {
_wiki_upload(m, FEEL, m.Option(kit.MDB_PATH))
}},

30
core/wiki/music.go Normal file
View File

@ -0,0 +1,30 @@
package wiki
import (
ice "github.com/shylinux/icebergs"
"github.com/shylinux/icebergs/base/mdb"
kit "github.com/shylinux/toolkits"
)
func _music_show(m *ice.Message, name, text string, arg ...string) {
_option(m, MUSIC, name, text, arg...)
}
func _music_search(m *ice.Message, kind, name, text string) {
m.PushSearch("cmd", MUSIC, "type", "163", "name", name, "text",
kit.MergeURL("https://music.163.com/#/search/m/", "s", name))
}
const MUSIC = "music"
func init() {
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
MUSIC: {Name: "music [name] url", Help: "视频", Action: map[string]*ice.Action{
mdb.SEARCH: {Name: "search type name text", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
_music_search(m, arg[0], arg[1], arg[2])
}},
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
arg = _name(m, arg)
_music_show(m, arg[0], kit.Select(arg[0], arg[1]), arg[2:]...)
}},
}})
}

43
core/wiki/video.go Normal file
View File

@ -0,0 +1,43 @@
package wiki
import (
ice "github.com/shylinux/icebergs"
"github.com/shylinux/icebergs/base/mdb"
kit "github.com/shylinux/toolkits"
"net/url"
)
func _video_show(m *ice.Message, name, text string, arg ...string) {
_option(m, VIDEO, name, text, arg...)
m.Render(ice.RENDER_TEMPLATE, m.Conf(VIDEO, "meta.template"))
}
func _video_search(m *ice.Message, kind, name, text string) {
m.PushSearch("cmd", VIDEO, "type", "v", "name", name, "text",
kit.MergeURL("https://v.qq.com/x/search/", "q", name))
m.PushSearch("cmd", VIDEO, "type", "iqiyi", "name", name, "text",
kit.MergeURL("https://so.iqiyi.com/so/q_"+url.QueryEscape(name)))
m.PushSearch("cmd", VIDEO, "type", "kuaishou", "name", name, "text",
kit.MergeURL("https://video.kuaishou.com/search", "searchKey", name))
m.PushSearch("cmd", VIDEO, "type", "bilibili", "name", name, "text",
kit.MergeURL("https://search.bilibili.com/all", "keyword", name))
}
const VIDEO = "video"
func init() {
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
VIDEO: {Name: "video [name] url", Help: "视频", Action: map[string]*ice.Action{
mdb.SEARCH: {Name: "search type name text", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
_video_search(m, arg[0], arg[1], arg[2])
}},
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
arg = _name(m, arg)
_video_show(m, arg[0], kit.Select(arg[0], arg[1]), arg[2:]...)
}},
}})
}

View File

@ -2,6 +2,7 @@ package wiki
import (
ice "github.com/shylinux/icebergs"
"github.com/shylinux/icebergs/base/mdb"
"github.com/shylinux/icebergs/base/nfs"
"github.com/shylinux/icebergs/base/web"
kit "github.com/shylinux/toolkits"
@ -53,7 +54,11 @@ const WIKI = "wiki"
var Index = &ice.Context{Name: WIKI, Help: "文档中心",
Commands: map[string]*ice.Command{
ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { m.Load() }},
ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
m.Cmd(mdb.SEARCH, mdb.CREATE, VIDEO, m.Prefix(VIDEO))
m.Cmd(mdb.SEARCH, mdb.CREATE, MUSIC, m.Prefix(MUSIC))
m.Load()
}},
ice.CTX_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { m.Save() }},
},
}

View File

@ -271,14 +271,6 @@ func _image_show(m *ice.Message, name, text string, arg ...string) {
_option(m, IMAGE, name, text, arg...)
m.Render(ice.RENDER_TEMPLATE, m.Conf(IMAGE, "meta.template"))
}
func _video_show(m *ice.Message, name, text string, arg ...string) {
_option(m, VIDEO, name, text, arg...)
m.Render(ice.RENDER_TEMPLATE, m.Conf(VIDEO, "meta.template"))
}
func _baidu_show(m *ice.Message, name, text string, arg ...string) {
_option(m, BAIDU, name, text, arg...)
// m.Cmdy(mdb.RENDER, web.RENDER.Frame, kit.Format("https://baidu.com/s?wd=%s", text))
}
func _other_show(m *ice.Message, name, text string, arg ...string) {
_option(m, OTHER, name, text, arg...)
// m.Cmdy(mdb.RENDER, web.RENDER.Frame, text)
@ -309,9 +301,7 @@ const (
ORDER = "order"
TABLE = "table"
IMAGE = "image"
VIDEO = "video"
BAIDU = "baidu"
OTHER = "other"
PREMENU = "premenu"
@ -442,15 +432,7 @@ func init() {
_image_show(m, arg[0], kit.Select(arg[0], arg[1]), arg[2:]...)
m.Render("")
}},
VIDEO: {Name: "video [name] url", Help: "视频", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
arg = _name(m, arg)
_video_show(m, arg[0], kit.Select(arg[0], arg[1]), arg[2:]...)
}},
BAIDU: {Name: "baidu [name] word", Help: "百度", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
arg = _name(m, arg)
_baidu_show(m, arg[0], kit.Select(arg[0], arg[1]), arg[2:]...)
}},
OTHER: {Name: "other [name] url", Help: "网页", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
arg = _name(m, arg)
_other_show(m, arg[0], kit.Select(arg[0], arg[1]), arg[2:]...)

4
go.sum
View File

@ -1,11 +1,13 @@
github.com/AaronO/go-git-http v0.0.0-20161214145340-1d9485b3a98f/go.mod h1:+6Yuq73F9068Na+mSBNXCvyuxvgw4f/g5ii40e3U8Sc=
github.com/Baozisoftware/qrcode-terminal-go v0.0.0-20170407111555-c0650d8dff0f h1:2dk3eOnYllh+wUOuDhOoC2vUVoJF/5z478ryJ+wzEII=
github.com/Baozisoftware/qrcode-terminal-go v0.0.0-20170407111555-c0650d8dff0f/go.mod h1:4a58ifQTEe2uwwsaqbh3i2un5/CBPg+At/qHpt18Tmk=
github.com/creack/pty v1.1.7 h1:6pwm8kMQKCmgUg0ZHTm5+/YvRK0s3THD/28+T6/kk4A=
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/google/uuid v1.1.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/pty v1.1.8 h1:AkaSdXYQOWeaO3neb8EM634ahkXXe3jYbVh/F9lq+GI=
github.com/kr/pty v1.1.8/go.mod h1:O1sed60cT9XZ5uDucP5qwvh+TE3NnUj51EiZO/lmSfw=
github.com/maruel/rs v0.0.0-20150922171536-2c81c4312fe4/go.mod h1:kcRFpEzolcEklV6rD7W95mG49/sbdX/PlFmd7ni3RvA=
github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8=
@ -22,6 +24,7 @@ github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e/go.mod h1:XV66xRDq
github.com/tuotoo/qrcode v0.0.0-20190222102259-ac9c44189bf2/go.mod h1:lPnW9HVS0vJdeYyQtOvIvlXgZPNhUAhwz+z5r8AJk0Y=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20201208171446-5f87f3452ae9 h1:sYNJzB4J8toYPQTM6pAkcmBRgw9SnQKP9oXCHfgy604=
golang.org/x/crypto v0.0.0-20201208171446-5f87f3452ae9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@ -30,5 +33,6 @@ golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae h1:/WDfKMnPU+m5M4xB+6x4kaepxRw6jWvR5iDRdvjHgy8=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221 h1:/ZHdbVpdR/jk3g30/d4yUL0JU9kksj8+F/bnQUVLGDM=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=

12
misc.go
View File

@ -115,17 +115,9 @@ func (m *Message) PushSearch(args ...interface{}) {
case kit.SSH_CMD:
m.Push(k, data[kit.SSH_CMD])
case kit.MDB_TIME:
m.Push(k, m.Time())
case kit.MDB_SIZE:
m.Push(k, "")
case kit.MDB_TYPE:
m.Push(k, data[kit.MDB_TYPE])
case kit.MDB_NAME:
m.Push(k, data[kit.MDB_NAME])
case kit.MDB_TEXT:
m.Push(k, data[kit.MDB_TEXT])
m.Push(k, kit.Select(m.Time(), data[kit.MDB_TIME]))
default:
m.Push(k, data[k])
m.Push(k, kit.Select("", data[k]))
}
}
}