From 473826664a9d577a3e20f92c7830ffd58ca453d6 Mon Sep 17 00:00:00 2001 From: shy Date: Tue, 25 Feb 2025 12:14:41 +0800 Subject: [PATCH] add some --- base/aaa/user.go | 2 +- base/cli/runtime.go | 5 +++-- base/web/option.go | 2 +- base/web/store.go | 11 ++++++----- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/base/aaa/user.go b/base/aaa/user.go index 77f2477b..762d7b40 100644 --- a/base/aaa/user.go +++ b/base/aaa/user.go @@ -105,7 +105,7 @@ func UserRoot(m *ice.Message, arg ...string) *ice.Message { userzone := kit.Select(ice.OPS, arg, 4) email := kit.Select(UserEmail(m, username), arg, 5) if len(arg) > 0 { - ice.Info.Username = username + kit.If(username != ROOT, func() { ice.Info.Username = username }) m.Cmd(USER, mdb.CREATE, userrole, username, usernick, language, userzone, email) } return SessAuth(m, kit.Dict(USERROLE, userrole, USERNAME, username, USERNICK, usernick)) diff --git a/base/cli/runtime.go b/base/cli/runtime.go index f47e1ce5..ff16100d 100644 --- a/base/cli/runtime.go +++ b/base/cli/runtime.go @@ -43,9 +43,10 @@ func _runtime_init(m *ice.Message) { kit.HashSeed = append(kit.HashSeed, ice.Info.Username) kit.HashSeed = append(kit.HashSeed, ice.Info.Hostname) kit.HashSeed = append(kit.HashSeed, ice.Info.Pathname) - aaa.UserRoot(ice.Pulse, aaa.ROOT, aaa.ROOT) + aaa.UserRoot(ice.Pulse, aaa.TECH, ice.Info.Make.Author, "", "", ice.DEV, ice.Info.Make.Email) aaa.UserRoot(ice.Pulse, aaa.TECH, ice.Info.Make.Username, "", "", ice.DEV, ice.Info.Make.Email) - aaa.UserRoot(ice.Pulse, aaa.TECH, ice.Info.Username) + aaa.UserRoot(ice.Pulse, aaa.ROOT, ice.Info.Username) + aaa.UserRoot(ice.Pulse, aaa.ROOT, aaa.ROOT) ice.Info.Time = m.Time() m.Conf(RUNTIME, kit.Keys(BOOT, mdb.TIME), ice.Info.Time) if runtime.GOARCH != MIPSLE { diff --git a/base/web/option.go b/base/web/option.go index 9d4c6a4a..f58c0b54 100644 --- a/base/web/option.go +++ b/base/web/option.go @@ -15,7 +15,7 @@ import ( ) func UserWeb(m *ice.Message) *url.URL { - return kit.ParseURL(m.Option(ice.MSG_USERWEB)) + return kit.ParseURL(m.OptionDefault(ice.MSG_USERWEB, "http://localhost:9020")) } func UserHost(m *ice.Message) string { if p := m.Option(ice.MSG_USERHOST); p != "" { diff --git a/base/web/store.go b/base/web/store.go index ff821eb6..aac56014 100644 --- a/base/web/store.go +++ b/base/web/store.go @@ -89,11 +89,12 @@ func init() { origin := SpideOrigin(m, arg[0]) kit.If(origin == "", func() { arg[0], origin, dream = ice.DEV, arg[0], arg[0]+dream }) // if kit.IsIn(kit.ParseURL(origin).Hostname(), append(m.Cmds(tcp.HOST).Appendv(aaa.IP), tcp.LOCALHOST)...) { - if kit.IsIn(kit.ParseURL(origin).Hostname(), tcp.LOCALHOST) { - origin = m.Option(ice.MSG_USERHOST) - } else { - origin = tcp.PublishLocalhost(m, origin) - } + // if kit.IsIn(kit.ParseURL(origin).Hostname(), tcp.LOCALHOST) { + // origin = m.Option(ice.MSG_USERHOST) + // } else { + // origin = tcp.PublishLocalhost(m, origin) + // } + origin = tcp.PublishLocalhost(m, origin) stat := map[string]int{} list := m.Spawn(ice.Maps{ice.MSG_FIELDS: ""}).CmdMap(SPACE, mdb.NAME) m.SetAppend().Spawn().SplitIndex(m.Cmdx(SPIDE, arg[0], dream, kit.Dict(mdb.ConfigSimple(m, CLIENT_TIMEOUT)))).Table(func(value ice.Maps) {