1
0
mirror of https://shylinux.com/x/icebergs synced 2025-06-26 10:27:31 +08:00

Compare commits

...

6 Commits

Author SHA1 Message Date
shy
a9ebeed451 add some 2025-06-23 21:48:44 +08:00
shy
db926c80e8 add some 2025-06-19 19:20:07 +08:00
shy
3adf9ecc77 add some 2025-06-18 08:35:35 +08:00
shy
cd25b243c4 add some 2025-06-16 14:35:04 +08:00
shy
fa884c8302 add some 2025-06-16 13:53:14 +08:00
shy
8d40fb6fbb add some 2025-06-16 13:39:17 +08:00
18 changed files with 106 additions and 73 deletions

View File

@ -47,7 +47,7 @@ func _command_search(m *ice.Message, kind, name, text string) {
}
m.PushSearch(ice.CTX, kit.PathName(1), ice.CMD, kit.FileName(1),
kit.SimpleKV("", s.Prefix(), kit.Select(key, cmd.Name), cmd.Help),
INDEX, kit.Keys(s.Prefix(), key))
INDEX, kit.Keys(s.Prefix(), key), mdb.HELP, cmd.Help)
}).Sort(m.OptionFields())
}
@ -124,7 +124,7 @@ func init() {
}},
}), Hand: func(m *ice.Message, arg ...string) {
if len(arg) == 0 {
m.OptionFields(INDEX)
m.OptionFields(INDEX, mdb.HELP)
m.Cmdy("", mdb.SEARCH, COMMAND)
} else {
kit.For(arg, func(k string) { _command_list(m, k) })

View File

@ -90,6 +90,7 @@ const (
VIEW = "view"
VALUE = "value"
INPUT = "input"
TITLE = "title"
ICON = "icon"
ICONS = "icons"
OUTPUT = "output"

View File

@ -85,7 +85,7 @@ func Render(m *ice.Message, cmd string, args ...ice.Any) bool {
"$status", fieldset+">div.status",
"$fieldset", fieldset,
"$field", fieldset,
"$input", "body>div.input.float."+m.Option(ctx.INDEX),
"$input", "div.input.float."+m.Option(ctx.INDEX),
"$body", "body.cmd."+m.Option(ctx.INDEX),
"$index", m.Option(ctx.INDEX),
)))

View File

@ -190,6 +190,7 @@ func _serve_handle(key string, cmd *ice.Command, m *ice.Message, w http.Response
kit.For(r.Cookies(), func(k, v string) { m.Optionv(k, v) })
m.Options(ice.MSG_METHOD, r.Method, ice.MSG_COUNT, "0")
m.Options(ice.MSG_REFERER, r.Header.Get(html.Referer))
m.Options(ice.MSG_USERURL, r.URL.String())
m.Options(ice.MSG_USERWEB, _serve_domain(m), ice.MSG_USERPOD, m.Option(ice.POD))
m.Options(ice.MSG_USERUA, r.Header.Get(html.UserAgent), ice.MSG_USERIP, r.Header.Get(ice.MSG_USERIP))
m.Options(ice.MSG_SESSID, kit.Select(m.Option(ice.MSG_SESSID), m.Option(CookieName(m.Option(ice.MSG_USERWEB)))))
@ -248,7 +249,7 @@ func _serve_domain(m *ice.Message) string {
}
func _serve_auth(m *ice.Message, key string, cmds []string, w http.ResponseWriter, r *http.Request) ([]string, bool) {
kit.If(len(cmds) > 0, func() { cmds = append(kit.Split(cmds[0], ","), cmds[1:]...) })
kit.If(!aaa.IsTechOrRoot(m), func() { m.Option("user_uid", "") })
// kit.If(!aaa.IsTechOrRoot(m), func() { m.Option("user_uid", "") })
if r.URL.Path == PP(SPACE) {
aaa.SessCheck(m, m.Option(ice.MSG_SESSID))
return cmds, true

View File

@ -155,7 +155,7 @@ func _space_handle(m *ice.Message, safe bool, name string, c *websocket.Conn) {
}()
msg := m.Spawn(b)
if safe && msg.Option(ice.MSG_UNSAFE) != ice.TRUE { // 下行权限
if !aaa.IsTechOrRoot(msg) && msg.Option(ice.MSG_HANDLE) != ice.TRUE {
if !aaa.IsTechOrRoot(msg) && msg.Option(ice.MSG_HANDLE) != ice.TRUE && msg.Option(ice.MSG_USERUID) == "" {
msg.Option(ice.MSG_USERROLE, kit.Select(msg.Option(ice.MSG_USERROLE), aaa.UserRole(msg, msg.Option(ice.MSG_USERNAME))))
}
// kit.If(kit.IsIn(msg.Option(ice.MSG_USERROLE), "", aaa.VOID), func() { msg.Option(ice.MSG_USERROLE, aaa.UserRole(msg, msg.Option(ice.MSG_USERNAME))) })
@ -530,7 +530,10 @@ func init() {
})
case SPACE:
AdminCmd(m, SPACE).Table(func(value ice.Maps) {
kit.If(kit.IsIn(value[mdb.TYPE], WORKER, SERVER), func() { m.Push(arg[0], value[mdb.NAME]) })
kit.If(kit.IsIn(value[mdb.TYPE], WORKER, SERVER), func() {
m.Push(arg[0], value[mdb.NAME])
m.Push(mdb.HELP, value[mdb.HELP])
})
})
case SERVER:
AdminCmd(m, SPACE).Table(func(value ice.Maps) {
@ -559,7 +562,8 @@ func init() {
} else {
m.Cmdy(ctx.COMMAND)
}
m.CutTo(ctx.INDEX, arg[0])
m.Cut(ctx.INDEX, mdb.HELP)
m.RenameAppend(ctx.INDEX, arg[0])
case ctx.ARGS:
m.OptionDefault(ctx.INDEX, m.Option("extra.index"))
if space := m.Option(SPACE); space != "" {

View File

@ -171,6 +171,7 @@ const ( // DIR
SRC_MAIN_CSS = "src/main.css"
SRC_MAIN_JS = "src/main.js"
SRC_MAIN_GO = "src/main.go"
SRC_OPTION_GO = "src/option.go"
SRC_WEBVIEW_GO = "src/webview.go"
SRC_VERSION_GO = "src/version.go"
SRC_BINPACK_GO = "src/binpack.go"
@ -222,6 +223,7 @@ const ( // MSG
MSG_USERIP = "user.ip"
MSG_USERUA = "user.ua"
MSG_USERURL = "user.url"
MSG_USERWEB = "user.web"
MSG_USERPOD = "user.pod"
MSG_USERPOD0 = "user.pod0"
@ -235,6 +237,7 @@ const ( // MSG
MSG_USERZONE = "user.zone"
MSG_LANGUAGE = "user.lang"
MSG_AVATAR = "user.avatar"
MSG_USERSTATUS = "user.status"
MSG_USERUID = "user.uid"
MSG_BG = "sess.bg"

View File

@ -66,6 +66,8 @@ fieldset.desktop>div.output>div.desktop>fieldset.web.chat.macos.finder>div.actio
fieldset.desktop>div.output>div.desktop>fieldset.web.chat.iframe.portal>div.action { display:none; }
fieldset.desktop>div.output>div.desktop>fieldset.web.chat.macos.finder>div.status { display:none; }
fieldset.desktop>div.output>div.desktop>fieldset.web.chat.macos.finder>div.output div.item.disable { display:none; }
fieldset.desktop>div.output>div.desktop>fieldset.web.team.gonganxitong.service>form.option input { display:none; }
fieldset.desktop>div.output>div.desktop>fieldset.web.team.gonganxitong.recent>form.option input { display:none; }
fieldset.desktop>div.output>fieldset.web.chat.macos.dock>div.output div.item.disable { display:none; }
fieldset.desktop>div.output>div.desktop>div.item.disable { display:none; }
fieldset.macos.menu>div.output>div.item { padding:0 var(--button-padding); height:var(--desktop-menu-height); float:right; }

11
core/chat/oauth/cache.go Normal file
View File

@ -0,0 +1,11 @@
package oauth
import "shylinux.com/x/ice"
type cache struct {
ice.Hash
short string `data:"uniq"`
field string `data:"hash,state,goback"`
}
func init() { ice.Cmd("web.chat.oauth.cache", cache{}) }

View File

@ -158,6 +158,9 @@ func (s Client) Login(m *ice.Message, arg ...string) {
func (s Client) Login2(m *ice.Message, arg ...string) {
if state, code := m.Option(STATE), m.Option(CODE); !m.WarnNotValid(state == "" || code == "") {
msg := m.Spawn()
_msg := m.Cmd("web.chat.oauth.cache", state)
state = kit.Select(state, _msg.Append("state"))
m.Option("goback", _msg.Append("goback"))
s.Hash.List(msg, m.Option(mdb.HASH, state)).Table(func(value ice.Maps) { msg.Options(value) })
msg.Options(GRANT_TYPE, AUTHORIZATION_CODE, REDIRECT_URI, s.RedirectURI(msg)).Option(ACCESS_TOKEN, "")
if res := s.Get(msg, msg.Option(mdb.HASH), msg.Option(GRANT_URL), kit.Simple(msg.OptionSimple(GRANT_TYPE, CODE), "appid", msg.Option(CLIENT_ID), "secret", msg.Option(CLIENT_SECRET))...); !m.WarnNotValid(res == nil) {

View File

@ -29,7 +29,7 @@ func init() {
} else {
if msg := m.Cmd(web.SPACE, "20240724-community", "web.chat.oauth.client", "action", "login2"); msg.Option("_arg") != "" {
m.RenderResult(kit.Format(template(`document.cookie = "sessid=%s;path=/"; location.href = "%s"; document.cookie = "goback=;path=/;expires=Mon, 19 May 2025 00:52:51 GMT"`),
kit.Simple(msg.Optionv("_arg"))[1], m.Option("goback")))
kit.Simple(msg.Optionv("_arg"))[1], kit.Select("/s/20240724-enterprise/c/web.team.yingxiaotuiguang.portal", msg.Option("goback"), m.Option("goback"))))
return
}
}

View File

@ -111,15 +111,16 @@ func init() {
kit.If(cli.SystemFindGo(m), func() { m.PushButton(kit.Dict(m.CommandKey(), m.Commands("").Help)) })
})
}},
}, web.DreamTablesAction(), ctx.ConfAction(cli.ENV, kit.Dict(GOPRIVATE, "shylinux.com,github.com", GOPROXY, "https://goproxy.cn,direct", CGO_ENABLED, "0"))), Hand: func(m *ice.Message, arg ...string) {
}, web.DreamTablesAction(), ctx.ConfAction(cli.ENV, kit.Dict(GOPRIVATE, "shylinux.com", GOPROXY, "https://goproxy.cn,direct", CGO_ENABLED, "0"))), Hand: func(m *ice.Message, arg ...string) {
main, file, goos, arch := _compile_target(m, arg...)
env := kit.Simple(cli.PATH, cli.BinPath(), cli.HOME, kit.Select(kit.Path(""), kit.Env(cli.HOME)), mdb.Configv(m, cli.ENV), m.Optionv(cli.ENV), cli.GOOS, goos, cli.GOARCH, arch)
kit.If(runtime.GOOS == cli.WINDOWS, func() { env = append(env, GOPATH, kit.HomePath(GO), GOCACHE, kit.HomePath("go/go-build")) })
m.Options(cli.CMD_ENV, env).Cmd(AUTOGEN, VERSION)
_compile_get(m, main)
defer m.StatusTime(VERSION, strings.TrimPrefix(GoVersion(m), "go version"))
args := []string{main, ice.SRC_VERSION_GO}
nfs.Exists(m, "src/option.go", func(p string) { args = append(args, p) })
args := []string{main}
nfs.Exists(m, ice.SRC_OPTION_GO, func(p string) { args = append(args, p) })
nfs.Exists(m, ice.SRC_VERSION_GO, func(p string) { args = append(args, p) })
kit.If(file != ice.BIN_ICE_BIN, func() { args = append(args, ice.SRC_BINPACK_GO, ice.SRC_BINPACK_USR_GO) })
if msg := GoBuild(m.Spawn(), file, args...); !cli.IsSuccess(msg) {
m.Copy(msg)

View File

@ -18,20 +18,13 @@ func _css_stat(m *ice.Message, zone string, stats map[string]int) {
m.Copy(msg.SortIntR(mdb.VALUE))
}
func _css_show(m *ice.Message, arg ...string) {
if _go_portal(m, arg...) {
return
}
if arg[1] == "main.css" {
m.EchoIFrame(m.MergePodCmd("", web.ADMIN))
return
}
if cmd := ctx.GetFileCmd(path.Join(arg[2], arg[1])); cmd != "" {
if p := path.Join(arg[2], strings.Split(arg[1], "/")[0], "portal.go"); nfs.Exists(m, p) {
if _cmd := ctx.GetFileCmd(p); _cmd != "" {
if msg := m.Cmd(_cmd, "commandSelect", cmd); msg.Length() > 0 {
ctx.ProcessField(m, _cmd, kit.Simple())
return
}
}
}
}
cmd := kit.Select(ice.CAN_PLUGIN, ctx.GetFileCmd(kit.ExtChange(path.Join(arg[2], arg[1]), GO)))
ctx.DisplayBaseCSS(m, require(arg[2], arg[1]), "render", "replace", ctx.INDEX, cmd, ice.POD, m.Option(ice.MSG_USERPOD))
ctx.DisplayBase(m, require(arg[2], arg[1]))
@ -72,6 +65,9 @@ func _css_show(m *ice.Message, arg ...string) {
_css_stat(m, "stats.value", stats_value)
}
func _css_exec(m *ice.Message, arg ...string) {
if _go_portal(m, arg...) {
return
}
if arg[2] == ice.USR_VOLCANOS {
if strings.HasPrefix(arg[1], ice.PLUGIN_LOCAL) {
ctx.ProcessField(m, kit.Select(ice.CAN_PLUGIN, "web."+strings.Replace(kit.TrimExt(strings.TrimPrefix(arg[1], ice.PLUGIN_LOCAL), JS), nfs.PS, nfs.PT, -1)), kit.Simple())

View File

@ -5,6 +5,7 @@ import (
"strings"
ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/aaa"
"shylinux.com/x/icebergs/base/cli"
"shylinux.com/x/icebergs/base/ctx"
"shylinux.com/x/icebergs/base/gdb"
@ -61,6 +62,33 @@ func _go_navigate(m *ice.Message, arg ...string) {
}
_c_tags(m, GOTAGS, "-f", nfs.TAGS, "-R", nfs.PWD)
}
func _go_portal(m *ice.Message, arg ...string) bool {
if p := path.Join(arg[2], strings.Split(arg[1], "/")[0], "portal.go"); nfs.Exists(m, p) {
cmd := ctx.GetFileCmd(path.Join(arg[2], kit.ExtChange(arg[1], "go")))
if _cmd := ctx.GetFileCmd(p); _cmd != "" {
if m.ActionKey() == mdb.RENDER {
if path.Base(arg[1]) == "common.go" {
ctx.ProcessField(m, strings.ReplaceAll(_cmd, ".portal", ".clean"), kit.Simple())
} else if msg := m.Cmd(_cmd, "commandSelect", cmd); msg.Length() > 0 || cmd == "" {
ctx.ProcessField(m, _cmd, kit.Simple())
} else {
ctx.ProcessField(m, cmd, kit.Simple())
}
} else if aaa.IsTechOrRoot(m) {
ls := kit.Split(arg[1], "/")
if msg := m.Cmd(_cmd, "commandSelect", cmd); msg.Length() > 0 && !kit.IsIn(path.Base(arg[1]), "model.go", "common.go") {
ctx.ProcessField(m, "web.code.mysql.query", kit.Simple("mysql", ls[0], TableName(kit.TrimExt(kit.Select("", ls, -1), arg[0]))))
} else {
ctx.ProcessField(m, "web.code.mysql.query", kit.Simple("mysql", ls[0]))
}
} else {
m.Option(ice.MSG_DISPLAY, "")
}
}
return true
}
return false
}
func _go_show(m *ice.Message, arg ...string) {
if arg[1] == MAIN_GO {
ProcessXterm(m, kit.JoinWord("ish", arg[1]), "", "")
@ -68,31 +96,8 @@ func _go_show(m *ice.Message, arg ...string) {
ctx.ProcessField(m, cli.RUNTIME, kit.Simple())
} else if arg[1] == "binpack.go" {
ctx.ProcessField(m, nfs.PACK, kit.Simple())
} else if path.Base(arg[1]) == "model.go" {
ctx.ProcessField(m, "web.code.mysql.query", kit.Simple("mysql", kit.Split(arg[1], "/", "/")[0]))
} else if _go_portal(m, arg...) {
} 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 _cmd := ctx.GetFileCmd(p); _cmd != "" {
if m.ActionKey() == mdb.RENDER {
if path.Base(arg[1]) == "common.go" {
ctx.ProcessField(m, strings.ReplaceAll(_cmd, ".portal", ".clean"), kit.Simple())
return
}
if msg := m.Cmd(_cmd, "commandSelect", cmd); msg.Length() > 0 {
ctx.ProcessField(m, _cmd, kit.Simple())
return
}
} else {
ls := kit.Split(strings.TrimSuffix(arg[1], ".go"), "/")
if path.Base(arg[1]) == "common.go" {
ctx.ProcessField(m, "web.code.mysql.query", kit.Simple("mysql", ls[0]))
} else {
ctx.ProcessField(m, "web.code.mysql.query", kit.Simple("mysql", ls[0], TableName(kit.Select("", ls, -1))))
}
return
}
}
}
ctx.ProcessField(m, cmd, kit.Simple())
} else if msg := m.Cmd(yac.STACK, path.Join(arg[2], arg[1])); msg.Option("__index") != "" {
ctx.ProcessField(m, msg.Option("__index"), kit.Simple())

View File

@ -1,7 +1,6 @@
package code
import (
"path"
"strings"
ice "shylinux.com/x/icebergs"
@ -21,17 +20,7 @@ func _js_show(m *ice.Message, arg ...string) {
} else if strings.HasPrefix(arg[1], "plugin/local/") {
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 cmd := ctx.GetFileCmd(path.Join(arg[2], arg[1])); cmd != "" {
if p := path.Join(arg[2], strings.Split(arg[1], "/")[0], "portal.go"); nfs.Exists(m, p) {
if _cmd := ctx.GetFileCmd(p); _cmd != "" {
if msg := m.Cmd(_cmd, "commandSelect", cmd); msg.Length() > 0 {
ctx.ProcessField(m, _cmd, kit.Simple())
return
}
}
}
ctx.DisplayBase(m, require(arg[2], arg[1]))
ctx.ProcessField(m, kit.Select(ice.CAN_PLUGIN, ctx.GetFileCmd(kit.ExtChange(path.Join(arg[2], arg[1]), GO))), kit.Simple())
} else if _go_portal(m, arg...) {
}
}

View File

@ -32,6 +32,12 @@ func init() {
})
}},
mdb.ENGINE: {Hand: func(m *ice.Message, arg ...string) {
if path.Base(arg[1]) == "portal.json" {
if cmd := ctx.GetFileCmd(path.Join(arg[2], arg[1])); cmd != "" {
ctx.ProcessField(m, cmd, kit.Simple("table"))
return
}
}
m.Cmdy(nfs.CAT, path.Join(arg[2], arg[1]))
ctx.DisplayStoryJSON(m)
}},

View File

@ -145,6 +145,7 @@ func init() {
gdb.Event(m, VIMER_SAVE)
}},
mdb.RENDER: {Role: aaa.VOID, Hand: func(m *ice.Message, arg ...string) { _inner_show(m, arg[0], arg[1], arg[2]) }},
mdb.ENGINE: {Role: aaa.VOID, Hand: func(m *ice.Message, arg ...string) { _inner_exec(m, arg[0], arg[1], arg[2]) }},
TEMPLATE: {Hand: func(m *ice.Message, arg ...string) {
m.Cmdy(TEMPLATE, kit.Ext(m.Option(mdb.FILE)), m.Option(nfs.FILE), m.Option(nfs.PATH))
}},

View File

@ -52,7 +52,15 @@ func init() {
"oauth", "", web.SPACE, "", nfs.SCRIPT, "https://res.wx.qq.com/open/js/jweixin-1.6.0.js",
)), Hand: func(m *ice.Message, arg ...string) {
m.Cmdy(ACCESS, AGENT).Options(SIGNATURE, _wx_sign(m, m.Option(NONCESTR, ice.Info.Pathname), m.Option(TIMESTAMP, kit.Format(time.Now().Unix())))).Display("")
m.Info("what %v", m.FormatsMeta(nil))
ctx.OptionFromConfig(m, "oauth", nfs.SCRIPT)
if m.Option(ice.MSG_USERNAME) == "" {
msg := m.Spawn()
web.ParseURL(msg, m.Option("oauth"))
state := m.Cmdx("web.chat.oauth.cache", mdb.CREATE, "state", msg.Option("state"), "goback", kit.Select(m.Option(ice.MSG_USERURL), m.Option(ice.MSG_REFERER)))
oauth := kit.MergeURL(m.Option("oauth"), "state", state)
m.Option("oauth", oauth)
}
m.Option("oauth", strings.ReplaceAll(m.Option("oauth"), "https%3A%2F%2Fyunxuanlinghang.com", strings.ReplaceAll(m.Option(ice.MSG_USERHOST), "://", "%3A%2F%2F")))
}},
})

View File

@ -8,6 +8,7 @@ Volcanos(chat.ONIMPORT, {
debug = false, can.onmotion.hidden(can, can._fields)
wx.config({debug: debug, signature: msg.Option("signature"), timestamp: msg.Option("timestamp"), nonceStr: msg.Option("noncestr"), appId: msg.Option("appid"),
jsApiList: can.core.Item({
/*
getLocation: function(can, cb) { wx.getLocation({type: "gcj02", success: function (res) {
can.base.isFunc(cb) && cb({type: "gcj02", name: "当前位置", text: "当前位置", latitude: parseInt(res.latitude*100000), longitude: parseInt(res.longitude*100000) })
} }) },
@ -27,6 +28,7 @@ Volcanos(chat.ONIMPORT, {
scanQRCode: function(can, cb) { wx.scanQRCode({needResult: cb? 1: 0, scanType: ["qrCode", "barCode"], success: function (res) {
can.base.isFunc(cb) && cb(can.base.ParseJSON(res.resultStr))
} }) },
*/
}, function(key, value) { return can.user.agent[key] = value, key }).concat([
"updateAppMessageShareData",
], can.user.isMobile? ["updateTimelineShareData"]: []), openTagList: ["wx-open-subscribe"],