mirror of
https://shylinux.com/x/icebergs
synced 2025-07-02 12:41:20 +08:00
Compare commits
No commits in common. "master" and "v1.9.67" have entirely different histories.
@ -79,7 +79,7 @@ func UserInfo(m *ice.Message, name ice.Any, key, meta string) (value string) {
|
||||
func UserRole(m *ice.Message, username ice.Any) (role string) {
|
||||
if username == "" {
|
||||
return VOID
|
||||
} else if role = VOID; username == ice.Info.UserName {
|
||||
} else if role = VOID; username == ice.Info.Username {
|
||||
return ROOT
|
||||
} else {
|
||||
return UserInfo(m, username, USERROLE, ice.MSG_USERROLE)
|
||||
@ -99,13 +99,13 @@ func UserEmail(m *ice.Message, username ice.Any) (nick string) {
|
||||
}
|
||||
func UserRoot(m *ice.Message, arg ...string) *ice.Message {
|
||||
userrole := kit.Select(TECH, arg, 0)
|
||||
username := kit.Select(ice.Info.UserName, arg, 1)
|
||||
username := kit.Select(ice.Info.Username, arg, 1)
|
||||
usernick := kit.Select(UserNick(m, username), arg, 2)
|
||||
language := kit.Select(UserLang(m, username), arg, 3)
|
||||
userzone := kit.Select(ice.OPS, arg, 4)
|
||||
email := kit.Select(UserEmail(m, username), arg, 5)
|
||||
if len(arg) > 0 {
|
||||
kit.If(username != ROOT, func() { ice.Info.UserName = username })
|
||||
kit.If(username != ROOT, func() { ice.Info.Username = username })
|
||||
m.Cmd(USER, mdb.CREATE, userrole, username, usernick, language, userzone, email)
|
||||
}
|
||||
return SessAuth(m, kit.Dict(USERROLE, userrole, USERNAME, username, USERNICK, usernick))
|
||||
|
@ -54,7 +54,9 @@ 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 {
|
||||
kit.If(m.IsMobileUA(), func() { m.Option(SIZE, "280") })
|
||||
if m.IsMobileUA() {
|
||||
m.Option(SIZE, "280")
|
||||
}
|
||||
return m.Cmd(Prefix(QRCODE), kit.Simple(args...)).Result()
|
||||
})
|
||||
}},
|
||||
@ -64,13 +66,6 @@ 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)
|
||||
|
@ -37,15 +37,15 @@ func _runtime_init(m *ice.Message) {
|
||||
if name, e := os.Hostname(); e == nil && name != "" {
|
||||
m.Conf(RUNTIME, kit.Keys(BOOT, HOSTNAME), name)
|
||||
}
|
||||
ice.Info.UserName = m.Conf(RUNTIME, kit.Keys(BOOT, USERNAME))
|
||||
ice.Info.HostName = m.Conf(RUNTIME, kit.Keys(BOOT, HOSTNAME))
|
||||
ice.Info.PathName = m.Conf(RUNTIME, kit.Keys(BOOT, PATHNAME))
|
||||
kit.HashSeed = append(kit.HashSeed, ice.Info.UserName)
|
||||
kit.HashSeed = append(kit.HashSeed, ice.Info.HostName)
|
||||
kit.HashSeed = append(kit.HashSeed, ice.Info.PathName)
|
||||
ice.Info.Username = m.Conf(RUNTIME, kit.Keys(BOOT, USERNAME))
|
||||
ice.Info.Hostname = m.Conf(RUNTIME, kit.Keys(BOOT, HOSTNAME))
|
||||
ice.Info.Pathname = m.Conf(RUNTIME, kit.Keys(BOOT, PATHNAME))
|
||||
kit.HashSeed = append(kit.HashSeed, ice.Info.Username)
|
||||
kit.HashSeed = append(kit.HashSeed, ice.Info.Hostname)
|
||||
kit.HashSeed = append(kit.HashSeed, ice.Info.Pathname)
|
||||
aaa.UserRoot(ice.Pulse, aaa.TECH, ice.Info.Make.Author, "", "", ice.DEV, ice.Info.Make.Email)
|
||||
aaa.UserRoot(ice.Pulse, aaa.TECH, ice.Info.Make.Username, "", "", ice.DEV, ice.Info.Make.Email)
|
||||
aaa.UserRoot(ice.Pulse, aaa.ROOT, ice.Info.UserName)
|
||||
aaa.UserRoot(ice.Pulse, aaa.ROOT, ice.Info.Username)
|
||||
aaa.UserRoot(ice.Pulse, aaa.ROOT, aaa.ROOT)
|
||||
ice.Info.Time = m.Time()
|
||||
m.Conf(RUNTIME, kit.Keys(BOOT, mdb.TIME), ice.Info.Time)
|
||||
@ -149,15 +149,16 @@ const (
|
||||
)
|
||||
const (
|
||||
CTX_SHY = "ctx_shy"
|
||||
CTX_DEV = "ctx_dev"
|
||||
CTX_WEB = "ctx_web"
|
||||
CTX_GIT = "ctx_git"
|
||||
CTX_DEV_IP = "ctx_dev_ip"
|
||||
CTX_DEV = "ctx_dev"
|
||||
CTX_OPS = "ctx_ops"
|
||||
CTX_REPOS = "ctx_repos"
|
||||
CTX_NAME = "ctx_name"
|
||||
CTX_DEMO = "ctx_demo"
|
||||
CTX_MAIL = "ctx_mail"
|
||||
CTX_ROOT = "ctx_root"
|
||||
CTX_DOMAIN = "ctx_domain"
|
||||
|
||||
CTX_PID = "ctx_pid"
|
||||
CTX_LOG = "ctx_log"
|
||||
@ -193,9 +194,9 @@ func init() {
|
||||
HOSTINFO: {Hand: func(m *ice.Message, arg ...string) { _runtime_hostinfo(m) }},
|
||||
HOSTNAME: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg) > 0 {
|
||||
ice.Info.HostName = mdb.Conf(m, RUNTIME, kit.Keys(NODE, mdb.NAME), mdb.Conf(m, RUNTIME, kit.Keys(BOOT, HOSTNAME), arg[0]))
|
||||
ice.Info.Hostname = mdb.Conf(m, RUNTIME, kit.Keys(NODE, mdb.NAME), mdb.Conf(m, RUNTIME, kit.Keys(BOOT, HOSTNAME), arg[0]))
|
||||
}
|
||||
m.Echo(ice.Info.HostName)
|
||||
m.Echo(ice.Info.Hostname)
|
||||
}},
|
||||
MAXPROCS: {Hand: func(m *ice.Message, arg ...string) {
|
||||
kit.If(len(arg) > 0, func() { runtime.GOMAXPROCS(kit.Int(mdb.Conf(m, RUNTIME, kit.Keys(HOST, MAXPROCS), arg[0]))) })
|
||||
|
@ -21,12 +21,8 @@ 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, icons)
|
||||
m.Push(mdb.ICONS, kit.Select(cmd.Icon, icon, !kit.HasPrefix(icon, "bi ", "{")))
|
||||
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)))
|
||||
@ -47,7 +43,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), mdb.HELP, cmd.Help)
|
||||
INDEX, kit.Keys(s.Prefix(), key))
|
||||
}).Sort(m.OptionFields())
|
||||
}
|
||||
|
||||
@ -124,7 +120,7 @@ func init() {
|
||||
}},
|
||||
}), Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg) == 0 {
|
||||
m.OptionFields(INDEX, mdb.HELP)
|
||||
m.OptionFields(INDEX)
|
||||
m.Cmdy("", mdb.SEARCH, COMMAND)
|
||||
} else {
|
||||
kit.For(arg, func(k string) { _command_list(m, k) })
|
||||
@ -217,9 +213,6 @@ 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) {
|
||||
|
@ -51,9 +51,6 @@ func DisplayStoryForm(m *ice.Message, arg ...ice.Any) *ice.Message {
|
||||
func DisplayInputKey(m *ice.Message, arg ...ice.Any) *ice.Message {
|
||||
return DisplayInput(m, "key", arg...)
|
||||
}
|
||||
func DisplayStoryWeight(m *ice.Message, arg ...ice.Any) *ice.Message {
|
||||
return DisplayStory(m, "weight", arg...)
|
||||
}
|
||||
func DisplayStoryPie(m *ice.Message, arg ...ice.Any) *ice.Message {
|
||||
return DisplayStory(m, "pie", arg...)
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ import (
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/aaa"
|
||||
@ -184,18 +183,12 @@ func init() {
|
||||
}
|
||||
// if m.Options(mdb.HASH, up[0], mdb.NAME, up[1]); watch {
|
||||
if watch {
|
||||
m.Cmdy(CACHE, WATCH, up[0], path.Join(kit.Select(m.Option(nfs.PATH), msg.Append(nfs.PATH)), up[1]))
|
||||
m.Cmdy(CACHE, WATCH, up[0], path.Join(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)
|
||||
|
@ -1,6 +1,7 @@
|
||||
package web
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
"regexp"
|
||||
@ -21,46 +22,56 @@ import (
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
func _dream_list(m *ice.Message) *ice.Message {
|
||||
func _dream_list(m *ice.Message, simple bool) *ice.Message {
|
||||
list := m.CmdMap(SPACE, mdb.NAME)
|
||||
mdb.HashSelects(m.Spawn()).Table(func(value ice.Maps, index int, head []string) {
|
||||
if value[aaa.ACCESS] == aaa.PRIVATE && (m.Option(ice.FROM_SPACE) != "" || !aaa.IsTechOrRoot(m)) {
|
||||
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))
|
||||
m.Push(mdb.TYPE, space[mdb.TYPE]).Push(cli.STATUS, cli.START)
|
||||
m.Push(nfs.MODULE, space[nfs.MODULE]).Push(nfs.VERSION, space[nfs.VERSION])
|
||||
button := []ice.Any{PORTAL, DESKTOP, ADMIN, WORD}
|
||||
text := space[nfs.MODULE]
|
||||
kit.If(m.Option(ice.DREAM_SIMPLE) != ice.TRUE && aaa.IsTechOrRoot(m), func() {
|
||||
kit.If(m.IsDebug(), func() {
|
||||
button = append(button, VIMER, STATUS, COMPILE, cli.RUNTIME, XTERM)
|
||||
text += "\n" + DreamStat(m, value[mdb.NAME])
|
||||
})
|
||||
button = append(button, "settings", cli.STOP)
|
||||
})
|
||||
m.Push(mdb.TEXT, text)
|
||||
m.PushButton(append(button, OPEN)...)
|
||||
if m.IsCliUA() || simple {
|
||||
m.Push(mdb.TYPE, space[mdb.TYPE]).Push(cli.STATUS, cli.START)
|
||||
m.Push(nfs.MODULE, space[nfs.MODULE]).Push(nfs.VERSION, space[nfs.VERSION])
|
||||
// m.Push(mdb.TEXT, DreamStat(m, value[mdb.NAME]))
|
||||
m.Push(mdb.TEXT, "")
|
||||
button := []ice.Any{PORTAL, DESKTOP, ADMIN, WORD, OPEN}
|
||||
kit.If(aaa.IsTechOrRoot(m), func() { button = append(button, cli.STOP) })
|
||||
m.PushButton(button...)
|
||||
} else {
|
||||
msg := gdb.Event(m.Spawn(value, space), DREAM_TABLES)
|
||||
kit.If(aaa.IsTechOrRoot(m), func() { msg.Copy(m.Spawn().PushButton(cli.STOP)) })
|
||||
m.Push(mdb.TYPE, space[mdb.TYPE]).Push(cli.STATUS, cli.START)
|
||||
m.Push(nfs.MODULE, space[nfs.MODULE]).Push(nfs.VERSION, space[nfs.VERSION])
|
||||
m.Push(mdb.TEXT, space[nfs.MODULE]+"\n"+msg.Append(mdb.TEXT))
|
||||
m.PushButton(strings.Join(msg.Appendv(ctx.ACTION), ""))
|
||||
}
|
||||
} else if aaa.IsTechOrRoot(m) {
|
||||
m.Push("", value, kit.Slice(head, 0, -1))
|
||||
m.Push(nfs.MODULE, "").Push(nfs.VERSION, "").Push(mdb.TEXT, "")
|
||||
if m.Push(mdb.TYPE, WORKER); nfs.Exists(m, path.Join(ice.USR_LOCAL_WORK, value[mdb.NAME])) {
|
||||
m.Push(cli.STATUS, cli.STOP).PushButton(cli.START, nfs.TRASH)
|
||||
m.Push(cli.STATUS, cli.STOP).Push(nfs.MODULE, "").Push(nfs.VERSION, "").Push(mdb.TEXT, "")
|
||||
kit.If(aaa.IsTechOrRoot(m), func() { m.PushButton(cli.START, nfs.TRASH) }, func() { m.PushButton() })
|
||||
} else {
|
||||
m.Push(cli.STATUS, cli.BEGIN).PushButton(cli.START, mdb.REMOVE)
|
||||
m.Push(cli.STATUS, cli.BEGIN).Push(nfs.MODULE, "").Push(nfs.VERSION, "").Push(mdb.TEXT, "")
|
||||
kit.If(aaa.IsTechOrRoot(m), func() { m.PushButton(cli.START, mdb.REMOVE) }, func() { m.PushButton() })
|
||||
}
|
||||
}
|
||||
})
|
||||
m.RewriteAppend(func(value, key string, index int) string {
|
||||
if key == mdb.TIME {
|
||||
if space, ok := list[m.Appendv(mdb.NAME)[index]]; ok {
|
||||
return space[mdb.TIME]
|
||||
value = space[mdb.TIME]
|
||||
}
|
||||
} else if key == mdb.ICONS {
|
||||
}
|
||||
return value
|
||||
})
|
||||
return m
|
||||
}
|
||||
func _dream_list_icon(m *ice.Message) {
|
||||
m.RewriteAppend(func(value, key string, index int) string {
|
||||
if key == mdb.ICONS {
|
||||
if kit.HasPrefix(value, HTTP, nfs.PS) {
|
||||
return value
|
||||
} else if nfs.ExistsFile(m, path.Join(ice.USR_LOCAL_WORK, m.Appendv(mdb.NAME)[index], value)) {
|
||||
@ -71,44 +82,34 @@ func _dream_list(m *ice.Message) *ice.Message {
|
||||
}
|
||||
return value
|
||||
})
|
||||
return m
|
||||
}
|
||||
func _dream_list_more(m *ice.Message) *ice.Message {
|
||||
func _dream_list_more(m *ice.Message, simple bool) *ice.Message {
|
||||
field := kit.Split(mdb.Config(m, mdb.FIELD) + ",type,status,module,version,text")
|
||||
m.Cmds(SPACE).Table(func(value ice.Maps) {
|
||||
value[nfs.REPOS] = "https://" + value[nfs.MODULE]
|
||||
value[aaa.ACCESS] = kit.Select("", value[aaa.USERROLE], value[aaa.USERROLE] != aaa.VOID)
|
||||
value[mdb.STATUS] = cli.START
|
||||
button := []ice.Any{PORTAL, DESKTOP, ADMIN, WORD}
|
||||
kit.If(m.IsDebug(), func() { button = append(button, VIMER, STATUS, COMPILE, cli.RUNTIME, XTERM) })
|
||||
button := []ice.Any{PORTAL, DESKTOP, ADMIN, WORD, VIMER, STATUS, COMPILE, cli.RUNTIME, XTERM, OPEN}
|
||||
switch value[mdb.TYPE] {
|
||||
case ORIGIN:
|
||||
if m.IsCliUA() {
|
||||
return
|
||||
}
|
||||
value[mdb.TEXT] = kit.JoinLine(value[nfs.MODULE], value[mdb.TEXT])
|
||||
kit.If(aaa.IsTechOrRoot(m), func() { button = append(button, GETTOKEN) })
|
||||
kit.If(value[aaa.ACCESS] == "", func() { button = []ice.Any{PORTAL} })
|
||||
button = append(button, OPEN)
|
||||
button = append(button, "gettoken")
|
||||
if value[aaa.ACCESS] == "" {
|
||||
defer m.PushButton(PORTAL, OPEN)
|
||||
} else {
|
||||
defer m.PushButton(button...)
|
||||
}
|
||||
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
|
||||
}
|
||||
kit.If(aaa.IsTechOrRoot(m), func() { button = append(button, SETTOKEN) })
|
||||
button = append(button, OPEN)
|
||||
button = append(button, "settoken")
|
||||
value[mdb.TEXT] = kit.JoinLine(value[nfs.MODULE], value[mdb.TEXT])
|
||||
defer m.PushButton(button...)
|
||||
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])))
|
||||
defer func() { button = []ice.Any{GRANT} }()
|
||||
defer m.PushButton(GRANT)
|
||||
default:
|
||||
return
|
||||
}
|
||||
m.Push("", value, field)
|
||||
m.PushButton(button...)
|
||||
})
|
||||
return m
|
||||
}
|
||||
@ -130,7 +131,7 @@ func _dream_start(m *ice.Message, name string) {
|
||||
defer m.Options(cli.CMD_DIR, "", cli.CMD_ENV, "", cli.CMD_OUTPUT, "")
|
||||
m.Options(cli.CMD_DIR, kit.Path(p), cli.CMD_ENV, kit.EnvList(kit.Simple(m.OptionSimple(ice.TCP_DOMAIN),
|
||||
cli.CTX_OPS, HostPort(m, tcp.LOCALHOST, m.Cmdv(SERVE, tcp.PORT)), cli.CTX_LOG, ice.VAR_LOG_BOOT_LOG,
|
||||
cli.CTX_ROOT, kit.Path(""), cli.PATH, cli.BinPath(p, ""), cli.USER, ice.Info.UserName,
|
||||
cli.CTX_ROOT, kit.Path(""), cli.PATH, cli.BinPath(p, ""), cli.USER, ice.Info.Username,
|
||||
)...), cli.CMD_OUTPUT, path.Join(p, ice.VAR_LOG_BOOT_LOG), mdb.CACHE_CLEAR_ONEXIT, ice.TRUE)
|
||||
kit.If(m.Option(nfs.BINARY) == "" && !cli.SystemFindGo(m), func(p string) { m.Option(nfs.BINARY, S(name)) })
|
||||
kit.If(m.Option(nfs.BINARY), func(p string) { _dream_binary(m, p) })
|
||||
@ -177,8 +178,7 @@ func _dream_binary(m *ice.Message, p string) {
|
||||
if bin := path.Join(m.Option(cli.CMD_DIR), ice.BIN_ICE_BIN); nfs.Exists(m, bin) {
|
||||
return
|
||||
} else if kit.IsUrl(p) || strings.HasPrefix(p, S()) {
|
||||
// m.Cmd(DREAM, DOWNLOAD, bin, kit.MergeURL2(p, kit.Format("/publish/ice.%s.%s", runtime.GOOS, runtime.GOARCH), ice.POD, m.Option(mdb.NAME)))
|
||||
m.Cmd(DREAM, DOWNLOAD, bin, kit.MergeURL(p, cli.GOOS, runtime.GOOS, cli.GOARCH, runtime.GOARCH))
|
||||
m.Cmd(DREAM, DOWNLOAD, bin, kit.MergeURL2(p, kit.Format("/publish/ice.%s.%s", runtime.GOOS, runtime.GOARCH), ice.POD, m.Option(mdb.NAME)))
|
||||
} else {
|
||||
m.Cmd(nfs.LINK, bin, kit.Path(p))
|
||||
}
|
||||
@ -207,8 +207,6 @@ const (
|
||||
STOPALL = "stopall"
|
||||
FOR_EACH = "forEach"
|
||||
FOR_FLOW = "forFlow"
|
||||
GETTOKEN = "gettoken"
|
||||
SETTOKEN = "settoken"
|
||||
|
||||
DREAM_INPUTS = "dream.inputs"
|
||||
DREAM_CREATE = "dream.create"
|
||||
@ -218,6 +216,7 @@ const (
|
||||
DREAM_STOP = "dream.stop"
|
||||
DREAM_OPEN = "dream.open"
|
||||
DREAM_CLOSE = "dream.close"
|
||||
|
||||
DREAM_TABLES = "dream.tables"
|
||||
DREAM_ACTION = "dream.action"
|
||||
|
||||
@ -238,28 +237,66 @@ func init() {
|
||||
每个空间都自带软件开发工具,也可以随时编程添加新的功能。
|
||||
`, 200.0)
|
||||
}},
|
||||
html.BUTTON: {Hand: func(m *ice.Message, arg ...string) {
|
||||
mdb.Config(m, html.BUTTON, kit.Join(arg))
|
||||
}},
|
||||
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if mdb.IsSearchPreview(m, arg) {
|
||||
mdb.HashSelects(m.Spawn()).Table(func(value ice.Maps) { m.PushSearch(mdb.TYPE, WORKER, mdb.TEXT, m.MergePod(value[mdb.NAME]), value) })
|
||||
}
|
||||
}},
|
||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
||||
switch arg[0] {
|
||||
case mdb.NAME:
|
||||
DreamEach(m, "", kit.Select(cli.START, cli.STOP, m.Option(ctx.ACTION) == STARTALL), func(name string) { m.Push(arg[0], name) })
|
||||
case tcp.NODENAME:
|
||||
m.Cmdy(SPACE, m.Option(mdb.NAME), SPACE, ice.INFO).CutTo(mdb.NAME, arg[0])
|
||||
case aaa.USERNAME:
|
||||
if aaa.IsTechOrRoot(m) && m.Option(ctx.ACTION) == GRANT {
|
||||
m.Cmdy(aaa.USER).Cut(aaa.USERNAME, aaa.USERNICK).Option(ice.TABLE_CHECKBOX, ice.FALSE)
|
||||
} else {
|
||||
m.Push(arg[0], m.Option(tcp.NODENAME))
|
||||
m.Push(arg[0], m.Option(ice.MSG_USERNAME))
|
||||
switch m.Option(ctx.ACTION) {
|
||||
case mdb.CREATE:
|
||||
switch arg[0] {
|
||||
case mdb.NAME:
|
||||
_dream_list(m, true).Cut("name,status,time")
|
||||
case mdb.ICONS:
|
||||
mdb.HashInputs(m, arg)
|
||||
case nfs.REPOS:
|
||||
defer ctx.DisplayInputKey(m, ctx.STYLE, "_nameicon")
|
||||
m.Cmd(STORE).Table(func(value ice.Maps) {
|
||||
m.Spawn().SplitIndex(m.Cmdx(SPIDE, value[mdb.NAME], SPIDE_RAW, http.MethodGet, C(DREAM))).Table(func(value ice.Maps) {
|
||||
m.PushRecord(value, mdb.ICONS, nfs.REPOS, nfs.VERSION, mdb.NAME)
|
||||
})
|
||||
})
|
||||
case nfs.BINARY:
|
||||
defer ctx.DisplayInputKey(m, ctx.STYLE, "_nameicon")
|
||||
m.Cmd(STORE).Table(func(val ice.Maps) {
|
||||
m.Spawn().SplitIndex(m.Cmdx(SPIDE, val[mdb.NAME], SPIDE_RAW, http.MethodGet, S(), cli.GOOS, runtime.GOOS, cli.GOARCH, runtime.GOARCH)).Table(func(value ice.Maps) {
|
||||
m.Push(mdb.ICONS, value[mdb.ICONS])
|
||||
m.Push(arg[0], val[ORIGIN]+S(value[mdb.NAME])).Push(nfs.SIZE, value[nfs.SIZE]).Push(mdb.TIME, value[mdb.TIME])
|
||||
})
|
||||
})
|
||||
}
|
||||
case nfs.REPOS:
|
||||
case nfs.BINARY:
|
||||
case STARTALL:
|
||||
DreamEach(m, "", cli.STOP, func(name string) { m.Push(arg[0], name) })
|
||||
case tcp.SEND:
|
||||
m.Cmd(SPACE, func(value ice.Maps) {
|
||||
kit.If(kit.IsIn(value[mdb.TYPE], SERVER), func() { m.Push(arg[0], value[mdb.NAME]) })
|
||||
})
|
||||
default:
|
||||
gdb.Event(m, DREAM_INPUTS, arg)
|
||||
switch arg[0] {
|
||||
case mdb.NAME:
|
||||
DreamEach(m, "", cli.START, func(name string) { m.Push(arg[0], name) })
|
||||
case ctx.CMDS:
|
||||
m.Cmdy(ctx.COMMAND)
|
||||
case nfs.FILE:
|
||||
m.Options(nfs.DIR_TYPE, nfs.TYPE_CAT, ice.MSG_FIELDS, nfs.PATH)
|
||||
m.Cmdy(nfs.DIR, nfs.SRC).Cmdy(nfs.DIR, nfs.ETC).Cmdy(nfs.DIR, "")
|
||||
case tcp.NODENAME:
|
||||
m.Cmdy(SPACE, m.Option(mdb.NAME), SPACE, ice.INFO).CutTo(mdb.NAME, tcp.NODENAME)
|
||||
case aaa.USERNAME:
|
||||
if aaa.IsTechOrRoot(m) && m.Option(ctx.ACTION) == GRANT {
|
||||
m.Cmdy(aaa.USER).Cut(aaa.USERNAME, aaa.USERNICK)
|
||||
m.Option(ice.TABLE_CHECKBOX, ice.FALSE)
|
||||
} else {
|
||||
m.Push(arg[0], m.Option(ice.MSG_USERNAME))
|
||||
m.Push(arg[0], m.Option(tcp.NODENAME))
|
||||
}
|
||||
default:
|
||||
gdb.Event(m, DREAM_INPUTS, arg)
|
||||
}
|
||||
}
|
||||
}},
|
||||
nfs.SCAN: {Hand: func(m *ice.Message, arg ...string) {
|
||||
@ -272,9 +309,12 @@ func init() {
|
||||
}},
|
||||
mdb.CREATE: {Name: "create name*=hi repos binary", Hand: func(m *ice.Message, arg ...string) {
|
||||
kit.If(!strings.Contains(m.Option(mdb.NAME), "-") || !strings.HasPrefix(m.Option(mdb.NAME), "20"), func() { m.Option(mdb.NAME, m.Time("20060102-")+m.Option(mdb.NAME)) })
|
||||
kit.If(mdb.Config(m, nfs.BINARY), func(p string) { m.OptionDefault(nfs.BINARY, p+m.Option(mdb.NAME)) })
|
||||
kit.If(mdb.Config(m, nfs.REPOS), func(p string) { m.OptionDefault(nfs.REPOS, p+m.Option(mdb.NAME)) })
|
||||
m.Option(nfs.REPOS, kit.Select("", kit.Split(m.Option(nfs.REPOS)), -1))
|
||||
if mdb.HashCreate(m); ice.Info.Important == true {
|
||||
_dream_start(m, m.Option(mdb.NAME))
|
||||
StreamPushRefreshConfirm(m, m.Trans("refresh for new space ", "刷新列表查看新空间 ")+m.Option(mdb.NAME))
|
||||
SpaceEvent(m, OPS_DREAM_CREATE, m.Option(mdb.NAME), m.OptionSimple(mdb.NAME, nfs.REPOS, nfs.BINARY)...)
|
||||
}
|
||||
}},
|
||||
@ -302,18 +342,16 @@ func init() {
|
||||
m.Cmd(SPACE, path.Base(p), cli.RUNTIME, UPGRADE)
|
||||
return true
|
||||
}
|
||||
}).Sleep3s()
|
||||
m.ProcessHold()
|
||||
})
|
||||
m.Sleep("3s")
|
||||
// kit.If(m.Option(mdb.NAME) == "", func() { m.Sleep("5s").Cmdy(ROUTE, cli.BUILD).ProcessInner() })
|
||||
}},
|
||||
PUBLISH: {Name: "publish name", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Option(ice.MSG_TITLE, kit.Keys(m.Option(ice.MSG_USERPOD0), m.Option(ice.MSG_USERPOD), m.CommandKey(), m.ActionKey()))
|
||||
list := []string{cli.LINUX, cli.DARWIN, cli.WINDOWS}
|
||||
msg := m.Spawn(ice.Maps{ice.MSG_DAEMON: ""})
|
||||
func() {
|
||||
if m.Option(mdb.NAME) != "" {
|
||||
return
|
||||
}
|
||||
defer ToastProcess(m, PUBLISH, ice.Info.PathName)()
|
||||
defer ToastProcess(m, PUBLISH, ice.Info.Pathname)()
|
||||
m.Cmd(AUTOGEN, BINPACK)
|
||||
kit.For(list, func(goos string) {
|
||||
list := []string{cli.AMD64}
|
||||
@ -329,7 +367,8 @@ func init() {
|
||||
list := []string{cli.AMD64}
|
||||
kit.If(goos == cli.DARWIN, func() { list = append(list, cli.ARM64) })
|
||||
kit.For(list, func(arch string) {
|
||||
PushNoticeRich(m.Options(ice.MSG_COUNT, "0", ice.LOG_DISABLE, ice.TRUE), mdb.NAME, name, msg.Cmd(SPACE, name, COMPILE, goos, arch, kit.Dict(ice.MSG_USERPOD, name)).AppendSimple())
|
||||
PushNoticeRich(m.Options(ice.MSG_COUNT, "0", ice.LOG_DISABLE, ice.TRUE), mdb.NAME, name,
|
||||
msg.Cmd(SPACE, name, COMPILE, goos, arch, kit.Dict(ice.MSG_USERPOD, name)).AppendSimple())
|
||||
})
|
||||
})
|
||||
})
|
||||
@ -346,46 +385,66 @@ func init() {
|
||||
if cb, ok := m.OptionCB("").(func(string) bool); ok && cb(p) {
|
||||
return
|
||||
}
|
||||
defer PushNoticeGrow(msg, "\r\n\r\n")
|
||||
PushNoticeGrow(msg, kit.Format("\033[33m[%s]%s$\033[0m %s\r\n", time.Now().Format(ice.MOD_TIME_ONLY), name, m.Option(ice.CMD)))
|
||||
defer PushNoticeGrow(msg, "\r\n\r\n\r\n")
|
||||
PushNoticeGrow(msg, kit.Format("[%s]%s$ %s\r\n", time.Now().Format(ice.MOD_TIME_ONLY), name, m.Option(ice.CMD)))
|
||||
m.Cmd(cli.SYSTEM, kit.Split(m.Option(ice.CMD)), kit.Dict(cli.CMD_DIR, p)).Sleep300ms()
|
||||
})
|
||||
}},
|
||||
ctx.CMDS: {Name: "cmds name cmds*", Help: "命令", Icon: "bi bi-terminal", Hand: func(m *ice.Message, arg ...string) {
|
||||
DreamEach(m, m.Option(mdb.NAME), "", func(name string) {
|
||||
m.Push(mdb.NAME, name).Push(mdb.TEXT, m.Cmdx(SPACE, name, kit.Split(m.Option(ctx.CMDS))))
|
||||
}).StatusTimeCount(m.OptionSimple(ctx.CMDS)).ProcessInner()
|
||||
}},
|
||||
nfs.FILE: {Name: "file name file*", Help: "文件", Icon: "bi bi-file-earmark-code", Hand: func(m *ice.Message, arg ...string) {
|
||||
DreamEach(m, m.Option(mdb.NAME), "", func(name string) {
|
||||
m.Push(mdb.NAME, name).Push(mdb.TEXT, m.Cmdx(SPACE, name, nfs.CAT, m.Option(nfs.FILE)))
|
||||
}).StatusTimeCount(m.OptionSimple(nfs.FILE)).ProcessInner()
|
||||
}},
|
||||
|
||||
cli.START: {Hand: func(m *ice.Message, arg ...string) {
|
||||
_dream_start(m, m.Option(mdb.NAME))
|
||||
gdb.Event(m, DREAM_START, arg)
|
||||
}},
|
||||
cli.STOP: {Hand: func(m *ice.Message, arg ...string) {
|
||||
defer ToastProcess(m)()
|
||||
gdb.Event(m, DREAM_STOP, arg)
|
||||
m.Cmd(SPACE, mdb.MODIFY, m.OptionSimple(mdb.NAME), mdb.STATUS, cli.STOP)
|
||||
m.Cmd(SPACE, m.Option(mdb.NAME), ice.EXIT).Sleep3s()
|
||||
}},
|
||||
cli.RUNTIME: {Hand: func(m *ice.Message, arg ...string) {
|
||||
ProcessPodCmd(m, m.Option(mdb.NAME), "", nil, arg...)
|
||||
}},
|
||||
nfs.TRASH: {Hand: func(m *ice.Message, arg ...string) {
|
||||
gdb.Event(m, DREAM_TRASH, arg)
|
||||
nfs.Trash(m, path.Join(ice.USR_LOCAL_WORK, m.Option(mdb.NAME)))
|
||||
}},
|
||||
cli.RUNTIME: {Hand: func(m *ice.Message, arg ...string) {
|
||||
ProcessPodCmd(m, m.Option(mdb.NAME), "", nil, arg...)
|
||||
nfs.COPY: {Name: "copy to*", Help: "复制", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy("", mdb.CREATE, mdb.NAME, m.Option(nfs.TO), nfs.BINARY, path.Join(ice.USR_LOCAL_WORK, m.Option(mdb.NAME), ice.BIN_ICE_BIN))
|
||||
}},
|
||||
"settings": {Name: "settings restart=manual,always access=public,private", Help: "设置", Style: html.DANGER, Hand: func(m *ice.Message, arg ...string) {
|
||||
tcp.SEND: {Name: "send to*", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(SPACE, m.Option(nfs.TO), DREAM, mdb.CREATE, m.OptionSimple(mdb.NAME, mdb.ICONS, nfs.REPOS, nfs.BINARY))
|
||||
m.Cmd(SPACE, m.Option(nfs.TO), DREAM, cli.START, m.OptionSimple(mdb.NAME))
|
||||
ProcessIframe(m, "", m.MergePod(kit.Keys(m.Option(nfs.TO), m.Option(mdb.NAME))))
|
||||
}},
|
||||
"settings": {Name: "settings restart=manual,always access=public,private", Help: "设置", Style: "danger", Hand: func(m *ice.Message, arg ...string) {
|
||||
kit.If(m.Option(cli.RESTART) == "manual", func() { m.Option(cli.RESTART, "") })
|
||||
kit.If(m.Option(aaa.ACCESS) == aaa.PUBLIC, func() { m.Option(aaa.ACCESS, "") })
|
||||
mdb.HashModify(m, m.OptionSimple(mdb.NAME, cli.RESTART, aaa.ACCESS))
|
||||
}},
|
||||
SETTOKEN: {Name: "settoken nodename* username*", Help: "令牌", Style: html.DANGER, Hand: func(m *ice.Message, arg ...string) {
|
||||
"settoken": {Name: "settoken nodename* username*", Help: "令牌", Style: "danger", Hand: func(m *ice.Message, arg ...string) {
|
||||
token := m.Cmdx(TOKEN, mdb.CREATE, mdb.TYPE, SERVER, mdb.NAME, m.Option(aaa.USERNAME), mdb.TEXT, m.Option(tcp.NODENAME))
|
||||
m.Cmd(SPACE, m.Option(mdb.NAME), SPIDE, DEV_CREATE_TOKEN, ice.Maps{TOKEN: token})
|
||||
m.Cmd(SPACE, m.Option(mdb.NAME), SPIDE, DEV_CREATE_TOKEN, ice.Maps{CLIENT_NAME: ice.DEV, TOKEN: token})
|
||||
}},
|
||||
GETTOKEN: {Help: "令牌", Style: html.DANGER, Hand: func(m *ice.Message, arg ...string) {
|
||||
"gettoken": {Help: "令牌", Style: "danger", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Options(m.Cmd(SPIDE, m.Option(mdb.NAME)).AppendSimple()).Cmdy(SPIDE, mdb.DEV_REQUEST)
|
||||
}},
|
||||
GRANT: {Name: "grant username", Role: aaa.VOID, Hand: func(m *ice.Message, arg ...string) {
|
||||
GRANT: {Name: "grant username", Hand: func(m *ice.Message, arg ...string) {
|
||||
if aaa.IsTechOrRoot(m) && m.Option(aaa.USERNAME) != "" {
|
||||
m.Option(ice.MSG_USERNAME, m.Option(aaa.USERNAME))
|
||||
}
|
||||
m.Cmd(CHAT_GRANT, aaa.CONFIRM, kit.Dict(SPACE, m.Option(mdb.NAME)))
|
||||
}},
|
||||
OPEN: {Style: html.NOTICE, Role: aaa.VOID, Hand: func(m *ice.Message, arg ...string) {
|
||||
OPEN: {Style: "notice", Role: aaa.VOID, Hand: func(m *ice.Message, arg ...string) {
|
||||
if strings.HasSuffix(m.Option(ice.MAIN), ".portal") || kit.HasPrefixList(arg, ctx.RUN) {
|
||||
if !kit.HasPrefixList(arg, ctx.RUN) {
|
||||
defer m.Push(TITLE, m.Option(mdb.NAME))
|
||||
@ -415,15 +474,17 @@ func init() {
|
||||
button := []ice.Any{}
|
||||
if aaa.IsTechOrRoot(m) {
|
||||
switch m.Option(mdb.TYPE) {
|
||||
case ORIGIN:
|
||||
button = append(button, DREAM, GETTOKEN)
|
||||
case SERVER:
|
||||
button = append(button, DREAM, SETTOKEN)
|
||||
case WORKER:
|
||||
button = append(button, "settings")
|
||||
button = append(button, OPEN, "settings")
|
||||
case SERVER:
|
||||
button = append(button, DREAM, OPEN, "settoken")
|
||||
default:
|
||||
button = append(button, DREAM, OPEN, "gettoken")
|
||||
}
|
||||
} else {
|
||||
button = append(button, OPEN)
|
||||
}
|
||||
m.PushButton(append(button, OPEN)...)
|
||||
m.PushButton(button...)
|
||||
}},
|
||||
SERVE_START: {Hand: func(m *ice.Message, arg ...string) {
|
||||
for _, cmd := range kit.Reverse(kit.Split(mdb.Config(m, html.BUTTON))) {
|
||||
@ -438,7 +499,7 @@ func init() {
|
||||
})
|
||||
}},
|
||||
STATS_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if msg := _dream_list(m.Spawn()); msg.Length() > 0 {
|
||||
if msg := _dream_list(m.Spawn(), true); msg.Length() > 0 {
|
||||
stat := map[string]int{}
|
||||
msg.Table(func(value ice.Maps) { stat[value[mdb.TYPE]]++; stat[value[mdb.STATUS]]++ })
|
||||
PushStats(m, kit.Keys(m.CommandKey(), cli.START), stat[cli.START], "", "已启动空间")
|
||||
@ -450,8 +511,6 @@ func init() {
|
||||
m.Cmd(SPACE).Table(func(value ice.Maps, index int, head []string) {
|
||||
kit.If(value[mdb.TYPE] == m.ActionKey(), func() { m.PushRecord(value, head...) })
|
||||
})
|
||||
m.SortStrR(mdb.NAME)
|
||||
kit.If(len(arg) > 0, func() { m.Cut(arg...) })
|
||||
}},
|
||||
SERVER: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(SPACE).Table(func(value ice.Maps, index int, head []string) {
|
||||
@ -483,35 +542,53 @@ func init() {
|
||||
m.Cmd(cli.SYSTEM, cli.GO, "work", "init")
|
||||
kit.For([]string{".", nfs.USR_RELEASE, nfs.USR_ICEBERGS, nfs.USR_TOOLKITS}, func(p string) { m.Cmd(cli.SYSTEM, cli.GO, "work", "use", p) })
|
||||
DreamEach(m, m.Option(mdb.NAME), "", func(name string) { m.Cmd(cli.SYSTEM, cli.GO, "work", "use", path.Join(ice.USR_LOCAL_WORK, name)) })
|
||||
m.Cmdy(nfs.CAT, "go.work")
|
||||
}},
|
||||
}, StatsAction(), DreamAction(), DreamTablesAction(), mdb.ImportantHashAction(
|
||||
mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,help,main,icons,repos,binary,template,restart,access",
|
||||
mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,main,icons,repos,binary,template,restart,access",
|
||||
html.BUTTON, kit.JoinWord(PORTAL, DESKTOP, ADMIN, WORD, VIMER, STATUS, COMPILE, XTERM, DREAM),
|
||||
ONLINE, ice.TRUE,
|
||||
)), Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg) == 0 {
|
||||
if ice.Info.NodeType == WORKER {
|
||||
return
|
||||
simple := m.Option(ice.DREAM_SIMPLE) == ice.TRUE || m.Option(ice.MSG_DEBUG) != ice.TRUE
|
||||
if ice.Info.NodeType != WORKER {
|
||||
_dream_list(m, simple)
|
||||
_dream_list_icon(m)
|
||||
if m.Length() == 0 {
|
||||
m.EchoInfoButton(m.Trans("please scan or create new dream", "请扫描或创建新空间"), mdb.CREATE, nfs.SCAN)
|
||||
return
|
||||
}
|
||||
}
|
||||
_dream_list(m)
|
||||
if _dream_list_more(m); !aaa.IsTechOrRoot(m) || m.IsCliUA() {
|
||||
if !m.IsCliUA() && aaa.IsTechOrRoot(m) {
|
||||
_dream_list_more(m, simple)
|
||||
} else {
|
||||
msg := m.Spawn(kit.Dict(ice.MSG_USERROLE, aaa.TECH))
|
||||
m.Cmds(SPACE).Table(func(value ice.Maps) {
|
||||
if value[mdb.TYPE] == SERVER {
|
||||
if p := ProxyDomain(msg, value[mdb.NAME]); p != "" {
|
||||
value[mdb.TEXT] = p
|
||||
m.PushRecord(value, mdb.TIME, mdb.TYPE, mdb.NAME, mdb.ICONS, nfs.MODULE, nfs.VERSION, mdb.TEXT)
|
||||
m.PushButton(PORTAL, DESKTOP)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
if ice.Info.NodeType == WORKER || !aaa.IsTechOrRoot(m) || m.IsCliUA() {
|
||||
m.Action()
|
||||
} else if m.IsDebug() && cli.SystemFindGo(m) {
|
||||
m.Action(mdb.CREATE, STARTALL, STOPALL, cli.BUILD, PUBLISH)
|
||||
} else {
|
||||
m.Action(mdb.CREATE, STARTALL, STOPALL)
|
||||
}
|
||||
if m.Length() == 0 {
|
||||
m.EchoInfoButton(m.Trans("please scan or create new dream", "请扫描或创建新空间"), mdb.CREATE, nfs.SCAN)
|
||||
return
|
||||
}
|
||||
ctx.DisplayTableCard(m)
|
||||
m.Options(ice.MSG_TOOLKIT, "web.code.compose.insight")
|
||||
m.Sort("type,status,name", []string{aaa.LOGIN, WORKER, SERVER, ORIGIN}, []string{cli.START, cli.STOP, cli.BEGIN}, ice.STR_R)
|
||||
m.StatusTimeCountStats(mdb.TYPE, mdb.STATUS)
|
||||
ctx.DisplayTableCard(m)
|
||||
// kit.If(!aaa.IsTechOrRoot(m), func() { m.Options(ice.MSG_TOOLKIT, "", ice.MSG_ONLINE, ice.FALSE) })
|
||||
// kit.If(!m.IsDebug(), func() { m.Options(ice.MSG_TOOLKIT, "") })
|
||||
m.Options(ice.MSG_TOOLKIT, "web.code.compose.insight")
|
||||
} else if arg[0] == ctx.ACTION {
|
||||
m.Cmdy(arg[1], DREAM_ACTION, arg)
|
||||
// gdb.Event(m, DREAM_ACTION, arg)
|
||||
gdb.Event(m, DREAM_ACTION, arg)
|
||||
} else {
|
||||
mdb.HashSelects(m, arg[0]).PushAction(PORTAL, DESKTOP, ADMIN, OPEN, mdb.REMOVE)
|
||||
}
|
||||
}},
|
||||
})
|
||||
|
@ -85,12 +85,10 @@ const (
|
||||
CONTENT = "content"
|
||||
PROFILE = "profile"
|
||||
DISPLAY = "display"
|
||||
PORTAL = "portal"
|
||||
|
||||
VIEW = "view"
|
||||
VALUE = "value"
|
||||
INPUT = "input"
|
||||
TITLE = "title"
|
||||
ICON = "icon"
|
||||
ICONS = "icons"
|
||||
OUTPUT = "output"
|
||||
|
@ -84,10 +84,8 @@ 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
|
||||
}
|
||||
@ -173,12 +171,9 @@ 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 := strings.Split(UserHost(m), "://")[1]
|
||||
serve := kit.Select("localhost:9020", UserWeb(m).Host)
|
||||
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),
|
||||
kit.Select(serve, pod)+" "+kit.Select(cmd, msg.Append(mdb.HELP), !m.IsEnglish()),
|
||||
)
|
||||
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)))
|
||||
}
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ func init() {
|
||||
case nfs.PATH:
|
||||
m.Push(key, kit.Path(""))
|
||||
case tcp.HOSTNAME:
|
||||
m.Push(key, ice.Info.HostName)
|
||||
m.Push(key, ice.Info.Hostname)
|
||||
default:
|
||||
m.Push(key, "")
|
||||
}
|
||||
|
@ -33,8 +33,12 @@ func _serve_start(m *ice.Message) {
|
||||
m.Go(func() {
|
||||
m.Cmd(SPIDE, ice.OPS, _serve_address(m)+nfs.PS+ice.EXIT, ice.Maps{CLIENT_TIMEOUT: cli.TIME_30ms, ice.LOG_DISABLE: ice.TRUE})
|
||||
}).Sleep(cli.TIME_1s)
|
||||
cli.NodeInfo(m, kit.Select(kit.Split(ice.Info.HostName, nfs.PT)[0], m.Option(tcp.NODENAME)), SERVER, mdb.Config(m, mdb.ICONS))
|
||||
cli.NodeInfo(m, kit.Select(kit.Split(ice.Info.Hostname, nfs.PT)[0], m.Option(tcp.NODENAME)), SERVER, mdb.Config(m, mdb.ICONS))
|
||||
kit.If(ice.HasVar(), func() { m.Cmd(nfs.SAVE, ice.VAR_LOG_ICE_PORT, m.Option(tcp.PORT)) })
|
||||
m.Spawn(ice.Maps{TOKEN: ""}).Start("", m.OptionSimple(tcp.HOST, tcp.PORT)...)
|
||||
if m.Cmd(tcp.HOST).Length() == 0 {
|
||||
return
|
||||
}
|
||||
kit.For(kit.Split(m.Option(ice.DEV)), func(dev string) {
|
||||
if strings.HasPrefix(dev, HTTP) {
|
||||
m.Cmd(SPIDE, mdb.CREATE, dev, ice.DEV, "", nfs.REPOS)
|
||||
@ -43,16 +47,12 @@ func _serve_start(m *ice.Message) {
|
||||
}
|
||||
if msg := m.Cmd(SPIDE, dev); msg.Append(TOKEN) == "" {
|
||||
if m.Option(TOKEN) != "" {
|
||||
m.Cmd(SPACE, tcp.DIAL, ice.DEV, dev, TOKEN, m.Option(TOKEN))
|
||||
m.Sleep300ms(SPACE, tcp.DIAL, ice.DEV, dev, TOKEN, m.Option(TOKEN))
|
||||
} else {
|
||||
m.Cmd(SPACE, tcp.DIAL, ice.DEV, dev)
|
||||
m.Sleep300ms(SPACE, tcp.DIAL, ice.DEV, dev)
|
||||
}
|
||||
}
|
||||
})
|
||||
m.Spawn(ice.Maps{TOKEN: ""}).Start("", m.OptionSimple(tcp.HOST, tcp.PORT)...)
|
||||
if m.Cmd(tcp.HOST).Length() == 0 {
|
||||
return
|
||||
}
|
||||
}
|
||||
func _serve_main(m *ice.Message, w http.ResponseWriter, r *http.Request) bool {
|
||||
const (
|
||||
@ -65,10 +65,6 @@ func _serve_main(m *ice.Message, w http.ResponseWriter, r *http.Request) bool {
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
func() {
|
||||
defer InfoLock.Lock()()
|
||||
Info.ServeMainCount++
|
||||
}()
|
||||
if ip := r.Header.Get(X_REAL_IP); ip != "" {
|
||||
if r.Header.Set(ice.MSG_USERIP, ip); r.Header.Get(X_REAL_PORT) != "" {
|
||||
r.Header.Set(ice.MSG_USERADDR, ip+nfs.DF+r.Header.Get(X_REAL_PORT))
|
||||
@ -190,7 +186,6 @@ 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)))))
|
||||
@ -199,6 +194,7 @@ 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))
|
||||
@ -218,22 +214,6 @@ func _serve_handle(key string, cmd *ice.Command, m *ice.Message, w http.Response
|
||||
} else {
|
||||
m.CmdHand(cmd, key, cmds...)
|
||||
}
|
||||
func() {
|
||||
defer InfoLock.Lock()()
|
||||
Info.Commands[kit.Select(kit.Select("", cmds, 0), m.Option(ice.MSG_INDEX))]++
|
||||
switch r.Method {
|
||||
case http.MethodGet:
|
||||
Info.ServeGetCount++
|
||||
case http.MethodPut:
|
||||
Info.ServePutCount++
|
||||
case http.MethodPost:
|
||||
Info.ServePostCount++
|
||||
case http.MethodDelete:
|
||||
Info.ServeDeleteCount++
|
||||
}
|
||||
}()
|
||||
} else {
|
||||
m.RenderResult()
|
||||
}
|
||||
}
|
||||
func _serve_domain(m *ice.Message) string {
|
||||
@ -251,7 +231,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
|
||||
@ -259,9 +239,6 @@ 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), msg.Append(mdb.TYPE), msg.Append(mdb.NAME))
|
||||
m.RenderDownload(msg.Append(mdb.TEXT))
|
||||
default:
|
||||
RenderMain(m)
|
||||
}
|
||||
|
@ -23,35 +23,15 @@ import (
|
||||
"shylinux.com/x/icebergs/base/web/html"
|
||||
"shylinux.com/x/icebergs/misc/websocket"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
"shylinux.com/x/toolkits/task"
|
||||
)
|
||||
|
||||
var Info = struct {
|
||||
ServeMainCount int
|
||||
ServeGetCount int
|
||||
ServePutCount int
|
||||
ServePostCount int
|
||||
ServeDeleteCount int
|
||||
SpaceCmdCount int
|
||||
SpaceReadCount int
|
||||
SpaceReadByte int
|
||||
SpaceWriteCount int
|
||||
SpaceWriteByte int
|
||||
Commands map[string]int
|
||||
}{
|
||||
Commands: map[string]int{},
|
||||
}
|
||||
var InfoLock = &task.Lock{}
|
||||
|
||||
func _space_qrcode(m *ice.Message, dev string) {
|
||||
ssh.PrintQRCode(m, m.Cmdv(SPACE, dev, cli.PWD, mdb.LINK))
|
||||
}
|
||||
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,
|
||||
mdb.HELP, ice.Info.Titles,
|
||||
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, 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() {
|
||||
@ -94,18 +74,17 @@ func _space_fork(m *ice.Message) {
|
||||
safe := false
|
||||
if m.Option(ice.MSG_USERNAME, ""); kit.IsIn(m.Option(mdb.TYPE), WORKER, PORTAL) {
|
||||
if tcp.IsLocalHost(m, m.Option(ice.MSG_USERIP)) {
|
||||
aaa.SessAuth(m, kit.Dict(m.Cmd(aaa.USER, m.Option(ice.MSG_USERNAME, ice.Info.UserName)).AppendSimple()))
|
||||
aaa.SessAuth(m, kit.Dict(m.Cmd(aaa.USER, m.Option(ice.MSG_USERNAME, ice.Info.Username)).AppendSimple()))
|
||||
}
|
||||
} else if m.Option(TOKEN) != "" {
|
||||
if msg := m.Cmd(TOKEN, m.Option(TOKEN)); msg.Append(mdb.TIME) > m.Time() && kit.IsIn(msg.Append(mdb.TYPE), SERVER, SPIDE) {
|
||||
aaa.SessAuth(m, kit.Dict(m.Cmd(aaa.USER, m.Option(ice.MSG_USERNAME, msg.Append(mdb.NAME))).AppendSimple()))
|
||||
name = SpaceName(kit.Select(name, msg.Append(mdb.TEXT)))
|
||||
// kit.If(ProxyDomain(m.Spawn(kit.Dict(ice.MSG_USERROLE, aaa.TECH)), name), func(p string) { text = p })
|
||||
kit.If(ProxyDomain(m, name), func(p string) { text = p })
|
||||
safe = aaa.IsTechOrRoot(m)
|
||||
}
|
||||
}
|
||||
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 := 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 = 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)...)
|
||||
@ -148,14 +127,9 @@ func _space_handle(m *ice.Message, safe bool, name string, c *websocket.Conn) {
|
||||
if e != nil {
|
||||
break
|
||||
}
|
||||
func() {
|
||||
defer InfoLock.Lock()()
|
||||
Info.SpaceReadCount++
|
||||
Info.SpaceReadByte += len(b)
|
||||
}()
|
||||
msg := m.Spawn(b)
|
||||
if safe && msg.Option(ice.MSG_UNSAFE) != ice.TRUE { // 下行权限
|
||||
if !aaa.IsTechOrRoot(msg) && msg.Option(ice.MSG_HANDLE) != ice.TRUE && msg.Option(ice.MSG_USERUID) == "" {
|
||||
if !aaa.IsTechOrRoot(msg) && msg.Option(ice.MSG_HANDLE) != ice.TRUE {
|
||||
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))) })
|
||||
@ -234,11 +208,6 @@ func _space_exec(m *ice.Message, name string, source, target []string, c *websoc
|
||||
if m.IsErr() {
|
||||
return
|
||||
}
|
||||
func() {
|
||||
defer InfoLock.Lock()()
|
||||
Info.SpaceCmdCount++
|
||||
Info.Commands[kit.Select(kit.Select("", m.Detailv(), 0), m.Option(ice.MSG_INDEX))]++
|
||||
}()
|
||||
m.Options(ice.MSG_ARGS, "", ice.MSG_COUNT, "0")
|
||||
kit.If(m.Option(ice.MSG_DAEMON), func(p string) {
|
||||
m.Option(ice.MSG_DAEMON0, m.Option(ice.MSG_DAEMON))
|
||||
@ -260,11 +229,6 @@ func _space_echo(m *ice.Message, source, target []string, c *websocket.Conn) {
|
||||
m.Options(ice.MSG_SOURCE, source, ice.MSG_TARGET, target[1:])
|
||||
data := m.FormatMeta()
|
||||
if !m.WarnNotValid(c.WriteMessage(1, []byte(data))) {
|
||||
func() {
|
||||
defer InfoLock.Lock()()
|
||||
Info.SpaceWriteCount++
|
||||
Info.SpaceWriteByte += len(data)
|
||||
}()
|
||||
if source != nil {
|
||||
m.Log(kit.Select(tcp.SEND, tcp.DONE, m.Option(ice.MSG_HANDLE) == ice.TRUE), "%d %v->%v %v %v", len(data), source, target,
|
||||
kit.ReplaceAll(kit.Format("%v", m.Detailv()), "\r\n", "\\r\\n", "\t", "\\t", "\n", "\\n"), data)
|
||||
@ -367,7 +331,7 @@ func init() {
|
||||
"s": {Help: "空间", Actions: ApiWhiteAction(), Hand: func(m *ice.Message, arg ...string) { m.Cmdy(CHAT_POD, arg) }},
|
||||
SPACE: {Name: "space name cmds auto", Help: "空间站", Actions: ice.MergeActions(ice.Actions{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
cli.NodeInfo(m, ice.Info.PathName, WORKER)
|
||||
cli.NodeInfo(m, ice.Info.Pathname, WORKER)
|
||||
aaa.White(m, SPACE, ice.MAIN)
|
||||
if kit.IsIn(ice.Info.NodeIcon, "src/main.ico", "") {
|
||||
nfs.Exists(m, "src/main.ico", func(p string) { ice.Info.NodeIcon = p })
|
||||
@ -376,7 +340,7 @@ func init() {
|
||||
}
|
||||
}},
|
||||
mdb.ICONS: {Hand: func(m *ice.Message, arg ...string) {
|
||||
cli.NodeInfo(m, ice.Info.PathName, WORKER, arg[0])
|
||||
cli.NodeInfo(m, ice.Info.Pathname, WORKER, arg[0])
|
||||
m.Cmd(SERVE, m.ActionKey(), arg)
|
||||
}},
|
||||
ice.MAIN: {Name: "main index", Role: aaa.VOID, Hand: func(m *ice.Message, arg ...string) {
|
||||
@ -394,7 +358,7 @@ func init() {
|
||||
m.Push(mdb.ICONS, ice.Info.NodeIcon)
|
||||
m.Push(nfs.MODULE, ice.Info.Make.Module)
|
||||
m.Push(nfs.VERSION, ice.Info.Make.Versions())
|
||||
m.Push(nfs.PATHNAME, ice.Info.PathName)
|
||||
m.Push(nfs.PATHNAME, ice.Info.Pathname)
|
||||
m.Push(tcp.HOSTPORT, HostPort(m, m.Cmd(tcp.HOST).Append(aaa.IP), m.Cmd(SERVER).Append(tcp.PORT)))
|
||||
m.Push(ORIGIN, m.Option(ice.MSG_USERHOST))
|
||||
}},
|
||||
@ -447,7 +411,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,help,text,main,icons,module,version,agent,system,ip,usernick,username,userrole",
|
||||
mdb.SHORT, mdb.NAME, mdb.FIELD, "time,type,name,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 {
|
||||
@ -494,9 +458,6 @@ 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
|
||||
@ -530,10 +491,7 @@ 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])
|
||||
m.Push(mdb.HELP, value[mdb.HELP])
|
||||
})
|
||||
kit.If(kit.IsIn(value[mdb.TYPE], WORKER, SERVER), func() { m.Push(arg[0], value[mdb.NAME]) })
|
||||
})
|
||||
case SERVER:
|
||||
AdminCmd(m, SPACE).Table(func(value ice.Maps) {
|
||||
@ -562,8 +520,7 @@ func init() {
|
||||
} else {
|
||||
m.Cmdy(ctx.COMMAND)
|
||||
}
|
||||
m.Cut(ctx.INDEX, mdb.HELP)
|
||||
m.RenameAppend(ctx.INDEX, arg[0])
|
||||
m.CutTo(ctx.INDEX, arg[0])
|
||||
case ctx.ARGS:
|
||||
m.OptionDefault(ctx.INDEX, m.Option("extra.index"))
|
||||
if space := m.Option(SPACE); space != "" {
|
||||
|
@ -115,6 +115,7 @@ 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:
|
||||
@ -310,6 +311,7 @@ func init() {
|
||||
m.Cmd("", mdb.CREATE, kit.Select(dev, os.Getenv("ctx_dev_ip")), ice.DEV_IP, ice.SRC_MAIN_ICO, "dev_ip")
|
||||
m.Cmd("", mdb.CREATE, kit.Select("http://localhost:9020", conf[cli.CTX_OPS]), ice.OPS, ice.SRC_MAIN_ICO, nfs.REPOS)
|
||||
m.Cmd("", mdb.CREATE, kit.Select("https://shylinux.com", conf[cli.CTX_SHY]), ice.SHY, ice.SRC_MAIN_ICO, nfs.REPOS)
|
||||
m.Cmd("", mdb.CREATE, kit.Select("https://web.shylinux.com", conf[cli.CTX_WEB]), ice.WEB, ice.SRC_MAIN_ICO, nfs.REPOS)
|
||||
m.Cmd("", mdb.CREATE, kit.Select("https://mail.shylinux.com", conf[cli.CTX_MAIL]), ice.MAIL, "usr/icons/Mail.png", "mail")
|
||||
m.Cmd("", mdb.CREATE, kit.Select("https://demo.shylinux.com", conf[cli.CTX_DEMO]), ice.DEMO, ice.SRC_MAIN_ICO, "demo")
|
||||
m.Cmd("", mdb.CREATE, "https://2023.shylinux.com", "2023-ContextOS", ice.SRC_MAIN_ICO, nfs.REPOS)
|
||||
@ -387,9 +389,8 @@ func init() {
|
||||
mdb.HashModify(m, mdb.NAME, m.Option(CLIENT_NAME), TOKEN, "")
|
||||
}},
|
||||
DEV_CREATE_TOKEN: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.OptionDefault(CLIENT_NAME, m.Option(ice.FROM_SPACE))
|
||||
mdb.HashModify(m, m.OptionSimple(CLIENT_NAME, TOKEN))
|
||||
m.Cmd(SPACE, tcp.DIAL, m.Option(CLIENT_NAME)).Sleep300ms()
|
||||
m.Cmd(SPACE, tcp.DIAL, ice.DEV, m.Option(CLIENT_NAME), m.OptionSimple(TOKEN)).Sleep300ms()
|
||||
}},
|
||||
DEV_REQUEST_TEXT: {Hand: func(m *ice.Message, arg ...string) { m.Echo(SpaceName(ice.Info.NodeName)) }},
|
||||
}, DevTokenAction(CLIENT_NAME, CLIENT_URL), mdb.ImportantHashAction(mdb.SHORT, CLIENT_NAME, mdb.FIELD, "time,icons,client.name,client.url,client.type,token")), Hand: func(m *ice.Message, arg ...string) {
|
||||
@ -430,17 +431,8 @@ 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 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 ""
|
||||
return m.Cmdx(nfs.CAT, p)
|
||||
}
|
||||
}
|
||||
nfs.TemplatePath = func(m *ice.Message, arg ...string) string {
|
||||
|
@ -24,7 +24,7 @@ func init() {
|
||||
PushStats(m, "", "", "", "令牌总数", TOKEN)
|
||||
PushStats(m, "", "", "", "注册总数", aaa.APPLY)
|
||||
PushStats(m, "", "", "", "邀请总数", aaa.OFFER)
|
||||
if ice.Info.UserName == ice.Info.Make.Username {
|
||||
if ice.Info.Username == ice.Info.Make.Username {
|
||||
PushStats(m, "", m.Cmd(aaa.USER).Length()-1, "", "用户总数", aaa.USER)
|
||||
} else {
|
||||
PushStats(m, "", m.Cmd(aaa.USER).Length()-2, "", "用户总数", aaa.USER)
|
||||
|
@ -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 { border:var(--plugin-border); border-radius:var(--plugin-radius); }
|
||||
$content>div.item { box-shadow:var(--th-box-shadow); 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); }
|
||||
|
@ -37,10 +37,6 @@ func init() {
|
||||
mdb.REMOVE: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(SPIDE, mdb.REMOVE, CLIENT_NAME, m.Option(mdb.NAME))
|
||||
}},
|
||||
tcp.DIAL: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Options(m.Cmd(SPIDE, m.Option(mdb.NAME)).AppendSimple())
|
||||
m.Cmdy(SPIDE, mdb.DEV_REQUEST)
|
||||
}},
|
||||
INSTALL: {Name: "install name*", Hand: func(m *ice.Message, arg ...string) {
|
||||
if !kit.HasPrefixList(arg, ctx.RUN) {
|
||||
m.Cmdy(DREAM, mdb.CREATE, m.OptionSimple(mdb.NAME, nfs.REPOS, nfs.BINARY))
|
||||
@ -51,6 +47,12 @@ func init() {
|
||||
PORTAL: {Role: aaa.VOID, Hand: func(m *ice.Message, arg ...string) {
|
||||
ProcessIframe(m, m.Option(mdb.NAME), m.Option(ORIGIN)+S(m.Option(mdb.NAME))+C(m.ActionKey()), arg...)
|
||||
}},
|
||||
DESKTOP: {Role: aaa.VOID, Hand: func(m *ice.Message, arg ...string) {
|
||||
ProcessIframe(m, kit.Keys(m.Option(mdb.NAME), m.ActionKey()), S(m.Option(mdb.NAME))+C(m.ActionKey()), arg...)
|
||||
}},
|
||||
ADMIN: {Role: aaa.VOID, Hand: func(m *ice.Message, arg ...string) {
|
||||
ProcessIframe(m, kit.Keys(m.Option(mdb.NAME), m.ActionKey()), S(m.Option(mdb.NAME))+C(m.ActionKey()), arg...)
|
||||
}},
|
||||
OPEN: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if m.Option(mdb.TYPE) == ORIGIN {
|
||||
m.ProcessOpen(m.Option(ORIGIN))
|
||||
@ -58,6 +60,10 @@ func init() {
|
||||
m.ProcessOpen(S(m.Option(mdb.NAME)))
|
||||
}
|
||||
}},
|
||||
"connect": {Help: "连接", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Options(m.Cmd(SPIDE, m.Option(mdb.NAME)).AppendSimple())
|
||||
m.Cmdy(SPIDE, mdb.DEV_REQUEST)
|
||||
}},
|
||||
}, ctx.ConfAction(CLIENT_TIMEOUT, cli.TIME_3s), DREAM), Hand: func(m *ice.Message, arg ...string) {
|
||||
if kit.HasPrefixList(arg, ctx.ACTION) {
|
||||
m.Cmdy(DREAM, arg)
|
||||
@ -66,7 +72,8 @@ func init() {
|
||||
m.Cmd(SPIDE, arg, kit.Dict(ice.MSG_FIELDS, "time,icons,client.type,client.name,client.origin")).Table(func(value ice.Maps) {
|
||||
kit.If(value[CLIENT_TYPE] == nfs.REPOS && value[CLIENT_NAME] != ice.SHY, func() {
|
||||
kit.If(value[CLIENT_NAME] == ice.OPS, func() { value[CLIENT_ORIGIN] = UserHost(m) })
|
||||
m.Push(mdb.TYPE, ORIGIN).Push(mdb.NAME, value[CLIENT_NAME]).Push(mdb.ICONS, value[mdb.ICONS]).Push(ORIGIN, value[CLIENT_ORIGIN])
|
||||
m.Push(mdb.TYPE, ORIGIN)
|
||||
m.Push(mdb.NAME, value[CLIENT_NAME]).Push(mdb.ICONS, value[mdb.ICONS]).Push(ORIGIN, value[CLIENT_ORIGIN])
|
||||
if _, ok := list[value[CLIENT_NAME]]; ok || kit.IsIn(value[CLIENT_NAME], ice.OPS, ice.DEV) {
|
||||
m.Push(mdb.STATUS, ice.TRUE)
|
||||
} else {
|
||||
@ -74,10 +81,11 @@ func init() {
|
||||
}
|
||||
})
|
||||
})
|
||||
if m.SortStrR(mdb.NAME); ice.Info.NodeType == WORKER || !aaa.IsTechOrRoot(m) {
|
||||
m.SortStrR(mdb.NAME)
|
||||
if ice.Info.NodeType == WORKER || !aaa.IsTechOrRoot(m) {
|
||||
m.Action()
|
||||
} else {
|
||||
m.PushAction(OPEN, tcp.DIAL, mdb.REMOVE).Action(mdb.CREATE)
|
||||
m.PushAction(OPEN, "connect", mdb.REMOVE).Action(mdb.CREATE)
|
||||
}
|
||||
} else {
|
||||
defer ToastProcess(m, ice.LIST, arg[0])()
|
||||
@ -94,17 +102,14 @@ func init() {
|
||||
// } else {
|
||||
// origin = tcp.PublishLocalhost(m, origin)
|
||||
// }
|
||||
// origin = tcp.PublishLocalhost(m, origin)
|
||||
origin = tcp.PublishLocalhost(m, origin)
|
||||
stat := map[string]int{}
|
||||
list := m.Spawn(ice.Maps{ice.MSG_FIELDS: ""}).CmdMap(SPACE, mdb.NAME)
|
||||
m.SetAppend().Spawn().SplitIndex(m.Cmdx(SPIDE, arg[0], dream, kit.Dict(mdb.ConfigSimple(m, CLIENT_TIMEOUT)))).Table(func(value ice.Maps) {
|
||||
if value[mdb.TYPE] == ORIGIN {
|
||||
return
|
||||
}
|
||||
stat[value[mdb.TYPE]]++
|
||||
if value[nfs.BINARY] == "" {
|
||||
value[nfs.BINARY] = origin + S(value[mdb.NAME])
|
||||
}
|
||||
// if value[nfs.BINARY] == "" {
|
||||
value[nfs.BINARY] = origin + S(value[mdb.NAME])
|
||||
// }
|
||||
m.Push("", value, kit.Split("time,type,name,icons,repos,binary,module,version"))
|
||||
if _, ok := list[value[mdb.NAME]]; ok {
|
||||
m.Push(mdb.STATUS, ice.TRUE)
|
||||
|
34
conf.go
34
conf.go
@ -171,7 +171,6 @@ 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"
|
||||
@ -221,24 +220,21 @@ const ( // MSG
|
||||
MSG_DISPLAY_CSS = "_display_css"
|
||||
MSG_TOOLKIT = "_toolkit"
|
||||
|
||||
MSG_USERIP = "user.ip"
|
||||
MSG_USERUA = "user.ua"
|
||||
MSG_USERURL = "user.url"
|
||||
MSG_USERWEB = "user.web"
|
||||
MSG_USERPOD = "user.pod"
|
||||
MSG_USERPOD0 = "user.pod0"
|
||||
MSG_USERWEB0 = "user.web0"
|
||||
MSG_USERHOST = "user.host"
|
||||
MSG_USERADDR = "user.addr"
|
||||
MSG_USERDATA = "user.data"
|
||||
MSG_USERNICK = "user.nick"
|
||||
MSG_USERNAME = "user.name"
|
||||
MSG_USERROLE = "user.role"
|
||||
MSG_USERZONE = "user.zone"
|
||||
MSG_LANGUAGE = "user.lang"
|
||||
MSG_AVATAR = "user.avatar"
|
||||
MSG_USERSTATUS = "user.status"
|
||||
MSG_USERUID = "user.uid"
|
||||
MSG_USERIP = "user.ip"
|
||||
MSG_USERUA = "user.ua"
|
||||
MSG_USERWEB = "user.web"
|
||||
MSG_USERPOD = "user.pod"
|
||||
MSG_USERPOD0 = "user.pod0"
|
||||
MSG_USERWEB0 = "user.web0"
|
||||
MSG_USERHOST = "user.host"
|
||||
MSG_USERADDR = "user.addr"
|
||||
MSG_USERDATA = "user.data"
|
||||
MSG_USERNICK = "user.nick"
|
||||
MSG_USERNAME = "user.name"
|
||||
MSG_USERROLE = "user.role"
|
||||
MSG_USERZONE = "user.zone"
|
||||
MSG_LANGUAGE = "user.lang"
|
||||
MSG_AVATAR = "user.avatar"
|
||||
|
||||
MSG_BG = "sess.bg"
|
||||
MSG_FG = "sess.fg"
|
||||
|
@ -60,7 +60,7 @@ func init() {
|
||||
if msg.Length() == 0 {
|
||||
return
|
||||
}
|
||||
m.Options(tcp.HOSTNAME, ice.Info.HostName, nfs.PATH, msg.Append(mdb.TEXT))
|
||||
m.Options(tcp.HOSTNAME, ice.Info.Hostname, nfs.PATH, msg.Append(mdb.TEXT))
|
||||
if !m.WarnNotValid(m.Option(nfs.PATH) == "", arg[0]) {
|
||||
m.Option(aaa.IP, msg.Append(aaa.IP))
|
||||
m.Option(ice.MSG_USERUA, msg.Append(aaa.UA))
|
||||
|
@ -127,7 +127,7 @@ func init() {
|
||||
m.Cmd("", mdb.CREATE, mdb.TYPE, mdb.PLUGIN, mdb.NAME, "免登录体验", mdb.ORDER, "12", ctx.INDEX, HEADER, ctx.ARGS, ice.DEMO)
|
||||
mdb.Config(m, ice.DEMO, ice.TRUE)
|
||||
} else if mdb.Config(m, ice.DEMO) == ice.TRUE {
|
||||
web.RenderCookie(m, aaa.SessCreate(m, ice.Info.UserName))
|
||||
web.RenderCookie(m, aaa.SessCreate(m, ice.Info.Username))
|
||||
m.Echo("login success")
|
||||
} else {
|
||||
m.Echo("login failure")
|
||||
@ -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,prompt,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,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"))
|
||||
@ -154,25 +154,17 @@ func init() {
|
||||
m.Option(ice.MSG_NODETYPE, ice.Info.NodeType)
|
||||
m.Option(ice.MSG_NODENAME, ice.Info.NodeName)
|
||||
m.Option("favicon", ice.Info.NodeIcon)
|
||||
m.Option("titles", kit.GetValid(
|
||||
func() string { return kit.Select("", ice.Info.Titles, ice.Info.Titles != "ContextOS") },
|
||||
func() string { return kit.Select("", ice.Info.NodeName, ice.Info.NodeName != "ContextOS") },
|
||||
func() string { return kit.Select("", ice.Info.PathName, ice.Info.PathName != "ContextOS") },
|
||||
func() string { return kit.Select("", ice.Info.HostName, ice.Info.HostName != "ContextOS") },
|
||||
))
|
||||
if ice.Info.NodeType == web.WORKER && ice.Info.Titles == "ContextOS" {
|
||||
return
|
||||
}
|
||||
m.Option("titles", ice.Info.Titles)
|
||||
})
|
||||
if ice.Info.NodeType == web.WORKER {
|
||||
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 {
|
||||
return kit.Select("", kit.Split(m.R.Header.Get(html.AcceptLanguage), ",;"), 0)
|
||||
}
|
||||
return ""
|
||||
},
|
||||
func() string { return kit.Select("", kit.Split(m.R.Header.Get(html.AcceptLanguage), ",;"), 0) },
|
||||
func() string { return ice.Info.Lang },
|
||||
), " ."), 0)), "_", "-"))
|
||||
m.Option("language.list", m.Cmd(nfs.DIR, nfs.TemplatePath(m, aaa.LANGUAGE)+nfs.PS, nfs.FILE).Appendv(nfs.FILE))
|
||||
|
@ -1,10 +1,17 @@
|
||||
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"
|
||||
@ -18,6 +25,23 @@ 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,7 +27,6 @@ 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); }
|
||||
@ -64,15 +63,8 @@ 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; }
|
||||
@ -81,9 +73,7 @@ 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; }
|
||||
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.item.avatar>img { 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; }
|
||||
@ -96,8 +86,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); }
|
||||
@ -106,7 +96,6 @@ 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; }
|
||||
@ -115,7 +104,7 @@ fieldset.macos.menu.cmd>div.output>div.menu { padding:0 var(--button-padding); }
|
||||
body.dark fieldset.desktop>div.output>fieldset.macos { background-color:#08234ad1; }
|
||||
body.light fieldset.desktop>div.output>fieldset.macos { background-color:#daefff99; }
|
||||
body.white fieldset.desktop>div.output>div.desktop>div.item>div.name { color:white; }
|
||||
body.mobile fieldset.desktop>div.output>div.desktop>fieldset>legend { float:left; }
|
||||
body.mobile fieldset.desktop>div.output>div.desktop>fieldset>legend { float:none; }
|
||||
body.mobile fieldset.desktop>div.output>div.desktop>fieldset>form.option>div.item.text>input { width:60px; }
|
||||
body.mobile fieldset.macos.dock>div.output { overflow-y:hidden; }
|
||||
body.windows fieldset.desktop>div.output>fieldset.macos.notifications>div.action>div.item.refresh>span { font-size:24px; margin-top:0; }
|
||||
|
@ -20,22 +20,22 @@ func init() {
|
||||
}},
|
||||
ice.CTX_OPEN: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if m.Cmd(DESKTOP).Length() == 0 {
|
||||
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")
|
||||
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)
|
||||
}
|
||||
if m.Cmd(DOCK).Length() == 0 {
|
||||
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")
|
||||
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)
|
||||
}
|
||||
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(), mdb.TEXT, cmd.Help)
|
||||
cmd.Icon = AppInstall(m, cmd.Icon, m.PrefixKey())
|
||||
}
|
||||
})
|
||||
})
|
||||
@ -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("space,index,args"), mdb.ExportHashAction())},
|
||||
}, web.DreamTablesAction(), PodCmdAction(), CmdHashAction(ctx.INDEX), mdb.ExportHashAction())},
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -4,9 +4,9 @@ Volcanos(chat.ONIMPORT, {
|
||||
can.onlayout.background(can, can.misc.ResourceIcons(can, can.user.info.background||"usr/icons/background.png"), can._fields)
|
||||
can.onimport._menu(can), can.onimport._notifications(can), can.onimport._searchs(can), can.onimport._dock(can)
|
||||
can.sup.onexport.link = function() { return can.misc.MergeURL(can, {pod: can.ConfSpace()||can.misc.Search(can, ice.POD), cmd: web.DESKTOP}) }
|
||||
// can.onexport.title(can, can.ConfHelp(), can.user.titles)
|
||||
can.onexport.title(can, can.ConfHelp(), can.user.titles)
|
||||
},
|
||||
_menu: function(can) { can.onappend.plugin(can, {index: "web.chat.macos.menu", style: html.OUTPUT, title: can.Conf("title")}, function(sub) { can.ui.menu = sub, sub._desktop = can
|
||||
_menu: function(can) { can.onappend.plugin(can, {index: "web.chat.macos.menu", style: html.OUTPUT}, function(sub) { can.ui.menu = sub, sub._desktop = can
|
||||
var tabs = can.misc.sessionStorage(can, [can.ConfIndex(), html.TABS])
|
||||
sub.onexport.output = function() { can.onimport._desktop(can, can._msg)
|
||||
var sess = can.misc.SearchHash(can)[0]||can.Conf("session")
|
||||
@ -71,28 +71,15 @@ 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) { if (!can.user.isTechOrRoot(can)) { return } var carte = can.user.carteRight(event, can, {
|
||||
oncontextmenu: function(event) { 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.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.left = (can.ConfWidth()-item.width)/2, item.top = (can.ConfHeight()-item.height-125)/4+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() {
|
||||
@ -102,10 +89,7 @@ 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), style: msg.Option("style"), index: web.CHAT_IFRAME, args: [arg]})
|
||||
}
|
||||
sub.onimport._open = function(sub, msg, arg) { can.onimport._window(can, {title: msg.Option(html.TITLE), 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() }) }
|
||||
@ -113,12 +97,7 @@ 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, 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.onexport.output = function() { 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,6 +14,4 @@ func init() {
|
||||
})
|
||||
}
|
||||
|
||||
func DockAppend(m *ice.Message, icon, index string, arg ...string) {
|
||||
install(m, DOCK, icon, index, arg...)
|
||||
}
|
||||
func DockAppend(m *ice.Message, icon, index string) { install(m, DOCK, icon, index) }
|
||||
|
@ -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,20 +1,18 @@
|
||||
Volcanos(chat.ONIMPORT, {
|
||||
_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) {
|
||||
case ".":
|
||||
case "applications": can.onimport.icons(can, msg, can.ui.content); break
|
||||
default: can.onappend.table(can, msg, null, can.ui.content)
|
||||
} can.onimport.layout(can)
|
||||
})
|
||||
_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) {
|
||||
case ".":
|
||||
case "applications": can.onimport.icons(can, msg, can.ui.content); break
|
||||
default: can.onappend.table(can, msg, null, can.ui.content)
|
||||
} 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.isTechOrRoot(can) && can.user.carteRight(event, can, {
|
||||
oncontextmenu: function(event) { 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,9 +1,6 @@
|
||||
package macos
|
||||
|
||||
import (
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/aaa"
|
||||
"shylinux.com/x/icebergs/base/cli"
|
||||
@ -53,35 +50,17 @@ 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...))
|
||||
msg := disableApp(mdb.HashSelect(m.Spawn(), arg...).Sort(mdb.NAME))
|
||||
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]+value[ctx.ARGS]], func() { has[value[ctx.INDEX]+value[ctx.ARGS]] = true; m.Push("", value, head) })
|
||||
kit.If(!has[value[ctx.INDEX]], func() { has[value[ctx.INDEX]] = true; m.Push("", value, head) })
|
||||
})
|
||||
m.Sort("score,space,index,args", ice.INT)
|
||||
}},
|
||||
}
|
||||
}
|
||||
@ -98,7 +77,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("score,space,index,args").Display(m.FileURI(file)))
|
||||
disableApp(mdb.HashSelect(m, arg...).Sort(mdb.NAME).Display(m.FileURI(file)))
|
||||
}},
|
||||
}, 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)))
|
||||
}, 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)))
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ Volcanos(chat.ONIMPORT, {_init: function(can, msg) { can.page.style(can, can._ou
|
||||
{view: [[html.MENU, html.TITLE]], list: [
|
||||
{img: can.misc.ResourceFavicon(can, msg.Option(html.FAVICON), can.ConfSpace())},
|
||||
{text: decodeURIComponent(
|
||||
can.Conf("title")||
|
||||
(window == top? can.user.info.titles: "")||can.ConfSpace()||can.misc.Search(can, ice.POD)||location.host
|
||||
)},
|
||||
], onclick: function(event) { can.sup.onexport.record(can, html.DESKTOP) }},
|
||||
|
@ -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)
|
||||
|
@ -1,11 +0,0 @@
|
||||
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,9 +158,6 @@ 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) {
|
||||
@ -173,8 +170,7 @@ 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)), "-3")
|
||||
m.ProcessCookie(ice.MSG_SESSID, aaa.SessCreate(m.Message, msg.Option(aaa.USERNAME)), "-2")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,22 +18,6 @@ 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)
|
||||
|
@ -49,9 +49,6 @@ func _autogen_import(m *ice.Message, main string, ctx string, mod string) string
|
||||
_autogen_defs(m, ice.SRC_MAIN_GO, ice.ETC_MISS_SH, ice.README_MD, ice.MAKEFILE, ice.LICENSE)
|
||||
begin, done, list := false, false, []string{}
|
||||
imports := kit.Format(`_ "%s/src/%s"`, mod, ctx)
|
||||
if mod == "shylinux.com/x/ice" {
|
||||
imports = kit.Format(`_ "%s/%s"`, mod, ctx)
|
||||
}
|
||||
m.Cmd(nfs.CAT, main, func(line string, index int) {
|
||||
if strings.HasSuffix(line, imports) {
|
||||
done = true
|
||||
@ -106,7 +103,7 @@ func _autogen_git(m *ice.Message, arg ...string) ice.Map {
|
||||
msg.Append("icebergs", value["version"])
|
||||
}
|
||||
})
|
||||
return kit.Dict(arg, aaa.USERNAME, m.Option(ice.MSG_USERNAME), tcp.HOSTNAME, ice.Info.HostName, nfs.PATH, kit.Path("")+nfs.PS, mdb.TIME, m.Time(),
|
||||
return kit.Dict(arg, aaa.USERNAME, m.Option(ice.MSG_USERNAME), tcp.HOSTNAME, ice.Info.Hostname, nfs.PATH, kit.Path("")+nfs.PS, mdb.TIME, m.Time(),
|
||||
GIT, GitVersion(m), GO, GoVersion(m), nfs.MODULE, _autogen_mod(m, ice.GO_MOD),
|
||||
msg.AppendSimple("remote,branch,version,forword,author,email,hash,when,message,release,icebergs"),
|
||||
web.DOMAIN, m.Spawn(kit.Dict(ice.MSG_USERWEB, web.UserHost(m), ice.MSG_USERPOD, m.Option(ice.MSG_USERPOD))).MergePod(""),
|
||||
@ -197,12 +194,14 @@ func init() {
|
||||
}
|
||||
}},
|
||||
DEVPACK: {Help: "开发", Hand: func(m *ice.Message, arg ...string) {
|
||||
if m.Cmdy(WEBPACK, mdb.REMOVE); ice.Info.NodeType == web.SERVER {
|
||||
m.Cmdy(web.DREAM, nfs.GOWORK)
|
||||
m.Cmdy(WEBPACK, mdb.REMOVE)
|
||||
if ice.Info.NodeType == web.SERVER {
|
||||
m.Cmd(web.DREAM, nfs.GOWORK)
|
||||
}
|
||||
}},
|
||||
WEBPACK: {Help: "打包", Hand: func(m *ice.Message, arg ...string) {
|
||||
if m.Cmdy(WEBPACK, mdb.CREATE); ice.Info.NodeType == web.SERVER {
|
||||
m.Cmdy(WEBPACK, mdb.CREATE)
|
||||
if ice.Info.NodeType == web.SERVER {
|
||||
nfs.Trash(m, ice.GO_WORK_SUM)
|
||||
nfs.Trash(m, ice.GO_WORK)
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package code
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path"
|
||||
"runtime"
|
||||
"strings"
|
||||
@ -111,17 +112,17 @@ 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", 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,github.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}
|
||||
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) })
|
||||
args := []string{main, ice.SRC_VERSION_GO, ice.SRC_BINPACK_GO, ice.SRC_BINPACK_USR_GO}
|
||||
if _, e := os.Stat("src/option.go"); e == nil {
|
||||
args = append(args, "src/option.go")
|
||||
}
|
||||
if msg := GoBuild(m.Spawn(), file, args...); !cli.IsSuccess(msg) {
|
||||
m.Copy(msg)
|
||||
} else {
|
||||
|
@ -18,9 +18,6 @@ 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
|
||||
@ -65,9 +62,6 @@ 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,7 +5,6 @@ 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"
|
||||
@ -62,33 +61,6 @@ 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]), "", "")
|
||||
@ -96,8 +68,31 @@ 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 _go_portal(m, arg...) {
|
||||
} 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 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) &&
|
||||
!kit.IsIn(arg[1],
|
||||
"gonganxitong/user.go",
|
||||
"gonganxitong/sess.go",
|
||||
"gonganxitong/grant.go",
|
||||
"gonganxitong/domain.go",
|
||||
"gonganxitong/command.go",
|
||||
"gonganxitong/quotalist.go",
|
||||
) {
|
||||
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())
|
||||
@ -231,9 +226,9 @@ func TableName(model string) string {
|
||||
if strings.Contains("0123456789", model[len(model)-1:]) {
|
||||
return model
|
||||
}
|
||||
if kit.IsIn(model, "sms", "equipment", "bonus") {
|
||||
if kit.IsIn(model, "sms", "equipment") {
|
||||
|
||||
} else if kit.HasSuffix(model, "y") && !kit.HasSuffix(model, "way") {
|
||||
} else if kit.HasSuffix(model, "y") {
|
||||
model = model[:len(model)-1] + "ies"
|
||||
} else if kit.HasSuffix(model, "s") {
|
||||
if !kit.HasSuffix(model, "os") {
|
||||
|
@ -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: {Role: aaa.VOID, Hand: func(m *ice.Message, arg ...string) { _inner_show(m, arg[0], arg[1], arg[2]) }},
|
||||
mdb.RENDER: {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,6 +1,7 @@
|
||||
package code
|
||||
|
||||
import (
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
@ -20,7 +21,15 @@ 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 _go_portal(m, arg...) {
|
||||
} else {
|
||||
if p := path.Join(arg[2], strings.Split(arg[1], "/")[0], "portal.go"); 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())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,12 +32,6 @@ 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)
|
||||
}},
|
||||
|
@ -62,13 +62,13 @@ func init() {
|
||||
}), Hand: func(m *ice.Message, arg ...string) {
|
||||
repos := map[string]string{}
|
||||
list := map[string]map[string]string{}
|
||||
list[ice.Info.PathName] = map[string]string{}
|
||||
list[ice.Info.Pathname] = map[string]string{}
|
||||
m.Cmds(web.CODE_GIT_REPOS).Table(func(value ice.Maps) { repos[strings.Split(value[web.ORIGIN], "://")[1]] = value[nfs.VERSION] })
|
||||
m.Cmd(web.CODE_MOD, mdb.RENDER, MOD, ice.GO_MOD, nfs.PWD).Table(func(value ice.Maps) {
|
||||
list[ice.Info.PathName][value[REQUIRE]] = value[VERSION]
|
||||
list[ice.Info.Pathname][value[REQUIRE]] = value[VERSION]
|
||||
if value[REPLACE] == nfs.PWD {
|
||||
list[ice.Info.PathName][MODULE] = value[REQUIRE]
|
||||
list[ice.Info.PathName][VERSION] = value[VERSION]
|
||||
list[ice.Info.Pathname][MODULE] = value[REQUIRE]
|
||||
list[ice.Info.Pathname][VERSION] = value[VERSION]
|
||||
} else {
|
||||
repos[value[REQUIRE]] = value[VERSION]
|
||||
}
|
||||
|
@ -136,16 +136,11 @@ 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))
|
||||
}},
|
||||
|
@ -94,7 +94,7 @@ func init() {
|
||||
kit.If(value[mdb.TYPE] == SHELL, func() { m.Push(arg[0], value[mdb.TEXT]) })
|
||||
})
|
||||
case mdb.NAME:
|
||||
m.Push(arg[0], path.Base(m.Option(mdb.TYPE)), ice.Info.HostName)
|
||||
m.Push(arg[0], path.Base(m.Option(mdb.TYPE)), ice.Info.Hostname)
|
||||
case nfs.PATH:
|
||||
m.Cmdy(nfs.DIR, ice.USR_LOCAL_WORK, nfs.PATH)
|
||||
m.Cmdy(nfs.DIR, ice.USR_LOCAL_REPOS, nfs.PATH)
|
||||
|
@ -37,7 +37,6 @@ 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 {
|
||||
@ -58,17 +57,9 @@ func (s *Label) Draw(m *ice.Message, x, y int) wiki.Chart {
|
||||
item.Width = s.max[i]
|
||||
}
|
||||
if m.Option(HIDE_BLOCK) != ice.TRUE {
|
||||
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.EchoRect(RECT, item.GetHeight(), item.GetWidth(), left+item.MarginX/2, top+item.MarginY/2, args...)
|
||||
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.fg"), "fill", m.Option("order.fg")))
|
||||
}
|
||||
gs.EchoText(TEXT, left+item.GetWidths()/2, top+item.GetHeights()/2, item.Text, args...)
|
||||
gs.EchoText(TEXT, left+item.GetWidths()/2, top+item.GetHeights()/2, item.Text)
|
||||
if left += item.GetWidths(); item.GetHeights() > height {
|
||||
height = item.GetHeights()
|
||||
}
|
||||
|
@ -1,81 +1,74 @@
|
||||
$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); }
|
||||
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; }
|
||||
div.story[data-type=qrcode] { text-align:center; }
|
||||
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; }
|
||||
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; }
|
||||
|
@ -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("").DisplayCSS("")
|
||||
m.Display("")
|
||||
}},
|
||||
})
|
||||
}
|
||||
|
@ -58,7 +58,6 @@ 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)
|
||||
@ -70,7 +69,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,7 +99,6 @@ 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" {
|
||||
@ -121,7 +120,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(BRIEF, arg[0]).Cmdy(ORDER, arg[1])
|
||||
m.Cmdy(SPARK, TITLE, 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))
|
||||
@ -130,7 +129,7 @@ func _spark_project(m *ice.Message, arg ...string) {
|
||||
}()
|
||||
}()
|
||||
func() {
|
||||
defer m.Cmdy(STYLE, COLUMN, FLEX, "0 0 480px").Cmdy(STYLE, END)
|
||||
defer m.Cmdy(STYLE, COLUMN, FLEX, "0 0 500px", "padding", "10px").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 > 50000, ErrTooDeepCount) {
|
||||
if count := kit.Int(m.Option(MSG_COUNT, kit.Format(kit.Int(m.Option(MSG_COUNT))+1))); m.Warn(count > 3000, 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.20
|
||||
shylinux.com/x/toolkits v1.0.18
|
||||
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.20 h1:uBnfyyqDsbSWYsXfXmBugZ8ZWp5QQ8sthrzRdJ6ET90=
|
||||
shylinux.com/x/toolkits v1.0.20/go.mod h1:CHDJarGlDkg60kVsvMLYL/a5hAnRLEOShiEsMOuEp0Q=
|
||||
shylinux.com/x/toolkits v1.0.18 h1:jtQZhmvU10Ajegc87tU0cYFUBSviaODo5TsCXpYb2O4=
|
||||
shylinux.com/x/toolkits v1.0.18/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=
|
||||
|
15
info.go
15
info.go
@ -46,7 +46,7 @@ func (s MakeInfo) Versions() string {
|
||||
}
|
||||
}
|
||||
func (s info) Title() string {
|
||||
p := path.Base(kit.Select(s.PathName, s.Make.Remote, s.Titles))
|
||||
p := path.Base(kit.Select(s.Pathname, s.Make.Remote, s.Titles))
|
||||
if strings.HasPrefix(p, "20") {
|
||||
p = kit.Join(strings.Split(p, "-")[1:], "-")
|
||||
}
|
||||
@ -63,9 +63,9 @@ type info struct {
|
||||
Size string
|
||||
Hash string
|
||||
|
||||
UserName string
|
||||
HostName string
|
||||
PathName string
|
||||
Username string
|
||||
Hostname string
|
||||
Pathname string
|
||||
NodeName string
|
||||
NodeType string
|
||||
NodeIcon string
|
||||
@ -308,9 +308,6 @@ 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
|
||||
}
|
||||
@ -332,9 +329,7 @@ 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,7 +7,6 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"path"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
@ -124,8 +123,7 @@ func (m *Message) Warn(err Any, arg ...Any) bool {
|
||||
}
|
||||
str, meta := m.join(arg...)
|
||||
if m.log(LOG_WARN, str, meta...); len(arg) > 0 {
|
||||
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.Option(MSG_TITLE, kit.JoinWord(kit.Keys(m.Option(MSG_USERPOD), m.CommandKey(), m.ActionKey()), logs.FileLines(-2)))
|
||||
m.error(arg...)
|
||||
kit.If(map[string]int{
|
||||
ErrNotLogin: http.StatusUnauthorized,
|
||||
|
4
meta.go
4
meta.go
@ -130,10 +130,6 @@ func (m *Message) Push(key string, value Any, arg ...Any) *Message {
|
||||
k = strings.TrimSuffix(k, "*")
|
||||
m.Push(k, kit.Select(kit.Format(val[k]), value[k]))
|
||||
})
|
||||
case map[string]int:
|
||||
kit.For(value, func(key string, value int) {
|
||||
m.Push(key, value)
|
||||
})
|
||||
default:
|
||||
keys := strings.Split(key, ",")
|
||||
kit.For(kit.Simple(value, arg), func(v string, i int) {
|
||||
|
@ -16,7 +16,6 @@ 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.HashAction(
|
||||
}, gdb.EventsAction(web.SPACE_GRANT, web.SPACE_LOGIN_CLOSE), mdb.ExportHashAction(
|
||||
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, TOKENS, TICKET, mdb.REMOVE).StatusTimeCount(mdb.ConfigSimple(m, ACCESS, APPID), web.SERVE, m.MergeLink("/chat/wx/login/"))
|
||||
mdb.HashSelect(m, arg...).PushAction(OAUTH, web.SSO, 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", kit.Int(res.Append(oauth.EXPIRES_IN))-3600)), token, res.Append(kit.Select(oauth.ACCESS_TOKEN, TICKET, api == TICKET_GETTICKET)))
|
||||
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)))
|
||||
msg = mdb.HashSelect(m.Spawn(), m.Option(ACCESS))
|
||||
}
|
||||
m.Echo(msg.Append(token)).Status(msg.AppendSimple(expire))
|
||||
|
@ -51,15 +51,8 @@ func init() {
|
||||
}, gdb.EventsAction(chat.HEADER_AGENT), ctx.ConfAction(
|
||||
"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.Cmdy(ACCESS, AGENT).Options(SIGNATURE, _wx_sign(m, m.Option(NONCESTR, ice.Info.Pathname), m.Option(TIMESTAMP, kit.Format(time.Now().Unix())))).Display("")
|
||||
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,6 +8,13 @@ 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)
|
||||
} }) },
|
||||
@ -17,47 +24,23 @@ 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) {
|
||||
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),
|
||||
})
|
||||
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))
|
||||
} }) },
|
||||
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",
|
||||
], can.user.isMobile? ["updateTimelineShareData"]: []), openTagList: ["wx-open-subscribe"],
|
||||
})
|
||||
wx.error(function (res) {
|
||||
can.user.toastFailure(can, JSON.stringify(res))
|
||||
"updateAppMessageShareData", "updateTimelineShareData",
|
||||
]), openTagList: ["wx-open-subscribe"],
|
||||
})
|
||||
wx.ready(function () {
|
||||
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))
|
||||
}})
|
||||
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})
|
||||
}
|
||||
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, link) { if (!can) { return }
|
||||
can.user.agent.init = function(can, content, icons) { 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, link)
|
||||
share(document.title, p, content)
|
||||
}, 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)
|
||||
})
|
||||
})
|
||||
},
|
||||
|
@ -84,7 +84,7 @@ func init() {
|
||||
aaa.SESS: {Name: "sess code", Help: "会话", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Option(ice.MSG_USERZONE, WX)
|
||||
if mdb.Conf(m, "header", "meta.demo") == ice.TRUE {
|
||||
m.Echo(aaa.SessCreate(m.Spawn(), ice.Info.UserName))
|
||||
m.Echo(aaa.SessCreate(m.Spawn(), ice.Info.Username))
|
||||
return
|
||||
}
|
||||
appid := kit.Select(m.Option(APPID), kit.Split(kit.ParseURL(m.Option(ice.MSG_REFERER)).Path, nfs.PS), 0)
|
||||
|
@ -1,8 +1,6 @@
|
||||
package wx
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/ctx"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
@ -41,23 +39,22 @@ func init() {
|
||||
value[mdb.TEXT] = web.C(value[ctx.INDEX])
|
||||
}
|
||||
}
|
||||
value[mdb.TEXT] = m.MergeLink(value[mdb.TEXT] + value[ctx.ARGS])
|
||||
value[mdb.TEXT] = m.MergeLink(value[mdb.TEXT])
|
||||
})
|
||||
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, strings.ReplaceAll(kit.Format(list), "\\u0026", "&"))))
|
||||
m.Echo(kit.Formats(SpidePost(m, MENU_CREATE, web.SPIDE_DATA, kit.Formats(list))))
|
||||
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("").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.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.Action(mdb.CREATE, mdb.UPDATE)
|
||||
}
|
||||
}},
|
||||
|
@ -14,7 +14,9 @@ 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,7 +47,6 @@ 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,4 +12,3 @@ 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
|
||||
|
14
render.go
14
render.go
@ -55,9 +55,6 @@ 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])
|
||||
}
|
||||
@ -234,11 +231,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(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) EchoImages(src string) *Message { return m.Echo(Render(m, RENDER_IMAGES, src)) }
|
||||
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 {
|
||||
kit.If(!m.IsCliUA(), func() {
|
||||
kit.If(src, func() { m.Echo(Render(m, RENDER_IFRAME, src)) })
|
||||
@ -268,9 +263,6 @@ 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