From a42766ddb201b9f9c9bf72c8140d0a02a668241d Mon Sep 17 00:00:00 2001 From: harveyshao Date: Wed, 12 May 2021 11:13:26 +0800 Subject: [PATCH] opt index --- base/web/space.go | 3 +++ core/chat/river.go | 2 +- core/code/publish.go | 20 +++++++++++++------- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/base/web/space.go b/base/web/space.go index b4ea864a..8dcd566d 100644 --- a/base/web/space.go +++ b/base/web/space.go @@ -202,6 +202,9 @@ func _space_search(m *ice.Message, kind, name, text string, arg ...string) { if name == "" { port := m.Cmd(SERVE, ice.Option{mdb.FIELDS, tcp.PORT}).Append(tcp.PORT) + if port == "" { + return + } m.Cmd(tcp.HOST).Table(func(index int, value map[string]string, head []string) { m.PushSearch(kit.SSH_CMD, SPACE, kit.MDB_TYPE, MYSELF, kit.MDB_NAME, value[kit.MDB_NAME], kit.MDB_TEXT, kit.Format("http://%s:%s", value[tcp.IP], port), kit.SSH_POD, kit.Keys(m.Option(ice.MSG_USERPOD), value)) diff --git a/core/chat/river.go b/core/chat/river.go index 2ee86425..8d4d1577 100644 --- a/core/chat/river.go +++ b/core/chat/river.go @@ -322,7 +322,7 @@ func init() { m.Cmdy(mdb.IMPORT, RIVER, "", mdb.HASH) }}, aaa.INVITE: {Name: "invite", Help: "脚本", Hand: func(m *ice.Message, arg ...string) { - for _, k := range []string{"tmux", "base", "miss"} { + for _, k := range []string{"tmux", "base", "miss", "binary", "source"} { m.Cmdy("web.code.publish", "contexts", k) } }}, diff --git a/core/code/publish.go b/core/code/publish.go index 8aaba6a1..99c08ad2 100644 --- a/core/code/publish.go +++ b/core/code/publish.go @@ -1,6 +1,12 @@ package code import ( + "fmt" + "os" + "path" + "runtime" + "strings" + ice "github.com/shylinux/icebergs" "github.com/shylinux/icebergs/base/cli" "github.com/shylinux/icebergs/base/mdb" @@ -8,12 +14,6 @@ import ( "github.com/shylinux/icebergs/base/tcp" "github.com/shylinux/icebergs/base/web" kit "github.com/shylinux/toolkits" - - "fmt" - "os" - "path" - "runtime" - "strings" ) func _publish_file(m *ice.Message, file string, arg ...string) string { @@ -149,11 +149,17 @@ echo "hello world" } var _contexts = kit.Dict( + "source", `# 源码安装 +curl -fsSL {{.Option "httphost"}} |sh -s source +`, + "binary", `# 应用安装 +curl -fsSL {{.Option "httphost"}} |sh -s binary +`, "tmux", `# 终端环境 export ctx_dev={{.Option "httphost"}} ctx_temp=$(mktemp); curl -fsSL $ctx_dev -o $ctx_temp; source $ctx_temp `, "base", `# 生产环境 -export ctx_dev={{.Option "httphost"}} ctx_temp=$(mktemp); curl -fsSL $ctx_dev -o $ctx_temp; source $ctx_temp ice +export ctx_dev={{.Option "httphost"}} ctx_temp=$(mktemp); curl -fsSL $ctx_dev -o $ctx_temp; source $ctx_temp app `, "miss", `# 开发环境 export ctx_dev={{.Option "httphost"}} ctx_temp=$(mktemp); curl -fsSL $ctx_dev -o $ctx_temp; source $ctx_temp dev