From da81284b378268069d62f8b484208f7f32a3ce7a Mon Sep 17 00:00:00 2001 From: root Date: Mon, 17 Feb 2025 19:54:36 +0800 Subject: [PATCH] add some --- base/tcp/host.go | 3 +++ base/web/dream.go | 7 ++++--- base/web/spide.go | 7 ++++++- core/code/upgrade.go | 1 + misc/git/totals.go | 2 +- 5 files changed, 15 insertions(+), 5 deletions(-) diff --git a/base/tcp/host.go b/base/tcp/host.go index 48a977cd..a655059d 100644 --- a/base/tcp/host.go +++ b/base/tcp/host.go @@ -24,6 +24,9 @@ func _host_domain(m *ice.Message) string { } return "" }, + func() string { + return LOCALHOST + }, ) } func _host_list(m *ice.Message, name string) *ice.Message { diff --git a/base/web/dream.go b/base/web/dream.go index 6f4e6a35..a53e4e6d 100644 --- a/base/web/dream.go +++ b/base/web/dream.go @@ -512,14 +512,15 @@ func init() { m.Cmd(SPACE).Table(func(value ice.Maps, index int, head []string) { kit.If(value[mdb.TYPE] == m.ActionKey(), func() { m.PushRecord(value, head...) }) }) - if len(arg) > 0 { - m.Cut(arg...) - } + m.SortStrR(mdb.NAME) + kit.If(len(arg) > 0, func() { m.Cut(arg...) }) }}, WORKER: {Hand: func(m *ice.Message, arg ...string) { m.Cmd(SPACE).Table(func(value ice.Maps, index int, head []string) { kit.If(value[mdb.TYPE] == m.ActionKey(), func() { m.PushRecord(value, head...) }) }) + m.SortStrR(mdb.NAME) + kit.If(len(arg) > 0, func() { m.Cut(arg...) }) }}, DOWNLOAD: {Name: "download path link", Hand: func(m *ice.Message, arg ...string) { GoToast(m, func(toast func(string, int, int)) []string { diff --git a/base/web/spide.go b/base/web/spide.go index ccb6f12c..edb9d407 100644 --- a/base/web/spide.go +++ b/base/web/spide.go @@ -517,7 +517,12 @@ func HostPort(m *ice.Message, host, port string, arg ...string) string { kit.If(kit.Select("", arg, 1), func(cmd string) { p += C(cmd) }) } kit.If(m.Option(ice.LOG_DEBUG) == ice.TRUE, func() { p += "?debug=true" }) - kit.If(host == "", func() { host = kit.ParseURL(UserHost(m)).Hostname() }) + kit.If(host == "", func() { + if u := kit.ParseURL(UserHost(m)); u != nil { + host = u.Hostname() + } + }) + host = kit.Select("localhost", host) if port == tcp.PORT_443 { return kit.Format("https://%s", host) + p } else if port == tcp.PORT_80 { diff --git a/core/code/upgrade.go b/core/code/upgrade.go index 23074a63..07c157fe 100644 --- a/core/code/upgrade.go +++ b/core/code/upgrade.go @@ -33,6 +33,7 @@ func init() { uri := "/publish/" + kit.Format(value[nfs.FILE]) kit.If(m.Spawn().Options(ice.MSG_USERPOD, "").ParseLink(ice.Info.Make.Domain).Option(ice.MSG_USERPOD), func(p string) { uri = kit.MergeURL(uri, ice.POD, p) + uri = kit.MergeURL2(ice.Info.Make.Domain, uri) }) dir := path.Join(kit.Format(value[nfs.PATH]), kit.Format(value[nfs.FILE])) web.GoToast(m, func(toast func(name string, count, total int)) []string { diff --git a/misc/git/totals.go b/misc/git/totals.go index 70b903d7..1aa81271 100644 --- a/misc/git/totals.go +++ b/misc/git/totals.go @@ -118,9 +118,9 @@ func init() { } func TableGo(m *ice.Message, cb ice.Any) *ice.Message { wg, lock := sync.WaitGroup{}, &task.Lock{} + wg.Add(m.Length()) defer wg.Wait() m.Table(func(value ice.Maps) { - wg.Add(1) task.Put(m.FormatTaskMeta(), logs.FileLine(cb), func(*task.Task) { defer wg.Done() switch cb := cb.(type) {