mirror of
https://shylinux.com/x/icebergs
synced 2025-04-26 01:24:05 +08:00
opt chrome
This commit is contained in:
parent
cfdced2a57
commit
7fcbb658a3
@ -13,7 +13,7 @@ import (
|
||||
|
||||
type cache struct {
|
||||
ice.Hash
|
||||
operate
|
||||
daemon
|
||||
|
||||
short string `data:"link"`
|
||||
field string `data:"show,count,total,value,hash,type,name,link"`
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
|
||||
type change struct {
|
||||
ice.Hash
|
||||
operate
|
||||
daemon
|
||||
|
||||
short string `data:"property"`
|
||||
list string `name:"list wid tid selector:text@key property:textarea@key auto export import" help:"编辑"`
|
||||
|
@ -6,7 +6,6 @@ import (
|
||||
|
||||
type chrome struct {
|
||||
ice.Code
|
||||
|
||||
source string `data:"https://mirrors.tencent.com/tinycorelinux/4.x/x86/tcz/src/chromium-browser/chromium-22.0.1229.79.tar.xz"`
|
||||
list string `name:"list path auto order build download" help:"源码"`
|
||||
}
|
||||
|
66
misc/chrome/daemon.go
Normal file
66
misc/chrome/daemon.go
Normal file
@ -0,0 +1,66 @@
|
||||
package chrome
|
||||
|
||||
import (
|
||||
"shylinux.com/x/ice"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/web"
|
||||
"shylinux.com/x/icebergs/core/wiki"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
type daemon struct {
|
||||
reload string `name:"reload" help:"刷新"`
|
||||
list string `name:"list wid tid url auto" help:"操作"`
|
||||
}
|
||||
|
||||
func (s daemon) send(m *ice.Message, arg ...ice.Any) *ice.Message {
|
||||
return m.Cmdy(web.SPACE, "chrome", "chrome", arg)
|
||||
}
|
||||
|
||||
func (s daemon) Inputs(m *ice.Message, arg ...string) {
|
||||
switch arg[0] {
|
||||
case mdb.ZONE:
|
||||
s.send(m.Spawn()).Tables(func(value ice.Maps) {
|
||||
s.send(m.Spawn(), value[WID]).Tables(func(value ice.Maps) { m.Push(mdb.ZONE, kit.ParseURL(value[URL]).Host) })
|
||||
}).Sort(mdb.ZONE)
|
||||
}
|
||||
}
|
||||
func (s daemon) Spide(m *ice.Message, arg ...string) {
|
||||
if len(arg) < 2 {
|
||||
s.send(m, arg)
|
||||
return
|
||||
}
|
||||
s.send(m, arg[:2], "spide").Tables(func(value ice.Maps) {
|
||||
switch value[mdb.TYPE] {
|
||||
case wiki.VIDEO:
|
||||
m.PushVideos(mdb.SHOW, value[mdb.LINK])
|
||||
case wiki.IMG:
|
||||
m.PushImages(mdb.SHOW, value[mdb.LINK])
|
||||
default:
|
||||
m.Push(mdb.SHOW, "")
|
||||
}
|
||||
}).Cut("show,type,name,link")
|
||||
}
|
||||
func (s daemon) Reload(m *ice.Message, arg ...string) {
|
||||
s.send(m, arg[:2], "user.reload", ice.TRUE).ProcessHold()
|
||||
}
|
||||
func (s daemon) List(m *ice.Message, arg ...string) {
|
||||
switch len(arg) {
|
||||
case 3:
|
||||
s.send(m, arg[:2], "user.jumps", arg[2])
|
||||
case 2:
|
||||
s.Spide(m, arg...)
|
||||
m.Action(s.Reload)
|
||||
default:
|
||||
s.send(m, arg)
|
||||
}
|
||||
m.StatusTimeCount()
|
||||
}
|
||||
|
||||
const (
|
||||
WID = "wid"
|
||||
TID = "tid"
|
||||
URL = "url"
|
||||
)
|
||||
|
||||
func init() { ice.CodeCtxCmd(daemon{}) }
|
@ -6,24 +6,15 @@ import (
|
||||
|
||||
type favor struct {
|
||||
ice.Zone
|
||||
|
||||
short string `data:"zone"`
|
||||
field string `data:"time,id,type,name,link"`
|
||||
insert string `name:"insert zone=官网文档 type name=hi link=hello" help:"添加"`
|
||||
list string `name:"list zone id auto" help:"收载"`
|
||||
insert string `name:"insert zone*=官网文档 type name=hi link=*hello"`
|
||||
list string `name:"list zone id auto insert" help:"收藏"`
|
||||
}
|
||||
|
||||
func (f favor) Inputs(m *ice.Message, arg ...string) {
|
||||
f.Zone.Inputs(m, arg...)
|
||||
}
|
||||
func (f favor) Insert(m *ice.Message, arg ...string) {
|
||||
f.Zone.Insert(m, arg...)
|
||||
}
|
||||
func (f favor) List(m *ice.Message, arg ...string) {
|
||||
if f.Zone.List(m, arg...); len(arg) == 0 {
|
||||
m.Action(f.Insert, f.Export, f.Import)
|
||||
} else if len(arg) == 1 {
|
||||
m.Action(f.Insert)
|
||||
m.Action(f.Export, f.Import)
|
||||
}
|
||||
}
|
||||
func init() { ice.CodeCtxCmd(favor{}) }
|
||||
|
@ -10,27 +10,25 @@ import (
|
||||
|
||||
type field struct {
|
||||
ice.Zone
|
||||
operate
|
||||
daemon
|
||||
|
||||
short string `data:"zone"`
|
||||
field string `data:"time,id,index,args,style,left,top,right,bottom,selection"`
|
||||
insert string `name:"insert zone=golang.google.cn index=cli.system args=pwd" help:"添加"`
|
||||
insert string `name:"insert zone=golang.google.cn index=cli.system args=pwd"`
|
||||
list string `name:"list zone id auto insert" help:"插件"`
|
||||
}
|
||||
|
||||
func (f field) Inputs(m *ice.Message, arg ...string) {
|
||||
f.operate.Inputs(m, arg...)
|
||||
f.daemon.Inputs(m, arg...)
|
||||
}
|
||||
func (f field) Command(m *ice.Message, arg ...string) {
|
||||
m.OptionFields("")
|
||||
f.Zone.List(m.Spawn(), kit.Simple(m.Option(tcp.HOST), arg)...).Table(func(index int, value ice.Maps, head []string) {
|
||||
if len(arg) == 0 { // 命令列表
|
||||
if len(arg) == 0 {
|
||||
m.Option(ice.MSG_OPTS, head)
|
||||
for k, v := range value {
|
||||
m.Option(k, v)
|
||||
}
|
||||
m.Options(kit.Simple(value))
|
||||
f.send(m.Spawn(), "1", m.Option(TID), m.CommandKey(), value[mdb.ID], value[ctx.ARGS])
|
||||
} else { // 命令详情
|
||||
} else {
|
||||
m.Cmdy(ctx.COMMAND, value[mdb.INDEX])
|
||||
}
|
||||
})
|
||||
|
@ -1,68 +0,0 @@
|
||||
package chrome
|
||||
|
||||
import (
|
||||
"shylinux.com/x/ice"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/web"
|
||||
"shylinux.com/x/icebergs/core/wiki"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
type operate struct {
|
||||
reload string `name:"reload" help:"刷新"`
|
||||
list string `name:"list wid tid url auto" help:"操作"`
|
||||
}
|
||||
|
||||
func (o operate) send(m *ice.Message, arg ...ice.Any) *ice.Message {
|
||||
return m.Cmdy(web.SPACE, "chrome", "chrome", arg)
|
||||
}
|
||||
|
||||
func (o operate) Inputs(m *ice.Message, arg ...string) {
|
||||
switch arg[0] {
|
||||
case mdb.ZONE:
|
||||
o.send(m.Spawn()).Tables(func(value ice.Maps) {
|
||||
o.send(m.Spawn(), value[WID]).Tables(func(value ice.Maps) {
|
||||
m.Push(mdb.ZONE, kit.ParseURL(value[URL]).Host)
|
||||
})
|
||||
}).Sort(mdb.ZONE)
|
||||
}
|
||||
}
|
||||
func (o operate) Spide(m *ice.Message, arg ...string) {
|
||||
if len(arg) < 2 {
|
||||
o.send(m, arg)
|
||||
return
|
||||
}
|
||||
o.send(m, arg[:2], "spide").Tables(func(value ice.Maps) {
|
||||
switch value[mdb.TYPE] {
|
||||
case wiki.VIDEO:
|
||||
m.PushVideos(mdb.SHOW, value[mdb.LINK])
|
||||
case wiki.IMG:
|
||||
m.PushImages(mdb.SHOW, value[mdb.LINK])
|
||||
default:
|
||||
m.Push(mdb.SHOW, "")
|
||||
}
|
||||
}).Cut("show,type,name,link")
|
||||
}
|
||||
func (o operate) Reload(m *ice.Message, arg ...string) {
|
||||
o.send(m, arg[:2], "user.reload", ice.TRUE).ProcessHold()
|
||||
}
|
||||
func (o operate) List(m *ice.Message, arg ...string) {
|
||||
switch len(arg) {
|
||||
case 3:
|
||||
o.send(m, arg[:2], "user.jumps", arg[2])
|
||||
case 2:
|
||||
m.Action(o.Reload)
|
||||
o.Spide(m, arg...)
|
||||
m.StatusTimeCount()
|
||||
default:
|
||||
o.send(m, arg)
|
||||
}
|
||||
}
|
||||
|
||||
const (
|
||||
WID = "wid"
|
||||
TID = "tid"
|
||||
URL = "url"
|
||||
)
|
||||
|
||||
func init() { ice.CodeCtxCmd(operate{}) }
|
@ -6,7 +6,7 @@ import (
|
||||
)
|
||||
|
||||
type page struct {
|
||||
operate
|
||||
daemon
|
||||
style
|
||||
field
|
||||
|
||||
@ -21,7 +21,7 @@ func (p page) Run(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(p.field.Run, arg)
|
||||
}
|
||||
func (p page) List(m *ice.Message, arg ...string) {
|
||||
p.operate.Inputs(m, mdb.ZONE)
|
||||
p.daemon.Inputs(m, mdb.ZONE)
|
||||
}
|
||||
|
||||
func init() { ice.CodeCtxCmd(page{}) }
|
||||
|
@ -7,16 +7,16 @@ import (
|
||||
|
||||
type style struct {
|
||||
ice.Zone
|
||||
operate
|
||||
daemon
|
||||
|
||||
short string `data:"zone"`
|
||||
field string `data:"time,id,selector,property"`
|
||||
insert string `name:"insert zone=golang.google.cn selector=. property:textarea" help:"添加"`
|
||||
insert string `name:"insert zone=golang.google.cn selector=. property:textarea"`
|
||||
list string `name:"style zone id auto insert" help:"样式"`
|
||||
}
|
||||
|
||||
func (s style) Inputs(m *ice.Message, arg ...string) {
|
||||
s.operate.Inputs(m, arg...)
|
||||
s.daemon.Inputs(m, arg...)
|
||||
}
|
||||
func (s style) Command(m *ice.Message, arg ...string) {
|
||||
s.Zone.List(m, m.Option(tcp.HOST)).Tables(func(value ice.Maps) {
|
||||
|
@ -8,10 +8,10 @@ import (
|
||||
|
||||
type sync struct {
|
||||
ice.Lists
|
||||
favor `name:"favor zone=some type name link" help:"收藏"`
|
||||
favor `name:"favor zone=some type name link"`
|
||||
|
||||
field string `data:"time,id,type,name,link"`
|
||||
insert string `name:"insert type name link" help:"添加" http:"/sync"`
|
||||
insert string `name:"insert type name link" http:"/sync"`
|
||||
list string `name:"list id auto" help:"同步流"`
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
)
|
||||
|
||||
type video struct {
|
||||
operate
|
||||
daemon
|
||||
|
||||
play string `name:"play" help:"播放"`
|
||||
next string `name:"next" help:"下一集"`
|
||||
|
Loading…
x
Reference in New Issue
Block a user