mirror of
https://shylinux.com/x/icebergs
synced 2025-06-26 18:37:29 +08:00
add some
This commit is contained in:
parent
6e6041aa88
commit
c356669ff5
@ -1,6 +1,7 @@
|
|||||||
package cli
|
package cli
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"io"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -42,6 +43,9 @@ func init() {
|
|||||||
REPOS: {Help: "镜像源", Hand: func(m *ice.Message, arg ...string) {
|
REPOS: {Help: "镜像源", Hand: func(m *ice.Message, arg ...string) {
|
||||||
switch {
|
switch {
|
||||||
case strings.Contains(release(m.Spawn()), ALPINE):
|
case strings.Contains(release(m.Spawn()), ALPINE):
|
||||||
|
ice.Info.PushStream(m)
|
||||||
|
m.Optionv(CMD_OUTPUT).(io.Writer).Write([]byte("\n"))
|
||||||
|
defer ice.Info.PushNotice(m, "toast", "success")
|
||||||
m.Cmd(nfs.SAVE, ETC_APK_REPOS, strings.ReplaceAll(m.Cmdx(nfs.CAT, ETC_APK_REPOS), "dl-cdn.alpinelinux.org", "mirrors.tencent.com"))
|
m.Cmd(nfs.SAVE, ETC_APK_REPOS, strings.ReplaceAll(m.Cmdx(nfs.CAT, ETC_APK_REPOS), "dl-cdn.alpinelinux.org", "mirrors.tencent.com"))
|
||||||
m.Cmdy(SYSTEM, "apk", "update")
|
m.Cmdy(SYSTEM, "apk", "update")
|
||||||
m.StatusTimeCount()
|
m.StatusTimeCount()
|
||||||
@ -49,6 +53,9 @@ func init() {
|
|||||||
}},
|
}},
|
||||||
"add": {Help: "安装", Hand: func(m *ice.Message, arg ...string) {
|
"add": {Help: "安装", Hand: func(m *ice.Message, arg ...string) {
|
||||||
mdb.ZoneSelect(m, m.Option(CLI)).Table(func(value ice.Maps) {
|
mdb.ZoneSelect(m, m.Option(CLI)).Table(func(value ice.Maps) {
|
||||||
|
ice.Info.PushStream(m)
|
||||||
|
ice.Info.PushNotice(m, "toast", "process", "", "-1")
|
||||||
|
defer ice.Info.PushNotice(m, "toast", "success")
|
||||||
m.Push("res", m.Cmdx(kit.Split(value[CMD])))
|
m.Push("res", m.Cmdx(kit.Split(value[CMD])))
|
||||||
})
|
})
|
||||||
}},
|
}},
|
||||||
|
@ -160,7 +160,7 @@ const RUNTIME = "runtime"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
RUNTIME: {Name: "runtime info=bootinfo,ifconfig,diskinfo,hostinfo,userinfo,procstat,procinfo,bootinfo,role,api,cli,cmd,mod,env,path,chain,routine auto upgrade restart logs conf", Icon: "usr/icons/info.png", Help: "运行环境", Actions: ice.MergeActions(ice.Actions{
|
RUNTIME: {Name: "runtime info=bootinfo,ifconfig,diskinfo,hostinfo,userinfo,procstat,procinfo,bootinfo,role,api,cli,cmd,mod,env,path,chain,routine auto upgrade restart logs conf", Icon: "usr/icons/Infomation.png", Help: "运行环境", Actions: ice.MergeActions(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
aaa.White(m, ice.ETC_PATH)
|
aaa.White(m, ice.ETC_PATH)
|
||||||
aaa.White(m, ice.LICENSE)
|
aaa.White(m, ice.LICENSE)
|
||||||
|
@ -39,9 +39,7 @@ func EventsAction(arg ...string) ice.Actions {
|
|||||||
list := kit.DictList(arg...)
|
list := kit.DictList(arg...)
|
||||||
return ice.Actions{ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
return ice.Actions{ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
for sub := range m.Target().Commands[m.CommandKey()].Actions {
|
for sub := range m.Target().Commands[m.CommandKey()].Actions {
|
||||||
kit.If(list[sub] == ice.TRUE, func() {
|
kit.If(list[sub] == ice.TRUE, func() { Watch(m, sub) })
|
||||||
Watch(m, sub)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}}}
|
}}}
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
}, m.Option(mdb.NAME))
|
}, m.Option(mdb.NAME))
|
||||||
}},
|
}},
|
||||||
}, mdb.StatusHashAction(mdb.FIELD, "time,hash,status,name,cmd"), mdb.ClearOnExitHashAction())},
|
}, mdb.StatusHashAction(mdb.LIMIT, 1000, mdb.LEAST, 500, mdb.FIELD, "time,hash,status,name,cmd"), mdb.ClearOnExitHashAction())},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
func Go(m *ice.Message, cb ice.Any, arg ...string) {
|
func Go(m *ice.Message, cb ice.Any, arg ...string) {
|
||||||
|
@ -131,6 +131,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type templateMessage interface {
|
type templateMessage interface {
|
||||||
|
Optionv(key string, arg ...ice.Any) ice.Any
|
||||||
PrefixKey(...string) string
|
PrefixKey(...string) string
|
||||||
Cmdx(...ice.Any) string
|
Cmdx(...ice.Any) string
|
||||||
}
|
}
|
||||||
@ -142,7 +143,11 @@ func TemplateText(m templateMessage, p string) string {
|
|||||||
return m.Cmdx(CAT, path.Join(m.PrefixKey(), path.Base(p)), kit.Dict(DIR_ROOT, ice.SRC_TEMPLATE))
|
return m.Cmdx(CAT, path.Join(m.PrefixKey(), path.Base(p)), kit.Dict(DIR_ROOT, ice.SRC_TEMPLATE))
|
||||||
}
|
}
|
||||||
func TemplatePath(m templateMessage, arg ...string) string {
|
func TemplatePath(m templateMessage, arg ...string) string {
|
||||||
return path.Join(ice.SRC_TEMPLATE, m.PrefixKey(), path.Join(arg...))
|
if p := path.Join(ice.SRC_TEMPLATE, m.PrefixKey(), path.Join(arg...)); Exists(m, p) {
|
||||||
|
return p
|
||||||
|
} else {
|
||||||
|
return p
|
||||||
|
}
|
||||||
}
|
}
|
||||||
func IsSourceFile(m *ice.Message, ext string) bool {
|
func IsSourceFile(m *ice.Message, ext string) bool {
|
||||||
return mdb.Conf(m, Prefix(CAT), kit.Keym(SOURCE, ext)) == ice.TRUE
|
return mdb.Conf(m, Prefix(CAT), kit.Keym(SOURCE, ext)) == ice.TRUE
|
||||||
|
@ -3,6 +3,7 @@ package nfs
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
@ -10,7 +11,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func _defs_file(m *ice.Message, name string, text ...string) {
|
func _defs_file(m *ice.Message, name string, text ...string) {
|
||||||
if Exists(m, path.Join(m.Option(DIR_ROOT), name)) {
|
if s, e := os.Stat(path.Join(m.Option(DIR_ROOT), name)); e == nil && s.Size() > 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
for i, v := range text {
|
for i, v := range text {
|
||||||
|
@ -1,18 +1,21 @@
|
|||||||
package web
|
package web
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
kit "shylinux.com/x/toolkits"
|
kit "shylinux.com/x/toolkits"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const ADMIN = "admin"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
const ADMIN = "admin"
|
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
ADMIN: {Name: ADMIN, Help: "管理", Hand: func(m *ice.Message, arg ...string) {
|
ADMIN: {Name: ADMIN, Help: "管理", Hand: func(m *ice.Message, arg ...string) {
|
||||||
args := []string{}
|
args := []string{}
|
||||||
kit.If(len(arg) == 0, func() { arg = append(arg, SPACE, DOMAIN) })
|
kit.If(len(arg) == 0, func() { arg = append(arg, SPACE, DOMAIN) })
|
||||||
kit.For(arg[1:], func(v string) { args = append(args, ice.ARG, v) })
|
kit.For(arg[1:], func(v string) { args = append(args, ice.ARG, v) })
|
||||||
m.Cmdy(SPIDE, ice.OPS, SPIDE_RAW, CHAT_CMD+arg[0]+"?debug=true", SPIDE_FORM, args)
|
m.Cmdy(SPIDE, ice.OPS, SPIDE_RAW, http.MethodGet, CHAT_CMD+arg[0]+"?debug=true", args)
|
||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ func init() {
|
|||||||
mdb.CREATE: {Name: "create type name text", Hand: func(m *ice.Message, arg ...string) {
|
mdb.CREATE: {Name: "create type name text", Hand: func(m *ice.Message, arg ...string) {
|
||||||
mdb.HashSelectUpdate(m, mdb.HashCreate(m), func(value ice.Map) { value[mdb.COUNT] = kit.Int(value[mdb.COUNT]) + 1 })
|
mdb.HashSelectUpdate(m, mdb.HashCreate(m), func(value ice.Map) { value[mdb.COUNT] = kit.Int(value[mdb.COUNT]) + 1 })
|
||||||
}},
|
}},
|
||||||
}, ctx.CmdAction(), mdb.HashAction(mdb.SHORT, "type,name", mdb.FIELD, "time,hash,count,type,name,text")), Hand: func(m *ice.Message, arg ...string) {
|
}, ctx.CmdAction(), mdb.HashAction(mdb.LIMIT, 1000, mdb.LEAST, 500, mdb.SHORT, "type,name", mdb.FIELD, "time,hash,count,type,name,text")), Hand: func(m *ice.Message, arg ...string) {
|
||||||
mdb.HashSelect(m, arg...).Sort("type,name,text", "str", "str", "str")
|
mdb.HashSelect(m, arg...).Sort("type,name,text", "str", "str", "str")
|
||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
|
@ -103,6 +103,8 @@ func PushNoticeGrow(m *ice.Message, arg ...ice.Any) { PushNotice(m, kit.List("g
|
|||||||
func PushStream(m *ice.Message) {
|
func PushStream(m *ice.Message) {
|
||||||
m.Options(cli.CMD_OUTPUT, file.NewWriteCloser(func(buf []byte) { PushNoticeGrow(m, string(buf)) }, nil)).ProcessHold(toastContent(m, ice.SUCCESS))
|
m.Options(cli.CMD_OUTPUT, file.NewWriteCloser(func(buf []byte) { PushNoticeGrow(m, string(buf)) }, nil)).ProcessHold(toastContent(m, ice.SUCCESS))
|
||||||
}
|
}
|
||||||
|
func init() { ice.Info.PushStream = PushStream }
|
||||||
|
func init() { ice.Info.PushNotice = PushNotice }
|
||||||
|
|
||||||
func Toast(m *ice.Message, text string, arg ...ice.Any) { // [title [duration [progress]]]
|
func Toast(m *ice.Message, text string, arg ...ice.Any) { // [title [duration [progress]]]
|
||||||
if len(arg) > 1 {
|
if len(arg) > 1 {
|
||||||
|
@ -56,7 +56,7 @@ const ROUTE = "route"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
ROUTE: {Name: "route space:text cmds:text auto spide cmds build travel monitor prunes", Icon: "usr/icons/route.png", Help: "路由表", Actions: ice.MergeActions(ice.Actions{
|
ROUTE: {Name: "route space:text cmds:text auto spide cmds build travel monitor prunes", Icon: "usr/icons/Podcasts.png", Help: "路由表", Actions: ice.MergeActions(ice.Actions{
|
||||||
ice.MAIN: {Help: "首页", Hand: func(m *ice.Message, arg ...string) {
|
ice.MAIN: {Help: "首页", Hand: func(m *ice.Message, arg ...string) {
|
||||||
ctx.ProcessField(m, CHAT_IFRAME, m.MergePod(""), arg...)
|
ctx.ProcessField(m, CHAT_IFRAME, m.MergePod(""), arg...)
|
||||||
}},
|
}},
|
||||||
|
@ -58,7 +58,7 @@ func _serve_main(m *ice.Message, w http.ResponseWriter, r *http.Request) bool {
|
|||||||
r.Header.Set(ice.MSG_USERIP, strings.Split(r.RemoteAddr, nfs.DF)[0])
|
r.Header.Set(ice.MSG_USERIP, strings.Split(r.RemoteAddr, nfs.DF)[0])
|
||||||
}
|
}
|
||||||
if m.Logs(r.Header.Get(ice.MSG_USERIP), r.Method, r.URL.String()); r.Method == http.MethodGet {
|
if m.Logs(r.Header.Get(ice.MSG_USERIP), r.Method, r.URL.String()); r.Method == http.MethodGet {
|
||||||
ispod := kit.Contains(r.Header.Get("Referer"), "/chat/pod/", "pod=")
|
ispod := kit.Contains(r.Header.Get("Referer"), "/chat/pod/", "pod=") || kit.Contains(r.URL.String(), "/chat/pod/", "pod=")
|
||||||
if msg := m.Spawn(w, r).Options(ice.MSG_USERUA, r.UserAgent()); path.Join(r.URL.Path) == nfs.PS {
|
if msg := m.Spawn(w, r).Options(ice.MSG_USERUA, r.UserAgent()); path.Join(r.URL.Path) == nfs.PS {
|
||||||
if !msg.IsCliUA() {
|
if !msg.IsCliUA() {
|
||||||
if r.URL.Path = kit.Select(nfs.PS, mdb.Config(m, ice.MAIN)); path.Join(r.URL.Path) != nfs.PS {
|
if r.URL.Path = kit.Select(nfs.PS, mdb.Config(m, ice.MAIN)); path.Join(r.URL.Path) != nfs.PS {
|
||||||
|
@ -44,6 +44,12 @@ func _share_proxy(m *ice.Message) {
|
|||||||
case http.MethodGet:
|
case http.MethodGet:
|
||||||
m.RenderDownload(p, m.Option(mdb.TYPE), m.Option(mdb.NAME))
|
m.RenderDownload(p, m.Option(mdb.TYPE), m.Option(mdb.NAME))
|
||||||
case http.MethodPost:
|
case http.MethodPost:
|
||||||
|
msg := m.Cmd(SHARE, m.Option(SHARE))
|
||||||
|
defer m.Cmd(SHARE, mdb.REMOVE, mdb.HASH, m.Option(SHARE))
|
||||||
|
if m.Warn(msg.Append(mdb.TEXT) == "") {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
p := path.Join(ice.VAR_PROXY, msg.Append(mdb.TEXT), msg.Append(mdb.NAME))
|
||||||
if _, _, e := m.R.FormFile(UPLOAD); e == nil {
|
if _, _, e := m.R.FormFile(UPLOAD); e == nil {
|
||||||
m.Cmdy(CACHE, UPLOAD).Cmdy(CACHE, WATCH, m.Option(mdb.HASH), p)
|
m.Cmdy(CACHE, UPLOAD).Cmdy(CACHE, WATCH, m.Option(mdb.HASH), p)
|
||||||
}
|
}
|
||||||
@ -157,11 +163,16 @@ func ShareLocalFile(m *ice.Message, arg ...string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
pp := path.Join(ice.VAR_PROXY, m.Option(ice.POD), p)
|
pp := path.Join(ice.VAR_PROXY, m.Option(ice.POD), p)
|
||||||
cache, size := time.Now().Add(-time.Hour*24), int64(0)
|
size, cache := int64(0), time.Now().Add(-time.Hour*24)
|
||||||
if s, e := file.StatFile(pp); e == nil {
|
if s, e := file.StatFile(pp); e == nil {
|
||||||
cache, size = s.ModTime(), s.Size()
|
size, cache = s.Size(), s.ModTime()
|
||||||
|
} else if s, e := file.StatFile(p); e == nil {
|
||||||
|
size, cache = s.Size(), s.ModTime()
|
||||||
}
|
}
|
||||||
kit.If(p == ice.BIN_ICE_BIN, func() { m.Option(ice.MSG_USERROLE, aaa.TECH) })
|
kit.If(p == ice.BIN_ICE_BIN, func() { m.Option(ice.MSG_USERROLE, aaa.TECH) })
|
||||||
m.Cmd(SPACE, m.Option(ice.POD), SPIDE, ice.DEV, SPIDE_RAW, http.MethodPost, MergeLink(m, PP(SHARE, PROXY)), SPIDE_PART, m.OptionSimple(ice.POD), nfs.PATH, p, nfs.SIZE, size, CACHE, cache.Format(ice.MOD_TIME), UPLOAD, mdb.AT+p)
|
share := m.Cmdx(SHARE, mdb.CREATE, mdb.TYPE, PROXY, mdb.NAME, p, mdb.TEXT, m.Option(ice.POD))
|
||||||
|
defer m.Cmd(SHARE, mdb.REMOVE, mdb.HASH, share)
|
||||||
|
url := tcp.PublishLocalhost(m, MergeLink(m, PP(SHARE, PROXY), SHARE, share))
|
||||||
|
m.Cmd(SPACE, m.Option(ice.POD), SPIDE, PROXY, "url", url, nfs.SIZE, size, CACHE, cache.Format(ice.MOD_TIME), UPLOAD, mdb.AT+p)
|
||||||
m.RenderDownload(kit.Select(p, pp, file.ExistsFile(pp)))
|
m.RenderDownload(kit.Select(p, pp, file.ExistsFile(pp)))
|
||||||
}
|
}
|
||||||
|
@ -186,6 +186,18 @@ func init() {
|
|||||||
kit.If(mdb.Config(m, ice.MAIN), func(cmd string) { RenderPodCmd(m, "", cmd) }, func() { RenderMain(m) })
|
kit.If(mdb.Config(m, ice.MAIN), func(cmd string) { RenderPodCmd(m, "", cmd) }, func() { RenderMain(m) })
|
||||||
m.Optionv(ice.MSG_ARGS, kit.Simple(m.Optionv(ice.MSG_ARGS)))
|
m.Optionv(ice.MSG_ARGS, kit.Simple(m.Optionv(ice.MSG_ARGS)))
|
||||||
}},
|
}},
|
||||||
|
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
if mdb.IsSearchPreview(m, arg) {
|
||||||
|
m.Cmds("", func(value ice.Maps) {
|
||||||
|
switch value[mdb.TYPE] {
|
||||||
|
case MASTER:
|
||||||
|
m.PushSearch(mdb.TEXT, m.Cmdv(SPIDE, value[mdb.NAME], CLIENT_ORIGIN), value)
|
||||||
|
case SERVER:
|
||||||
|
m.PushSearch(mdb.TEXT, m.MergePod(value[mdb.NAME]), value)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}},
|
||||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
switch arg[0] {
|
switch arg[0] {
|
||||||
case SPACE:
|
case SPACE:
|
||||||
@ -207,18 +219,6 @@ func init() {
|
|||||||
m.Cmd("", m.Option(mdb.NAME), ice.EXIT)
|
m.Cmd("", m.Option(mdb.NAME), ice.EXIT)
|
||||||
m.Sleep("1s")
|
m.Sleep("1s")
|
||||||
}},
|
}},
|
||||||
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
if mdb.IsSearchPreview(m, arg) {
|
|
||||||
m.Cmds("", func(value ice.Maps) {
|
|
||||||
switch value[mdb.TYPE] {
|
|
||||||
case MASTER:
|
|
||||||
m.PushSearch(mdb.TEXT, m.Cmdv(SPIDE, value[mdb.NAME], CLIENT_ORIGIN), value)
|
|
||||||
case SERVER:
|
|
||||||
m.PushSearch(mdb.TEXT, m.MergePod(value[mdb.NAME]), value)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}},
|
|
||||||
DOMAIN: {Hand: func(m *ice.Message, arg ...string) { m.Echo(_space_domain(m)) }},
|
DOMAIN: {Hand: func(m *ice.Message, arg ...string) { m.Echo(_space_domain(m)) }},
|
||||||
LOGIN: {Help: "授权", Hand: func(m *ice.Message, arg ...string) {
|
LOGIN: {Help: "授权", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Option(ice.MSG_USERUA, m.Cmdv("", kit.Select(m.Option(mdb.NAME), arg, 0), ice.MSG_USERUA))
|
m.Option(ice.MSG_USERUA, m.Cmdv("", kit.Select(m.Option(mdb.NAME), arg, 0), ice.MSG_USERUA))
|
||||||
@ -233,7 +233,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
nfs.PS: {Hand: func(m *ice.Message, arg ...string) { _space_fork(m) }},
|
nfs.PS: {Hand: func(m *ice.Message, arg ...string) { _space_fork(m) }},
|
||||||
}, mdb.HashAction(mdb.LIMIT, 1000, mdb.LEAST, 1000, mdb.SHORT, mdb.NAME, mdb.FIELD, "time,type,name,text,module,version", ctx.ACTION, OPEN, REDIAL, kit.Dict("a", 3000, "b", 1000, "c", 1000)), mdb.ClearOnExitHashAction()), Hand: func(m *ice.Message, arg ...string) {
|
}, mdb.HashAction(mdb.LIMIT, 1000, mdb.LEAST, 500, mdb.SHORT, mdb.NAME, mdb.FIELD, "time,type,name,text,module,version", ctx.ACTION, OPEN, REDIAL, kit.Dict("a", 3000, "b", 1000, "c", 1000)), mdb.ClearOnExitHashAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if len(arg) < 2 {
|
if len(arg) < 2 {
|
||||||
defer m.StatusTimeCount(ice.MAIN, mdb.Config(m, ice.MAIN))
|
defer m.StatusTimeCount(ice.MAIN, mdb.Config(m, ice.MAIN))
|
||||||
m.Option(ice.MSG_USERWEB, tcp.PublishLocalhost(m, m.Option(ice.MSG_USERWEB)))
|
m.Option(ice.MSG_USERWEB, tcp.PublishLocalhost(m, m.Option(ice.MSG_USERWEB)))
|
||||||
|
@ -42,6 +42,9 @@ func _spide_show(m *ice.Message, name string, arg ...string) {
|
|||||||
method = kit.Select(http.MethodGet, msg.Append(CLIENT_METHOD), method)
|
method = kit.Select(http.MethodGet, msg.Append(CLIENT_METHOD), method)
|
||||||
uri, arg := arg[0], arg[1:]
|
uri, arg := arg[0], arg[1:]
|
||||||
body, head, arg := _spide_body(m, method, arg...)
|
body, head, arg := _spide_body(m, method, arg...)
|
||||||
|
if m.Option("_break") == ice.TRUE {
|
||||||
|
return
|
||||||
|
}
|
||||||
if c, ok := body.(io.Closer); ok {
|
if c, ok := body.(io.Closer); ok {
|
||||||
defer c.Close()
|
defer c.Close()
|
||||||
}
|
}
|
||||||
@ -141,15 +144,20 @@ func _spide_part(m *ice.Message, arg ...string) (string, io.Reader) {
|
|||||||
cache = t
|
cache = t
|
||||||
}
|
}
|
||||||
} else if strings.HasPrefix(arg[i+1], mdb.AT) {
|
} else if strings.HasPrefix(arg[i+1], mdb.AT) {
|
||||||
if s, e := nfs.StatFile(m, arg[i+1][1:]); !m.Warn(e, ice.ErrNotValid) {
|
p := arg[i+1][1:]
|
||||||
|
if s, e := nfs.StatFile(m, p); !m.Warn(e, ice.ErrNotValid) {
|
||||||
if s.Size() == size && s.ModTime().Before(cache) {
|
if s.Size() == size && s.ModTime().Before(cache) {
|
||||||
|
m.Option("_break", ice.TRUE)
|
||||||
|
continue
|
||||||
|
} else if s.Size() == size && !nfs.Exists(m.Spawn(kit.Dict(ice.MSG_FILES, nfs.DiskFile)), p) {
|
||||||
|
m.Option("_break", ice.TRUE)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
m.Logs(nfs.FIND, LOCAL, s.ModTime(), nfs.SIZE, s.Size(), CACHE, cache, nfs.SIZE, size)
|
m.Logs(nfs.FIND, LOCAL, s.ModTime(), nfs.SIZE, s.Size(), CACHE, cache, nfs.SIZE, size)
|
||||||
}
|
}
|
||||||
if f, e := nfs.OpenFile(m, arg[i+1][1:]); !m.Warn(e, ice.ErrNotValid, arg[i+1]) {
|
if f, e := nfs.OpenFile(m, p); !m.Warn(e, ice.ErrNotValid, arg[i+1]) {
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
if p, e := mp.CreateFormFile(arg[i], path.Base(arg[i+1][1:])); !m.Warn(e, ice.ErrNotValid, arg[i+1]) {
|
if p, e := mp.CreateFormFile(arg[i], path.Base(p)); !m.Warn(e, ice.ErrNotValid, arg[i+1]) {
|
||||||
if n, e := io.Copy(p, f); !m.Warn(e, ice.ErrNotValid, arg[i+1]) {
|
if n, e := io.Copy(p, f); !m.Warn(e, ice.ErrNotValid, arg[i+1]) {
|
||||||
m.Logs(nfs.LOAD, nfs.FILE, arg[i+1], nfs.SIZE, n)
|
m.Logs(nfs.LOAD, nfs.FILE, arg[i+1], nfs.SIZE, n)
|
||||||
}
|
}
|
||||||
@ -271,9 +279,16 @@ func init() {
|
|||||||
m.Cmd("", mdb.CREATE, ice.DEV, kit.Select(kit.Select("https://contexts.com.cn", ice.Info.Make.Domain), conf[cli.CTX_DEV]))
|
m.Cmd("", mdb.CREATE, ice.DEV, kit.Select(kit.Select("https://contexts.com.cn", ice.Info.Make.Domain), conf[cli.CTX_DEV]))
|
||||||
m.Cmd("", mdb.CREATE, ice.COM, kit.Select("https://contexts.com.cn", conf[cli.CTX_COM]))
|
m.Cmd("", mdb.CREATE, ice.COM, kit.Select("https://contexts.com.cn", conf[cli.CTX_COM]))
|
||||||
m.Cmd("", mdb.CREATE, ice.HUB, kit.Select("https://repos.shylinux.com", conf[cli.CTX_HUB]))
|
m.Cmd("", mdb.CREATE, ice.HUB, kit.Select("https://repos.shylinux.com", conf[cli.CTX_HUB]))
|
||||||
m.Cmd("", mdb.CREATE, "repos", kit.Select("https://repos.shylinux.com", conf[cli.CTX_HUB]))
|
m.Cmd("", mdb.CREATE, nfs.REPOS, kit.Select("https://repos.shylinux.com", conf[cli.CTX_HUB]))
|
||||||
m.Cmd("", mdb.CREATE, ice.SHY, kit.Select(kit.Select("https://shylinux.com", ice.Info.Make.Remote), conf[cli.CTX_SHY]))
|
m.Cmd("", mdb.CREATE, ice.SHY, kit.Select(kit.Select("https://shylinux.com", ice.Info.Make.Remote), conf[cli.CTX_SHY]))
|
||||||
}},
|
}},
|
||||||
|
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
if mdb.IsSearchPreview(m, arg) {
|
||||||
|
mdb.HashSelectValue(m.Spawn(), func(value ice.Map) {
|
||||||
|
m.PushSearch(mdb.TYPE, LINK, mdb.NAME, kit.Value(value, CLIENT_NAME), mdb.TEXT, kit.Value(value, CLIENT_ORIGIN), value)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}},
|
||||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
switch m.Option(ctx.ACTION) {
|
switch m.Option(ctx.ACTION) {
|
||||||
case COOKIE:
|
case COOKIE:
|
||||||
@ -290,23 +305,19 @@ func init() {
|
|||||||
mdb.HashSelectValue(m.Spawn(), func(value ice.Map) { m.Push(kit.Select(ORIGIN, arg, 0), kit.Value(value, CLIENT_ORIGIN)) })
|
mdb.HashSelectValue(m.Spawn(), func(value ice.Map) { m.Push(kit.Select(ORIGIN, arg, 0), kit.Value(value, CLIENT_ORIGIN)) })
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
|
mdb.CREATE: {Name: "create name link", Hand: func(m *ice.Message, arg ...string) { _spide_create(m, m.Option(mdb.NAME), m.Option(LINK)) }},
|
||||||
HEADER: {Name: "header key* value", Hand: func(m *ice.Message, arg ...string) {
|
HEADER: {Name: "header key* value", Hand: func(m *ice.Message, arg ...string) {
|
||||||
mdb.HashModify(m, m.OptionSimple(CLIENT_NAME), kit.Keys(HEADER, m.Option(mdb.KEY)), m.Option(mdb.VALUE))
|
mdb.HashModify(m, m.OptionSimple(CLIENT_NAME), kit.Keys(HEADER, m.Option(mdb.KEY)), m.Option(mdb.VALUE))
|
||||||
}},
|
}},
|
||||||
COOKIE: {Name: "cookie key* value", Hand: func(m *ice.Message, arg ...string) {
|
COOKIE: {Name: "cookie key* value", Hand: func(m *ice.Message, arg ...string) {
|
||||||
mdb.HashModify(m, m.OptionSimple(CLIENT_NAME), kit.Keys(COOKIE, m.Option(mdb.KEY)), m.Option(mdb.VALUE))
|
mdb.HashModify(m, m.OptionSimple(CLIENT_NAME), kit.Keys(COOKIE, m.Option(mdb.KEY)), m.Option(mdb.VALUE))
|
||||||
}},
|
}},
|
||||||
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
if mdb.IsSearchPreview(m, arg) {
|
|
||||||
mdb.HashSelectValue(m.Spawn(), func(value ice.Map) {
|
|
||||||
m.PushSearch(mdb.TYPE, LINK, mdb.NAME, kit.Value(value, CLIENT_NAME), mdb.TEXT, kit.Value(value, CLIENT_ORIGIN), value)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}},
|
|
||||||
mdb.CREATE: {Name: "create name link", Hand: func(m *ice.Message, arg ...string) { _spide_create(m, m.Option(mdb.NAME), m.Option(LINK)) }},
|
|
||||||
MERGE: {Hand: func(m *ice.Message, arg ...string) {
|
MERGE: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Echo(kit.MergeURL2(m.Cmdv("", arg[0], CLIENT_URL), arg[1], arg[2:]))
|
m.Echo(kit.MergeURL2(m.Cmdv("", arg[0], CLIENT_URL), arg[1], arg[2:]))
|
||||||
}},
|
}},
|
||||||
|
PROXY: {Name: "proxy url size cache upload", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
m.Cmdy(SPIDE, ice.DEV, SPIDE_RAW, http.MethodPost, m.Option("url"), SPIDE_PART, arg[2:])
|
||||||
|
}},
|
||||||
}, mdb.HashAction(mdb.SHORT, CLIENT_NAME, mdb.FIELD, "time,client.name,client.url")), Hand: func(m *ice.Message, arg ...string) {
|
}, mdb.HashAction(mdb.SHORT, CLIENT_NAME, mdb.FIELD, "time,client.name,client.url")), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if len(arg) < 2 || arg[0] == "" || (len(arg) > 3 && arg[3] == "") {
|
if len(arg) < 2 || arg[0] == "" || (len(arg) > 3 && arg[3] == "") {
|
||||||
mdb.HashSelect(m, kit.Slice(arg, 0, 1)...).Sort(CLIENT_NAME)
|
mdb.HashSelect(m, kit.Slice(arg, 0, 1)...).Sort(CLIENT_NAME)
|
||||||
|
@ -11,7 +11,7 @@ const FLOWS = "flows"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
FLOWS: {Name: "flows zone hash auto", Icon: "usr/icons/flows.png", Help: "工作流", Actions: ice.MergeActions(ice.Actions{
|
FLOWS: {Name: "flows zone hash auto", Icon: "usr/icons/Automator.png", Help: "工作流", Actions: ice.MergeActions(ice.Actions{
|
||||||
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
if mdb.IsSearchPreview(m, arg) {
|
if mdb.IsSearchPreview(m, arg) {
|
||||||
mdb.HashSelect(m.Spawn(ice.OptionFields(""))).Table(func(value ice.Maps) {
|
mdb.HashSelect(m.Spawn(ice.OptionFields(""))).Table(func(value ice.Maps) {
|
||||||
|
@ -24,7 +24,7 @@ func init() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
mdb.CREATE: {Hand: func(m *ice.Message, arg ...string) {
|
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()))
|
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) {
|
||||||
|
@ -21,12 +21,9 @@ func init() {
|
|||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
FinderAppend(m, "Applications", m.PrefixKey())
|
FinderAppend(m, "Applications", m.PrefixKey())
|
||||||
m.Travel(func(p *ice.Context, c *ice.Context, key string, cmd *ice.Command) {
|
m.Travel(func(p *ice.Context, c *ice.Context, key string, cmd *ice.Command) {
|
||||||
kit.If(cmd.Icon, func() {
|
kit.If(cmd.Icon, func() { AppInstall(m, cmd.Icon, m.PrefixKey()) })
|
||||||
m.Debug("what %v", cmd.Icon)
|
|
||||||
AppInstall(m, cmd.Icon, m.PrefixKey())
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
Notify(m, cli.RUNTIME, "系统启动成功", ctx.INDEX, cli.RUNTIME)
|
Notify(m, "usr/icons/Infomation.png", cli.RUNTIME, "系统启动成功", ctx.INDEX, cli.RUNTIME)
|
||||||
}},
|
}},
|
||||||
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) { mdb.Conf(m, m.PrefixKey(), mdb.HASH, "") }},
|
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) { mdb.Conf(m, m.PrefixKey(), mdb.HASH, "") }},
|
||||||
code.INSTALL: {Hand: func(m *ice.Message, arg ...string) { AppInstall(m, arg[0], arg[1]) }},
|
code.INSTALL: {Hand: func(m *ice.Message, arg ...string) { AppInstall(m, arg[0], arg[1]) }},
|
||||||
|
@ -10,9 +10,11 @@ fieldset.macos.desktop>div.output>fieldset.macos.dock { border:var(--box-border)
|
|||||||
fieldset.macos.desktop>div.output>fieldset.macos.searchs { position:absolute; z-index:100; }
|
fieldset.macos.desktop>div.output>fieldset.macos.searchs { position:absolute; z-index:100; }
|
||||||
fieldset.macos.desktop>div.output>fieldset.macos.searchs>form.option>div.item.keyword input { background-color:transparent; width:320px; }
|
fieldset.macos.desktop>div.output>fieldset.macos.searchs>form.option>div.item.keyword input { background-color:transparent; width:320px; }
|
||||||
fieldset.macos.desktop>div.output>fieldset.macos.notifications { border-radius:0; height:calc(100% - 125px); width:250px; overflow:auto; position:absolute; top:25px; left:800px; }
|
fieldset.macos.desktop>div.output>fieldset.macos.notifications { border-radius:0; height:calc(100% - 125px); width:250px; overflow:auto; position:absolute; top:25px; left:800px; }
|
||||||
fieldset.macos.desktop>div.output>fieldset.macos.notifications>div.output>div.item { margin-top:10px; min-height:60px; clear:both; }
|
fieldset.macos.desktop>div.output>fieldset.macos.notifications>div.output>div.item { min-height:60px; clear:both; }
|
||||||
fieldset.macos.desktop>div.output>fieldset.macos.notifications div.item div.title { margin-top:10px; width:132px; overflow:hidden; }
|
fieldset.macos.desktop>div.output>fieldset.macos.notifications>div.output>div.item.read { color:var(--disable-fg-color); }
|
||||||
fieldset.macos.desktop>div.output>fieldset.macos.notifications div.item div.time { font-size:var(--code-font-size); margin-top:10px; width:48px; }
|
fieldset.macos.desktop>div.output>fieldset.macos.notifications div.item div.icon img { height:50px; margin:5px; }
|
||||||
|
fieldset.macos.desktop>div.output>fieldset.macos.notifications div.item div.title { padding-top:10px; width:132px; overflow:hidden; }
|
||||||
|
fieldset.macos.desktop>div.output>fieldset.macos.notifications div.item div.time { font-size:var(--code-font-size); text-align:right; padding-top:10px; width:48px; }
|
||||||
fieldset.macos.desktop>div.output>fieldset.macos.notifications div.item div.content { width:180px; }
|
fieldset.macos.desktop>div.output>fieldset.macos.notifications div.item div.content { width:180px; }
|
||||||
fieldset.macos.desktop>div.output>div.desktop:not(.select) { display:none; }
|
fieldset.macos.desktop>div.output>div.desktop:not(.select) { display:none; }
|
||||||
fieldset.macos.desktop>div.output>div.desktop>div.item { color:silver; position:absolute; text-align:center; }
|
fieldset.macos.desktop>div.output>div.desktop>div.item { color:silver; position:absolute; text-align:center; }
|
||||||
|
@ -55,5 +55,5 @@ func CmdHashAction(arg ...string) ice.Actions {
|
|||||||
mdb.SELECT: {Name: "list hash auto create", Hand: func(m *ice.Message, arg ...string) {
|
mdb.SELECT: {Name: "list hash auto create", Hand: func(m *ice.Message, arg ...string) {
|
||||||
mdb.HashSelect(m, arg...).Sort(mdb.NAME).Display(ctx.FileURI(file))
|
mdb.HashSelect(m, arg...).Sort(mdb.NAME).Display(ctx.FileURI(file))
|
||||||
}},
|
}},
|
||||||
}, ctx.CmdAction(), mdb.HashAction(mdb.SHORT, kit.Select("", arg, 0), mdb.FIELD, kit.Select("time,hash,name,icon,text,space,index,args", arg, 1), kit.Slice(arg, 2)))
|
}, ctx.CmdAction(), mdb.HashAction(mdb.SHORT, kit.Select("", arg, 0), mdb.FIELD, kit.Select("time,hash,icon,name,text,space,index,args", arg, 1), kit.Slice(arg, 2)))
|
||||||
}
|
}
|
||||||
|
@ -3,9 +3,9 @@ package macos
|
|||||||
import (
|
import (
|
||||||
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/gdb"
|
||||||
"shylinux.com/x/icebergs/base/mdb"
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
"shylinux.com/x/icebergs/base/web"
|
"shylinux.com/x/icebergs/base/web"
|
||||||
kit "shylinux.com/x/toolkits"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const NOTIFICATIONS = "notifications"
|
const NOTIFICATIONS = "notifications"
|
||||||
@ -13,13 +13,17 @@ const NOTIFICATIONS = "notifications"
|
|||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
NOTIFICATIONS: {Name: "notifications list", Actions: ice.MergeActions(ice.Actions{
|
NOTIFICATIONS: {Name: "notifications list", Actions: ice.MergeActions(ice.Actions{
|
||||||
mdb.PRUNES: {Name: "prunes", Hand: func(m *ice.Message, arg ...string) { m.Conf("", kit.Keys(mdb.HASH), "") }},
|
|
||||||
web.DREAM_CREATE: {Hand: func(m *ice.Message, arg ...string) {
|
web.DREAM_CREATE: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmd("", mdb.CREATE, m.OptionSimple(mdb.NAME), mdb.TEXT, "空间创建成功", ctx.INDEX, web.CHAT_IFRAME, ctx.ARGS, m.MergePod(m.Option(mdb.NAME)))
|
Notify(m, "usr/icons/Launchpad.png", m.Option(mdb.NAME), "空间创建成功", ctx.INDEX, web.CHAT_IFRAME, ctx.ARGS, m.MergePod(m.Option(mdb.NAME)))
|
||||||
}},
|
}},
|
||||||
}, CmdHashAction()), Hand: func(m *ice.Message, arg ...string) { mdb.HashSelect(m, arg...).SortStrR(mdb.TIME).Display("") }},
|
"read": {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
m.Cmd(mdb.MODIFY, m.PrefixKey(), "", mdb.LIST, mdb.ID, m.Option(mdb.ID), mdb.STATUS, "read")
|
||||||
|
}},
|
||||||
|
}, gdb.EventAction(web.DREAM_CREATE), mdb.ListAction(mdb.FIELD, "time,id,status,icon,name,text,space,index,args")), Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
mdb.ListSelect(m, arg...).Display("")
|
||||||
|
}},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
func Notify(m *ice.Message, name, text string, arg ...string) {
|
func Notify(m *ice.Message, icon, name, text string, arg ...string) {
|
||||||
m.Cmd(NOTIFICATIONS, mdb.CREATE, mdb.NAME, name, mdb.TEXT, text, arg)
|
m.Cmd(NOTIFICATIONS, mdb.INSERT, mdb.ICON, icon, mdb.NAME, name, mdb.TEXT, text, arg)
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,18 @@
|
|||||||
Volcanos(chat.ONIMPORT, {_init: function(can, msg) {
|
Volcanos(chat.ONIMPORT, {_init: function(can, msg) {
|
||||||
can.page.Appends(can, can._output, msg.Table(function(item) { return {view: html.ITEM, _init: function(target) {
|
can.page.Appends(can, can._output, msg.Table(function(item) { return {view: [[html.ITEM, item.status]], _init: function(target) {
|
||||||
var ui = can.onappend.layout(can, [html.ICON, [[wiki.TITLE, mdb.TIME], wiki.CONTENT]], "", target)
|
var ui = can.onappend.layout(can, [html.ICON, [[wiki.TITLE, mdb.TIME], wiki.CONTENT]], "", target)
|
||||||
can.page.Append(can, ui.icon, [{img: can.misc.PathJoin(item.icon||can.page.drawText(can, item.name||item.index, 60))}])
|
can.page.Append(can, ui.icon, [{img: can.misc.PathJoin(item.icon||can.page.drawText(can, item.name||item.index, 60))}])
|
||||||
ui.title.innerHTML = item.name||"", ui.content.innerHTML = item.text||"", ui.time.innerHTML = item.time.split(lex.SP).pop().split(nfs.DF).slice(0, 2).join(nfs.DF)
|
ui.title.innerHTML = item.name||"", ui.content.innerHTML = item.text||"", ui.time.innerHTML = item.time.split(lex.SP).pop().split(nfs.DF).slice(0, 2).join(nfs.DF)
|
||||||
target.onclick = function(event) { can.sup.onexport.record(can.sup, item.index, ctx.INDEX, item), can.runAction(event, mdb.REMOVE, [item.hash], function() { can.page.Remove(can, target) }) }
|
target.onclick = function(event) { can.sup.onexport.record(can.sup, item.index, ctx.INDEX, item),
|
||||||
|
can.runAction(can.request(event, item), "read", [], function() {
|
||||||
|
can.onappend.style(can, "read", target)
|
||||||
|
return
|
||||||
|
can.page.Remove(can, target) }) }
|
||||||
}} })), msg.Length() == 0 && can.onmotion.hidden(can, can._fields), can.onappend._action(can), can.page.style(can, can._action, html.DISPLAY, html.BLOCK)
|
}} })), msg.Length() == 0 && can.onmotion.hidden(can, can._fields), can.onappend._action(can), can.page.style(can, can._action, html.DISPLAY, html.BLOCK)
|
||||||
}})
|
}})
|
||||||
Volcanos(chat.ONACTION, {list: [web.UPDATE, mdb.PRUNES, web.TOGGLE], _trans: {update: "刷新", toggle: "隐藏"},
|
Volcanos(chat.ONACTION, {
|
||||||
update: function(event, can, button) { can.Update(event) },
|
list: [web.REFRESH, mdb.PRUNES, html.TOGGLE],
|
||||||
|
_trans: {refresh: "刷新", toggle: "隐藏"},
|
||||||
|
refresh: function(event, can, button) { can.Update(event) },
|
||||||
toggle: function(event, can, button) { can.onmotion.hidden(can, can._fields) },
|
toggle: function(event, can, button) { can.onmotion.hidden(can, can._fields) },
|
||||||
})
|
})
|
||||||
|
@ -25,8 +25,7 @@ func init() {
|
|||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
PY: {Name: "py path auto", Help: "脚本", Actions: ice.MergeActions(ice.Actions{
|
PY: {Name: "py path auto", Help: "脚本", Actions: ice.MergeActions(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
cli.IsAlpine(m, "python", "python2")
|
cli.IsAlpine(m, "python", "python3")
|
||||||
cli.IsAlpine(m, "python2")
|
|
||||||
cli.IsAlpine(m, "python3")
|
cli.IsAlpine(m, "python3")
|
||||||
cli.IsCentos(m, "python", "python2")
|
cli.IsCentos(m, "python", "python2")
|
||||||
cli.IsCentos(m, "python2")
|
cli.IsCentos(m, "python2")
|
||||||
|
@ -118,7 +118,7 @@ func init() {
|
|||||||
nfs.DirDeepAll(m.Spawn(), nfs.PWD, p, func(value ice.Maps) { push("", value[nfs.PATH]) }, nfs.PATH)
|
nfs.DirDeepAll(m.Spawn(), nfs.PWD, p, func(value ice.Maps) { push("", value[nfs.PATH]) }, nfs.PATH)
|
||||||
}
|
}
|
||||||
m.Cmd(XTERM).Table(func(value ice.Maps) {
|
m.Cmd(XTERM).Table(func(value ice.Maps) {
|
||||||
push(ctx.INDEX, kit.Join([]string{"web.code.xterm", value[mdb.HASH], kit.Select(value[mdb.TYPE], value[mdb.NAME])}))
|
push(ctx.INDEX, kit.Join([]string{web.CODE_XTERM, value[mdb.HASH], kit.Select(value[mdb.TYPE], value[mdb.NAME])}))
|
||||||
})
|
})
|
||||||
m.Cmd(ctx.COMMAND, mdb.SEARCH, ctx.COMMAND, ice.OptionFields(ctx.INDEX)).Table(func(value ice.Maps) { push(ctx.INDEX, value[ctx.INDEX]) })
|
m.Cmd(ctx.COMMAND, mdb.SEARCH, ctx.COMMAND, ice.OptionFields(ctx.INDEX)).Table(func(value ice.Maps) { push(ctx.INDEX, value[ctx.INDEX]) })
|
||||||
m.Cmd(mdb.SEARCH, cli.SYSTEM, cli.OPENS, ice.OptionFields("type,name,text")).Sort("type,name,text").Table(func(value ice.Maps) { push(cli.OPENS, value[nfs.NAME]) })
|
m.Cmd(mdb.SEARCH, cli.SYSTEM, cli.OPENS, ice.OptionFields("type,name,text")).Sort("type,name,text").Table(func(value ice.Maps) { push(cli.OPENS, value[nfs.NAME]) })
|
||||||
|
26
info.go
26
info.go
@ -69,12 +69,14 @@ var Info = struct {
|
|||||||
Index Map
|
Index Map
|
||||||
Stack map[string]func(m *Message, key string, arg ...Any) Any
|
Stack map[string]func(m *Message, key string, arg ...Any) Any
|
||||||
|
|
||||||
merges []Any
|
merges []Any
|
||||||
render map[string]func(*Message, ...Any) string
|
render map[string]func(*Message, ...Any) string
|
||||||
OpenFile func(m *Message, p string) (io.ReadCloser, error)
|
OpenFile func(m *Message, p string) (io.ReadCloser, error)
|
||||||
Load func(m *Message, key ...string) *Message
|
PushStream func(m *Message)
|
||||||
Save func(m *Message, key ...string) *Message
|
PushNotice func(m *Message, arg ...Any)
|
||||||
Log func(m *Message, p, l, s string)
|
Load func(m *Message, key ...string) *Message
|
||||||
|
Save func(m *Message, key ...string) *Message
|
||||||
|
Log func(m *Message, p, l, s string)
|
||||||
}{
|
}{
|
||||||
Localhost: true,
|
Localhost: true,
|
||||||
|
|
||||||
@ -84,11 +86,13 @@ var Info = struct {
|
|||||||
Index: Map{},
|
Index: Map{},
|
||||||
Stack: map[string]func(m *Message, key string, arg ...Any) Any{},
|
Stack: map[string]func(m *Message, key string, arg ...Any) Any{},
|
||||||
|
|
||||||
render: map[string]func(*Message, ...Any) string{},
|
render: map[string]func(*Message, ...Any) string{},
|
||||||
OpenFile: func(m *Message, p string) (io.ReadCloser, error) { return miss.OpenFile(p) },
|
OpenFile: func(m *Message, p string) (io.ReadCloser, error) { return miss.OpenFile(p) },
|
||||||
Load: func(m *Message, key ...string) *Message { return m },
|
PushStream: func(m *Message) {},
|
||||||
Save: func(m *Message, key ...string) *Message { return m },
|
PushNotice: func(m *Message, arg ...Any) {},
|
||||||
Log: func(m *Message, p, l, s string) {},
|
Load: func(m *Message, key ...string) *Message { return m },
|
||||||
|
Save: func(m *Message, key ...string) *Message { return m },
|
||||||
|
Log: func(m *Message, p, l, s string) {},
|
||||||
}
|
}
|
||||||
|
|
||||||
func AddMergeAction(h ...Any) { Info.merges = append(Info.merges, h...) }
|
func AddMergeAction(h ...Any) { Info.merges = append(Info.merges, h...) }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user