1
0
forked from x/icebergs
This commit is contained in:
IT 老营长 @云轩领航-创始人 2023-09-11 09:26:12 +08:00
parent c6916cd152
commit 27f23e5dbf
7 changed files with 16 additions and 8 deletions

View File

@ -6,6 +6,7 @@ import (
"regexp"
"runtime"
"strings"
"time"
ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/aaa"
@ -85,7 +86,14 @@ func _dream_binary(m *ice.Message, p string) {
if bin := path.Join(m.Option(cli.CMD_DIR), ice.BIN_ICE_BIN); nfs.Exists(m, bin) {
} else if kit.IsUrl(p) {
SpideSave(m, bin, kit.MergeURL(p, cli.GOOS, runtime.GOOS, cli.GOARCH, runtime.GOARCH), nil)
GoToast(m, "download", func(toast func(string, int, int)) (list []string) {
begin := time.Now()
SpideSave(m, bin, kit.MergeURL(p, cli.GOOS, runtime.GOOS, cli.GOARCH, runtime.GOARCH), func(count, total, value int) {
cost := time.Now().Sub(begin)
toast(kit.FormatShow(nfs.FROM, begin.Format("15:04:05"), cli.COST, kit.FmtDuration(cost), cli.REST, kit.FmtDuration(cost*time.Duration(101)/time.Duration(value+1)-cost)), count, total)
})
return nil
})
os.Chmod(bin, ice.MOD_DIR)
} else {
m.Cmd(nfs.LINK, bin, kit.Path(p))

View File

@ -341,6 +341,6 @@ func SpidePost(m *ice.Message, arg ...ice.Any) ice.Any {
func SpideDelete(m *ice.Message, arg ...ice.Any) ice.Any {
return kit.UnMarshal(m.Cmdx(http.MethodDelete, arg))
}
func SpideSave(m *ice.Message, file, link string, cb func(int, int, int)) *ice.Message {
func SpideSave(m *ice.Message, file, link string, cb func(count int, total int, value int)) *ice.Message {
return m.Cmd(Prefix(SPIDE), ice.DEV, SPIDE_SAVE, file, http.MethodGet, link, cb)
}

View File

@ -54,7 +54,7 @@ func _header_check(m *ice.Message, arg ...string) bool {
if m.Option(ice.MSG_USERNAME) != "" {
return true
} else if ctx.OptionFromConfig(m, SSO) == "" && ctx.OptionFromConfig(m, web.LOGIN) == "" {
m.Option(SSO, GetSSO(m))
m.Option(SSO, kit.Format(kit.Dict("serve.icon", "usr/icons/icebergs.jpg", "serve.url", GetSSO(m))))
}
return false
}

View File

@ -1,4 +1,4 @@
package chat
package macos
import (
ice "shylinux.com/x/icebergs"

View File

@ -1,4 +1,4 @@
package chat
package macos
import (
ice "shylinux.com/x/icebergs"

View File

@ -192,6 +192,7 @@ func init() {
if m.Cmdy(INNER, arg); arg[0] != ctx.ACTION {
kit.If(len(arg) > 1, func() { mdb.HashCreate(m.Spawn(), nfs.PATH, path.Join(kit.Slice(arg, 0, 2)...)) })
m.Action(nfs.SAVE, COMPILE, "show", "exec")
ctx.Toolkit(m, COMPILE, cli.RUNTIME)
ctx.DisplayLocal(m, "")
}
}},

View File

@ -647,9 +647,8 @@ func init() {
kit.If(m.Option(REPOS), func(p string) {
p = strings.Split(p, mdb.QS)[0]
kit.If(!strings.Contains(p, "://"), func() { p = web.UserHost(m) + "/x/" + p })
if ice.Info.System == cli.LINUX {
p = strings.Replace(p, "https", "http", 1)
}
kit.If(ice.Info.System == cli.LINUX, func() { p = strings.Replace(p, "https", "http", 1) })
web.Toast(m, "clone "+p)
m.Cmd("", CLONE, ORIGIN, p, nfs.PATH, m.Option(cli.CMD_DIR), ice.Maps{cli.CMD_DIR: ""})
})
}},