1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-25 17:18:05 +08:00

Compare commits

...

8 Commits

Author SHA1 Message Date
shy
7e5cff6b81 add some 2025-03-22 12:54:06 +08:00
shy
6c0e3a0a58 add some 2025-03-15 20:27:05 +08:00
shy
08f2f1626d add some 2025-03-10 18:38:39 +08:00
shy
5260027c9f add some 2025-03-08 08:38:13 +08:00
shy
26e62a1b22 add some 2025-03-05 23:33:47 +08:00
shy
e008f4d417 add some 2025-03-05 08:55:30 +08:00
shy
5fc5ccd0ea add some 2025-03-04 14:52:57 +08:00
shy
35c1407d29 add some 2025-03-03 22:13:05 +08:00
9 changed files with 36 additions and 17 deletions

View File

@ -149,16 +149,15 @@ const (
)
const (
CTX_SHY = "ctx_shy"
CTX_WEB = "ctx_web"
CTX_GIT = "ctx_git"
CTX_DEV_IP = "ctx_dev_ip"
CTX_DEV = "ctx_dev"
CTX_DEV_IP = "ctx_dev_ip"
CTX_OPS = "ctx_ops"
CTX_REPOS = "ctx_repos"
CTX_NAME = "ctx_name"
CTX_DEMO = "ctx_demo"
CTX_MAIL = "ctx_mail"
CTX_ROOT = "ctx_root"
CTX_DOMAIN = "ctx_domain"
CTX_PID = "ctx_pid"
CTX_LOG = "ctx_log"

View File

@ -174,7 +174,8 @@ 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) {
return
} else if kit.IsUrl(p) || strings.HasPrefix(p, S()) {
m.Cmd(DREAM, DOWNLOAD, bin, kit.MergeURL2(p, kit.Format("/publish/ice.%s.%s", runtime.GOOS, runtime.GOARCH), ice.POD, m.Option(mdb.NAME)))
// m.Cmd(DREAM, DOWNLOAD, bin, kit.MergeURL2(p, kit.Format("/publish/ice.%s.%s", runtime.GOOS, runtime.GOARCH), ice.POD, m.Option(mdb.NAME)))
m.Cmd(DREAM, DOWNLOAD, bin, kit.MergeURL(p, cli.GOOS, runtime.GOOS, cli.GOARCH, runtime.GOARCH))
} else {
m.Cmd(nfs.LINK, bin, kit.Path(p))
}
@ -370,12 +371,12 @@ func init() {
}},
SETTOKEN: {Name: "settoken nodename* username*", Help: "令牌", Style: html.DANGER, Hand: func(m *ice.Message, arg ...string) {
token := m.Cmdx(TOKEN, mdb.CREATE, mdb.TYPE, SERVER, mdb.NAME, m.Option(aaa.USERNAME), mdb.TEXT, m.Option(tcp.NODENAME))
m.Cmd(SPACE, m.Option(mdb.NAME), SPIDE, DEV_CREATE_TOKEN, ice.Maps{CLIENT_NAME: ice.DEV, TOKEN: token})
m.Cmd(SPACE, m.Option(mdb.NAME), SPIDE, DEV_CREATE_TOKEN, ice.Maps{TOKEN: token})
}},
GETTOKEN: {Help: "令牌", Style: html.DANGER, Hand: func(m *ice.Message, arg ...string) {
m.Options(m.Cmd(SPIDE, m.Option(mdb.NAME)).AppendSimple()).Cmdy(SPIDE, mdb.DEV_REQUEST)
}},
GRANT: {Name: "grant username", Hand: func(m *ice.Message, arg ...string) {
GRANT: {Name: "grant username", Role: aaa.VOID, Hand: func(m *ice.Message, arg ...string) {
if aaa.IsTechOrRoot(m) && m.Option(aaa.USERNAME) != "" {
m.Option(ice.MSG_USERNAME, m.Option(aaa.USERNAME))
}
@ -506,7 +507,8 @@ func init() {
m.Sort("type,status,name", []string{aaa.LOGIN, WORKER, SERVER, ORIGIN}, []string{cli.START, cli.STOP, cli.BEGIN}, ice.STR_R)
m.StatusTimeCountStats(mdb.TYPE, mdb.STATUS)
} else if arg[0] == ctx.ACTION {
gdb.Event(m, DREAM_ACTION, arg)
m.Cmdy(arg[1], DREAM_ACTION, arg)
// gdb.Event(m, DREAM_ACTION, arg)
}
}},
})

View File

