1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-26 01:24:05 +08:00
This commit is contained in:
harveyshao 2022-04-12 07:43:57 +08:00
parent bca3c8bb0d
commit d5023bccad
12 changed files with 46 additions and 10 deletions

View File

@ -36,7 +36,7 @@ func init() {
}
if p := m.Cmdx(nfs.CAT, m.Conf("gdb.signal", kit.Keym(nfs.PATH))); p != "" {
m.Cmd(SYSTEM, "kill", "-n", 3, p)
m.Cmd(SYSTEM, "kill", "-s", "QUIT", p)
}
m.Cmdy(FOREVER, kit.Select(os.Args[0], nfs.PWD+ice.BIN_ICE_BIN, kit.FileExists(ice.BIN_ICE_BIN)),

View File

@ -93,7 +93,9 @@ func _hash_export(m *ice.Message, prefix, chain, file string) {
}
func _hash_import(m *ice.Message, prefix, chain, file string) {
f, e := os.Open(kit.Keys(file, JSON))
m.Assert(e)
if m.Warn(e) {
return
}
defer f.Close()
list := map[string]interface{}{}

View File

@ -90,7 +90,9 @@ func _zone_export(m *ice.Message, prefix, chain, file string) {
}
func _zone_import(m *ice.Message, prefix, chain, file string) {
f, e := os.Open(kit.Keys(file, CSV))
m.Assert(e)
if m.Warn(e) {
return
}
defer f.Close()
r := csv.NewReader(f)

View File

@ -133,7 +133,13 @@ func (f *Frame) scan(m *ice.Message, h, line string) *Frame {
f.ps2 = kit.Simple(m.Confv(PROMPT, kit.Keym(PS2)))
ps := f.ps1
m.Sleep("100ms")
if h == STDIO {
m.Sleep("800ms")
pwd := ice.Render(m, ice.RENDER_QRCODE, m.Cmdx("space", "domain"))
m.Sleep("100ms")
f.printf(m, pwd+ice.NL)
}
m.I, m.O = f.stdin, f.stdout
bio := bufio.NewScanner(f.stdin)
for f.prompt(m, ps...); bio.Scan() && f.stdin != nil; f.prompt(m, ps...) {

View File

@ -46,8 +46,9 @@ func _client_dial(m *ice.Message, arg ...string) {
case func(net.Conn, error):
cb(c, e)
case func(net.Conn):
m.Assert(e)
cb(c)
if !m.Warn(e) {
cb(c)
}
case func(net.Conn, []byte, error):
b := make([]byte, ice.MOD_BUFS)
for {

View File

@ -293,7 +293,7 @@ func init() {
repos := kit.Select(ice.INTSHELL, ice.VOLCANOS, strings.Contains(r.Header.Get("User-Agent"), "Mozilla/5.0"))
if repos == ice.VOLCANOS {
if s := m.Cmdx("web.chat.website", "show", "index.iml", "Header", "", "River", "", "Action", "", "Footer", ""); s != "" {
if s := msg.Cmdx("web.chat.website", "show", "index.iml", "Header", "", "River", "", "Action", "", "Footer", ""); s != "" {
Render(msg, ice.RENDER_RESULT, s)
return true
}

View File

@ -81,6 +81,10 @@ func _share_local(m *ice.Message, arg ...string) {
size = s.Size()
}
if p == "bin/ice.bin" {
aaa.UserRoot(m)
}
// 上传文件
m.Cmd(SPACE, m.Option(ice.POD), SPIDE, ice.DEV, SPIDE_RAW, m.MergeURL2(SHARE_PROXY, nfs.PATH, ""),
SPIDE_PART, m.OptionSimple(ice.POD), nfs.PATH, p, nfs.SIZE, size, CACHE, cache.Format(ice.MOD_TIME), UPLOAD, "@"+p)

View File

@ -17,6 +17,9 @@ import (
func _space_domain(m *ice.Message) (link string) {
if link = m.Config(DOMAIN); link == "" {
link = m.Cmd(SPACE, ice.OPS, cli.PWD).Append(mdb.LINK)
}
if link == "" {
link = m.Cmd(SPACE, ice.DEV, cli.PWD).Append(mdb.LINK)
}
if link == "" {
@ -284,6 +287,9 @@ func init() {
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
m.Conf(SPACE, mdb.HASH, "")
}},
"domain": {Name: "domain", Help: "域名", Hand: func(m *ice.Message, arg ...string) {
m.Echo(_space_domain(m))
}},
mdb.SEARCH: {Name: "search type name text", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
_space_search(m, arg[0], arg[1], kit.Select("", arg, 2))
_broad_search(m, arg[0], arg[1], kit.Select("", arg, 2))

View File

@ -4,6 +4,7 @@ import (
"path"
ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/aaa"
"shylinux.com/x/icebergs/base/ctx"
"shylinux.com/x/icebergs/base/web"
kit "shylinux.com/x/toolkits"
@ -31,6 +32,7 @@ func init() {
m.RenderCmd(web.ROUTE)
} else if len(arg) == 1 { // 节点首页
aaa.UserRoot(m)
if m.RenderWebsite(arg[0], "index.iml", "Header", "", "River", "", "Action", "", "Footer", ""); m.Result() == "" {
m.RenderIndex(web.SERVE, ice.VOLCANOS)
}

View File

@ -73,6 +73,11 @@ func init() {
web.SERVE_START: {Name: "serve.start", Help: "服务启动", Hand: func(m *ice.Message, arg ...string) {
_publish_file(m, ice.ICE_BIN)
}},
mdb.SEARCH: {Name: "search type name text", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
if arg[0] == mdb.FOREACH && arg[1] == "" {
m.PushSearch(mdb.TYPE, ice.CONTEXTS, mdb.NAME, ice.CORE, mdb.TEXT, m.Cmdx(m.PrefixKey(), ice.CONTEXTS, ice.CORE))
}
}},
ice.VOLCANOS: {Name: "volcanos", Help: "火山架", Hand: func(m *ice.Message, arg ...string) {
defer func() { m.EchoQRCode(m.Option(ice.MSG_USERWEB)) }()
@ -147,7 +152,7 @@ var _contexts = kit.Dict(
export ctx_dev={{.Option "httphost"}}; ctx_temp=$(mktemp); curl -fsSL $ctx_dev -o $ctx_temp; source $ctx_temp dev
`,
ice.CORE, `# 标准版
export ctx_dev={{.Option "httphost"}}; ctx_temp=$(mktemp); wget -O $ctx_temp $ctx_dev; source $ctx_temp app
export ctx_dev={{.Option "httphost"}} ctx_pod={{.Option "user.pod"}}; ctx_temp=$(mktemp); wget -O $ctx_temp $ctx_dev; source $ctx_temp app
`,
ice.BASE, `# 官方版
ctx_temp=$(mktemp); curl -o $ctx_temp -fsSL {{.Cmdx "spide" "shy" "url"}}; source $ctx_temp binary

View File

@ -30,8 +30,6 @@ func _repos_insert(m *ice.Message, name string, dir string) {
BRANCH, strings.TrimSpace(m.Cmdx(cli.SYSTEM, GIT, BRANCH)),
REMOTE, strings.TrimSpace(m.Cmdx(cli.SYSTEM, GIT, REMOTE, "-v")),
))
} else {
m.Debug("what %v %v", s, e)
}
}

View File

@ -75,6 +75,16 @@ func init() {
}
m.Cmdy(TEXT)
}},
mdb.SEARCH: {Name: "search type name text", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
if arg[0] == mdb.FOREACH && arg[1] == "" {
text := m.Cmdx(cli.SYSTEM, TMUX, "show-buffer")
if strings.HasPrefix(text, "http") {
m.PushSearch(mdb.TEXT, text)
} else {
m.PushSearch(mdb.TEXT, ice.Render(m, ice.RENDER_SCRIPT, text))
}
}
}},
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
text := m.Cmdx(cli.SYSTEM, TMUX, "show-buffer")
m.EchoQRCode(text)