mirror of
https://shylinux.com/x/icebergs
synced 2025-04-25 17:18:05 +08:00
add ssh.server
This commit is contained in:
parent
6debe2039f
commit
7747b0e9fd
@ -347,6 +347,8 @@ var Index = &ice.Context{Name: "ssh", Help: "终端模块",
|
||||
"PS2", []interface{}{"count", " ", "target", "> "},
|
||||
)},
|
||||
REMOTE: {Name: "remote", Help: "远程连接", Value: kit.Data()},
|
||||
|
||||
"dial": {Name: "dial", Help: "远程连接", Value: kit.Data()},
|
||||
},
|
||||
Commands: map[string]*ice.Command{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { m.Load() }},
|
||||
@ -354,6 +356,7 @@ var Index = &ice.Context{Name: "ssh", Help: "终端模块",
|
||||
if _, ok := m.Target().Server().(*Frame); ok {
|
||||
m.Done()
|
||||
}
|
||||
m.Save()
|
||||
}},
|
||||
|
||||
SOURCE: {Name: "source file", Help: "脚本解析", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
|
@ -171,7 +171,7 @@ var Index = &ice.Context{Name: "chat", Help: "聊天中心",
|
||||
}
|
||||
}
|
||||
|
||||
if m.Warn(m.Right(m.Option(ice.MSG_USERURL), m.Optionv(ice.MSG_CMDS))) {
|
||||
if m.Warn(!m.Right(m.Option(ice.MSG_USERURL), m.Optionv(ice.MSG_CMDS))) {
|
||||
return
|
||||
}
|
||||
|
||||
|
2
go.mod
2
go.mod
@ -7,8 +7,10 @@ require (
|
||||
github.com/gomarkdown/markdown v0.0.0-20200824053859-8c8b3816f167
|
||||
github.com/gomodule/redigo v2.0.0+incompatible // indirect
|
||||
github.com/gorilla/websocket v1.4.2
|
||||
github.com/kr/pty v1.1.1
|
||||
github.com/nareix/joy4 v0.0.0-20200507095837-05a4ffbb5369
|
||||
github.com/shylinux/toolkits v0.1.7
|
||||
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e
|
||||
github.com/tuotoo/qrcode v0.0.0-20190222102259-ac9c44189bf2
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550
|
||||
)
|
||||
|
2
go.sum
2
go.sum
@ -26,6 +26,7 @@ github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0U
|
||||
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/jackmordaunt/icns v0.0.0-20181231085925-4f16af745526/go.mod h1:UQkeMHVoNcyXYq9otUupF7/h/2tmHlhrS2zw7ZVvUqc=
|
||||
github.com/josephspurrier/goversioninfo v0.0.0-20200309025242-14b0ab84c6ca/go.mod h1:eJTEwMjXb7kZ633hO3Ln9mBUCOjX2+FlTljvpl9SYdE=
|
||||
github.com/kr/pty v1.1.1 h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/lucor/goinfo v0.0.0-20200401173949-526b5363a13a/go.mod h1:ORP3/rB5IsulLEBwQZCJyyV6niqmI7P4EWSmkug+1Ng=
|
||||
@ -58,6 +59,7 @@ github.com/tuotoo/qrcode v0.0.0-20190222102259-ac9c44189bf2/go.mod h1:lPnW9HVS0v
|
||||
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
||||
golang.org/dl v0.0.0-20190829154251-82a15e2f2ead/go.mod h1:IUMfjQLJQd4UTqG1Z90tenwKoCX93Gn3MAQJMOSBsDQ=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
golang.org/x/image v0.0.0-20200430140353-33d19683fad8 h1:6WW6V3x1P/jokJBpRQYUJnMHRP6isStQwCozxnU7XQw=
|
||||
|
@ -10,6 +10,7 @@ import (
|
||||
"github.com/shylinux/icebergs/core/code"
|
||||
kit "github.com/shylinux/toolkits"
|
||||
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
@ -421,6 +422,14 @@ var Index = &ice.Context{Name: GIT, Help: "代码库",
|
||||
})
|
||||
m.Sort("name")
|
||||
}},
|
||||
|
||||
"/repos/": {Name: "/repos/", Help: "缓存池", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
switch arg[2] {
|
||||
case "info":
|
||||
http.ServeFile(m.W, m.R, path.Join("demo.git", path.Join(arg[3:]...)))
|
||||
}
|
||||
m.Render(ice.RENDER_VOID)
|
||||
}},
|
||||
},
|
||||
}
|
||||
|
||||
|
11
type.go
11
type.go
@ -31,6 +31,7 @@ type Config struct {
|
||||
type Action struct {
|
||||
Name string
|
||||
Help string
|
||||
List []interface{}
|
||||
Hand func(m *Message, arg ...string)
|
||||
}
|
||||
type Command struct {
|
||||
@ -132,6 +133,7 @@ func (c *Context) Register(s *Context, x Server, name ...string) *Context {
|
||||
for _, n := range name {
|
||||
Name(n, s)
|
||||
}
|
||||
s.Merge(s, x)
|
||||
|
||||
Pulse.Log("register", "%s <- %s", c.Name, s.Name)
|
||||
if c.contexts == nil {
|
||||
@ -155,6 +157,15 @@ func (c *Context) Merge(s *Context, x Server) *Context {
|
||||
}
|
||||
for k, v := range s.Commands {
|
||||
c.Commands[k] = v
|
||||
if v.Meta == nil {
|
||||
v.Meta = kit.Dict()
|
||||
}
|
||||
for k, a := range v.Action {
|
||||
if a.List != nil {
|
||||
v.Meta[a.Help] = a.List
|
||||
v.Meta[k] = a.List
|
||||
}
|
||||
}
|
||||
}
|
||||
for k, v := range s.Configs {
|
||||
c.Configs[k] = v
|
||||
|
Loading…
x
Reference in New Issue
Block a user