mirror of
https://shylinux.com/x/icebergs
synced 2025-04-29 02:29:22 +08:00
add some
This commit is contained in:
parent
1197a56ced
commit
0291b619d2
@ -137,13 +137,7 @@ func _serve_auth(m *ice.Message, key string, cmds []string, w http.ResponseWrite
|
|||||||
return cmds, true
|
return cmds, true
|
||||||
}
|
}
|
||||||
defer func() { m.Options(ice.MSG_CMDS, "", ice.MSG_SESSID, "") }()
|
defer func() { m.Options(ice.MSG_CMDS, "", ice.MSG_SESSID, "") }()
|
||||||
if aaa.SessCheck(m, m.Option(ice.MSG_SESSID)); m.Option(SHARE) != "" {
|
if aaa.SessCheck(m, m.Option(ice.MSG_SESSID)); m.Option(ice.MSG_USERNAME) == "" && ice.Info.Localhost {
|
||||||
switch msg := m.Cmd(SHARE, m.Option(SHARE)); msg.Append(mdb.TYPE) {
|
|
||||||
case FIELD, STORM:
|
|
||||||
msg.Table(func(value ice.Maps) { aaa.SessAuth(m, value) })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if m.Option(ice.MSG_USERNAME) == "" && ice.Info.Localhost {
|
|
||||||
ls := kit.Simple(mdb.Cache(m, m.Option(ice.MSG_USERIP), func() ice.Any {
|
ls := kit.Simple(mdb.Cache(m, m.Option(ice.MSG_USERIP), func() ice.Any {
|
||||||
if tcp.IsLocalHost(m, m.Option(ice.MSG_USERIP)) {
|
if tcp.IsLocalHost(m, m.Option(ice.MSG_USERIP)) {
|
||||||
aaa.UserRoot(m)
|
aaa.UserRoot(m)
|
||||||
@ -198,7 +192,7 @@ func init() {
|
|||||||
ssh.PrintQRCode(m, tcp.PublishLocalhost(m, _serve_address(m)))
|
ssh.PrintQRCode(m, tcp.PublishLocalhost(m, _serve_address(m)))
|
||||||
})
|
})
|
||||||
}},
|
}},
|
||||||
"system": {Help: "系统", Hand: func(m *ice.Message, arg ...string) { cli.Opens(m, "System Settings.app") }},
|
cli.SYSTEM: {Help: "系统", Hand: func(m *ice.Message, arg ...string) { cli.Opens(m, "System Settings.app") }},
|
||||||
"dark": {Help: "主题", Hand: func(m *ice.Message, arg ...string) {
|
"dark": {Help: "主题", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if !tcp.IsLocalHost(m, m.Option(ice.MSG_USERIP)) {
|
if !tcp.IsLocalHost(m, m.Option(ice.MSG_USERIP)) {
|
||||||
return
|
return
|
||||||
|
@ -69,7 +69,10 @@ func init() {
|
|||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
SHARE: {Name: "share hash auto login prunes", Help: "共享链", Actions: ice.MergeActions(ice.Actions{
|
SHARE: {Name: "share hash auto login prunes", Help: "共享链", Actions: ice.MergeActions(ice.Actions{
|
||||||
mdb.CREATE: {Name: "create type name text", Hand: func(m *ice.Message, arg ...string) {
|
mdb.CREATE: {Name: "create type name text", Hand: func(m *ice.Message, arg ...string) {
|
||||||
mdb.HashCreate(m, arg, m.OptionSimple(ice.POD, ice.CMD), aaa.USERNICK, m.Option(ice.MSG_USERNICK), aaa.USERNAME, m.Option(ice.MSG_USERNAME), aaa.USERROLE, m.Option(ice.MSG_USERROLE))
|
if m.Option(mdb.TYPE) == LOGIN {
|
||||||
|
arg = append(arg, mdb.TEXT, tcp.PublishLocalhost(m, m.Option(mdb.TEXT)))
|
||||||
|
}
|
||||||
|
mdb.HashCreate(m, arg, aaa.USERNICK, m.Option(ice.MSG_USERNICK), aaa.USERNAME, m.Option(ice.MSG_USERNAME), aaa.USERROLE, m.Option(ice.MSG_USERROLE))
|
||||||
m.Option(mdb.LINK, _share_link(m, P(SHARE, m.Result())))
|
m.Option(mdb.LINK, _share_link(m, P(SHARE, m.Result())))
|
||||||
}},
|
}},
|
||||||
LOGIN: {Help: "登录", Hand: func(m *ice.Message, arg ...string) {
|
LOGIN: {Help: "登录", Hand: func(m *ice.Message, arg ...string) {
|
||||||
@ -86,24 +89,24 @@ func init() {
|
|||||||
}
|
}
|
||||||
switch msg.Append(mdb.TYPE) {
|
switch msg.Append(mdb.TYPE) {
|
||||||
case LOGIN:
|
case LOGIN:
|
||||||
if msg.Append(ice.CMD) != "" {
|
m.RenderRedirect(msg.Append(mdb.TEXT), ice.MSG_SESSID, aaa.SessCreate(m, msg.Append(aaa.USERNAME)))
|
||||||
m.RenderRedirect(m.MergePodCmd("", msg.Append(ice.CMD)), ice.MSG_SESSID, aaa.SessCreate(m, msg.Append(aaa.USERNAME)))
|
case FIELD:
|
||||||
} else {
|
RenderCmd(m, msg.Append(mdb.NAME), kit.UnMarshal(msg.Append(mdb.TEXT)))
|
||||||
m.RenderRedirect(nfs.PS+kit.Select("", "?debug=true", m.Option("debug") == "true"), ice.MSG_SESSID, aaa.SessCreate(m, msg.Append(aaa.USERNAME)))
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
if msg.Append(ice.CMD) != "" {
|
|
||||||
// RenderCmd(m, msg.Append(ice.CMD))
|
|
||||||
RenderPodCmd(m, msg.Append(ice.POD), msg.Append(ice.CMD))
|
|
||||||
} else {
|
|
||||||
RenderMain(m)
|
RenderMain(m)
|
||||||
}
|
}
|
||||||
|
}},
|
||||||
|
ctx.COMMAND: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
if msg := mdb.HashSelect(m.Spawn(), m.Option(SHARE)); !IsNotValidFieldShare(m, msg) {
|
||||||
|
m.Cmdy(ctx.COMMAND, msg.Append(mdb.NAME))
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
}, mdb.HashAction(mdb.FIELD, "time,hash,type,name,text,river,storm,usernick,username,userrole", mdb.EXPIRE, mdb.DAYS), aaa.WhiteAction()), Hand: func(m *ice.Message, arg ...string) {
|
ctx.RUN: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
if ctx.PodCmd(m, SHARE, arg) {
|
if msg := mdb.HashSelect(m.Spawn(), m.Option(SHARE)); !IsNotValidFieldShare(m, msg) {
|
||||||
return
|
m.Cmdy(msg.Append(mdb.NAME), arg[1:])
|
||||||
}
|
}
|
||||||
|
}},
|
||||||
|
}, aaa.WhiteAction(ctx.COMMAND, ctx.RUN), mdb.HashAction(mdb.FIELD, "time,hash,type,name,text,usernick,username,userrole", mdb.EXPIRE, mdb.DAYS)), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if mdb.HashSelect(m, arg...); len(arg) > 0 {
|
if mdb.HashSelect(m, arg...); len(arg) > 0 {
|
||||||
link := _share_link(m, P(SHARE, arg[0]))
|
link := _share_link(m, P(SHARE, arg[0]))
|
||||||
m.PushQRCode(cli.QRCODE, link)
|
m.PushQRCode(cli.QRCODE, link)
|
||||||
@ -122,6 +125,15 @@ func init() {
|
|||||||
func IsNotValidShare(m *ice.Message, time string) bool {
|
func IsNotValidShare(m *ice.Message, time string) bool {
|
||||||
return m.Warn(time < m.Time(), ice.ErrNotValid, m.Option(SHARE), time, m.Time(), logs.FileLineMeta(2))
|
return m.Warn(time < m.Time(), ice.ErrNotValid, m.Option(SHARE), time, m.Time(), logs.FileLineMeta(2))
|
||||||
}
|
}
|
||||||
|
func IsNotValidFieldShare(m *ice.Message, msg *ice.Message) bool {
|
||||||
|
if m.Warn(IsNotValidShare(m, msg.Append(mdb.TIME)), kit.Format("共享超时, 请联系 %s(%s), 重新分享 %s %s %s", msg.Append(aaa.USERNICK), msg.Append(aaa.USERNAME), msg.Append(mdb.TYPE), msg.Append(mdb.NAME), msg.Append(mdb.TEXT))) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
if m.Warn(msg.Append(mdb.NAME) == "") {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
func ShareLocalFile(m *ice.Message, arg ...string) {
|
func ShareLocalFile(m *ice.Message, arg ...string) {
|
||||||
p := path.Join(arg...)
|
p := path.Join(arg...)
|
||||||
switch ls := strings.Split(p, nfs.PS); ls[0] {
|
switch ls := strings.Split(p, nfs.PS); ls[0] {
|
||||||
|
@ -225,6 +225,8 @@ func init() {
|
|||||||
}
|
}
|
||||||
if kit.IsIn(value[mdb.TYPE], SERVER, WORKER) {
|
if kit.IsIn(value[mdb.TYPE], SERVER, WORKER) {
|
||||||
m.Push(mdb.LINK, m.MergePod(value[mdb.NAME]))
|
m.Push(mdb.LINK, m.MergePod(value[mdb.NAME]))
|
||||||
|
} else if value[mdb.TYPE] == CHROME && value[mdb.NAME] != "chrome" {
|
||||||
|
m.Push(mdb.LINK, MergeURL2(m, value[mdb.TEXT]))
|
||||||
} else {
|
} else {
|
||||||
m.Push(mdb.LINK, "")
|
m.Push(mdb.LINK, "")
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user