mirror of
https://shylinux.com/x/icebergs
synced 2025-04-27 17:58:29 +08:00
opt some
This commit is contained in:
parent
2bb2b168f8
commit
405bd641f3
@ -133,6 +133,11 @@ func _hash_import(m *ice.Message, prefix, chain, file string) {
|
||||
}
|
||||
}
|
||||
|
||||
const (
|
||||
MONTH = "720h"
|
||||
WEEK = "24h"
|
||||
HOUR = "1h"
|
||||
)
|
||||
const (
|
||||
HASH_FIELD = "time,hash,type,name,text"
|
||||
)
|
||||
|
2
misc.go
2
misc.go
@ -424,8 +424,6 @@ func SplitCmd(name string, actions Actions) (list []Any) {
|
||||
push(TEXTAREA, ls[i])
|
||||
case PASSWORD:
|
||||
push(PASSWORD, ls[i])
|
||||
case "image":
|
||||
push(TEXT, ls[i], "img")
|
||||
case "time":
|
||||
push(TEXT, ls[i], "date")
|
||||
case "*":
|
||||
|
@ -185,9 +185,7 @@ func init() {
|
||||
ctx.ProcessField(m, "", arg, arg...)
|
||||
}},
|
||||
TOKEN: {Hand: func(m *ice.Message, arg ...string) {
|
||||
token := kit.Hashs("uniq")
|
||||
m.Cmd(TOKEN, mdb.CREATE, aaa.USERNAME, m.Option(ice.MSG_USERNAME), TOKEN, token)
|
||||
m.EchoScript(kit.Format("echo %s >> ~/.git-credentials", strings.Replace(m.Option(ice.MSG_USERHOST), "://", kit.Format("://%s:%s@", m.Option(ice.MSG_USERNAME), token), 1)))
|
||||
m.Echo(m.Cmdx(TOKEN, mdb.CREATE, aaa.USERNAME, m.Option(ice.MSG_USERNAME), TOKEN, kit.Hashs("uniq")))
|
||||
}},
|
||||
}, gdb.EventAction(web.DREAM_INPUTS)), Hand: func(m *ice.Message, arg ...string) {
|
||||
if m.Option(nfs.DIR_ROOT, ice.USR_LOCAL_REPOS); len(arg) == 0 {
|
||||
@ -196,6 +194,7 @@ func init() {
|
||||
m.PushScript("git clone " + _git_url(m, value[mdb.NAME]))
|
||||
}).Cut("time,name,size,script,action").RenameAppend(mdb.NAME, nfs.REPOS).SortTimeR(mdb.TIME)
|
||||
m.Echo(strings.ReplaceAll(m.Cmdx("web.code.publish", ice.CONTEXTS), "app username", "dev username"))
|
||||
m.Echo(m.Cmdx(TOKEN, m.Option(ice.MSG_USERNAME)))
|
||||
} else if dir := path.Join(m.Option(nfs.DIR_ROOT), arg[0]); len(arg) == 1 {
|
||||
_repos_branch(m, dir)
|
||||
} else if len(arg) == 2 {
|
||||
|
@ -1,17 +1,23 @@
|
||||
package git
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/aaa"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
const TOKEN = "token"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
TOKEN: {Name: "token username auto", Actions: ice.MergeActions(mdb.HashAction(
|
||||
mdb.SHORT, aaa.USERNAME, mdb.EXPIRE, "720h", mdb.FIELD, "time,username,token",
|
||||
))},
|
||||
TOKEN: {Name: "token username auto prunes", Actions: mdb.HashAction(mdb.EXPIRE, mdb.MONTH, mdb.SHORT, aaa.USERNAME, mdb.FIELD, "time,username,token"), Hand: func(m *ice.Message, arg ...string) {
|
||||
if mdb.HashSelect(m, arg...); len(arg) > 0 && m.Length() > 0 {
|
||||
m.EchoScript(nfs.Template(m, "echo.sh", strings.Replace(m.Option(ice.MSG_USERHOST), "://", kit.Format("://%s:%s@", m.Option(ice.MSG_USERNAME), m.Append(TOKEN)), 1)))
|
||||
}
|
||||
}},
|
||||
})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user