1
0
forked from x/icebergs
This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-02-14 23:28:59 +08:00
parent 0fe6237649
commit 4cc9da13c5
5 changed files with 8 additions and 14 deletions

View File

@ -161,7 +161,7 @@ func _dream_binary(m *ice.Message, p string) {
GoToast(m, DOWNLOAD, func(toast func(string, int, int)) (list []string) { GoToast(m, DOWNLOAD, func(toast func(string, int, int)) (list []string) {
begin := time.Now() begin := time.Now()
SpideSave(m, bin, kit.MergeURL(p, cli.GOOS, runtime.GOOS, cli.GOARCH, runtime.GOARCH), func(count, total, value int) { SpideSave(m, bin, kit.MergeURL(p, cli.GOOS, runtime.GOOS, cli.GOARCH, runtime.GOARCH), func(count, total, value int) {
toast(m.Option(mdb.NAME)+" "+kit.FormatShow(cli.COST, kit.FmtDuration(time.Now().Sub(begin))), count, total) toast(m.Option(mdb.NAME)+"\n"+kit.FormatShow(cli.COST, kit.FmtDuration(time.Now().Sub(begin))), count, total)
}) })
return nil return nil
}) })

View File

@ -86,7 +86,7 @@ func init() {
} }
GoToast(m, "", func(toast func(name string, count, total int)) []string { GoToast(m, "", func(toast func(name string, count, total int)) []string {
fields := kit.Split(mdb.Config(m, mdb.FIELD)) fields := kit.Split(mdb.Config(m, mdb.FIELD))
m.Options("space.timeout", "3s", "dream.simple", ice.TRUE) m.Options("space.timeout", cli.TIME_300ms, "dream.simple", ice.TRUE)
kit.For(_matrix_list(m, "", fields...), func(domain string, index int, total int) { kit.For(_matrix_list(m, "", fields...), func(domain string, index int, total int) {
toast(domain, index, total) toast(domain, index, total)
_matrix_list(m, domain, fields...) _matrix_list(m, domain, fields...)
@ -98,7 +98,7 @@ func init() {
value = kit.MergeURL(strings.Split(value, "?")[0], ice.POD, kit.Keys(m.Appendv(DOMAIN)[index], m.Appendv(mdb.NAME)[index])) value = kit.MergeURL(strings.Split(value, "?")[0], ice.POD, kit.Keys(m.Appendv(DOMAIN)[index], m.Appendv(mdb.NAME)[index]))
} }
return value return value
}).Sort("status,name,domain", []string{cli.START, cli.STOP, ""}, "str_r", "str_r") }).Sort("type,status,name,domain", []string{SERVER, WORKER, ""}, []string{cli.START, cli.STOP, ""}, "str_r", "str_r")
return nil return nil
}).Action(html.FILTER, mdb.CREATE).Display("") }).Action(html.FILTER, mdb.CREATE).Display("")
}}, }},

View File

@ -463,7 +463,7 @@ func SpideSave(m *ice.Message, file, link string, cb func(count, total, value in
return m.Cmd(Prefix(SPIDE), ice.DEV_IP, SPIDE_SAVE, file, http.MethodGet, link, cb) return m.Cmd(Prefix(SPIDE), ice.DEV_IP, SPIDE_SAVE, file, http.MethodGet, link, cb)
} }
func SpideCache(m *ice.Message, link string) *ice.Message { func SpideCache(m *ice.Message, link string) *ice.Message {
return m.Cmd(Prefix(SPIDE), ice.DEV, SPIDE_CACHE, http.MethodGet, link) return m.Cmd(Prefix(SPIDE), ice.DEV_IP, SPIDE_CACHE, http.MethodGet, link)
} }
func SpideOrigin(m *ice.Message, name string) string { return m.Cmdv(SPIDE, name, CLIENT_ORIGIN) } func SpideOrigin(m *ice.Message, name string) string { return m.Cmdv(SPIDE, name, CLIENT_ORIGIN) }
func SpideURL(m *ice.Message, name string) string { return m.Cmdv(SPIDE, name, CLIENT_URL) } func SpideURL(m *ice.Message, name string) string { return m.Cmdv(SPIDE, name, CLIENT_URL) }

View File

@ -61,7 +61,8 @@ func init() {
m.Cmdy(nfs.DIR, dir, "time,size,path,hash").Push(web.ORIGIN, kit.MergeURL2(web.SpideOrigin(m, ice.DEV_IP), uri)) m.Cmdy(nfs.DIR, dir, "time,size,path,hash").Push(web.ORIGIN, kit.MergeURL2(web.SpideOrigin(m, ice.DEV_IP), uri))
}) })
if web.ToastSuccess(m); m.Option(ice.EXIT) == ice.TRUE { if web.ToastSuccess(m); m.Option(ice.EXIT) == ice.TRUE {
web.Toast(m, cli.RESTART).Cmd("", cli.RESTART) web.Toast(m, cli.RESTART)
m.GoSleep("30ms", func() { m.Cmd("", cli.RESTART) })
} }
}}, }},
}}) }})

11
init.go
View File

@ -96,15 +96,8 @@ func init() {
func Run(arg ...string) string { func Run(arg ...string) string {
kit.If(len(arg) == 0 && len(os.Args) > 1, func() { arg = os.Args[1:] }) kit.If(len(arg) == 0 && len(os.Args) > 1, func() { arg = os.Args[1:] })
if len(arg) == 0 { kit.If(len(arg) == 0, func() { arg = append(arg, FOREVER, START) })
if runtime.GOOS == WINDOWS { kit.If(runtime.GOOS == WINDOWS && kit.HasPrefixList(arg, FOREVER, START), func() { arg[0] = SERVE })
arg = append(arg, SERVE, START)
} else {
arg = append(arg, FOREVER, START)
}
} else if arg[0] == FOREVER && arg[1] == START && runtime.GOOS == WINDOWS {
arg[0] = SERVE
}
Pulse.value(MSG_DETAIL, arg...) Pulse.value(MSG_DETAIL, arg...)
kit.For(kit.Sort(os.Environ()), func(env string) { kit.For(kit.Sort(os.Environ()), func(env string) {
if ls := strings.SplitN(env, EQ, 2); strings.ToLower(ls[0]) == ls[0] && ls[0] != "_" { if ls := strings.SplitN(env, EQ, 2); strings.ToLower(ls[0]) == ls[0] && ls[0] != "_" {