mirror of
https://shylinux.com/x/icebergs
synced 2025-06-30 20:04:43 +08:00
Compare commits
31 Commits
Author | SHA1 | Date | |
---|---|---|---|
7c3af575c7 | |||
1a63572b28 | |||
3a9d03d556 | |||
e87bdc0a82 | |||
941e97f98b | |||
a9ebeed451 | |||
db926c80e8 | |||
3adf9ecc77 | |||
cd25b243c4 | |||
fa884c8302 | |||
8d40fb6fbb | |||
fe08248103 | |||
f905b3616f | |||
989071cf66 | |||
db34f85840 | |||
3adf0c66ac | |||
aa27f507bc | |||
c2c18610de | |||
9c48f02a0f | |||
3d5a29b5f3 | |||
1d591dc2f2 | |||
5401298cff | |||
8e7eadbb95 | |||
f769841c33 | |||
4bb96d905d | |||
7d26b0afb0 | |||
1f9e8d756f | |||
705f3d074e | |||
b0c7feb56e | |||
7e5cff6b81 | |||
6c0e3a0a58 |
@ -54,9 +54,7 @@ func init() {
|
||||
), Actions: ice.MergeActions(ice.Actions{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
ice.AddRender(ice.RENDER_QRCODE, func(m *ice.Message, args ...ice.Any) string {
|
||||
if m.IsMobileUA() {
|
||||
m.Option(SIZE, "280")
|
||||
}
|
||||
kit.If(m.IsMobileUA(), func() { m.Option(SIZE, "280") })
|
||||
return m.Cmd(Prefix(QRCODE), kit.Simple(args...)).Result()
|
||||
})
|
||||
}},
|
||||
@ -66,6 +64,13 @@ func init() {
|
||||
m.Push(arg[0], kit.SortedKey(_color_map))
|
||||
}
|
||||
}},
|
||||
"view": {Name: "view text icon link", Hand: func(m *ice.Message, arg ...string) {
|
||||
defer m.Echo("<div class='code qrcode'>").Echo("</div>")
|
||||
// m.Cmdy("", kit.MergeURL2(m.Option(ice.MSG_USERWEB), arg[2]))
|
||||
m.Cmdy("", arg[2])
|
||||
m.Echo("<img class='avatar' src='%s'></img>", arg[1])
|
||||
m.Echo(arg[0])
|
||||
}},
|
||||
}), Hand: func(m *ice.Message, arg ...string) {
|
||||
if m.IsCliUA() {
|
||||
m.OptionDefault(FG, BLACK, BG, WHITE)
|
||||
|
@ -21,8 +21,12 @@ func _command_list(m *ice.Message, name string) *ice.Message {
|
||||
m.Option(ice.MSG_NODEICON, m.Resource(ice.Info.NodeIcon))
|
||||
m.Spawn(m.Source()).Search(name, func(p *ice.Context, s *ice.Context, key string, cmd *ice.Command) {
|
||||
icon := kit.Format(kit.Value(cmd.Meta, kit.Keys(ice.CTX_ICONS, key)))
|
||||
icons := kit.Select(cmd.Icon, icon, !kit.HasPrefix(icon, "bi ", "{"))
|
||||
if icons != "" {
|
||||
icons = m.Resource(icons)
|
||||
}
|
||||
m.Push(mdb.INDEX, kit.Keys(s.Prefix(), key))
|
||||
m.Push(mdb.ICONS, kit.Select(cmd.Icon, icon, !kit.HasPrefix(icon, "bi ", "{")))
|
||||
m.Push(mdb.ICONS, icons)
|
||||
m.Push(mdb.NAME, kit.Format(cmd.Name)).Push(mdb.HELP, kit.Format(cmd.Help))
|
||||
m.Push(mdb.LIST, kit.Format(cmd.List)).Push(mdb.META, kit.Format(cmd.Meta))
|
||||
m.Push("_command", ShortCmd(kit.Keys(s.Prefix(), key)))
|
||||
@ -43,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())
|
||||
}
|
||||
|
||||
@ -120,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) })
|
||||
@ -213,6 +217,9 @@ func ShortCmd(key string) string {
|
||||
return key
|
||||
}
|
||||
func ResourceFile(m *ice.Message, file string, arg ...string) string {
|
||||
if strings.Contains(file, "bi ") {
|
||||
return file
|
||||
}
|
||||
if kit.HasPrefix(file, nfs.PS, ice.HTTP) {
|
||||
return file
|
||||
} else if nfs.Exists(m, file) {
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/aaa"
|
||||
@ -183,12 +184,18 @@ func init() {
|
||||
}
|
||||
// if m.Options(mdb.HASH, up[0], mdb.NAME, up[1]); watch {
|
||||
if watch {
|
||||
m.Cmdy(CACHE, WATCH, up[0], path.Join(msg.Append(nfs.PATH), up[1]))
|
||||
m.Cmdy(CACHE, WATCH, up[0], path.Join(kit.Select(m.Option(nfs.PATH), msg.Append(nfs.PATH)), up[1]))
|
||||
}
|
||||
}, action.Hand)
|
||||
}
|
||||
})
|
||||
}
|
||||
func UploadSave(m *ice.Message, p string) string {
|
||||
up := kit.Simple(m.Optionv(ice.MSG_UPLOAD))
|
||||
kit.If(strings.HasSuffix(p, nfs.PS), func() { p = path.Join(p, up[1]) })
|
||||
m.Cmd(CACHE, WATCH, up[0], p)
|
||||
return p
|
||||
}
|
||||
func Upload(m *ice.Message) []string {
|
||||
if up := kit.Simple(m.Optionv(ice.MSG_UPLOAD)); len(up) == 1 {
|
||||
msg := m.Cmd(CACHE, UPLOAD)
|
||||
|
@ -28,6 +28,7 @@ func _dream_list(m *ice.Message) *ice.Message {
|
||||
return
|
||||
}
|
||||
if space, ok := list[value[mdb.NAME]]; ok {
|
||||
value[mdb.HELP] = space[mdb.HELP]
|
||||
value[ice.MAIN] = space[ice.MAIN]
|
||||
value[mdb.ICONS] = space[mdb.ICONS]
|
||||
m.Push("", value, kit.Slice(head, 0, -1))
|
||||
@ -86,21 +87,23 @@ func _dream_list_more(m *ice.Message) *ice.Message {
|
||||
return
|
||||
}
|
||||
value[mdb.TEXT] = kit.JoinLine(value[nfs.MODULE], value[mdb.TEXT])
|
||||
button = append(button, GETTOKEN, OPEN)
|
||||
kit.If(value[aaa.ACCESS] == "", func() { button = []ice.Any{PORTAL, OPEN} })
|
||||
kit.If(aaa.IsTechOrRoot(m), func() { button = append(button, GETTOKEN) })
|
||||
kit.If(value[aaa.ACCESS] == "", func() { button = []ice.Any{PORTAL} })
|
||||
button = append(button, OPEN)
|
||||
case SERVER:
|
||||
if !m.IsCliUA() {
|
||||
value[mdb.TEXT] = kit.JoinLine(value[nfs.MODULE], value[mdb.TEXT])
|
||||
} else if !strings.HasPrefix(value[mdb.TEXT], ice.HTTP) {
|
||||
return
|
||||
}
|
||||
button = append(button, SETTOKEN, OPEN)
|
||||
kit.If(aaa.IsTechOrRoot(m), func() { button = append(button, SETTOKEN) })
|
||||
button = append(button, OPEN)
|
||||
case aaa.LOGIN:
|
||||
if m.IsCliUA() {
|
||||
return
|
||||
}
|
||||
value[mdb.TEXT] = kit.JoinWord(value[AGENT], value[cli.SYSTEM], value[aaa.IP], kit.Format(PublicIP(m, value[aaa.IP])))
|
||||
button = []ice.Any{GRANT}
|
||||
defer func() { button = []ice.Any{GRANT} }()
|
||||
default:
|
||||
return
|
||||
}
|
||||
@ -483,7 +486,7 @@ func init() {
|
||||
m.Cmdy(nfs.CAT, "go.work")
|
||||
}},
|
||||
}, StatsAction(), DreamAction(), DreamTablesAction(), mdb.ImportantHashAction(
|
||||
mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,main,icons,repos,binary,template,restart,access",
|
||||
mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,help,main,icons,repos,binary,template,restart,access",
|
||||
html.BUTTON, kit.JoinWord(PORTAL, DESKTOP, ADMIN, WORD, VIMER, STATUS, COMPILE, XTERM, DREAM),
|
||||
)), Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg) == 0 {
|
||||
|
@ -85,10 +85,12 @@ const (
|
||||
CONTENT = "content"
|
||||
PROFILE = "profile"
|
||||
DISPLAY = "display"
|
||||
PORTAL = "portal"
|
||||
|
||||
VIEW = "view"
|
||||
VALUE = "value"
|
||||
INPUT = "input"
|
||||
TITLE = "title"
|
||||
ICON = "icon"
|
||||
ICONS = "icons"
|
||||
OUTPUT = "output"
|
||||
|
@ -84,8 +84,10 @@ func Render(m *ice.Message, cmd string, args ...ice.Any) bool {
|
||||
"$output", fieldset+">div.output",
|
||||
"$status", fieldset+">div.status",
|
||||
"$fieldset", fieldset,
|
||||
"$field", fieldset,
|
||||
"$input", "div.input.float."+m.Option(ctx.INDEX),
|
||||
"$body", "body.cmd."+m.Option(ctx.INDEX),
|
||||
"$index", m.Option(ctx.INDEX),
|
||||
"$input", "body>div.input.float."+m.Option(ctx.INDEX),
|
||||
)))
|
||||
break
|
||||
}
|
||||
@ -171,7 +173,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)))
|
||||
|
@ -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)))))
|
||||
@ -198,7 +199,6 @@ func _serve_handle(key string, cmd *ice.Command, m *ice.Message, w http.Response
|
||||
})
|
||||
UserHost(m)
|
||||
for k, v := range m.R.Header {
|
||||
// m.Info("what %v %v", k, v)
|
||||
kit.If(strings.HasPrefix(k, "Wechatpay"), func() { m.Option(k, v) })
|
||||
}
|
||||
m.W.Header().Add(strings.ReplaceAll(ice.LOG_TRACEID, ".", "-"), m.Option(ice.LOG_TRACEID))
|
||||
@ -232,6 +232,8 @@ func _serve_handle(key string, cmd *ice.Command, m *ice.Message, w http.Response
|
||||
Info.ServeDeleteCount++
|
||||
}
|
||||
}()
|
||||
} else {
|
||||
m.RenderResult()
|
||||
}
|
||||
}
|
||||
func _serve_domain(m *ice.Message) string {
|
||||
@ -249,7 +251,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
|
||||
@ -257,6 +259,9 @@ func _serve_auth(m *ice.Message, key string, cmds []string, w http.ResponseWrite
|
||||
defer func() { m.Options(ice.MSG_CMDS, "") }()
|
||||
if strings.Contains(m.Option(ice.MSG_SESSID), " ") {
|
||||
m.Cmdy(kit.Split(m.Option(ice.MSG_SESSID)))
|
||||
if m.Warn(m.Option("user.status") == "1", "此用户已封号") {
|
||||
return cmds, false
|
||||
}
|
||||
} else if aaa.SessCheck(m, m.Option(ice.MSG_SESSID)); m.Option(ice.MSG_USERNAME) == "" {
|
||||
if ls := kit.Simple(mdb.Cache(m, m.Option(ice.MSG_USERIP), func() ice.Any {
|
||||
if !IsLocalHost(m) {
|
||||
|
@ -125,7 +125,7 @@ func init() {
|
||||
RenderPodCmd(m, msg.Append(SPACE), msg.Append(mdb.NAME), kit.UnMarshal(msg.Append(mdb.TEXT)))
|
||||
}
|
||||
case DOWNLOAD:
|
||||
m.RenderDownload(msg.Append(mdb.TEXT))
|
||||
m.RenderDownload(msg.Append(mdb.TEXT), msg.Append(mdb.TYPE), msg.Append(mdb.NAME))
|
||||
default:
|
||||
RenderMain(m)
|
||||
}
|
||||
|
@ -49,7 +49,9 @@ func _space_qrcode(m *ice.Message, dev string) {
|
||||
func _space_dial(m *ice.Message, dev, name string, arg ...string) {
|
||||
msg := m.Cmd(SPIDE, dev)
|
||||
origin := msg.Append(CLIENT_ORIGIN)
|
||||
u := kit.ParseURL(kit.MergeURL2(strings.Replace(origin, HTTP, "ws", 1), PP(SPACE), mdb.TYPE, ice.Info.NodeType, mdb.NAME, name, TOKEN, msg.Append(TOKEN), mdb.ICONS, ice.Info.NodeIcon,
|
||||
u := kit.ParseURL(kit.MergeURL2(strings.Replace(origin, HTTP, "ws", 1), PP(SPACE), mdb.TYPE, ice.Info.NodeType, mdb.NAME, name,
|
||||
mdb.HELP, ice.Info.Titles,
|
||||
TOKEN, msg.Append(TOKEN), mdb.ICONS, ice.Info.NodeIcon,
|
||||
ice.MAIN, ice.Info.NodeMain, mdb.TIME, ice.Info.Make.Time, nfs.MODULE, ice.Info.Make.Module, nfs.VERSION, ice.Info.Make.Versions(), cli.GOOS, runtime.GOOS, cli.GOARCH, runtime.GOARCH, arg))
|
||||
args := kit.SimpleKV("type,name,host,port", u.Scheme, dev, u.Hostname(), kit.Select(kit.Select(tcp.PORT_443, tcp.PORT_80, u.Scheme == "ws"), u.Port()))
|
||||
gdb.Go(m, func() {
|
||||
@ -103,7 +105,7 @@ func _space_fork(m *ice.Message) {
|
||||
safe = aaa.IsTechOrRoot(m)
|
||||
}
|
||||
}
|
||||
args := kit.Simple(mdb.TYPE, m.Option(mdb.TYPE), mdb.NAME, name, mdb.TEXT, text, m.OptionSimple(mdb.ICONS, mdb.TIME, nfs.MODULE, nfs.VERSION, cli.DAEMON, "main"))
|
||||
args := kit.Simple(mdb.TYPE, m.Option(mdb.TYPE), mdb.NAME, name, mdb.TEXT, text, m.OptionSimple(mdb.HELP, mdb.ICONS, mdb.TIME, nfs.MODULE, nfs.VERSION, cli.DAEMON, "main"))
|
||||
args = append(args, aaa.USERNICK, m.Option(ice.MSG_USERNICK), aaa.USERNAME, m.Option(ice.MSG_USERNAME), aaa.USERROLE, m.Option(ice.MSG_USERROLE))
|
||||
args = append(args, cli.SYSTEM, m.Option(cli.GOOS))
|
||||
args = append(args, ParseUA(m)...)
|
||||
@ -153,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))) })
|
||||
@ -445,7 +447,7 @@ func init() {
|
||||
}},
|
||||
nfs.PS: {Hand: func(m *ice.Message, arg ...string) { _space_fork(m) }},
|
||||
}, gdb.EventsAction(SPACE_LOGIN), mdb.HashAction(mdb.LIMIT, 1000, mdb.LEAST, 500,
|
||||
mdb.SHORT, mdb.NAME, mdb.FIELD, "time,type,name,text,main,icons,module,version,agent,system,ip,usernick,username,userrole",
|
||||
mdb.SHORT, mdb.NAME, mdb.FIELD, "time,type,name,help,text,main,icons,module,version,agent,system,ip,usernick,username,userrole",
|
||||
ctx.ACTION, OPEN, REDIAL, kit.Dict("a", 1000, "b", 100, "c", 1000),
|
||||
), mdb.ClearOnExitHashAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg) < 2 {
|
||||
@ -492,6 +494,9 @@ func init() {
|
||||
})
|
||||
m.Sort("", kit.Simple(aaa.LOGIN, WEIXIN, PORTAL, WORKER, SERVER, ORIGIN))
|
||||
} else {
|
||||
if arg[0] == "web.team.gonganxitong.sess" {
|
||||
return
|
||||
}
|
||||
if ice.Info.NodeType != WORKER && arg[0] == ice.OPS {
|
||||
m.Cmdy(arg[1:])
|
||||
return
|
||||
@ -525,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) {
|
||||
@ -554,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 != "" {
|
||||
|
@ -115,7 +115,6 @@ func _spide_body(m *ice.Message, method string, arg ...string) (io.Reader, ice.M
|
||||
case SPIDE_FORM:
|
||||
// arg = kit.Simple(arg, func(v string) string { return url.QueryEscape(v) })
|
||||
head[html.ContentType], body = html.ApplicationForm, bytes.NewBufferString(kit.JoinQuery(arg[1:]...))
|
||||
m.Info("debug what %v", kit.JoinQuery(arg[1:]...))
|
||||
case SPIDE_PART:
|
||||
head[html.ContentType], body = _spide_part(m, arg...)
|
||||
case SPIDE_FILE:
|
||||
@ -431,8 +430,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 {
|
||||
|
@ -1,6 +1,6 @@
|
||||
$project div.list { margin-left:25px; }
|
||||
$project div.item span.exists { color:var(--notice-bg-color); padding:0 var(--input-padding); }
|
||||
$content>div.item { box-shadow:var(--th-box-shadow); border:var(--plugin-border); border-radius:var(--plugin-radius); }
|
||||
$content>div.item { border:var(--plugin-border); border-radius:var(--plugin-radius); }
|
||||
$content>div.item:hover { box-shadow:var(--notice-box-shadow); }
|
||||
$content>div.item div.title div.label { font-size:var(--status-font-size); font-weight:normal; margin-top:var(--input-margin); }
|
||||
$content>div.item div.title div.label span { padding:var(--input-padding); padding-right:var(--input-margin); }
|
||||
|
4
conf.go
4
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"
|
||||
@ -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,8 @@ 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"
|
||||
MSG_FG = "sess.fg"
|
||||
|
@ -141,7 +141,7 @@ func init() {
|
||||
m.Echo(m.Option(ice.MSG_SESSID))
|
||||
}
|
||||
}},
|
||||
}, web.ApiAction(), mdb.ImportantHashAction(mdb.SHORT, mdb.NAME, mdb.FIELD, "time,type,name,help,icons,order,link,space,index,args")), Hand: func(m *ice.Message, arg ...string) {
|
||||
}, web.ApiAction(), mdb.ImportantHashAction(mdb.SHORT, mdb.NAME, mdb.FIELD, "time,type,name,help,prompt,icons,order,link,space,index,args")), Hand: func(m *ice.Message, arg ...string) {
|
||||
if kit.Contains(m.Option(ice.MSG_USERUA), "MicroMessenger") {
|
||||
if m.Option(ice.MSG_USERNAME) == "" && m.Option("code") == "" && mdb.Config(m, "oauth") != "" {
|
||||
m.ProcessOpen(mdb.Config(m, "oauth"))
|
||||
@ -163,6 +163,7 @@ func init() {
|
||||
return
|
||||
}
|
||||
m.Option(aaa.LANGUAGE, strings.ReplaceAll(strings.ToLower(kit.Select("", kit.Split(kit.GetValid(
|
||||
func() string { return m.Option(ice.MSG_LANGUAGE) },
|
||||
func() string { return kit.Select("", "zh-cn", strings.Contains(m.Option(ice.MSG_USERUA), "zh_CN")) },
|
||||
func() string {
|
||||
if m.R != nil {
|
||||
|
@ -1,17 +1,10 @@
|
||||
package macos
|
||||
|
||||
import (
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/aaa"
|
||||
"shylinux.com/x/icebergs/base/ctx"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
"shylinux.com/x/icebergs/base/web"
|
||||
"shylinux.com/x/icebergs/core/code"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
const APPLICATIONS = "applications"
|
||||
@ -25,23 +18,6 @@ func init() {
|
||||
}, PodCmdAction(), CmdHashAction("space,index,args"), mdb.ClearOnExitHashAction())},
|
||||
})
|
||||
}
|
||||
func install(m *ice.Message, cmd, icon, index string, arg ...string) string {
|
||||
if icon == "" {
|
||||
return ""
|
||||
} else if !kit.HasPrefix(icon, nfs.PS, web.HTTP) && !nfs.Exists(m, icon) && !nfs.Exists(m, ice.USR_ICONS+icon, func(p string) { icon = p }) {
|
||||
if strings.Contains(kit.Path(""), nfs.USR_LOCAL_WORK) && nfs.Exists(m, path.Join(strings.Split(kit.Path(""), nfs.USR_LOCAL_WORK)[0], ice.USR_ICONS+icon)) {
|
||||
icon = ice.USR_ICONS + icon
|
||||
} else {
|
||||
icon = path.Join(path.Dir(ctx.GetCmdFile(m, m.PrefixKey())), icon)
|
||||
}
|
||||
}
|
||||
name := kit.TrimExt(path.Base(icon), nfs.PNG, nfs.JPG, nfs.JPEG)
|
||||
if !strings.HasPrefix(icon, nfs.USR_ICONS) {
|
||||
name = kit.Select("", kit.Split(index, "."), -1)
|
||||
}
|
||||
m.Cmd(Prefix(cmd), mdb.CREATE, mdb.NAME, name, mdb.ICON, icon, ctx.INDEX, index, arg)
|
||||
return icon
|
||||
}
|
||||
func AppInstall(m *ice.Message, icon, index string, arg ...string) string {
|
||||
return install(m, APPLICATIONS, icon, index, arg...)
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ fieldset.desktop>div.output>div.desktop { display:flex; flex-direction:column; f
|
||||
fieldset.desktop>div.output>div.desktop:not(.select) { display:none; }
|
||||
fieldset.desktop>div.output>div.desktop>div.item { text-align:center; }
|
||||
fieldset.desktop>div.output>div.desktop>div.item img { object-fit:contain; height:var(--desktop-icon-size); width:var(--desktop-icon-size); }
|
||||
fieldset.desktop>div.output>div.desktop>div.item.portal img { padding:8px; border-radius:20px; }
|
||||
fieldset.desktop>div.output>div.desktop>div.item>div.name { color:white; white-space:pre; font-size:var(--code-font-size); width:var(--desktop-icon-size); overflow:hidden; }
|
||||
fieldset.desktop>div.output>div.desktop>fieldset { border:0; position:absolute; }
|
||||
fieldset.desktop>div.output>div.desktop>fieldset>legend { box-shadow:none; padding:0 var(--input-padding); margin:var(--button-margin); }
|
||||
@ -63,8 +64,15 @@ fieldset.desktop>div.output>div.desktop>fieldset.web.chat.location>div.action>di
|
||||
fieldset.desktop>div.output>div.desktop>fieldset.web.chat.location>div.action>div.item.style select { width:80px; }
|
||||
fieldset.desktop>div.output>div.desktop>fieldset.web.chat.location>div.action>div.item.feature select { width:60px; }
|
||||
fieldset.desktop>div.output>div.desktop>fieldset.web.chat.macos.finder>div.action { display:none; }
|
||||
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>div.desktop>fieldset.web.team.portal>div.action { top:48px; }
|
||||
fieldset.desktop>div.output>div.desktop>fieldset.web.team.portal>div.output div.item.card>div.action { display:none; }
|
||||
fieldset.desktop>div.output>div.desktop>fieldset.web.chat.iframe>div.output { background-color:var(--output-bg-color); color:var(--output-fg-color); }
|
||||
|
||||
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; }
|
||||
@ -73,7 +81,9 @@ body.mobile fieldset.macos.menu>div.output>div.tabs { display:none; }
|
||||
body.mobile fieldset.macos.menu>div.output>div.icon.create { display:none; }
|
||||
body.mobile fieldset.macos.menu>div.output>div.item.search { display:none; }
|
||||
body.mobile fieldset.macos.menu>div.output>div.item.notify { display:none; }
|
||||
fieldset.macos.menu>div.output>div.item.avatar>img { padding:0; height:var(--desktop-menu-height); }
|
||||
body.mobile fieldset.macos.menu>div.output>div.item.usernick { display:none; }
|
||||
body.mobile fieldset.macos.menu>div.output>div.item.qrcode { display:none; }
|
||||
fieldset.macos.menu>div.output>div.item.avatar>img { border-radius:20px; padding:0; height:var(--desktop-menu-height); }
|
||||
fieldset.macos.menu>div.output>div.menu { padding:0 var(--button-padding); float:left; }
|
||||
body.mobile fieldset.macos.menu>div.output>div.menu { padding:0 var(--input-padding); }
|
||||
fieldset.macos.menu>div.output>div.tabs { font-style:italic; padding:0 var(--input-padding); float:left; }
|
||||
@ -86,8 +96,8 @@ fieldset.macos.dock>div.output>div.item { text-align:center; align-self:baseline
|
||||
fieldset.macos.dock>div.output>div.item img { object-fit:contain; min-height:var(--desktop-icon-size); width:var(--desktop-icon-size); transition:width 0.3s; }
|
||||
fieldset.macos.dock>div.output>div.item>div.name { display:none; }
|
||||
fieldset.macos.finder>div.output div.content>div.item { text-align:center; float:left; width:var(--desktop-icon-size); }
|
||||
fieldset.macos.finder>div.output div.content>div.item img { object-fit:contain; width:var(--desktop-icon-size); }
|
||||
fieldset.macos.finder>div.output div.content>div.item img { object-fit:contain; width:var(--desktop-icon-size); height:var(--desktop-icon-size); }
|
||||
fieldset.macos.finder>div.output div.content>div.item.portal img { padding:8px; border-radius:20px; }
|
||||
fieldset.macos.finder>div.output div.content>div.item div.name { font-size:var(--code-font-size); white-space:pre; text-align:center; overflow:hidden; }
|
||||
fieldset.desktop>div.output>div.desktop fieldset table.content tbody tr:nth-child(odd):not(:hover) { background-color:var(--output-bg-color); }
|
||||
fieldset.desktop>div.output>div.desktop fieldset table.content tbody tr:nth-child(even):not(:hover) { background-color:var(--plugin-bg-color); }
|
||||
@ -96,6 +106,7 @@ body:not(.mobile) fieldset.macos.dock>div.output>div.item:hover { background-col
|
||||
body:not(.mobile) fieldset.macos.dock>div.output>div.item img:hover { width:160px; transition:width 0.3s; }
|
||||
body:not(.mobile) fieldset.desktop>div.output>fieldset.macos.dock:hover { margin-left:-40px; transition:margin-left 0.3s; }
|
||||
body:not(.mobile) fieldset.desktop>div.output>div.desktop>div.item { margin:var(--desktop-icon-margin); }
|
||||
body:not(.mobile) fieldset.desktop>div.output>div.desktop>div.item:hover { background-color:var(--hover-bg-color); }
|
||||
body:not(.mobile) fieldset.desktop>div.output>fieldset.macos.searchs>form.option>div.item.keyword input { background-color:transparent; width:var(--river-width); }
|
||||
body:not(.mobile) fieldset.desktop>div.output>fieldset.macos.searchs>div.action input { background-color:transparent; }
|
||||
body:not(.mobile) fieldset.desktop>div.output>div.desktop>fieldset>legend:not(:hover) { background-color:transparent; }
|
||||
|
@ -20,22 +20,22 @@ func init() {
|
||||
}},
|
||||
ice.CTX_OPEN: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if m.Cmd(DESKTOP).Length() == 0 {
|
||||
DeskAppend(m, "Books.png", web.WIKI_WORD)
|
||||
DeskAppend(m, "Photos.png", web.WIKI_FEEL)
|
||||
DeskAppend(m, "Calendar.png", web.TEAM_PLAN)
|
||||
DeskAppend(m, "Messages.png", web.CHAT_MESSAGE)
|
||||
DeskAppend(m, "Messages.png", web.CHAT_MESSAGE, mdb.TEXT, "消息", mdb.SCORE, "1")
|
||||
DeskAppend(m, "Calendar.png", web.TEAM_PLAN, mdb.TEXT, "日历", mdb.SCORE, "2")
|
||||
DeskAppend(m, "Photos.png", web.WIKI_FEEL, mdb.TEXT, "相册", mdb.SCORE, "3")
|
||||
DeskAppend(m, "Books.png", web.WIKI_WORD, mdb.TEXT, "文档", mdb.SCORE, "4")
|
||||
}
|
||||
if m.Cmd(DOCK).Length() == 0 {
|
||||
DockAppend(m, "Finder.png", Prefix(FINDER))
|
||||
DockAppend(m, "Safari.png", web.CHAT_IFRAME)
|
||||
DockAppend(m, "Terminal.png", web.CODE_XTERM)
|
||||
DockAppend(m, "git.png", web.CODE_GIT_STATUS)
|
||||
DockAppend(m, "vimer.png", web.CODE_VIMER)
|
||||
DockAppend(m, "Finder.png", Prefix(FINDER), mdb.SCORE, "1")
|
||||
DockAppend(m, "Safari.png", web.CHAT_IFRAME, mdb.SCORE, "2")
|
||||
DockAppend(m, "vimer.png", web.CODE_VIMER, mdb.SCORE, "3")
|
||||
DockAppend(m, "git.png", web.CODE_GIT_STATUS, mdb.SCORE, "4")
|
||||
DockAppend(m, "Terminal.png", web.CODE_XTERM, mdb.SCORE, "5")
|
||||
}
|
||||
m.Travel(func(p *ice.Context, c *ice.Context, key string, cmd *ice.Command) {
|
||||
kit.If(cmd.Icon, func() {
|
||||
if kit.Contains(cmd.Icon, ".ico", ".png", ".jpg") {
|
||||
cmd.Icon = AppInstall(m, cmd.Icon, m.PrefixKey())
|
||||
cmd.Icon = AppInstall(m, cmd.Icon, m.PrefixKey(), mdb.TEXT, cmd.Help)
|
||||
}
|
||||
})
|
||||
})
|
||||
@ -50,7 +50,7 @@ func init() {
|
||||
}},
|
||||
// web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { web.DreamProcessIframe(m, arg...) }},
|
||||
// web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { web.DreamProcess(m, "", arg, arg...) }},
|
||||
}, web.DreamTablesAction(), PodCmdAction(), CmdHashAction(ctx.INDEX), mdb.ExportHashAction())},
|
||||
}, web.DreamTablesAction(), PodCmdAction(), CmdHashAction("space,index,args"), mdb.ExportHashAction())},
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -71,15 +71,28 @@ Volcanos(chat.ONIMPORT, {
|
||||
}) }) },
|
||||
__item: function(can, msg, target) { var index = 0; can.onimport.icon(can, msg = msg||can._msg, target, function(target, item) { can.page.Modify(can, target, {
|
||||
onclick: function(event) { can.onimport._window(can, item) },
|
||||
oncontextmenu: function(event) { var carte = can.user.carteRight(event, can, {
|
||||
oncontextmenu: function(event) { if (!can.user.isTechOrRoot(can)) { return } var carte = can.user.carteRight(event, can, {
|
||||
remove: function() { can.runAction(event, mdb.REMOVE, [item.hash]) },
|
||||
}); can.page.style(can, carte._target, html.TOP, event.y) },
|
||||
}) }) },
|
||||
_window: function(can, item, cb) { if (!item.index) { return }
|
||||
item.height = can.base.Max(html.DESKTOP_HEIGHT, can.ConfHeight()-125), item.width = can.base.Max(html.DESKTOP_WIDTH, can.ConfWidth())
|
||||
item.left = (can.ConfWidth()-item.width)/2, item.top = (can.ConfHeight()-item.height-125)/4+25
|
||||
item.left = (can.ConfWidth()-item.width)/2, item.top = can.base.Min((can.ConfHeight()-item.height-125)/4+25, 25)
|
||||
var style = item.style
|
||||
if (item.index == web.CHAT_IFRAME && (item.style == "portal" || item._style == "portal") || can.base.beginWith(item.index, "web.team.") && can.base.endWith(item.index, ".portal")) {
|
||||
// item.title = "ContextOS",
|
||||
item.width = 390, item.height = can.base.Max(844, can.ConfHeight()-25)
|
||||
item.left = can.ConfWidth()-item.width, item.top = 25
|
||||
}
|
||||
item.type = html.PLUGIN, item.style = {left: item.left, top: item.top, height: item.height, width: item.width}
|
||||
can.onappend.plugin(can, item, function(sub) {
|
||||
can.page.Select(can, sub._legend, html.SPAN, function(target) {
|
||||
target.innerText = can.user.trans(can, sub.ConfIndex(), sub.ConfHelp())
|
||||
})
|
||||
if (can.page.tagis(sub._target, "fieldset.web.team.portal")) {
|
||||
sub.onimport.size(sub, item.height = can.base.Max(844, can.ConfHeight()-25), item.width = 390, false)
|
||||
}
|
||||
can.onappend.style(sub, style)
|
||||
var index = 0; can.core.Item({
|
||||
close: {color: "#f95f57", inner: "x", onclick: function(event) { sub.onaction._close(event, sub) }},
|
||||
small: {color: "#fcbc2f", inner: "-", onclick: function(event) { var dock = can.page.Append(can, can.ui.dock._output, [{view: html.ITEM, list: [{view: html.ICON, list: [{img: can.misc.PathJoin(item.icon)}]}], onclick: function() {
|
||||
@ -89,7 +102,10 @@ Volcanos(chat.ONIMPORT, {
|
||||
}, function(name, item) {
|
||||
can.page.insertBefore(can, [{view: [[html.ITEM, html.BUTTON, "window", name], ""], title: name, list: [{text: item.inner}], style: {"background-color": item.color, right: 10+25*index++}, onclick: item.onclick}], sub._output)
|
||||
})
|
||||
sub.onimport._open = function(sub, msg, arg) { can.onimport._window(can, {title: msg.Option(html.TITLE), index: web.CHAT_IFRAME, args: [arg]}) }
|
||||
|
||||
sub.onimport._open = function(sub, msg, arg) {
|
||||
can.onimport._window(can, {title: msg.Option(html.TITLE), style: msg.Option("style"), index: web.CHAT_IFRAME, args: [arg]})
|
||||
}
|
||||
sub.onimport._field = function(sub, msg) { msg.Table(function(item) { can.onimport._window(can, item) }) }
|
||||
sub.onaction._close = function() { can.page.Remove(can, sub._target), can.onexport.tabs(can) }
|
||||
sub.onappend.dock = function(item) { can.ui.dock.runAction(can.request(event, item), mdb.CREATE, [], function() { can.ui.dock.Update() }) }
|
||||
@ -97,7 +113,12 @@ Volcanos(chat.ONIMPORT, {
|
||||
sub.onexport.record = function(sub, value, key, item) { can.onimport._window(can, item) }
|
||||
sub.onexport.marginTop = function() { return 25 }, sub.onexport.marginBottom = function() { return 100 }
|
||||
sub.onexport.actionHeight = function(sub) { return can.page.ClassList.has(can, sub._target, html.OUTPUT)? 0: html.ACTION_HEIGHT+20 }
|
||||
sub.onexport.output = function() { sub.onimport.size(sub, item.height, can.base.Min(sub._target.offsetWidth, item.width), false)
|
||||
sub.onexport.output = function(_sub, msg) {
|
||||
if (msg.Option("display.style") == "portal") {
|
||||
sub.onimport.size(sub, item.height, can.base.Max(can.base.Min(sub._target.offsetWidth, item.width), 390), false)
|
||||
} else {
|
||||
sub.onimport.size(sub, item.height, can.base.Min(sub._target.offsetWidth, item.width), false)
|
||||
}
|
||||
sub._target._meta.args = can.base.trim(can.page.SelectArgs(can, sub._option, "", function(target) { return target.value })), can.onexport.tabs(can)
|
||||
}
|
||||
can.onappend.style(can, html.FLOAT, sub._target), can.ondetail.select(can, sub._target, sub)
|
||||
|
@ -14,4 +14,6 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func DockAppend(m *ice.Message, icon, index string) { install(m, DOCK, icon, index) }
|
||||
func DockAppend(m *ice.Message, icon, index string, arg ...string) {
|
||||
install(m, DOCK, icon, index, arg...)
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ const FINDER = "finder"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
FINDER: {Name: "finder list", Help: "应用", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{
|
||||
FINDER: {Name: "finder list", Help: "系统资源", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(APPLICATIONS, mdb.INPUTS, arg) }},
|
||||
mdb.INSERT: {Name: "insert space index* args name* icon*@icon", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(APPLICATIONS, mdb.CREATE, arg) }},
|
||||
}, CmdHashAction(mdb.NAME))},
|
||||
|
@ -1,5 +1,6 @@
|
||||
Volcanos(chat.ONIMPORT, {
|
||||
_init: function(can, msg) { can.ui = can.onappend.layout(can), msg.Table(function(value, index) { value._select = index == 0
|
||||
_init: function(can, msg) {
|
||||
can.ui = can.onappend.layout(can), msg.Table(function(value, index) { value._select = index == 0
|
||||
can.onimport.item(can, value, function(event, item) { if (can.onmotion.cache(can, function() { return value.name }, can.ui.content)) { return }
|
||||
can.runActionCommand(event, value.index, [], function(msg) {
|
||||
switch (value.name) {
|
||||
@ -9,10 +10,11 @@ Volcanos(chat.ONIMPORT, {
|
||||
} can.onimport.layout(can)
|
||||
})
|
||||
})
|
||||
}), can.onmotion.hidden(can, can.ui.project) },
|
||||
}), can.onmotion.hidden(can, can.ui.project)
|
||||
},
|
||||
icons: function(can, msg, target) { can.onimport.icon(can, msg = msg||can._msg, target, function(target, item) { can.page.Modify(can, target, {
|
||||
onclick: function(event) { can.sup.onexport.record(can.sup, item.name, mdb.NAME, item) },
|
||||
oncontextmenu: function(event) { can.user.carteRight(event, can, {
|
||||
oncontextmenu: function(event) { can.user.isTechOrRoot(can) && can.user.carteRight(event, can, {
|
||||
"add to desktop": function() { can.sup.onappend.desktop(item) },
|
||||
"add to dock": function() { can.sup.onappend.dock(item) },
|
||||
}, []) }, draggable: true, ondragstart: function(event) { window._drag_item = item },
|
||||
|
@ -1,6 +1,9 @@
|
||||
package macos
|
||||
|
||||
import (
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/aaa"
|
||||
"shylinux.com/x/icebergs/base/cli"
|
||||
@ -50,17 +53,35 @@ func disableApp(m *ice.Message) *ice.Message {
|
||||
})
|
||||
return m
|
||||
}
|
||||
func install(m *ice.Message, cmd, icon, index string, arg ...string) string {
|
||||
if icon == "" {
|
||||
return ""
|
||||
} else if !kit.HasPrefix(icon, nfs.PS, web.HTTP) && !nfs.Exists(m, icon) && !nfs.Exists(m, ice.USR_ICONS+icon, func(p string) { icon = p }) {
|
||||
if strings.Contains(kit.Path(""), nfs.USR_LOCAL_WORK) && nfs.Exists(m, path.Join(strings.Split(kit.Path(""), nfs.USR_LOCAL_WORK)[0], ice.USR_ICONS+icon)) {
|
||||
icon = ice.USR_ICONS + icon
|
||||
} else {
|
||||
icon = path.Join(path.Dir(ctx.GetCmdFile(m, m.PrefixKey())), icon)
|
||||
}
|
||||
}
|
||||
name := kit.TrimExt(path.Base(icon), nfs.PNG, nfs.JPG, nfs.JPEG)
|
||||
if !strings.HasPrefix(icon, nfs.USR_ICONS) {
|
||||
name = kit.Select("", kit.Split(index, "."), -1)
|
||||
}
|
||||
m.Cmd(Prefix(cmd), mdb.CREATE, mdb.NAME, name, mdb.ICON, icon, ctx.INDEX, index, mdb.SCORE, "1000", arg)
|
||||
return icon
|
||||
}
|
||||
func PodCmdAction(arg ...string) ice.Actions {
|
||||
file := kit.FileLine(-1, 100)
|
||||
return ice.Actions{
|
||||
mdb.SELECT: {Name: "list hash auto create", Hand: func(m *ice.Message, arg ...string) {
|
||||
defer m.Display(m.FileURI(file))
|
||||
msg := disableApp(mdb.HashSelect(m.Spawn(), arg...).Sort(mdb.NAME))
|
||||
msg := disableApp(mdb.HashSelect(m.Spawn(), arg...))
|
||||
web.PushPodCmd(msg, m.PrefixKey(), arg...)
|
||||
has := map[string]bool{}
|
||||
msg.Table(func(value ice.Maps, index int, head []string) {
|
||||
kit.If(!has[value[ctx.INDEX]], func() { has[value[ctx.INDEX]] = true; m.Push("", value, head) })
|
||||
kit.If(!has[value[ctx.INDEX]+value[ctx.ARGS]], func() { has[value[ctx.INDEX]+value[ctx.ARGS]] = true; m.Push("", value, head) })
|
||||
})
|
||||
m.Sort("score,space,index,args", ice.INT)
|
||||
}},
|
||||
}
|
||||
}
|
||||
@ -77,7 +98,7 @@ func CmdHashAction(arg ...string) ice.Actions {
|
||||
}},
|
||||
mdb.SELECT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Option(html.FAVICON, m.Cmd(web.SPACE, ice.INFO).Append(mdb.ICONS))
|
||||
disableApp(mdb.HashSelect(m, arg...).Sort(mdb.NAME).Display(m.FileURI(file)))
|
||||
disableApp(mdb.HashSelect(m, arg...).Sort("score,space,index,args").Display(m.FileURI(file)))
|
||||
}},
|
||||
}, mdb.HashAction(mdb.SHORT, kit.Select("", arg, 0), mdb.FIELD, kit.Select("time,hash,icon,name,text,space,index,args", arg, 1), kit.Slice(arg, 2)))
|
||||
}, mdb.HashAction(mdb.SHORT, kit.Select("", arg, 0), mdb.FIELD, kit.Select("time,hash,icon,name,text,score,space,index,args", arg, 1), kit.Slice(arg, 2)))
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ const MESSAGE = "message"
|
||||
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
MESSAGE: {Name: "message refresh", Help: "聊天", Icon: "Messages.png", Actions: ice.MergeActions(ice.Actions{
|
||||
MESSAGE: {Name: "message refresh", Help: "聊天消息", Icon: "Messages.png", Actions: ice.MergeActions(ice.Actions{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
MessageCreate(m, aaa.APPLY, html.ICONS_MAIL)
|
||||
MessageCreate(m, web.DREAM, html.ICONS_DREAM)
|
||||
|
11
core/chat/oauth/cache.go
Normal file
11
core/chat/oauth/cache.go
Normal 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{}) }
|
@ -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) {
|
||||
@ -170,7 +173,8 @@ func (s Client) Login2(m *ice.Message, arg ...string) {
|
||||
if msg.Option(SESS_CMD) != "" {
|
||||
m.Cmdy(kit.Split(msg.Option(SESS_CMD)), kit.Dict("user_uid", msg.Option("user_uid")))
|
||||
} else {
|
||||
m.ProcessCookie(ice.MSG_SESSID, aaa.SessCreate(m.Message, msg.Option(aaa.USERNAME)), "-2")
|
||||
// m.ProcessCookie(ice.MSG_SESSID, aaa.SessCreate(m.Message, msg.Option(aaa.USERNAME)), "-2")
|
||||
m.ProcessCookie(ice.MSG_SESSID, aaa.SessCreate(m.Message, msg.Option(aaa.USERNAME)), "-3")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,6 +18,22 @@ const POD = "pod"
|
||||
func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
POD: {Help: "空间", Actions: web.ApiWhiteAction(), Hand: func(m *ice.Message, arg ...string) {
|
||||
if m.IsWeixinUA() && m.Option(ice.MSG_USERNAME) == "" {
|
||||
template := func(script string) string { return kit.Format(`<html><body><script>%s</script></body></html>`, script) }
|
||||
if m.Option("code") == "" && m.Option("state") == "" {
|
||||
if msg := m.Cmd(web.SPACE, "20240724-community", "web.chat.wx.agent"); msg.Option("oauth") != "" {
|
||||
m.RenderResult(kit.Format(template(`document.cookie = "goback="+location.href+";path=/"; location.href = "%s"`),
|
||||
msg.Option("oauth")))
|
||||
return
|
||||
}
|
||||
} 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], kit.Select("/s/20240724-enterprise/c/web.team.yingxiaotuiguang.portal", msg.Option("goback"), m.Option("goback"))))
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
if m.IsCliUA() {
|
||||
if len(arg) == 0 || arg[0] == "" {
|
||||
m.Option(ice.MSG_USERROLE, aaa.TECH)
|
||||
|
@ -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,6 +18,9 @@ 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
|
||||
@ -62,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,32 +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 path.Base(arg[1]) == "common.go" {
|
||||
// ctx.ProcessField(m, "web.code.xterm", kit.Simple())
|
||||
ctx.ProcessField(m, "log.debug", kit.Simple("bench"))
|
||||
} 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" &&
|
||||
!kit.IsIn(arg[1],
|
||||
"gonganxitong/user.go",
|
||||
"gonganxitong/sess.go",
|
||||
"gonganxitong/grant.go",
|
||||
"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())
|
||||
} else {
|
||||
ls := kit.Split(strings.TrimSuffix(arg[1], ".go"), "/")
|
||||
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())
|
||||
@ -227,7 +231,7 @@ func TableName(model string) string {
|
||||
if strings.Contains("0123456789", model[len(model)-1:]) {
|
||||
return model
|
||||
}
|
||||
if kit.IsIn(model, "sms", "equipment") {
|
||||
if kit.IsIn(model, "sms", "equipment", "bonus") {
|
||||
|
||||
} else if kit.HasSuffix(model, "y") && !kit.HasSuffix(model, "way") {
|
||||
model = model[:len(model)-1] + "ies"
|
||||
|
@ -86,7 +86,7 @@ func init() {
|
||||
m.Cmdy(mdb.PLUGIN, m.Option(lex.PARSE, strings.ToLower(kit.Split(path.Base(arg[1]), nfs.PT)[0])), arg[1:])
|
||||
}
|
||||
}},
|
||||
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) { _inner_show(m, arg[0], arg[1], arg[2]) }},
|
||||
mdb.RENDER: {Role: aaa.VOID, Hand: func(m *ice.Message, arg ...string) { _inner_show(m, arg[0], arg[1], arg[2]) }},
|
||||
mdb.ENGINE: {Hand: func(m *ice.Message, arg ...string) { _inner_exec(m, arg[0], arg[1], arg[2]) }},
|
||||
nfs.TAGS: {Hand: func(m *ice.Message, arg ...string) { _inner_tags(m, m.Option(nfs.PATH), arg[0]) }},
|
||||
nfs.GREP: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(nfs.GREP, arg) }},
|
||||
|
@ -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 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
|
||||
}
|
||||
}
|
||||
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)
|
||||
}},
|
||||
|
@ -136,11 +136,16 @@ func init() {
|
||||
nfs.TRASH: {Hand: func(m *ice.Message, arg ...string) {
|
||||
nfs.Trash(m, arg[0])
|
||||
}},
|
||||
web.UPLOAD: {Hand: func(m *ice.Message, arg ...string) {
|
||||
web.UploadSave(m, path.Dir(path.Join(m.Option(nfs.PATH), m.Option(nfs.FILE)))+nfs.PS)
|
||||
}},
|
||||
nfs.SAVE: {Hand: func(m *ice.Message, arg ...string) {
|
||||
kit.If(m.Option(nfs.CONTENT) == "", func() { m.Option(nfs.CONTENT, m.Cmdx("", TEMPLATE)) })
|
||||
m.Cmd(nfs.SAVE, path.Join(m.Option(nfs.PATH), m.Option(nfs.FILE)))
|
||||
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))
|
||||
}},
|
||||
|
@ -37,6 +37,7 @@ func (s *Label) Draw(m *ice.Message, x, y int) wiki.Chart {
|
||||
wiki.AddGroupOption(m, TEXT, wiki.STROKE, m.Option(wiki.STROKE), wiki.FILL, m.Option(wiki.STROKE))
|
||||
defer gs.DumpAll(m, RECT, TEXT)
|
||||
top := y
|
||||
mod := kit.Int(m.Option("order.mod"))
|
||||
for _, line := range s.data {
|
||||
left, height := x, 0
|
||||
for i, text := range line {
|
||||
@ -57,9 +58,17 @@ func (s *Label) Draw(m *ice.Message, x, y int) wiki.Chart {
|
||||
item.Width = s.max[i]
|
||||
}
|
||||
if m.Option(HIDE_BLOCK) != ice.TRUE {
|
||||
gs.EchoRect(RECT, item.GetHeight(), item.GetWidth(), left+item.MarginX/2, top+item.MarginY/2)
|
||||
args := []string{}
|
||||
if mod > 0 && i%mod == 0 {
|
||||
args = append(args, "", "", "style", `"`+kit.JoinCSS("stroke", m.Option("order.bg"), "fill", m.Option("order.bg"))+`"`)
|
||||
}
|
||||
gs.EchoText(TEXT, left+item.GetWidths()/2, top+item.GetHeights()/2, item.Text)
|
||||
gs.EchoRect(RECT, item.GetHeight(), item.GetWidth(), left+item.MarginX/2, top+item.MarginY/2, args...)
|
||||
}
|
||||
args := []string{}
|
||||
if mod > 0 && i%mod == 0 {
|
||||
args = append(args, "style", kit.JoinCSS("stroke", m.Option("order.fg"), "fill", m.Option("order.fg")))
|
||||
}
|
||||
gs.EchoText(TEXT, left+item.GetWidths()/2, top+item.GetHeights()/2, item.Text, args...)
|
||||
if left += item.GetWidths(); item.GetHeights() > height {
|
||||
height = item.GetHeights()
|
||||
}
|
||||
|
@ -1,74 +1,81 @@
|
||||
fieldset.web.wiki.portal { --portal-max-width:1200px; --portal-header-height:64px; --portal-main-padding:40px; --plugin-radius:10px; }
|
||||
fieldset.web.wiki.portal.home { --portal-max-width:1500px; }
|
||||
fieldset.web.wiki.portal>div.header { display:none; }
|
||||
fieldset.web.wiki.portal>div.output { padding:0; }
|
||||
fieldset.web.wiki.portal>div.output>div.header { background-color:var(--panel-bg-color); height:var(--portal-header-height); --hover-bg-color:var(--plugin-bg-color); }
|
||||
fieldset.web.wiki.portal>div.output>div.header div.list { display:flex; }
|
||||
fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] { --hover-fg-color:white; }
|
||||
fieldset.web.wiki.portal>div.output>div.header div.story div.item span { white-space:pre; overflow:hidden; }
|
||||
fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] { display:flex; justify-content:center; }
|
||||
fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] div.item { text-align:center; padding:var(--legend-padding); height:var(--portal-header-height); }
|
||||
fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] div.item { display:flex; align-items:center; }
|
||||
fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] div.item:first-child { padding:var(--input-padding); }
|
||||
body.mobile fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] div.item:first-child span { display:none; font-size:18px; max-width:160px; }
|
||||
fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] div.item:first-child { line-height:calc(var(--portal-header-height) - 2 * var(--legend-padding)); font-size:24px; font-weight:bold; }
|
||||
fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] div.item:first-child img { margin-right:var(--button-margin); }
|
||||
fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] div.item.select { background-color:var(--output-bg-color); }
|
||||
fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] div.item:hover { background-color:var(--output-bg-color); }
|
||||
fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] div.item.space { padding:0px; margin:0 var(--portal-main-padding); }
|
||||
fieldset.web.wiki.portal>div.output>div.layout { display:flex; justify-content:center; }
|
||||
fieldset.web.wiki.portal>div.output>div.layout table.story.content { background-color:var(--output-bg-color); }
|
||||
fieldset.web.wiki.portal>div.output>div.layout table.story.content th { text-align:left; padding:var(--table-padding); }
|
||||
fieldset.web.wiki.portal>div.output>div.layout>div.nav { border-right:var(--box-border); padding:var(--portal-main-padding); padding-right:var(--button-padding); min-width:var(--project-width); overflow:auto; }
|
||||
fieldset.web.wiki.portal>div.output>div.layout>div.nav div.story[data-name=navmenu] div.item { padding:var(--input-padding); }
|
||||
fieldset.web.wiki.portal>div.output>div.layout>div.nav div.story[data-name=navmenu] div.item.select { border-right:var(--box-notice); }
|
||||
fieldset.web.wiki.portal>div.output>div.layout>div.nav div.story[data-name=navmenu]>div.item { border-bottom:var(--box-border); margin-top:var(--button-margin); }
|
||||
fieldset.web.wiki.portal>div.output>div.layout>div.nav div.story[data-name=navmenu] div.list { padding-left:var(--legend-padding); }
|
||||
fieldset.web.wiki.portal>div.output>div.layout>div.aside { padding:var(--portal-main-padding); padding-left:var(--button-padding); min-width:var(--project-width); overflow:auto; }
|
||||
fieldset.web.wiki.portal>div.output>div.layout>div.aside div.item { padding:var(--input-padding); }
|
||||
fieldset.web.wiki.portal>div.output>div.layout>div.aside div.item.select { border-left:var(--box-notice); }
|
||||
fieldset.web.wiki.portal>div.output>div.layout>div.aside div.item.section { padding-left:var(--legend-padding); }
|
||||
fieldset.web.wiki.portal>div.output>div.layout>div.main { padding:var(--portal-main-padding); height:600px; min-width:390px; max-width:var(--portal-max-width); overflow:auto; overflow-x:hidden; }
|
||||
fieldset.web.wiki.portal>div.output>div.layout>div.main div.story.column { display:flex; flex-direction:column; justify-content:center; }
|
||||
fieldset.web.wiki.portal>div.output>div.layout>div.main div.story.column fieldset.inner>div.output>div.layout>div.layout div.content div.tips { top:5px; right:10px; }
|
||||
fieldset.web.wiki.portal>div.output>div.layout>div.main div.story.column h1 { font-size:24px; font-style:italic; margin-top:0; }
|
||||
body.mobile fieldset.web.wiki.portal>div.output>div.layout>div.main div.story.column h2 { font-size:18px; }
|
||||
body:not(.mobile) fieldset.web.wiki.portal>div.output>div.layout>div.main div.story.column h1 { font-size:32px; }
|
||||
fieldset.web.wiki.portal>div.output>div.layout>div.main div.story.column h2 { margin:0 !important; }
|
||||
fieldset.web.wiki.portal>div.output>div.layout>div.main img[data-name="qrcode"] { margin-top:20px; width:240px !important; }
|
||||
fieldset.web.wiki.portal>div.output>div.layout>div.main div.story.column li { margin:10px 0; }
|
||||
fieldset.web.wiki.portal>div.output>div.layout>div.main div.story.column ul { margin:10px; }
|
||||
fieldset.web.wiki.portal>div.output>div.layout>div.main div.story.column b { font-size:22px; }
|
||||
fieldset.web.wiki.portal>div.output>div.layout>div.main div.story.column input[type=button] { box-shadow:var(--th-box-shadow); border:0; background-color:var(--notice-bg-color); color:var(--notice-fg-color); }
|
||||
fieldset.web.wiki.portal>div.output>div.layout>div.main div.story.column input[type=button]:hover { box-shadow:var(--notice-box-shadow); }
|
||||
fieldset.web.wiki.portal>div.output>div.layout>div.main fieldset.desktop>legend { display:none; }
|
||||
fieldset.web.wiki.portal>div.output>div.layout>div.main fieldset.inner.output div.content { padding:var(--input-padding) 0; }
|
||||
fieldset.web.wiki.portal>div.output>div.layout>div.main div.story[data-type=spark][data-name=shell] { border:var(--box-border); border-left:var(--box-notice3); }
|
||||
fieldset.web.wiki.portal>div.output>div.layout>div.main div.story[data-type=spark][data-name=shell]:hover { box-shadow:var(--notice-box-shadow); }
|
||||
fieldset.web.wiki.portal>div.output>div.layout>div.main div.story[data-type=spark][data-name=shell] { padding:var(--button-padding); margin-top:var(--button-margin); }
|
||||
fieldset.web.wiki.portal>div.output>div.layout>div.main table.content div.story[data-type=spark][data-name=shell] { margin-top:unset; }
|
||||
fieldset.web.wiki.portal.home>div.output>div.layout>div.main p { white-space:pre-wrap; }
|
||||
$fieldset { --portal-max-width:1200px; --portal-header-height:64px; --portal-main-padding:40px; --plugin-radius:10px; }
|
||||
$fieldset.home { --portal-max-width:1500px; }
|
||||
$fieldset>div.header { display:none; }
|
||||
$output { padding:0; }
|
||||
$output>div.header { box-shadow:var(--box-shadow); background-color:var(--panel-bg-color); height:var(--portal-header-height); --hover-bg-color:var(--plugin-bg-color); }
|
||||
$output>div.header div.list { display:flex; }
|
||||
$output>div.header div.story div.item span { white-space:pre; overflow:hidden; }
|
||||
$output>div.header div.story[data-name=navmenu] { --hover-fg-color:white; }
|
||||
$output>div.header div.story[data-name=navmenu] { display:flex; justify-content:center; }
|
||||
$output>div.header div.story[data-name=navmenu] div.item { text-align:center; padding:var(--legend-padding); height:var(--portal-header-height); }
|
||||
$output>div.header div.story[data-name=navmenu] div.item { display:flex; align-items:center; }
|
||||
$output>div.header div.story[data-name=navmenu] div.item:first-child { padding:var(--input-padding); }
|
||||
$output>div.header div.story[data-name=navmenu] div.item:first-child { line-height:calc(var(--portal-header-height) - 2 * var(--legend-padding)); font-size:24px; font-weight:bold; }
|
||||
$output>div.header div.story[data-name=navmenu] div.item:first-child img { margin-right:var(--button-margin); }
|
||||
$output>div.header div.story[data-name=navmenu] div.item.select { background-color:var(--output-bg-color); }
|
||||
$output>div.header div.story[data-name=navmenu] div.item:not(.space):hover { background-color:var(--output-bg-color); }
|
||||
// $output>div.header div.story[data-name=navmenu] div.item.space { padding:0px; margin:0 var(--portal-main-padding); }
|
||||
$output>div.header div.story[data-name=navmenu] div.item.space { padding:0px; width:20px; }
|
||||
$output>div.layout { display:flex; justify-content:center; }
|
||||
$output>div.layout table.story.content { background-color:var(--output-bg-color); }
|
||||
$output>div.layout table.story.content th { text-align:left; padding:var(--table-padding); }
|
||||
$output>div.layout>div.nav { border-right:var(--box-border); padding:var(--portal-main-padding); padding-right:var(--button-padding); min-width:var(--project-width); overflow:auto; }
|
||||
$output>div.layout>div.nav div.story[data-name=navmenu] div.item { padding:var(--input-padding); }
|
||||
$output>div.layout>div.nav div.story[data-name=navmenu] div.item.select { border-right:var(--box-notice); }
|
||||
$output>div.layout>div.nav div.story[data-name=navmenu]>div.item { border-bottom:var(--box-border); margin-top:var(--button-margin); }
|
||||
$output>div.layout>div.nav div.story[data-name=navmenu] div.list { padding-left:var(--legend-padding); }
|
||||
$output>div.layout>div.aside { padding:var(--portal-main-padding); padding-left:var(--button-padding); min-width:var(--project-width); overflow:auto; }
|
||||
$output>div.layout>div.aside div.item { padding:var(--input-padding); }
|
||||
$output>div.layout>div.aside div.item.select { border-left:var(--box-notice); }
|
||||
$output>div.layout>div.aside div.item.section { padding-left:var(--legend-padding); }
|
||||
$output>div.layout>div.main { padding:var(--portal-main-padding); height:600px; min-width:390px; max-width:var(--portal-max-width); overflow:auto; overflow-x:hidden; }
|
||||
$output>div.layout>div.main img[data-name="qrcode"] { margin-top:20px; width:240px !important; }
|
||||
body.width1 $output>div.layout>div.main>div.story.flex { flex-direction:column; }
|
||||
// body.width1 $output>div.layout>div.main div.story.column fieldset.inner { width:100%; }
|
||||
body.width1 $output>div.layout>div.main div.story.column { flex:unset !important; }
|
||||
$output>div.layout>div.main div.story.column { display:flex; flex-direction:column; justify-content:center; }
|
||||
$output>div.layout>div.main div.story.column fieldset.inner>div.output>div.layout>div.layout div.content div.tips { top:5px; right:10px; }
|
||||
$output>div.layout>div.main div.story.column fieldset.inner { box-shadow:none; border:var(--box-border); border-radius:0; }
|
||||
$output>div.layout>div.main div.story.column fieldset.inner>div.output { width:100%; }
|
||||
$output>div.layout>div.main div.story.column h1 { font-size:24px; font-style:italic; margin-top:0; }
|
||||
$output>div.layout>div.main div.story.column h2 { margin:0 !important; }
|
||||
$output>div.layout>div.main div.story.column p[data-type=brief] { font-size:1.5em; font-weight:bold; text-align:center; }
|
||||
$output>div.layout>div.main div.story.column li { margin:10px 0; }
|
||||
$output>div.layout>div.main div.story.column ul { margin:10px; }
|
||||
$output>div.layout>div.main div.story.column b { font-size:22px; }
|
||||
$output>div.layout>div.main div.story.column input[type=button] { box-shadow:var(--th-box-shadow); border:0; background-color:var(--notice-bg-color); color:var(--notice-fg-color); }
|
||||
$output>div.layout>div.main div.story.column input[type=button]:hover { box-shadow:var(--notice-box-shadow); }
|
||||
$output>div.layout>div.main div.story[data-type=spark][data-name=shell] { border:var(--box-border); border-left:var(--box-notice3); }
|
||||
$output>div.layout>div.main div.story[data-type=spark][data-name=shell]:hover { box-shadow:var(--notice-box-shadow); }
|
||||
$output>div.layout>div.main div.story[data-type=spark][data-name=shell] { padding:var(--button-padding); margin-top:var(--button-margin); }
|
||||
$output>div.layout>div.main table.content div.story[data-type=spark][data-name=shell] { margin-top:unset; }
|
||||
$output>div.layout>div.main fieldset.inner.output div.content { padding:var(--input-padding) 0; }
|
||||
$output>div.layout>div.main fieldset.desktop>legend { display:none; }
|
||||
$fieldset.home>div.output>div.layout>div.main p { white-space:pre-wrap; }
|
||||
$fieldset.home>div.output>div.layout>div.main p:hover { background-color:var(--hover-bg-color); color:var(--hover-fg-color); }
|
||||
div.story[data-type=qrcode] { text-align:center; }
|
||||
fieldset.web.wiki.portal.home>div.output>div.layout>div.main p:hover { background-color:var(--hover-bg-color); color:var(--hover-fg-color); }
|
||||
body.dark fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] div.item:hover { background-color:var(--output-bg-color); }
|
||||
body.dark fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] div.item.select { background-color:var(--output-bg-color); }
|
||||
body.dark fieldset.web.wiki.portal>div.output>div.layout { background-color:var(--plugin-bg-color); --code-bg-color:var(--output-bg-color); }
|
||||
body.dark fieldset.web.wiki.portal>div.output>div.layout>div.main fieldset:not(.macos) { border:var(--plugin-border); }
|
||||
body.dark fieldset.web.wiki.portal>div.output>div.layout>div.main fieldset { border-radius:0; }
|
||||
body.dark fieldset.web.wiki.portal>div.output>div.layout>div.main div.story[data-type=spark][data-name=shell] { border-left:var(--box-notice3); }
|
||||
body.white fieldset.web.wiki.portal>div.output>div.header { color:silver; }
|
||||
body.light fieldset.web.wiki.portal>div.output>div.header { color:white; }
|
||||
body.light fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] { --hover-fg-color:black; }
|
||||
body.mobile fieldset.web.wiki.portal { --portal-main-padding:5px; --legend-padding:10px; }
|
||||
body.mobile fieldset.web.wiki.portal>div.output>div.layout { display:block; }
|
||||
body.mobile fieldset.web.wiki.portal>div.output>div.layout>div.nav { height:400px; }
|
||||
body.mobile fieldset.web.wiki.portal>div.output>div.layout>div.main { height:unset; }
|
||||
body.mobile fieldset.web.wiki.portal>div.output>div.layout>div.main div.story.column { padding:10px 0 !important; }
|
||||
body.mobile fieldset.web.wiki.portal>div.output>div.layout>div.main fieldset { width:fit-content; }
|
||||
body.mobile fieldset.web.wiki.portal>div.output>div.layout>div.main fieldset>div.action { display:none; }
|
||||
body.mobile fieldset.web.wiki.portal.cmd>div.output>div.header div.story[data-name=navmenu] div.item { line-height:calc(var(--portal-header-height) - 2 * var(--legend-padding)); }
|
||||
body.mobile fieldset.web.wiki.portal.home>div.output>div.layout>div.main p { white-space:normal; text-align:center; padding:var(--button-padding); }
|
||||
body.mobile fieldset.web.wiki.portal.home>div.output>div.layout>div.main h2 { margin-top:40px; margin-bottom:0; }
|
||||
body.mobile fieldset.web.wiki.portal>div.output>div.layout>div.main p { padding:var(--input-padding); margin:0; }
|
||||
body.width2 fieldset.web.wiki.portal>div.output>div.layout>div.main>div.flex { flex-direction:column; }
|
||||
body.web.wiki.portal fieldset.Action.home>div.toast { display:none; }
|
||||
body:not(.mobile) $output>div.layout>div.main div.story.column h1 { font-size:32px; }
|
||||
body.dark $output>div.header div.story[data-name=navmenu] div.item:hover { background-color:var(--output-bg-color); }
|
||||
body.dark $output>div.header div.story[data-name=navmenu] div.item.select { background-color:var(--output-bg-color); }
|
||||
body.dark $output>div.layout { background-color:var(--plugin-bg-color); --code-bg-color:var(--output-bg-color); }
|
||||
body.dark $output>div.layout>div.main fieldset:not(.macos) { border:var(--plugin-border); }
|
||||
body.dark $output>div.layout>div.main fieldset { border-radius:0; }
|
||||
body.dark $output>div.layout>div.main div.story[data-type=spark][data-name=shell] { border-left:var(--box-notice3); }
|
||||
body.white $output>div.header { color:silver; }
|
||||
body.light $output>div.header { color:white; }
|
||||
body.light $output>div.header div.story[data-name=navmenu] { --hover-fg-color:black; }
|
||||
body.width1 $output>div.header div.story[data-name=navmenu] div.item:first-child span { display:none; font-size:18px; max-width:160px; }
|
||||
body.width1 $output>div.layout { display:block; }
|
||||
body.width1 $output>div.layout>div.nav { height:400px; }
|
||||
body.width1 $output>div.layout>div.main { height:unset; }
|
||||
body.width1 $output>div.layout>div.main div.story.column { padding:10px 0 !important; }
|
||||
body.width1 $output>div.layout>div.main fieldset { width:fit-content; }
|
||||
body.width1 $output>div.layout>div.main fieldset>div.action { display:none; }
|
||||
body.width1 $output>div.layout>div.main div.story.column h2 { font-size:18px; }
|
||||
body.width1 $fieldset { --portal-main-padding:5px; --legend-padding:10px; }
|
||||
body.width1 $fieldset.cmd>div.output>div.header div.story[data-name=navmenu] div.item { line-height:calc(var(--portal-header-height) - 2 * var(--legend-padding)); }
|
||||
body.width1 $fieldset.home>div.output>div.layout>div.main p { white-space:normal; text-align:center; padding:var(--button-padding); }
|
||||
body.width1 $fieldset.home>div.output>div.layout>div.main h2 { margin-top:40px; margin-bottom:0; }
|
||||
body.width1 $fieldset>div.output>div.layout>div.main p { padding:var(--input-padding); margin:0; }
|
||||
body.width2 $fieldset>div.output>div.layout>div.main>div.flex { flex-direction:column; }
|
||||
$body fieldset.Action.home>div.toast { display:none; }
|
||||
|
@ -38,7 +38,7 @@ func init() {
|
||||
if m.Push(HEADER, m.Cmdx(WORD, _portal_path(m, INDEX_SHY))); len(arg) > 0 {
|
||||
m.Push(NAV, m.Cmdx(WORD, _portal_path(m, path.Join(arg...), INDEX_SHY)))
|
||||
}
|
||||
m.Display("")
|
||||
m.Display("").DisplayCSS("")
|
||||
}},
|
||||
})
|
||||
}
|
||||
|
@ -58,6 +58,7 @@ Volcanos(chat.ONIMPORT, {
|
||||
})
|
||||
},
|
||||
title: function(can, meta, target) { can.isCmdMode() && can.page.tagis(target, html.H1) && can.onexport && can.onexport.title(can, meta.text) },
|
||||
brief: function(can, meta, target) { can.isCmdMode() && can.user.agent.init(can, meta.text) },
|
||||
button: function(can, meta, target) { var item = can.base.Obj(meta.meta); target.onclick = function(event) { can.onaction.route(event, can, item.route) } },
|
||||
layout: function(can, height, width) { if (!can.ui.layout || !can.ui.main) { return }
|
||||
can.ui.layout(height, width), can.ConfWidth(can.ui.main.offsetWidth), padding = can.Conf(html.PADDING)
|
||||
@ -69,7 +70,7 @@ Volcanos(chat.ONIMPORT, {
|
||||
sub.onimport.size(sub, can.base.Min(html.FLOAT_HEIGHT, can.ConfHeight()/2, can.ConfHeight()), (can.ConfWidth()-2*padding), true)
|
||||
})
|
||||
},
|
||||
}, [""])
|
||||
})
|
||||
Volcanos(chat.ONACTION, {
|
||||
route: function(event, can, route, internal) {
|
||||
var link = can.base.trimPrefix(route||"", nfs.USR_LEARNING_PORTAL, nfs.SRC_DOCUMENT); if (!link || link == can.db.current) { return }
|
||||
|
@ -99,6 +99,7 @@ func init() {
|
||||
}},
|
||||
PROJECT: {Hand: func(m *ice.Message, arg ...string) { _spark_project(m, arg...) }},
|
||||
PRODUCT: {Hand: func(m *ice.Message, arg ...string) { _spark_product(m, arg...) }},
|
||||
"html": {Hand: func(m *ice.Message, arg ...string) { m.Echo(arg[0], kit.TransArgs(arg[1:])...) }},
|
||||
}), Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Option(mdb.META, "")
|
||||
if kit.Ext(arg[0]) == "md" {
|
||||
@ -120,7 +121,7 @@ func _spark_project(m *ice.Message, arg ...string) {
|
||||
func() {
|
||||
defer m.Cmdy(STYLE, COLUMN).Cmdy(STYLE, END)
|
||||
m.Cmdy(TITLE, ice.Info.Title())
|
||||
m.Cmdy(SPARK, TITLE, arg[0]).Cmdy(ORDER, arg[1])
|
||||
m.Cmdy(BRIEF, arg[0]).Cmdy(ORDER, arg[1])
|
||||
func() {
|
||||
defer m.Cmdy(STYLE, FLEX).Cmdy(STYLE, END)
|
||||
m.Cmdy(SPARK, html.BUTTON, "体 验", ROUTE, web.SpideOrigin(m, ice.DEMO))
|
||||
@ -129,7 +130,7 @@ func _spark_project(m *ice.Message, arg ...string) {
|
||||
}()
|
||||
}()
|
||||
func() {
|
||||
defer m.Cmdy(STYLE, COLUMN, FLEX, "0 0 500px", "padding", "10px").Cmdy(STYLE, END)
|
||||
defer m.Cmdy(STYLE, COLUMN, FLEX, "0 0 480px").Cmdy(STYLE, END)
|
||||
m.Cmdy(SPARK, INNER, ice.SRC_MAIN_GO, html.WIDTH, "480px")
|
||||
m.Cmdy(SPARK, SHELL, kit.Renders(`
|
||||
git clone {{ .Make.Remote }}
|
||||
|
2
exec.go
2
exec.go
@ -164,7 +164,7 @@ func (m *Message) _command(arg ...Any) *Message {
|
||||
}
|
||||
}
|
||||
}
|
||||
if count := kit.Int(m.Option(MSG_COUNT, kit.Format(kit.Int(m.Option(MSG_COUNT))+1))); m.Warn(count > 3000, ErrTooDeepCount) {
|
||||
if count := kit.Int(m.Option(MSG_COUNT, kit.Format(kit.Int(m.Option(MSG_COUNT))+1))); m.Warn(count > 50000, ErrTooDeepCount) {
|
||||
panic(count)
|
||||
}
|
||||
list := kit.Simple(args...)
|
||||
|
2
go.mod
2
go.mod
@ -5,6 +5,6 @@ go 1.13
|
||||
require (
|
||||
shylinux.com/x/go-git/v5 v5.6.7
|
||||
shylinux.com/x/go-qrcode v0.0.3
|
||||
shylinux.com/x/toolkits v1.0.19
|
||||
shylinux.com/x/toolkits v1.0.20
|
||||
shylinux.com/x/websocket v0.0.4
|
||||
)
|
||||
|
4
go.sum
4
go.sum
@ -4,7 +4,7 @@ shylinux.com/x/go-qrcode v0.0.3 h1:RMo+Vidbgq3HatLBj7DDXcTbTLFUwzis5K7TqBkD38U=
|
||||
shylinux.com/x/go-qrcode v0.0.3/go.mod h1:KAbtU+KwiiABMZ/CJ0zh9PI2AX82Uf9rRYcQ4ODm4po=
|
||||
shylinux.com/x/toolkits v0.7.10 h1:65d5rkQXQ71MD8FzYnZ9DFxb1XcOYSYfmRc4j8qQsUw=
|
||||
shylinux.com/x/toolkits v0.7.10/go.mod h1:CHDJarGlDkg60kVsvMLYL/a5hAnRLEOShiEsMOuEp0Q=
|
||||
shylinux.com/x/toolkits v1.0.19 h1:Nrx0xYRc5ph1WS66EZ1hJUCe+2FdSWQ4QP6tBlguikQ=
|
||||
shylinux.com/x/toolkits v1.0.19/go.mod h1:CHDJarGlDkg60kVsvMLYL/a5hAnRLEOShiEsMOuEp0Q=
|
||||
shylinux.com/x/toolkits v1.0.20 h1:uBnfyyqDsbSWYsXfXmBugZ8ZWp5QQ8sthrzRdJ6ET90=
|
||||
shylinux.com/x/toolkits v1.0.20/go.mod h1:CHDJarGlDkg60kVsvMLYL/a5hAnRLEOShiEsMOuEp0Q=
|
||||
shylinux.com/x/websocket v0.0.4 h1:AJpwblePoOpiE6C8NrvgNYpKTotXMLrDDX2chTvx44Q=
|
||||
shylinux.com/x/websocket v0.0.4/go.mod h1:3UGWkjTu3ie5NAZen7J+uLPBrO7DFeKloj6Jxo13Oiw=
|
||||
|
7
info.go
7
info.go
@ -308,6 +308,9 @@ func Module(prefix string, arg ...Any) {
|
||||
}
|
||||
}
|
||||
func (m *Message) FileURI(dir string) string {
|
||||
if strings.Contains(dir, "bi ") {
|
||||
return dir
|
||||
}
|
||||
if dir == "" || kit.HasPrefix(dir, HTTP) {
|
||||
return dir
|
||||
}
|
||||
@ -329,7 +332,9 @@ func (m *Message) FileURI(dir string) string {
|
||||
dir = strings.TrimPrefix(dir, ISH_PLUGED)
|
||||
}
|
||||
if strings.HasPrefix(dir, PS) {
|
||||
|
||||
if !strings.Contains(dir, "pod=") {
|
||||
dir = kit.MergeURL(dir, POD, m.Option(MSG_USERPOD))
|
||||
}
|
||||
} else if strings.HasPrefix(dir, USR_VOLCANOS) {
|
||||
dir = strings.TrimPrefix(dir, USR)
|
||||
} else {
|
||||
|
4
logs.go
4
logs.go
@ -7,6 +7,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"path"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
@ -123,7 +124,8 @@ func (m *Message) Warn(err Any, arg ...Any) bool {
|
||||
}
|
||||
str, meta := m.join(arg...)
|
||||
if m.log(LOG_WARN, str, meta...); len(arg) > 0 {
|
||||
m.Option(MSG_TITLE, kit.JoinWord(kit.Keys(m.Option(MSG_USERPOD), m.CommandKey(), m.ActionKey()), logs.FileLines(-2)))
|
||||
p := path.Join(kit.Slice(strings.Split(logs.FileLines(-2), "/"), -2)...)
|
||||
m.Option(MSG_TITLE, kit.JoinWord(kit.Keys(m.Option(MSG_USERPOD), m.CommandKey(), m.ActionKey()), p))
|
||||
m.error(arg...)
|
||||
kit.If(map[string]int{
|
||||
ErrNotLogin: http.StatusUnauthorized,
|
||||
|
@ -16,6 +16,7 @@ import (
|
||||
)
|
||||
|
||||
func init() {
|
||||
return
|
||||
const TAGS = "tags"
|
||||
Index.MergeCommands(ice.Commands{
|
||||
TAGS: {Name: "tags path name auto", Actions: ice.MergeActions(ice.Actions{
|
||||
|
@ -136,10 +136,10 @@ func init() {
|
||||
m.Cmd(mdb.PRUNES, m.Prefix(SCAN), "", mdb.HASH, m.OptionSimple(mdb.NAME))
|
||||
m.Cmd(mdb.PRUNES, m.Prefix(IDE), "", mdb.HASH, m.OptionSimple(mdb.NAME))
|
||||
}},
|
||||
}, gdb.EventsAction(web.SPACE_GRANT, web.SPACE_LOGIN_CLOSE), mdb.ExportHashAction(
|
||||
}, gdb.EventsAction(web.SPACE_GRANT, web.SPACE_LOGIN_CLOSE), mdb.HashAction(
|
||||
mdb.SHORT, ACCESS, mdb.FIELD, "time,type,access,icons,usernick,appid,secret,token", tcp.SERVER, CGI_BIN,
|
||||
)), Hand: func(m *ice.Message, arg ...string) {
|
||||
mdb.HashSelect(m, arg...).PushAction(OAUTH, web.SSO, mdb.REMOVE).StatusTimeCount(mdb.ConfigSimple(m, ACCESS, APPID), web.SERVE, m.MergeLink("/chat/wx/login/"))
|
||||
mdb.HashSelect(m, arg...).PushAction(OAUTH, web.SSO, TOKENS, TICKET, mdb.REMOVE).StatusTimeCount(mdb.ConfigSimple(m, ACCESS, APPID), web.SERVE, m.MergeLink("/chat/wx/login/"))
|
||||
m.RewriteAppend(func(value, key string, index int) string {
|
||||
kit.If(key == cli.QRCODE, func() { value = ice.Render(m, ice.RENDER_QRCODE, value) })
|
||||
return value
|
||||
@ -159,7 +159,7 @@ func spideToken(m *ice.Message, api string, token, expire string, arg ...string)
|
||||
return
|
||||
}
|
||||
m.Info("res: %v", res.FormatMeta())
|
||||
mdb.HashModify(m, m.OptionSimple(ACCESS), expire, m.Time(kit.Format("%vs", res.Append(oauth.EXPIRES_IN))), token, res.Append(kit.Select(oauth.ACCESS_TOKEN, TICKET, api == TICKET_GETTICKET)))
|
||||
mdb.HashModify(m, m.OptionSimple(ACCESS), expire, m.Time(kit.Format("%vs", kit.Int(res.Append(oauth.EXPIRES_IN))-3600)), token, res.Append(kit.Select(oauth.ACCESS_TOKEN, TICKET, api == TICKET_GETTICKET)))
|
||||
msg = mdb.HashSelect(m.Spawn(), m.Option(ACCESS))
|
||||
}
|
||||
m.Echo(msg.Append(token)).Status(msg.AppendSimple(expire))
|
||||
|
@ -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")))
|
||||
}},
|
||||
})
|
||||
|
@ -8,13 +8,6 @@ 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) })
|
||||
} }) },
|
||||
openLocation: function(can, msg) { wx.openLocation({
|
||||
name: msg.Option(mdb.NAME), address: msg.Option(mdb.TEXT), infoUrl: msg.Option(web.LINK),
|
||||
longitude: parseFloat(msg.Option(aaa.LONGITUDE)), latitude: parseFloat(msg.Option(aaa.LATITUDE)), scale: msg.Option("scale")||14,
|
||||
}) },
|
||||
chooseImage: function(can, cb, count) { wx.chooseImage({count: count||9, sourceType: ["camera", "album"], sizeType: ["original", "compressed"], success: function (res) {
|
||||
can.base.isFunc(cb) && cb(res.localIds)
|
||||
} }) },
|
||||
@ -24,23 +17,47 @@ Volcanos(chat.ONIMPORT, {
|
||||
previewImage: function(can, url, list) {
|
||||
wx.previewImage({current: url, urls: list||[url]})
|
||||
},
|
||||
scanQRCode: function(can, cb) { wx.scanQRCode({needResult: cb? 1: 0, scanType: ["qrCode", "barCode"], success: function (res) {
|
||||
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))
|
||||
}, fail: function(res) {
|
||||
can.user.toastFailure(can, res)
|
||||
} })
|
||||
},
|
||||
getLocation: function(can, cb) { wx.getLocation({type: "gcj02", success: function (res) {
|
||||
can.base.isFunc(cb) && cb({type: "gcj02", name: can.user.info.usernick, text: can.base.Time(),
|
||||
latitude: parseInt(res.latitude*100000), longitude: parseInt(res.longitude*100000),
|
||||
})
|
||||
} }) },
|
||||
openLocation: function(can, msg) { wx.openLocation({
|
||||
name: msg.Option(mdb.NAME)||can.user.info.usernick, address: msg.Option(mdb.TEXT)||can.base.Time(), infoUrl: msg.Option(web.LINK)||location.href,
|
||||
longitude: parseFloat(msg.Option(aaa.LONGITUDE)/100000), latitude: parseFloat(msg.Option(aaa.LATITUDE)/100000), scale: msg.Option("scale")||14,
|
||||
}) },
|
||||
openAddress: function(can, cb) {
|
||||
wx.openAddress({success: function(res) { cb(res) }})
|
||||
},
|
||||
}, function(key, value) { return can.user.agent[key] = value, key }).concat([
|
||||
"updateAppMessageShareData", "updateTimelineShareData",
|
||||
]), openTagList: ["wx-open-subscribe"],
|
||||
"updateAppMessageShareData",
|
||||
], can.user.isMobile? ["updateTimelineShareData"]: []), openTagList: ["wx-open-subscribe"],
|
||||
})
|
||||
wx.error(function (res) {
|
||||
can.user.toastFailure(can, JSON.stringify(res))
|
||||
})
|
||||
wx.ready(function () {
|
||||
function share(title, icons, content) {
|
||||
wx.updateAppMessageShareData({title: title, desc: content||can.user.info.titles, link: location.href, imgUrl: icons})
|
||||
wx.updateTimelineShareData({title: title, link: location.href, imgUrl: icons})
|
||||
function share(title, icons, content, link) {
|
||||
wx.updateAppMessageShareData({title: title, desc: content||can.user.info.titles, link: link||location.href, imgUrl: icons, fail: function(res) {
|
||||
// can.user.toastFailure(can, JSON.stringify(res))
|
||||
}})
|
||||
can.user.isMobile && wx.updateTimelineShareData({title: title, link: link||location.href, imgUrl: icons, fail: function(res) {
|
||||
// can.user.toastFailure(can, JSON.stringify(res))
|
||||
}})
|
||||
}
|
||||
var p = can.misc.Resource(can, can.user.info.favicon); can.base.beginWith(p, "/") && (p = location.origin + p)
|
||||
can.user.agent.init = function(can, content, icons) { if (!can) { return }
|
||||
can.user.agent.init = function(can, content, icons, link) { if (!can) { return }
|
||||
p = can.misc.Resource(can, icons||can.Conf(mdb.ICONS))||p; can.base.beginWith(p, "/") && (p = location.origin + p)
|
||||
share(document.title, p, content)
|
||||
share(document.title, p, content, link)
|
||||
}, can.user.agent.init(can.user.agent.cmd, can.user.agent._init_content, can.user.agent._init_icons)
|
||||
// location.pathname == "/" && can.onmotion.delay(can, function() { share(document.title, can.misc.Resource(can, can.user.info.favicon)) }, 300)
|
||||
})
|
||||
})
|
||||
},
|
||||
|
@ -1,6 +1,8 @@
|
||||
package wx
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/ctx"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
@ -39,22 +41,23 @@ func init() {
|
||||
value[mdb.TEXT] = web.C(value[ctx.INDEX])
|
||||
}
|
||||
}
|
||||
value[mdb.TEXT] = m.MergeLink(value[mdb.TEXT])
|
||||
value[mdb.TEXT] = m.MergeLink(value[mdb.TEXT] + value[ctx.ARGS])
|
||||
})
|
||||
kit.Value(list, key, kit.Dict(mdb.TYPE, value[mdb.TYPE], mdb.NAME, value[mdb.NAME], mdb.KEY, value[mdb.HASH], web.URL, value[mdb.TEXT]))
|
||||
}
|
||||
})
|
||||
m.Echo(kit.Formats(SpidePost(m, MENU_CREATE, web.SPIDE_DATA, kit.Formats(list))))
|
||||
m.Echo(kit.Formats(SpidePost(m, MENU_CREATE, web.SPIDE_DATA, strings.ReplaceAll(kit.Format(list), "\\u0026", "&"))))
|
||||
m.ProcessHold()
|
||||
}},
|
||||
web.PREVIEW: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.ProcessOpen(m.MergeLink(kit.Select(web.S(m.Option(web.SPACE))+web.C(m.Option(ctx.INDEX)), m.Option(mdb.TEXT)) + m.Option(ctx.ARGS)))
|
||||
}},
|
||||
}, mdb.ExportHashAction(mdb.SHORT, "scene,river,storm", mdb.FIELD, "time,hash,scene,river,storm,type,name,text,icons,space,index,args")), Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Option("cache.limit", "-1")
|
||||
if len(arg) == 0 {
|
||||
m.Cmdy(ACCESS).PushAction("").Option(ice.MSG_ACTION, "")
|
||||
if m.Length() == 0 {
|
||||
m.SetResult()
|
||||
}
|
||||
} else if mdb.HashSelect(m, arg[1:]...).Sort(mdb.Config(m, mdb.SHORT), ice.STR, ice.INT, ice.INT); len(arg) == 1 {
|
||||
m.Cmdy(ACCESS).PushAction("").Action()
|
||||
kit.If(m.Length() == 0, func() { m.SetResult() })
|
||||
} else if mdb.HashSelect(m.Options("cache.limit", "-1"), arg[1:]...).Sort(mdb.Config(m, mdb.SHORT), ice.STR, ice.INT, ice.INT); len(arg) == 1 {
|
||||
m.PushAction(web.PREVIEW, mdb.REMOVE)
|
||||
m.Action(mdb.CREATE, mdb.UPDATE)
|
||||
}
|
||||
}},
|
||||
|
@ -14,9 +14,7 @@ func init() {
|
||||
m.Cmdy(ACCESS)
|
||||
} else if m.Option(ACCESS, arg[0]); len(arg) == 1 {
|
||||
res := SpideGet(m, "template/get_all_private_template")
|
||||
kit.For(kit.Value(res, "template_list"), func(value ice.Map) {
|
||||
m.Push("", value)
|
||||
})
|
||||
kit.For(kit.Value(res, "template_list"), func(value ice.Map) { m.Push("", value) })
|
||||
m.Cut("template_id,title,content,example")
|
||||
} else if len(arg) > 4 {
|
||||
args := []ice.Any{"template_id", arg[1], "touser", arg[2], "url", arg[3]}
|
||||
|
@ -47,6 +47,7 @@ func _user_list(m *ice.Message, res ice.Any) *ice.Message {
|
||||
list := map[string]string{}
|
||||
m.Cmd(TAGS, m.Option(ACCESS), func(value ice.Maps) { list[value[mdb.ID]] = value[mdb.NAME] })
|
||||
kit.For(kit.Value(res, kit.Keys(mdb.DATA, OPENID)), func(value string) {
|
||||
return
|
||||
res := SpideGet(m, USER_INFO, OPENID, value)
|
||||
m.Push(mdb.TIME, kit.TimeUnix(kit.Value(res, SUBSCRIBE_TIME)))
|
||||
m.Push("", res, []string{OPENID, SEX, aaa.USERNICK, aaa.LANGUAGE, aaa.PROVINCE, aaa.CITY})
|
||||
|
@ -12,3 +12,4 @@ field web.chat.wx.menu
|
||||
field web.chat.wx.scan
|
||||
field web.chat.wx.tags
|
||||
field web.chat.wx.users
|
||||
field web.chat.wx.template
|
||||
|
10
render.go
10
render.go
@ -55,6 +55,9 @@ func Render(m *Message, cmd string, args ...Any) string {
|
||||
case RENDER_SCRIPT:
|
||||
return kit.Format(`<code>%s</code>`, arg[0])
|
||||
case RENDER_IMAGES:
|
||||
if len(arg) > 2 {
|
||||
return kit.Format(`<img src="%s" height="%s" class="%s">`, arg[0], arg[1], arg[2])
|
||||
}
|
||||
if len(arg) > 1 {
|
||||
return kit.Format(`<img src="%s" height="%s">`, arg[0], arg[1])
|
||||
}
|
||||
@ -231,7 +234,9 @@ func (m *Message) EchoButton(arg ...Any) *Message {
|
||||
func (m *Message) EchoAnchor(arg ...string) *Message { return m.Echo(Render(m, RENDER_ANCHOR, arg)) }
|
||||
func (m *Message) EchoQRCode(src string) *Message { return m.Echo(Render(m, RENDER_QRCODE, src)) }
|
||||
func (m *Message) EchoScript(arg ...string) *Message { return m.Echo(Render(m, RENDER_SCRIPT, arg)) }
|
||||
func (m *Message) EchoImages(src string) *Message { return m.Echo(Render(m, RENDER_IMAGES, src)) }
|
||||
func (m *Message) EchoImages(arg ...string) *Message {
|
||||
return m.Echo(Render(m, RENDER_IMAGES, arg))
|
||||
}
|
||||
func (m *Message) EchoVideos(src string) *Message { return m.Echo(Render(m, RENDER_VIDEOS, src)) }
|
||||
func (m *Message) EchoAudios(src string) *Message { return m.Echo(Render(m, RENDER_AUDIOS, src)) }
|
||||
func (m *Message) EchoIFrame(src string) *Message {
|
||||
@ -263,6 +268,9 @@ func (m *Message) DisplayCSS(file string, arg ...Any) *Message {
|
||||
return m
|
||||
}
|
||||
func (m *Message) Resource(file string, arg ...string) string {
|
||||
if strings.Contains(file, "bi ") {
|
||||
return file
|
||||
}
|
||||
if len(arg) > 0 && arg[0] != "" {
|
||||
if strings.HasPrefix(file, HTTP) {
|
||||
return file
|
||||
|
Loading…
x
Reference in New Issue
Block a user