From 8c434eb4dfc9f3f5ad30f4ced7a006990a477fc7 Mon Sep 17 00:00:00 2001 From: shylinux Date: Wed, 1 Sep 2021 11:08:27 +0800 Subject: [PATCH] opt index --- base/web/serve.go | 8 ++++++-- core/code/publish.go | 12 ++++++------ render.go | 2 +- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/base/web/serve.go b/base/web/serve.go index b04e1920..c55ffad5 100644 --- a/base/web/serve.go +++ b/base/web/serve.go @@ -78,8 +78,12 @@ func _serve_main(m *ice.Message, w http.ResponseWriter, r *http.Request) bool { func _serve_params(msg *ice.Message, path string) { switch ls := strings.Split(path, "/"); kit.Select("", ls, 1) { case "share": - msg.Logs("refer", ls[1], ls[2]) - msg.Option(ls[1], ls[2]) + switch ls[2] { + case "local": + default: + msg.Logs("refer", ls[1], ls[2]) + msg.Option(ls[1], ls[2]) + } case "chat": switch kit.Select("", ls, 2) { case "pod": diff --git a/core/code/publish.go b/core/code/publish.go index 44a8b098..7034d91d 100644 --- a/core/code/publish.go +++ b/core/code/publish.go @@ -164,22 +164,22 @@ echo "hello world" var _contexts = kit.Dict( "project", `# 创建项目 -ctx_temp=$(mktemp); curl -fsSL https://shylinux.com -o $ctx_temp; source $ctx_temp project +source <(curl -fsSL https://shylinux.com) project `, "source", `# 源码安装 -ctx_temp=$(mktemp); curl -fsSL https://shylinux.com -o $ctx_temp; source $ctx_temp source +source <(curl -fsSL https://shylinux.com) source `, "binary", `# 应用安装 -ctx_temp=$(mktemp); curl -fsSL https://shylinux.com -o $ctx_temp; source $ctx_temp binary +source <(curl -fsSL https://shylinux.com) binary `, "miss", `# 开发环境 -export ctx_dev={{.Option "httphost"}} ctx_temp=$(mktemp); curl -fsSL $ctx_dev -o $ctx_temp; source $ctx_temp dev +export ctx_dev={{.Option "httphost"}}; source <(curl -fsSL $ctx_dev) dev `, "base", `# 生产环境 -export ctx_dev={{.Option "httphost"}} ctx_temp=$(mktemp); curl -fsSL $ctx_dev -o $ctx_temp; source $ctx_temp app +export ctx_dev={{.Option "httphost"}}; source <(curl -fsSL $ctx_dev) app `, "tmux", `# 终端环境 -export ctx_dev={{.Option "httphost"}} ctx_temp=$(mktemp); curl -fsSL $ctx_dev -o $ctx_temp; source $ctx_temp +export ctx_dev={{.Option "httphost"}}; source <(curl -fsSL $ctx_dev) `, "tool", `# 群组环境 mkdir contexts; cd contexts diff --git a/render.go b/render.go index f1dee6a4..82a0966f 100644 --- a/render.go +++ b/render.go @@ -134,5 +134,5 @@ func (m *Message) RenderRedirect(args ...interface{}) *Message { return m.Render(RENDER_REDIRECT, args...) } func (m *Message) RenderIndex(serve, repos string, file ...string) *Message { - return m.RenderDownload(kit.Path(m.Conf(serve, kit.Keym(repos, kit.SSH_PATH)), kit.Select(m.Conf(serve, kit.Keym(repos, kit.SSH_INDEX)), path.Join(file...)))) + return m.RenderDownload(path.Join(m.Conf(serve, kit.Keym(repos, kit.SSH_PATH)), kit.Select(m.Conf(serve, kit.Keym(repos, kit.SSH_INDEX)), path.Join(file...)))) }