1
0
forked from x/icebergs
This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-01-30 13:51:12 +08:00
parent 1a75e9a77e
commit 4e12b37e33
4 changed files with 11 additions and 7 deletions

View File

@ -92,8 +92,8 @@ func init() {
}
}},
PUBLISH: {Hand: func(m *ice.Message, arg ...string) {
for _, p := range []string{LOCALHOST, "127.0.0.1", strings.ToLower(ice.Info.Hostname)} {
if strings.Contains(arg[0], p) {
for _, p := range []string{LOCALHOST, "127.0.0.1", m.Option("tcp_localhost")} {
if p != "" && strings.Contains(arg[0], p) {
arg[0] = strings.Replace(arg[0], p, _host_domain(m), 1)
break
}

View File

@ -26,7 +26,7 @@ func UserWeb(m Message) *url.URL {
func UserHost(m *ice.Message) string {
if p := m.Option(ice.MSG_USERHOST); p != "" {
return p
} else if u := UserWeb(m); kit.HasSuffix(u.Hostname(), tcp.LOCALHOST, ".local") {
} else if u := UserWeb(m); u.Hostname() == tcp.LOCALHOST {
return m.Option(ice.MSG_USERHOST, tcp.PublishLocalhost(m, u.Scheme+"://"+u.Host))
} else {
return m.Option(ice.MSG_USERHOST, u.Scheme+"://"+u.Host)

View File

@ -94,7 +94,6 @@ func _autogen_git(m *ice.Message, arg ...string) ice.Map {
return kit.Dict(arg, aaa.USERNAME, m.Option(ice.MSG_USERNAME), tcp.HOSTNAME, ice.Info.Hostname, nfs.PATH, kit.Path("")+nfs.PS, mdb.TIME, m.Time(),
GIT, GitVersion(m), GO, GoVersion(m), nfs.MODULE, _autogen_mod(m, ice.GO_MOD),
msg.AppendSimple("remote,branch,version,forword,author,email,hash,when,message"),
// web.DOMAIN, strings.ReplaceAll(tcp.PublishLocalhost(m, m.Option(ice.MSG_USERWEB)), "%2F", nfs.PS),
web.DOMAIN, m.Spawn(kit.Dict(ice.MSG_USERWEB, m.Option(ice.MSG_USERHOST), ice.MSG_USERPOD, m.Option(ice.MSG_USERPOD))).MergePod(""),
cli.SYSTEM, ice.Info.System,
)

View File

@ -14,6 +14,7 @@ import (
"shylinux.com/x/icebergs/base/lex"
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/nfs"
"shylinux.com/x/icebergs/base/tcp"
"shylinux.com/x/icebergs/base/web"
kit "shylinux.com/x/toolkits"
)
@ -45,11 +46,15 @@ func _publish_file(m *ice.Message, file string, arg ...string) string {
}
func _publish_contexts(m *ice.Message, arg ...string) {
m.Options(nfs.DIR_ROOT, "").OptionDefault(ice.MSG_USERNAME, "demo")
m.Option("tcp_localhost", strings.ToLower(ice.Info.Hostname))
host := tcp.PublishLocalhost(m, web.UserHost(m))
for _, k := range kit.Default(arg, ice.MISC) {
m.OptionDefault(web.DOMAIN, web.UserHost(m))
m.OptionDefault(web.DOMAIN, host)
m.Options(cli.CTX_ENV, kit.Select("", lex.SP+kit.JoinKV(mdb.EQ, lex.SP, cli.CTX_POD, m.Option(ice.MSG_USERPOD)), m.Option(ice.MSG_USERPOD) != ""))
kit.If(m.Option("ctx_dev_ip"), func(p string) { m.Option(cli.CTX_ENV, m.Option(cli.CTX_DEV)+" "+"ctx_dev_ip="+p) })
m.Option(ice.TCP_DOMAIN, kit.ParseURL(web.UserHost(m)).Hostname())
kit.If(m.Option("ctx_dev_ip"), func(p string) {
m.Option(cli.CTX_ENV, m.Option(cli.CTX_DEV)+" "+"ctx_dev_ip="+tcp.PublishLocalhost(m, p))
})
m.Option(ice.TCP_DOMAIN, kit.ParseURL(host).Hostname())
switch k {
case INSTALL:
m.Option("format", "raw")