1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-26 01:24:05 +08:00
This commit is contained in:
harveyshao 2022-12-03 13:42:26 +08:00
parent 8772a64efa
commit 261ef042b9
7 changed files with 16 additions and 14 deletions

View File

@ -22,7 +22,7 @@ func _totp_gen(per int64) string {
return strings.ToUpper(base32.StdEncoding.EncodeToString(b[:]))
}
func _totp_get(key string, per int64, num int) string {
buf, now := []byte{}, kit.Int64(time.Now().Unix() / per)
buf, now := []byte{}, kit.Int64(time.Now().Unix()/per)
for i := 0; i < 8; i++ {
buf = append(buf, byte((uint64(now) >> uint64(((7 - i) * 8)))))
}

View File

@ -25,7 +25,7 @@ const MIRRORS = "mirrors"
func init() {
Index.MergeCommands(ice.Commands{
MIRRORS: {Name: "mirrors cli auto", Help: "软件镜像", Actions: ice.MergeActions(ice.Actions{
mdb.INSERT: {Name: "insert cli* osid cmd*"},
mdb.INSERT: {Name: "insert cli* osid cmd*"},
CMD: {Name: "cmd cli osid", Hand: func(m *ice.Message, arg ...string) {
osid := kit.Select(m.Conf(RUNTIME, kit.Keys(HOST, OSID)), m.Option(OSID))
mdb.ZoneSelectCB(m, m.Option(CLI), func(value ice.Map) {

View File

@ -58,14 +58,14 @@ func ProcessFloat(m *ice.Message, arg ...string) {
m.Cmdy(COMMAND, arg[0])
}
func ProcessRefresh(m *ice.Message, arg ...string) { m.ProcessRefresh(arg...) }
func ProcessRefresh(m *ice.Message, arg ...string) { m.ProcessRefresh(arg...) }
func ProcessRewrite(m *ice.Message, arg ...ice.Any) { m.ProcessRewrite(arg...) }
func ProcessHold(m *ice.Message, text ...ice.Any) { m.Process(ice.PROCESS_HOLD, text...) }
func ProcessOpen(m *ice.Message, url string) { m.Process(ice.PROCESS_OPEN, url) }
func ProcessHold(m *ice.Message, text ...ice.Any) { m.Process(ice.PROCESS_HOLD, text...) }
func ProcessOpen(m *ice.Message, url string) { m.Process(ice.PROCESS_OPEN, url) }
func ProcessAction() ice.Actions {
return ice.Actions{
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { AddProcess(m.CommandKey(), m.PrefixKey()) }},
PROCESS: {Hand: func(m *ice.Message, arg ...string) { ProcessField(m, m.PrefixKey(), arg, arg...) }},
PROCESS: {Hand: func(m *ice.Message, arg ...string) { ProcessField(m, m.PrefixKey(), arg, arg...) }},
}
}

View File

@ -33,7 +33,7 @@ func init() {
TIMER: {Name: "timer hash auto create prunes", Help: "定时器", Actions: ice.MergeActions(ice.Actions{
mdb.CREATE: {Name: "create name*=hi delay=10ms interval=10s count=3 cmd*=runtime"},
mdb.PRUNES: {Hand: func(m *ice.Message, arg ...string) { mdb.HashPrunesValue(m, mdb.COUNT, "0") }},
HAPPEN: {Hand: func(m *ice.Message, arg ...string) { _timer_action(m, time.Now(), arg...) }},
HAPPEN: {Hand: func(m *ice.Message, arg ...string) { _timer_action(m, time.Now(), arg...) }},
RESTART: {Name: "restart count=3", Hand: func(m *ice.Message, arg ...string) {
mdb.HashModify(m, m.OptionSimple(mdb.HashShort(m)), arg)
}},

View File

@ -2,10 +2,10 @@ package lex
const (
PATTERN = "pattern"
REGEXP = "regexp"
PREFIX = "prefix"
SUFFIX = "suffix"
SPACE = "space"
REGEXP = "regexp"
PREFIX = "prefix"
SUFFIX = "suffix"
SPACE = "space"
OPERATOR = "operator"
)

View File

@ -131,7 +131,7 @@ func HashAction(arg ...Any) ice.Actions {
return ice.Actions{
ice.CTX_INIT: AutoConfig(append(kit.List(FIELD, HASH_FIELD), arg...)...),
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) { HashSelectClose(m) }},
INPUTS: {Hand: func(m *ice.Message, arg ...string) { HashInputs(m, arg) }},
CREATE: {Hand: func(m *ice.Message, arg ...string) { HashCreate(m, arg) }},
REMOVE: {Hand: func(m *ice.Message, arg ...string) { HashRemove(m, arg) }},

View File

@ -10,7 +10,9 @@ import (
"shylinux.com/x/toolkits/miss"
)
func _list_fields(m *ice.Message) []string { return kit.Split(kit.Select(LIST_FIELD, m.OptionFields())) }
func _list_fields(m *ice.Message) []string {
return kit.Split(kit.Select(LIST_FIELD, m.OptionFields()))
}
func _list_inputs(m *ice.Message, prefix, chain string, field, value string) {
list := map[string]int{}
defer func() {