@ -84,6 +84,7 @@ func Render(m *ice.Message, cmd string, args ...ice.Any) bool {
"$output", fieldset+">div.output",
"$status", fieldset+">div.status",
"$fieldset", fieldset,
"$body", "body.cmd."+m.Option(ctx.INDEX),
"$index", m.Option(ctx.INDEX),
"$input", "body>div.input.float."+m.Option(ctx.INDEX),
)))
@ -171,7 +172,7 @@ func RenderPodCmd(m *ice.Message, pod, cmd string, arg ...ice.Any) {
m.Option(mdb.ICONS, msg.Option(ice.MSG_NODEICON))
}
m.OptionDefault(mdb.ICONS, m.Resource(kit.Select(ice.Info.NodeIcon, msg.Option(ice.MSG_NODEICON), msg.Append(mdb.ICONS))))
serve := kit.Select("localhost:9020", UserWeb(m).Host)
serve := strings.Split(UserHost(m), "://")[1]
pod = kit.Select(pod, msg.Option(ice.MSG_NODENAME), m.Option(ice.MSG_USERPOD) != "")
m.OptionDefault(TITLE, kit.Select(cmd, msg.Append(mdb.HELP), !m.IsEnglish())+" "+kit.Select(serve, pod))
RenderCmds(m, kit.Dict(msg.AppendSimple(), ctx.ARGS, kit.Simple(arg), ctx.DISPLAY, m.Option(ice.MSG_DISPLAY)))

View File

