mirror of
https://shylinux.com/x/icebergs
synced 2025-06-26 02:17:30 +08:00
add some
This commit is contained in:
parent
db926c80e8
commit
a9ebeed451
@ -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) })
|
||||
|
@ -90,6 +90,7 @@ const (
|
||||
VIEW = "view"
|
||||
VALUE = "value"
|
||||
INPUT = "input"
|
||||
TITLE = "title"
|
||||
ICON = "icon"
|
||||
ICONS = "icons"
|
||||
OUTPUT = "output"
|
||||
|
@ -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),
|
||||
)))
|
||||
|
@ -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 != "" {
|
||||
|
1
conf.go
1
conf.go
@ -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"
|
||||
|
@ -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)
|
||||
|
@ -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())
|
||||
|
@ -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())
|
||||
|
@ -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...) {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
}},
|
||||
|
@ -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))
|
||||
}},
|
||||
|
@ -52,6 +52,7 @@ 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()
|
||||
|
@ -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"],
|
||||
|
Loading…
x
Reference in New Issue
Block a user