mirror of
https://shylinux.com/x/icebergs
synced 2025-04-28 18:22:02 +08:00
opt some
This commit is contained in:
parent
e3ed4d0944
commit
a24e75a232
@ -57,15 +57,9 @@ func _serve_main(m *ice.Message, w http.ResponseWriter, r *http.Request) bool {
|
|||||||
|
|
||||||
// 主页接口
|
// 主页接口
|
||||||
if r.Method == "GET" && r.URL.Path == "/" {
|
if r.Method == "GET" && r.URL.Path == "/" {
|
||||||
msg, repos := m.Spawn(), ice.INTSHELL
|
msg := m.Spawn()
|
||||||
if msg.W, msg.R = w, r; strings.Contains(r.Header.Get("User-Agent"), "curl") {
|
msg.W, msg.R = w, r
|
||||||
repos = ice.INTSHELL
|
repos := kit.Select(ice.INTSHELL, ice.VOLCANOS, strings.Contains(r.Header.Get("User-Agent"), "Mozilla/5.0"))
|
||||||
} else {
|
|
||||||
repos = ice.VOLCANOS
|
|
||||||
if ice.DumpBinPack(w, r.URL.Path, func(name string) { RenderType(w, name, "") }) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Render(msg, ice.RENDER_DOWNLOAD, path.Join(m.Conf(SERVE, kit.Keym(repos, kit.SSH_PATH)), m.Conf(SERVE, kit.Keym(repos, kit.SSH_INDEX))))
|
Render(msg, ice.RENDER_DOWNLOAD, path.Join(m.Conf(SERVE, kit.Keym(repos, kit.SSH_PATH)), m.Conf(SERVE, kit.Keym(repos, kit.SSH_INDEX))))
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -253,10 +253,16 @@ func init() {
|
|||||||
m.Event(SPACE_START, args...)
|
m.Event(SPACE_START, args...)
|
||||||
defer m.Event(SPACE_STOP, args...)
|
defer m.Event(SPACE_STOP, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch kind {
|
switch kind {
|
||||||
case "chrome":
|
case CHROME:
|
||||||
|
if m.Option(ice.MSG_USERNAME) != "" {
|
||||||
|
break
|
||||||
|
}
|
||||||
link := kit.MergeURL(m.Conf(SHARE, kit.Keym(kit.MDB_DOMAIN)), "auth", name)
|
link := kit.MergeURL(m.Conf(SHARE, kit.Keym(kit.MDB_DOMAIN)), "auth", name)
|
||||||
m.Cmd(SPACE, name, "pwd", name, link, m.Cmdx(cli.QRCODE, link))
|
go func() {
|
||||||
|
m.Sleep("100ms").Cmd(SPACE, name, "pwd", name, link, m.Cmdx(cli.QRCODE, link))
|
||||||
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
frame := m.Target().Server().(*Frame)
|
frame := m.Target().Server().(*Frame)
|
||||||
|
@ -121,7 +121,7 @@ func init() {
|
|||||||
}},
|
}},
|
||||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
if len(arg) < 2 || arg[0] == "" || (len(arg) > 3 && arg[3] == "") {
|
if len(arg) < 2 || arg[0] == "" || (len(arg) > 3 && arg[3] == "") {
|
||||||
m.Option(mdb.FIELDS, kit.Select("time,client.name,client.method,client.url", mdb.DETAIL, len(arg) > 0 && arg[0] != ""))
|
m.Fields(len(arg) == 0 || arg[0] == "", "time,client.name,client.url")
|
||||||
m.Cmdy(mdb.SELECT, SPIDE, "", mdb.HASH, "client.name", arg)
|
m.Cmdy(mdb.SELECT, SPIDE, "", mdb.HASH, "client.name", arg)
|
||||||
m.PushAction(mdb.REMOVE)
|
m.PushAction(mdb.REMOVE)
|
||||||
return
|
return
|
||||||
|
@ -60,6 +60,7 @@ func init() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m.Cmd(aaa.ROLE, kit.Select(aaa.TECH, aaa.VOID, m.Option(ice.MSG_USERROLE) == aaa.VOID), m.Option(ice.MSG_USERNAME))
|
||||||
m.Cmd(web.SPACE, m.Option(web.SPACE), ice.MSG_SESSID, aaa.SessCreate(m, m.Option(ice.MSG_USERNAME)))
|
m.Cmd(web.SPACE, m.Option(web.SPACE), ice.MSG_SESSID, aaa.SessCreate(m, m.Option(ice.MSG_USERNAME)))
|
||||||
}},
|
}},
|
||||||
web.SHARE: {Name: "share type", Help: "共享", Hand: func(m *ice.Message, arg ...string) {
|
web.SHARE: {Name: "share type", Help: "共享", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
12
misc.go
12
misc.go
@ -109,8 +109,12 @@ func (m *Message) PushSearchWeb(cmd string, name string) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *Message) IsTermUA() bool {
|
||||||
|
return m.Option(MSG_USERUA) == "" || strings.Contains(m.Option(MSG_USERUA), "curl")
|
||||||
|
}
|
||||||
|
|
||||||
func Render(m *Message, cmd string, args ...interface{}) string {
|
func Render(m *Message, cmd string, args ...interface{}) string {
|
||||||
if m.Option(MSG_USERUA) == "" || strings.Contains(m.Option(MSG_USERUA), "curl") {
|
if m.IsTermUA() {
|
||||||
switch arg := kit.Simple(args...); cmd {
|
switch arg := kit.Simple(args...); cmd {
|
||||||
case RENDER_QRCODE: // text [size]
|
case RENDER_QRCODE: // text [size]
|
||||||
return m.Cmdx("cli.qrcode", arg[0])
|
return m.Cmdx("cli.qrcode", arg[0])
|
||||||
@ -181,9 +185,15 @@ func (m *Message) PushDownload(key string, arg ...interface{}) { // [name] file
|
|||||||
m.Push(key, Render(m, RENDER_DOWNLOAD, arg...))
|
m.Push(key, Render(m, RENDER_DOWNLOAD, arg...))
|
||||||
}
|
}
|
||||||
func (m *Message) PushAnchor(arg ...interface{}) { // [name] link
|
func (m *Message) PushAnchor(arg ...interface{}) { // [name] link
|
||||||
|
if m.IsTermUA() {
|
||||||
|
return
|
||||||
|
}
|
||||||
m.Push(kit.MDB_LINK, Render(m, RENDER_ANCHOR, arg...))
|
m.Push(kit.MDB_LINK, Render(m, RENDER_ANCHOR, arg...))
|
||||||
}
|
}
|
||||||
func (m *Message) PushButton(arg ...string) {
|
func (m *Message) PushButton(arg ...string) {
|
||||||
|
if m.IsTermUA() {
|
||||||
|
return
|
||||||
|
}
|
||||||
m.Push(kit.MDB_ACTION, Render(m, RENDER_BUTTON, strings.Join(arg, ",")))
|
m.Push(kit.MDB_ACTION, Render(m, RENDER_BUTTON, strings.Join(arg, ",")))
|
||||||
}
|
}
|
||||||
func (m *Message) PushScript(arg ...string) *Message { // [type] text...
|
func (m *Message) PushScript(arg ...string) *Message { // [type] text...
|
||||||
|
Loading…
x
Reference in New Issue
Block a user