@ -311,7 +311,6 @@ func init() {
m.Cmd("", mdb.CREATE, kit.Select(dev, os.Getenv("ctx_dev_ip")), ice.DEV_IP, ice.SRC_MAIN_ICO, "dev_ip")
m.Cmd("", mdb.CREATE, kit.Select("http://localhost:9020", conf[cli.CTX_OPS]), ice.OPS, ice.SRC_MAIN_ICO, nfs.REPOS)
m.Cmd("", mdb.CREATE, kit.Select("https://shylinux.com", conf[cli.CTX_SHY]), ice.SHY, ice.SRC_MAIN_ICO, nfs.REPOS)
m.Cmd("", mdb.CREATE, kit.Select("https://web.shylinux.com", conf[cli.CTX_WEB]), ice.WEB, ice.SRC_MAIN_ICO, nfs.REPOS)
m.Cmd("", mdb.CREATE, kit.Select("https://mail.shylinux.com", conf[cli.CTX_MAIL]), ice.MAIL, "usr/icons/Mail.png", "mail")
m.Cmd("", mdb.CREATE, kit.Select("https://demo.shylinux.com", conf[cli.CTX_DEMO]), ice.DEMO, ice.SRC_MAIN_ICO, "demo")
m.Cmd("", mdb.CREATE, "https://2023.shylinux.com", "2023-ContextOS", ice.SRC_MAIN_ICO, nfs.REPOS)
@ -389,7 +388,7 @@ func init() {
mdb.HashModify(m, mdb.NAME, m.Option(CLIENT_NAME), TOKEN, "")
}},
DEV_CREATE_TOKEN: {Hand: func(m *ice.Message, arg ...string) {
m.Option(CLIENT_NAME, m.Option(ice.FROM_SPACE))
m.OptionDefault(CLIENT_NAME, m.Option(ice.FROM_SPACE))
mdb.HashModify(m, m.OptionSimple(CLIENT_NAME, TOKEN))
m.Cmd(SPACE, tcp.DIAL, m.Option(CLIENT_NAME)).Sleep300ms()
}},
@ -432,8 +431,17 @@ func init() {
return kit.Format(mdb.Cache(ice.Pulse, p, func() ice.Any { return m.Cmdx(SPIDE, ice.OPS, SPIDE_RAW, http.MethodGet, p) }))
} else if p == "" {
return ""
} else {
} else if nfs.Exists(m, p) {
return m.Cmdx(nfs.CAT, p)
} else if strings.Contains(p, "/pkg/mod/") {
ls := strings.Split(p, "/pkg/mod/")
return kit.Format(mdb.Cache(ice.Pulse, p, func() ice.Any { return m.Cmdx(SPIDE, ice.OPS, SPIDE_RAW, http.MethodGet, nfs.REQUIRE+ls[1]) }))
} else if strings.Contains(p, "/usr/local/work/") {
ls := strings.Split(strings.Split(p, "/usr/local/work/")[1], "/src/")
pp := kit.MergeURL2(ice.Info.Make.Domain, "/p/src/"+ls[1]+"?pod="+ls[0])
return kit.Format(mdb.Cache(ice.Pulse, p, func() ice.Any { return m.Cmdx(SPIDE, ice.OPS, SPIDE_RAW, http.MethodGet, pp) }))
} else {
return ""
}
}
nfs.TemplatePath = func(m *ice.Message, arg ...string) string {

View File

@ -164,7 +164,12 @@ func init() {
}
m.Option(aaa.LANGUAGE, strings.ReplaceAll(strings.ToLower(kit.Select("", kit.Split(kit.GetValid(
func() string { return kit.Select("", "zh-cn", strings.Contains(m.Option(ice.MSG_USERUA), "zh_CN")) },
func() string { return kit.Select("", kit.Split(m.R.Header.Get(html.AcceptLanguage), ",;"), 0) },
func() string {
if m.R != nil {
return kit.Select("", kit.Split(m.R.Header.Get(html.AcceptLanguage), ",;"), 0)
}
return ""
},
func() string { return ice.Info.Lang },
), " ."), 0)), "_", "-"))
m.Option("language.list", m.Cmd(nfs.DIR, nfs.TemplatePath(m, aaa.LANGUAGE)+nfs.PS, nfs.FILE).Appendv(nfs.FILE))

View File

@ -6,7 +6,7 @@ Volcanos(chat.ONIMPORT, {
can.sup.onexport.link = function() { return can.misc.MergeURL(can, {pod: can.ConfSpace()||can.misc.Search(can, ice.POD), cmd: web.DESKTOP}) }
can.onexport.title(can, can.ConfHelp(), can.user.titles)
},
_menu: function(can) { can.onappend.plugin(can, {index: "web.chat.macos.menu", style: html.OUTPUT}, function(sub) { can.ui.menu = sub, sub._desktop = can
_menu: function(can) { can.onappend.plugin(can, {index: "web.chat.macos.menu", style: html.OUTPUT, title: can.Conf("title")}, function(sub) { can.ui.menu = sub, sub._desktop = can
var tabs = can.misc.sessionStorage(can, [can.ConfIndex(), html.TABS])
sub.onexport.output = function() { can.onimport._desktop(can, can._msg)
var sess = can.misc.SearchHash(can)[0]||can.Conf("session")

View File

@ -8,6 +8,7 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg) { can.page.style(can, can._ou
{view: [[html.MENU, html.TITLE]], list: [
{img: can.misc.ResourceFavicon(can, msg.Option(html.FAVICON), can.ConfSpace())},
{text: decodeURIComponent(
can.Conf("title")||
(window == top? can.user.info.titles: "")||can.ConfSpace()||can.misc.Search(can, ice.POD)||location.host
)},
], onclick: function(event) { can.sup.onexport.record(can, html.DESKTOP) }},

View File

@ -74,7 +74,7 @@ func _go_show(m *ice.Message, arg ...string) {
// ctx.ProcessField(m, "web.code.xterm", kit.Simple())
ctx.ProcessField(m, "log.debug", kit.Simple("bench"))
} else if cmd := ctx.GetFileCmd(path.Join(arg[2], arg[1])); cmd != "" {
if p := path.Join(arg[2], strings.Split(arg[1], "/")[0], "portal.go"); path.Base(arg[1]) != "portal.go" && nfs.Exists(m, p) &&
if p := path.Join(arg[2], strings.Split(arg[1], "/")[0], "portal.go"); path.Base(arg[1]) != "portal.go" &&
!kit.IsIn(arg[1],
"gonganxitong/user.go",
"gonganxitong/sess.go",
@ -82,7 +82,8 @@ func _go_show(m *ice.Message, arg ...string) {
"gonganxitong/domain.go",
"gonganxitong/command.go",
"gonganxitong/quotalist.go",
) {
"operation/studio.go",
) && nfs.Exists(m, p) {
if cmd := ctx.GetFileCmd(p); cmd != "" {
if m.ActionKey() == mdb.RENDER {
ctx.ProcessField(m, cmd, kit.Simple())
@ -228,7 +229,7 @@ func TableName(model string) string {
}
if kit.IsIn(model, "sms", "equipment") {
} else if kit.HasSuffix(model, "y") {
} else if kit.HasSuffix(model, "y") && !kit.HasSuffix(model, "way") {
model = model[:len(model)-1] + "ies"
} else if kit.HasSuffix(model, "s") {
if !kit.HasSuffix(model, "os") {

View File

@ -22,7 +22,9 @@ func _js_show(m *ice.Message, arg ...string) {
ctx.ProcessField(m, kit.Select(ice.CAN_PLUGIN, "web."+strings.Replace(strings.TrimSuffix(strings.TrimPrefix(arg[1], "plugin/local/"), nfs.PT+JS), nfs.PS, nfs.PT, -1)), nil)
}
} else {
if p := path.Join(arg[2], strings.Split(arg[1], "/")[0], "portal.go"); nfs.Exists(m, p) {
if p := path.Join(arg[2], strings.Split(arg[1], "/")[0], "portal.go"); !kit.IsIn(arg[1],
"operation/studio.js",
) && nfs.Exists(m, p) {
if cmd := ctx.GetFileCmd(p); cmd != "" {
ctx.ProcessField(m, cmd, kit.Simple())
return