1
0
forked from x/icebergs
This commit is contained in:
IT 老营长 @云轩领航-创始人 2023-12-20 15:04:32 +08:00
parent 9829b5c3ef
commit eed06ba25c
3 changed files with 10 additions and 8 deletions

View File

@ -200,10 +200,10 @@ func init() {
}}, }},
mdb.CREATE: {Name: "create name*=hi icon@icons repos binary template", Hand: func(m *ice.Message, arg ...string) { mdb.CREATE: {Name: "create name*=hi icon@icons repos binary template", Hand: func(m *ice.Message, arg ...string) {
kit.If(!strings.Contains(m.Option(mdb.NAME), "-") || !strings.HasPrefix(m.Option(mdb.NAME), "20"), func() { m.Option(mdb.NAME, m.Time("20060102-")+m.Option(mdb.NAME)) }) kit.If(!strings.Contains(m.Option(mdb.NAME), "-") || !strings.HasPrefix(m.Option(mdb.NAME), "20"), func() { m.Option(mdb.NAME, m.Time("20060102-")+m.Option(mdb.NAME)) })
m.OptionDefault(mdb.ICON, nfs.USR_ICONS_ICEBERGS)
kit.If(mdb.Config(m, nfs.REPOS), func(p string) { m.OptionDefault(nfs.REPOS, p+m.Option(mdb.NAME)) })
kit.If(mdb.Config(m, nfs.BINARY), func(p string) { m.OptionDefault(nfs.BINARY, p+m.Option(mdb.NAME)) }) kit.If(mdb.Config(m, nfs.BINARY), func(p string) { m.OptionDefault(nfs.BINARY, p+m.Option(mdb.NAME)) })
kit.If(mdb.Config(m, nfs.REPOS), func(p string) { m.OptionDefault(nfs.REPOS, p+m.Option(mdb.NAME)) })
m.Option(nfs.REPOS, kit.Select("", kit.Slice(kit.Split(m.Option(nfs.REPOS)), -1), 0)) m.Option(nfs.REPOS, kit.Select("", kit.Slice(kit.Split(m.Option(nfs.REPOS)), -1), 0))
m.OptionDefault(mdb.ICON, nfs.USR_ICONS_ICEBERGS)
if mdb.HashCreate(m); !m.IsCliUA() { if mdb.HashCreate(m); !m.IsCliUA() {
_dream_start(m, m.Option(mdb.NAME)) _dream_start(m, m.Option(mdb.NAME))
} }

View File

@ -146,14 +146,14 @@ func toastContent(m *ice.Message, state string, arg ...ice.Any) string {
return kit.JoinWord(kit.Simple(Icons[state], m.ActionKey(), state, arg)...) return kit.JoinWord(kit.Simple(Icons[state], m.ActionKey(), state, arg)...)
} }
func ToastSuccess(m *ice.Message, arg ...ice.Any) { func ToastSuccess(m *ice.Message, arg ...ice.Any) {
Toast(m, toastContent(m, ice.SUCCESS, arg...)) Toast(m, toastContent(m, ice.SUCCESS, arg...), "", "1s")
} }
func ToastFailure(m *ice.Message, arg ...ice.Any) { func ToastFailure(m *ice.Message, arg ...ice.Any) {
Toast(m, toastContent(m, ice.FAILURE, arg...), "", m.OptionDefault(ice.TOAST_DURATION, "3s")).Sleep(m.OptionDefault(ice.TOAST_DURATION, "3s")) Toast(m, toastContent(m, ice.FAILURE, arg...), "", m.OptionDefault(ice.TOAST_DURATION, "3s")).Sleep(m.OptionDefault(ice.TOAST_DURATION, "3s"))
} }
func ToastProcess(m *ice.Message, arg ...ice.Any) func() { func ToastProcess(m *ice.Message, arg ...ice.Any) func() {
Toast(m, toastContent(m, ice.PROCESS, arg...)) Toast(m, toastContent(m, ice.PROCESS, arg...), "", "30s")
return func() { Toast(m, toastContent(m, ice.SUCCESS, arg...)) } return func() { Toast(m, toastContent(m, ice.SUCCESS, arg...), "", "1s") }
} }
func GoToast(m *ice.Message, title string, cb func(toast func(name string, count, total int)) []string) *ice.Message { func GoToast(m *ice.Message, title string, cb func(toast func(name string, count, total int)) []string) *ice.Message {
_total := 0 _total := 0
@ -166,7 +166,7 @@ func GoToast(m *ice.Message, title string, cb func(toast func(name string, count
} }
if list := cb(toast); len(list) > 0 { if list := cb(toast); len(list) > 0 {
icon = Icons[ice.FAILURE] icon = Icons[ice.FAILURE]
m.Option(ice.TOAST_DURATION, "30s") m.Option(ice.TOAST_DURATION, "10s")
toast(kit.JoinWord(list...), len(list), _total) toast(kit.JoinWord(list...), len(list), _total)
} else { } else {
icon = Icons[ice.SUCCESS] icon = Icons[ice.SUCCESS]

View File

@ -36,14 +36,16 @@ func init() {
switch m.Option(ctx.ACTION) { switch m.Option(ctx.ACTION) {
case INIT: case INIT:
m.Cmd("web.spide", ice.OptionFields(web.CLIENT_ORIGIN), func(value ice.Maps) { m.Push(arg[0], value[web.CLIENT_ORIGIN]+"/x/"+path.Base(kit.Path(""))) }) m.Cmd("web.spide", ice.OptionFields(web.CLIENT_ORIGIN), func(value ice.Maps) { m.Push(arg[0], value[web.CLIENT_ORIGIN]+"/x/"+path.Base(kit.Path(""))) })
m.Push(arg[0], web.UserHost(m)+"/x/")
case INSTEADOF: case INSTEADOF:
m.Cmd("web.spide", ice.OptionFields(web.CLIENT_ORIGIN), func(value ice.Maps) { m.Push(arg[0], value[web.CLIENT_ORIGIN]+"/x/") }) m.Cmd("web.spide", ice.OptionFields(web.CLIENT_ORIGIN), func(value ice.Maps) { m.Push(arg[0], value[web.CLIENT_ORIGIN]+"/x/") })
m.Push(arg[0], web.UserHost(m)+"/x/")
default: default:
switch arg[0] { switch arg[0] {
case aaa.EMAIL:
m.Push(arg[0], _configs_get(m, USER_EMAIL), ice.Info.Make.Email)
case aaa.USERNAME: case aaa.USERNAME:
m.Push(arg[0], kit.Select(m.Option(ice.MSG_USERNAME), _configs_get(m, USER_NAME)), ice.Info.Make.Username) m.Push(arg[0], kit.Select(m.Option(ice.MSG_USERNAME), _configs_get(m, USER_NAME)), ice.Info.Make.Username)
case aaa.EMAIL:
m.Push(arg[0], _configs_get(m, USER_EMAIL), ice.Info.Make.Email)
default: default:
m.Cmdy(REPOS, mdb.INPUTS, arg) m.Cmdy(REPOS, mdb.INPUTS, arg)
} }