forked from x/icebergs
opt feel
This commit is contained in:
parent
11cff19070
commit
40838d0045
@ -264,11 +264,10 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const FAVOR = "favor"
|
const FAVOR = "favor"
|
||||||
const ( // TYPE
|
|
||||||
TYPE_SPIDE = "spide"
|
|
||||||
TYPE_SPACE = "space"
|
|
||||||
TYPE_STORY = "story"
|
|
||||||
|
|
||||||
|
const PLUGIN = "plugin"
|
||||||
|
|
||||||
|
const ( // TYPE
|
||||||
TYPE_RIVER = "river"
|
TYPE_RIVER = "river"
|
||||||
TYPE_STORM = "storm"
|
TYPE_STORM = "storm"
|
||||||
TYPE_ACTION = "action"
|
TYPE_ACTION = "action"
|
||||||
@ -303,6 +302,7 @@ func init() {
|
|||||||
_favor_create(m, arg[0])
|
_favor_create(m, arg[0])
|
||||||
}},
|
}},
|
||||||
mdb.INSERT: {Name: "insert zone type name text", Help: "插入", Hand: func(m *ice.Message, arg ...string) {
|
mdb.INSERT: {Name: "insert zone type name text", Help: "插入", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
_favor_create(m, arg[0])
|
||||||
_favor_insert(m, arg[0], arg[1], arg[2], kit.Select("", arg, 3))
|
_favor_insert(m, arg[0], arg[1], arg[2], kit.Select("", arg, 3))
|
||||||
}},
|
}},
|
||||||
mdb.MODIFY: {Name: "modify key value old", Help: "编辑", Hand: func(m *ice.Message, arg ...string) {
|
mdb.MODIFY: {Name: "modify key value old", Help: "编辑", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
@ -8,6 +8,7 @@ import (
|
|||||||
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@ -55,6 +56,9 @@ func Render(msg *ice.Message, cmd string, args ...interface{}) {
|
|||||||
case ice.RENDER_DOWNLOAD:
|
case ice.RENDER_DOWNLOAD:
|
||||||
msg.W.Header().Set("Content-Disposition", fmt.Sprintf("filename=%s", kit.Select(path.Base(arg[0]), arg, 2)))
|
msg.W.Header().Set("Content-Disposition", fmt.Sprintf("filename=%s", kit.Select(path.Base(arg[0]), arg, 2)))
|
||||||
msg.W.Header().Set("Content-Type", kit.Select("text/html", arg, 1))
|
msg.W.Header().Set("Content-Type", kit.Select("text/html", arg, 1))
|
||||||
|
if _, e := os.Stat(arg[0]); e != nil {
|
||||||
|
arg[0] = "/" + arg[0]
|
||||||
|
}
|
||||||
http.ServeFile(msg.W, msg.R, arg[0])
|
http.ServeFile(msg.W, msg.R, arg[0])
|
||||||
|
|
||||||
case ice.RENDER_RESULT:
|
case ice.RENDER_RESULT:
|
||||||
|
@ -260,7 +260,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch value[kit.MDB_TYPE] {
|
switch value[kit.MDB_TYPE] {
|
||||||
case TYPE_STORY:
|
case STORY:
|
||||||
value = _share_story(m, value, arg...)
|
value = _share_story(m, value, arg...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ func init() {
|
|||||||
_space_send(m, arg[0], arg[1:]...)
|
_space_send(m, arg[0], arg[1:]...)
|
||||||
}},
|
}},
|
||||||
|
|
||||||
"/space/": {Name: "/space/", Help: "空间站", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
"/space/": {Name: "/space/ type name", Help: "空间站", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
if s, e := websocket.Upgrade(m.W, m.R, nil, m.Confi(SPACE, "meta.buffer.r"), m.Confi(SPACE, "meta.buffer.w")); m.Assert(e) {
|
if s, e := websocket.Upgrade(m.W, m.R, nil, m.Confi(SPACE, "meta.buffer.r"), m.Confi(SPACE, "meta.buffer.w")); m.Assert(e) {
|
||||||
name := m.Option(kit.MDB_NAME, strings.Replace(kit.Select(m.Option(ice.MSG_USERADDR), m.Option(kit.MDB_NAME)), ".", "_", -1))
|
name := m.Option(kit.MDB_NAME, strings.Replace(kit.Select(m.Option(ice.MSG_USERADDR), m.Option(kit.MDB_NAME)), ".", "_", -1))
|
||||||
kind := kit.Select(WORKER, m.Option(kit.MDB_TYPE))
|
kind := kit.Select(WORKER, m.Option(kit.MDB_TYPE))
|
||||||
|
@ -47,7 +47,7 @@ func _spide_login(m *ice.Message, name string) {
|
|||||||
}
|
}
|
||||||
if msg.Result() != "" {
|
if msg.Result() != "" {
|
||||||
kit.Value(value, "client.login", msg.Result())
|
kit.Value(value, "client.login", msg.Result())
|
||||||
kit.Value(value, "client.share", m.Cmdx(SHARE, TYPE_SPIDE, name,
|
kit.Value(value, "client.share", m.Cmdx(SHARE, SPIDE, name,
|
||||||
kit.Format("%s?sessid=%s", kit.Value(value, "client.url"), kit.Value(value, "cookie.sessid"))))
|
kit.Format("%s?sessid=%s", kit.Value(value, "client.url"), kit.Value(value, "cookie.sessid"))))
|
||||||
}
|
}
|
||||||
m.Render(ice.RENDER_QRCODE, kit.Dict(
|
m.Render(ice.RENDER_QRCODE, kit.Dict(
|
||||||
@ -70,7 +70,7 @@ func _spide_create(m *ice.Message, name, address string, arg ...string) {
|
|||||||
dir, file := path.Split(uri.EscapedPath())
|
dir, file := path.Split(uri.EscapedPath())
|
||||||
m.Rich(SPIDE, nil, kit.Dict(
|
m.Rich(SPIDE, nil, kit.Dict(
|
||||||
"cookie", kit.Dict(), "header", kit.Dict(), "client", kit.Dict(
|
"cookie", kit.Dict(), "header", kit.Dict(), "client", kit.Dict(
|
||||||
"share", ShareCreate(m.Spawn(), TYPE_SPIDE, name, address),
|
"share", ShareCreate(m.Spawn(), SPIDE, name, address),
|
||||||
"name", name, "url", address, "method", "POST",
|
"name", name, "url", address, "method", "POST",
|
||||||
"protocol", uri.Scheme, "hostname", uri.Host,
|
"protocol", uri.Scheme, "hostname", uri.Host,
|
||||||
"path", dir, "file", file, "query", uri.RawQuery,
|
"path", dir, "file", file, "query", uri.RawQuery,
|
||||||
|
@ -91,7 +91,7 @@ func _pprof_show(m *ice.Message, zone string, id string) {
|
|||||||
m.Cmd(cli.DAEMON, m.Confv(PPROF, "meta.pprof"), "-http="+p, val[BINNARY], msg.Append(kit.MDB_TEXT))
|
m.Cmd(cli.DAEMON, m.Confv(PPROF, "meta.pprof"), "-http="+p, val[BINNARY], msg.Append(kit.MDB_TEXT))
|
||||||
|
|
||||||
url := "http://" + p + "/ui/top"
|
url := "http://" + p + "/ui/top"
|
||||||
m.Cmd(web.FAVOR, favor, web.TYPE_SPIDE, url, msg.Append(kit.MDB_TEXT))
|
m.Cmd(web.FAVOR, favor, web.SPIDE, url, msg.Append(kit.MDB_TEXT))
|
||||||
m.Set(ice.MSG_RESULT).Echo(url).Echo(" \n").Echo("\n")
|
m.Set(ice.MSG_RESULT).Echo(url).Echo(" \n").Echo("\n")
|
||||||
m.Echo(strings.Join(list, "\n")).Echo("\n")
|
m.Echo(strings.Join(list, "\n")).Echo("\n")
|
||||||
|
|
||||||
|
@ -15,20 +15,19 @@ func _feel_show(m *ice.Message, name string, arg ...string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const FEEL = "feel"
|
const FEEL = "feel"
|
||||||
const (
|
const FeelPlugin = "/plugin/local/wiki/feel.js"
|
||||||
FeelPlugin = "/plugin/local/wiki/feel.js"
|
|
||||||
)
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Name: "feel", Help: "影音媒体",
|
Index.Merge(&ice.Context{Name: "feel", Help: "影音媒体",
|
||||||
Configs: map[string]*ice.Config{
|
Configs: map[string]*ice.Config{
|
||||||
FEEL: {Name: "feel", Help: "影音媒体", Value: kit.Data(
|
FEEL: {Name: "feel", Help: "影音媒体", Value: kit.Data(
|
||||||
kit.MDB_SHORT, "name", "path", "", "regs", ".*.(qrc|png|jpg|JPG|MOV|m4v)",
|
kit.MDB_SHORT, "name", "path", "", "regs", ".*.(qrc|png|jpg|JPG|MOV|m4v)",
|
||||||
|
"height", "600", "page.limit", "3",
|
||||||
)},
|
)},
|
||||||
},
|
},
|
||||||
Commands: map[string]*ice.Command{
|
Commands: map[string]*ice.Command{
|
||||||
FEEL: {Name: "feel path=auto auto", Help: "影音媒体", Meta: kit.Dict(
|
FEEL: {Name: "feel path=auto auto", Help: "影音媒体", Meta: kit.Dict(
|
||||||
mdb.PLUGIN, FeelPlugin, "detail", []string{"标签", "删除"},
|
web.PLUGIN, FeelPlugin, "detail", []string{"标签", "删除"},
|
||||||
), Action: map[string]*ice.Action{
|
), Action: map[string]*ice.Action{
|
||||||
mdb.CREATE: {Name: "create", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
|
mdb.CREATE: {Name: "create", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Conf(FEEL, kit.Keys(path.Base(arg[2]), "-2"), arg[3])
|
m.Conf(FEEL, kit.Keys(path.Base(arg[2]), "-2"), arg[3])
|
||||||
@ -44,6 +43,9 @@ func init() {
|
|||||||
_wiki_upload(m, FEEL)
|
_wiki_upload(m, FEEL)
|
||||||
}},
|
}},
|
||||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
|
m.Option("prefix", m.Conf(FEEL, "meta.path"))
|
||||||
|
m.Option("height", m.Conf(FEEL, "meta.height"))
|
||||||
|
m.Option("limit", m.Conf(FEEL, "meta.page.limit"))
|
||||||
if !_wiki_list(m, FEEL, kit.Select("./", arg, 0)) {
|
if !_wiki_list(m, FEEL, kit.Select("./", arg, 0)) {
|
||||||
_feel_show(m, arg[0])
|
_feel_show(m, arg[0])
|
||||||
}
|
}
|
||||||
|
@ -16,13 +16,11 @@ func _wiki_list(m *ice.Message, cmd, name string, arg ...string) bool {
|
|||||||
if strings.HasSuffix(name, "/") {
|
if strings.HasSuffix(name, "/") {
|
||||||
m.Option(nfs.DIR_ROOT, m.Conf(cmd, "meta.path"))
|
m.Option(nfs.DIR_ROOT, m.Conf(cmd, "meta.path"))
|
||||||
m.Option(nfs.DIR_TYPE, nfs.TYPE_DIR)
|
m.Option(nfs.DIR_TYPE, nfs.TYPE_DIR)
|
||||||
m.Cmdy(nfs.DIR, name)
|
m.Cmdy(nfs.DIR, name, "time size path")
|
||||||
|
|
||||||
m.Option(nfs.DIR_TYPE, nfs.TYPE_FILE)
|
m.Option(nfs.DIR_TYPE, nfs.TYPE_FILE)
|
||||||
m.Option(nfs.DIR_REG, m.Conf(cmd, "meta.regs"))
|
m.Option(nfs.DIR_REG, m.Conf(cmd, "meta.regs"))
|
||||||
m.Cmdy(nfs.DIR, name)
|
m.Cmdy(nfs.DIR, name, "time size path")
|
||||||
|
|
||||||
m.Option("_display", "table")
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
@ -64,10 +62,8 @@ var Index = &ice.Context{Name: "wiki", Help: "文档中心",
|
|||||||
},
|
},
|
||||||
Commands: map[string]*ice.Command{
|
Commands: map[string]*ice.Command{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
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) {
|
ice.CTX_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
m.Save("feel")
|
|
||||||
}},
|
}},
|
||||||
|
|
||||||
"walk": {Name: "walk path=@province auto", Help: "走遍世界", Meta: kit.Dict("display", "local/wiki/walk"), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
"walk": {Name: "walk path=@province auto", Help: "走遍世界", Meta: kit.Dict("display", "local/wiki/walk"), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
|
@ -2,19 +2,36 @@ package crx
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/shylinux/icebergs"
|
"github.com/shylinux/icebergs"
|
||||||
|
"github.com/shylinux/icebergs/base/mdb"
|
||||||
"github.com/shylinux/icebergs/base/web"
|
"github.com/shylinux/icebergs/base/web"
|
||||||
"github.com/shylinux/icebergs/core/code"
|
"github.com/shylinux/icebergs/core/code"
|
||||||
"github.com/shylinux/toolkits"
|
"github.com/shylinux/toolkits"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const CHROME = "chrome"
|
||||||
|
|
||||||
var Index = &ice.Context{Name: "chrome", Help: "浏览器",
|
var Index = &ice.Context{Name: "chrome", Help: "浏览器",
|
||||||
Caches: map[string]*ice.Cache{},
|
|
||||||
Configs: map[string]*ice.Config{
|
Configs: map[string]*ice.Config{
|
||||||
"chrome": {Name: "chrome", Help: "chrome", Value: kit.Data(kit.MDB_SHORT, "name", "history", "url.history")},
|
CHROME: {Name: "chrome", Help: "浏览器", Value: kit.Data(
|
||||||
|
kit.MDB_SHORT, "name", web.FAVOR, "url.history",
|
||||||
|
)},
|
||||||
},
|
},
|
||||||
Commands: map[string]*ice.Command{
|
Commands: map[string]*ice.Command{
|
||||||
|
"/crx": {Name: "/crx", Help: "/crx", Action: map[string]*ice.Action{
|
||||||
|
"history": {Name: "history", Help: "历史记录", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
m.Cmdy(web.SPIDE, "dev", "/code/chrome/favor", "cmds", "insert", "name", arg[1], "note", arg[2],
|
||||||
|
"tab", m.Conf(CHROME, "meta.favor"), "sid", m.Option("sid"))
|
||||||
|
}},
|
||||||
|
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
|
}},
|
||||||
|
"/favor": {Name: "/favor", Help: "收藏", Action: map[string]*ice.Action{
|
||||||
|
mdb.INSERT: {Name: "insert", Help: "插入", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
m.Cmdy(web.FAVOR, mdb.INSERT, m.Option("tab"), web.SPIDE, m.Option("name"), m.Option("note"))
|
||||||
|
}},
|
||||||
|
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
|
}},
|
||||||
|
|
||||||
"chrome": {Name: "chrome", Help: "浏览器", List: kit.List(
|
CHROME: {Name: "chrome", Help: "浏览器", List: kit.List(
|
||||||
kit.MDB_INPUT, "text", "name", "name", "action", "auto",
|
kit.MDB_INPUT, "text", "name", "name", "action", "auto",
|
||||||
kit.MDB_INPUT, "text", "name", "wid", "action", "auto",
|
kit.MDB_INPUT, "text", "name", "wid", "action", "auto",
|
||||||
kit.MDB_INPUT, "text", "name", "url",
|
kit.MDB_INPUT, "text", "name", "url",
|
||||||
@ -76,48 +93,6 @@ var Index = &ice.Context{Name: "chrome", Help: "浏览器",
|
|||||||
// 下发命令
|
// 下发命令
|
||||||
m.Cmdy(web.SPACE, arg[0], "bookmark", arg[1:])
|
m.Cmdy(web.SPACE, arg[0], "bookmark", arg[1:])
|
||||||
}},
|
}},
|
||||||
|
|
||||||
web.LOGIN: {Name: "_login", Help: "_login", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
|
||||||
m.Option("you", "")
|
|
||||||
m.Richs("login", nil, m.Option("sid"), func(key string, value map[string]interface{}) {
|
|
||||||
// 查找空间
|
|
||||||
m.Option("you", value["you"])
|
|
||||||
})
|
|
||||||
|
|
||||||
m.Info("%s %s cmd: %v sub: %v", m.Option("you"), m.Option(ice.MSG_USERURL), m.Optionv("cmds"), m.Optionv("sub"))
|
|
||||||
}},
|
|
||||||
"/help": {Name: "/help", Help: "帮助", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
|
||||||
m.Cmdy("help")
|
|
||||||
}},
|
|
||||||
"/login": {Name: "/login", Help: "登录", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
|
||||||
m.Cmdy("login", "init", c.Name)
|
|
||||||
}},
|
|
||||||
"/logout": {Name: "/logout", Help: "登出", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
|
||||||
m.Cmdy("login", "exit")
|
|
||||||
}},
|
|
||||||
|
|
||||||
"/favor": {Name: "/favor", Help: "收藏", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
|
||||||
if len(arg) > 0 {
|
|
||||||
// 添加收藏
|
|
||||||
web.FavorInsert(m, m.Option("tab"), web.TYPE_SPIDE, m.Option("note"), arg[0])
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}},
|
|
||||||
|
|
||||||
"/crx": {Name: "/crx", Help: "/crx", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
|
||||||
switch arg[0] {
|
|
||||||
case "login":
|
|
||||||
m.Cmdy(web.SPIDE, "dev", "msg", "/code/chrome/login", "sid", m.Option("sid"))
|
|
||||||
|
|
||||||
case "bookmark":
|
|
||||||
m.Cmdy(web.SPIDE, "dev", "/code/chrome/favor", "cmds", arg[2], "note", arg[3],
|
|
||||||
"tab", kit.Select(m.Conf("chrome", "meta.history"), arg, 4), "sid", m.Option("sid"), "type", "spide")
|
|
||||||
|
|
||||||
case "history":
|
|
||||||
m.Cmdy(web.SPIDE, "dev", "/code/chrome/favor", "cmds", arg[2], "note", arg[3],
|
|
||||||
"tab", m.Conf("chrome", "meta.history"), "sid", m.Option("sid"))
|
|
||||||
}
|
|
||||||
}},
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user