diff --git a/base/ssh/ssh.go b/base/ssh/ssh.go index 3598d9e5..74398082 100644 --- a/base/ssh/ssh.go +++ b/base/ssh/ssh.go @@ -249,7 +249,9 @@ func (f *Frame) Start(m *ice.Message, arg ...string) bool { if m.Option(ice.MSG_PROMPT, m.Confv("prompt", "meta.PS1")); f.out == os.Stdout { f.printf(m, "\033[0m") } - m.Cmd(ice.WEB_FAVOR, "cmd.history", "cmd", kit.Select("stdio", arg, 0), line) + if m.Cap(ice.CTX_STREAM) == "stdio" { + m.Cmd(ice.WEB_FAVOR, "cmd.history", "cmd", kit.Select("stdio", arg, 0), line) + } // 解析命令 f.parse(m, line) @@ -265,7 +267,7 @@ func (f *Frame) Close(m *ice.Message, arg ...string) bool { var Index = &ice.Context{Name: "ssh", Help: "终端模块", Caches: map[string]*ice.Cache{}, Configs: map[string]*ice.Config{ - "history": {Name: "history", Help: "history", Value: kit.Data()}, + "history": {Name: "history", Help: "history", Value: kit.Data("limit", "200", "least", "100")}, "prompt": {Name: "prompt", Help: "prompt", Value: kit.Data( "PS1", []interface{}{"\033[33;44m", "count", "[", "time", "]", "\033[5m", "target", "\033[0m", "\033[44m", ">", "\033[0m ", "\033[?25h", "\033[32m"}, "PS2", []interface{}{"count", " ", "target", "> "}, diff --git a/base/web/web.go b/base/web/web.go index d7a1bd43..9c0a86ad 100644 --- a/base/web/web.go +++ b/base/web/web.go @@ -770,6 +770,7 @@ var Index = &ice.Context{Name: "web", Help: "网络模块", // 空间列表 m.Richs(ice.WEB_SPACE, nil, "*", func(key string, value map[string]interface{}) { m.Push(key, value, []string{"time", "type", "name", "text"}) + m.Push("link", fmt.Sprintf(`%s`, m.Conf(ice.WEB_SHARE, "meta.domain"), value["name"], value["name"])) }) m.Sort("name") return @@ -829,6 +830,8 @@ var Index = &ice.Context{Name: "web", Help: "网络模块", // 空间详情 m.Richs(ice.WEB_SPACE, nil, arg[0], func(key string, value map[string]interface{}) { m.Push("detail", value) + m.Push("key", "link") + m.Push("value", fmt.Sprintf(`%s`, m.Conf(ice.WEB_SHARE, "meta.domain"), value["name"], value["name"])) }) break } @@ -1627,9 +1630,9 @@ var Index = &ice.Context{Name: "web", Help: "网络模块", ), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { if len(arg) == 0 { // 共享列表 - m.Grows(ice.WEB_SHARE, nil, "", "", func(key int, value map[string]interface{}) { - m.Push(kit.Format(key), value, []string{kit.MDB_TIME, "share", kit.MDB_TYPE, kit.MDB_NAME, kit.MDB_TEXT}) - m.Push("value", fmt.Sprintf(m.Conf(ice.WEB_SHARE, "meta.template.link"), value["share"], value["share"])) + m.Grows(ice.WEB_SHARE, nil, "", "", func(index int, value map[string]interface{}) { + m.Push("", value, []string{kit.MDB_TIME, "share", kit.MDB_TYPE, kit.MDB_NAME, kit.MDB_TEXT}) + m.Push("value", fmt.Sprintf(m.Conf(ice.WEB_SHARE, "meta.template.link"), m.Conf(ice.WEB_SHARE, "meta.domain"), value["share"], value["share"])) }) return } diff --git a/go.mod b/go.mod index 83f3a4d1..181b2a78 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,6 @@ go 1.13 require ( github.com/gomarkdown/markdown v0.0.0-20200127000047-1813ea067497 github.com/gorilla/websocket v1.4.1 - github.com/shylinux/toolkits v0.1.3 + github.com/shylinux/toolkits v0.1.4 github.com/skip2/go-qrcode v0.0.0-20191027152451-9434209cb086 ) diff --git a/misc/git/git.go b/misc/git/git.go index ba152cb5..00618a22 100644 --- a/misc/git/git.go +++ b/misc/git/git.go @@ -16,7 +16,7 @@ func add(m *ice.Message, n string, p string) { ls := strings.SplitN(strings.Trim(m.Cmdx(ice.CLI_SYSTEM, "git", "log", "-n1", `--pretty=format:"%ad %s"`, "--date=iso"), "\""), " ", 4) m.Rich("repos", nil, kit.Data( "name", n, "path", p, - "last", ls[3], "time", strings.Join(ls[:2], " "), + "last", kit.Select("", ls, 3), "time", strings.Join(ls[:2], " "), "branch", strings.TrimSpace(m.Cmdx(ice.CLI_SYSTEM, "git", "branch")), "remote", strings.TrimSpace(m.Cmdx(ice.CLI_SYSTEM, "git", "remote", "-v")), )) diff --git a/template.sh b/template.sh index 3a7e7dfb..c5cebcde 100755 --- a/template.sh +++ b/template.sh @@ -8,10 +8,21 @@ local_shy="etc/local.shy" exit_shy="etc/exit.shy" main_go="src/main.go" readme="README.md" +shy="hi.shy" prepare() { - [ -f ${readme} ] || cat >> ${readme} <> ${shy} <