mirror of
https://shylinux.com/x/icebergs
synced 2025-04-26 17:44:05 +08:00
24 lines
729 B
Go
24 lines
729 B
Go
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 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)))
|
|
}
|
|
}},
|
|
})
|
|
}
|