forked from x/icebergs
add MergeLink
This commit is contained in:
parent
8264f902b8
commit
0223a40087
@ -29,7 +29,7 @@ func init() {
|
||||
msg := mdb.HashSelect(m.Spawn(), m.Option(mdb.HASH))
|
||||
if ls := kit.Split(msg.Append(EMAIL), mdb.AT); !m.Warn(msg.Length() == 0 || len(ls) < 2, ice.ErrNotValid, m.Option(mdb.HASH)) {
|
||||
m.Cmd(USER, mdb.CREATE, USERNICK, ls[0], USERNAME, msg.Append(EMAIL), USERZONE, ls[1])
|
||||
m.ProcessLocation(kit.MergeURL2(m.Option(ice.MSG_USERWEB), ice.PS, ice.MSG_SESSID, SessValid(m.Options(ice.MSG_USERNAME, msg.Append(EMAIL))), mdb.HASH, ""))
|
||||
m.ProcessLocation(m.MergeLink(ice.PS, ice.MSG_SESSID, SessValid(m.Options(ice.MSG_USERNAME, msg.Append(EMAIL))), mdb.HASH, ""))
|
||||
mdb.HashModify(m, m.OptionSimple(mdb.HASH), mdb.STATUS, ACCEPT)
|
||||
}
|
||||
}},
|
||||
|
@ -78,7 +78,7 @@ func DisplayLocalInner(m *ice.Message, arg ...ice.Any) *ice.Message {
|
||||
return DisplayLocal(m, "code/inner.js", arg...)
|
||||
}
|
||||
func DisplayBase(m *ice.Message, file string, arg ...ice.Any) *ice.Message {
|
||||
m.Option(ice.MSG_DISPLAY, kit.MergeURL(kit.Select(kit.ExtChange(file, nfs.JS), file, strings.Contains(file, mdb.QS)), arg...))
|
||||
m.Option(ice.MSG_DISPLAY, m.MergeLink(kit.Select(kit.ExtChange(file, nfs.JS), file, strings.Contains(file, mdb.QS)), arg...))
|
||||
Toolkit(m, "")
|
||||
return m
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ func _dir_list(m *ice.Message, root string, dir string, level int, deep bool, di
|
||||
m.PushDownload(mdb.LINK, p)
|
||||
}
|
||||
case mdb.SHOW:
|
||||
switch p := kit.MergeURL(ice.SHARE_LOCAL+p, ice.POD, m.Option(ice.MSG_USERPOD)); kit.Ext(s.Name()) {
|
||||
switch p := m.MergeLink(ice.SHARE_LOCAL+p, ice.POD, m.Option(ice.MSG_USERPOD)); kit.Ext(s.Name()) {
|
||||
case PNG, JPG:
|
||||
m.PushImages(field, p)
|
||||
case MP4:
|
||||
|
@ -160,7 +160,7 @@ func init() {
|
||||
} else if m.Append(nfs.FILE) == "" {
|
||||
m.PushScript(mdb.TEXT, m.Append(mdb.TEXT))
|
||||
} else {
|
||||
PushDisplay(m, m.Append(mdb.TYPE), m.Append(mdb.NAME), MergeURL2(m, P(SHARE, CACHE, arg[0])))
|
||||
PushDisplay(m, m.Append(mdb.TYPE), m.Append(mdb.NAME), m.MergeLink(P(SHARE, CACHE, arg[0])))
|
||||
}
|
||||
}},
|
||||
})
|
||||
@ -175,7 +175,7 @@ func init() {
|
||||
up := Upload(m)
|
||||
m.Assert(len(up) > 1)
|
||||
if m.Cmd(CACHE, m.Option(ice.MSG_UPLOAD)).Table(func(value ice.Maps) { m.Options(value) }).Length() == 0 {
|
||||
SpideCache(m.Spawn(), kit.MergeURL2(m.Option(ice.MSG_USERWEB), SHARE_CACHE+up[0]))
|
||||
SpideCache(m.Spawn(), m.MergeLink(SHARE_CACHE+up[0]))
|
||||
}
|
||||
if m.Options(mdb.HASH, up[0], mdb.NAME, up[1]); watch {
|
||||
m.Cmdy(CACHE, WATCH, m.Option(mdb.HASH), path.Join(m.Option(nfs.PATH), up[1]))
|
||||
@ -187,7 +187,7 @@ func init() {
|
||||
func Upload(m *ice.Message) []string {
|
||||
if up := kit.Simple(m.Optionv(ice.MSG_UPLOAD)); len(up) == 1 {
|
||||
if m.Cmdy(CACHE, UPLOAD).Optionv(ice.MSG_UPLOAD, kit.Simple(m.Append(mdb.HASH), m.Append(mdb.NAME), m.Append(nfs.SIZE))); m.Option(ice.MSG_USERPOD) != "" {
|
||||
m.Cmd(SPACE, m.Option(ice.MSG_USERPOD), SPIDE, ice.DEV, SPIDE_CACHE, http.MethodGet, tcp.PublishLocalhost(m, MergeURL2(m, PP(SHARE, CACHE, m.Append(mdb.HASH)))))
|
||||
m.Cmd(SPACE, m.Option(ice.MSG_USERPOD), SPIDE, ice.DEV, SPIDE_CACHE, http.MethodGet, tcp.PublishLocalhost(m, m.MergeLink(PP(SHARE, CACHE, m.Append(mdb.HASH)))))
|
||||
}
|
||||
return kit.Simple(m.Optionv(ice.MSG_UPLOAD))
|
||||
} else {
|
||||
|
@ -52,8 +52,8 @@ func _dream_start(m *ice.Message, name string) {
|
||||
return
|
||||
}
|
||||
defer ToastProcess(m)()
|
||||
defer m.ProcessOpen(m.MergePod(name))
|
||||
defer mdb.Lock(m, m.PrefixKey(), cli.START, name)()
|
||||
defer m.ProcessOpen(kit.MergeURL(S(name), m.OptionSimple(ice.MSG_DEBUG)))
|
||||
p := path.Join(ice.USR_LOCAL_WORK, name)
|
||||
if p := path.Join(p, ice.Info.PidPath); nfs.Exists(m, p) {
|
||||
if pid := m.Cmdx(nfs.CAT, p, kit.Dict(ice.MSG_USERROLE, aaa.TECH)); pid != "" && nfs.Exists(m, "/proc/"+pid) {
|
||||
@ -289,7 +289,7 @@ func init() {
|
||||
nfs.Trash(m, path.Join(ice.USR_LOCAL_WORK, m.Option(mdb.NAME)))
|
||||
}},
|
||||
OPEN: {Role: aaa.VOID, Hand: func(m *ice.Message, arg ...string) {
|
||||
m.ProcessOpen(kit.MergeURL(S(m.Option(mdb.NAME)), m.OptionSimple(ice.MSG_DEBUG)))
|
||||
m.ProcessOpen(m.MergePod(m.Option(mdb.NAME)))
|
||||
}},
|
||||
MAIN: {Name: "main index", Help: "首页", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(SPACE, m.Option(mdb.NAME), SPACE, ice.MAIN, m.Option(ctx.INDEX))
|
||||
|
@ -6,10 +6,8 @@ import (
|
||||
"time"
|
||||
|
||||
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/log"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
"shylinux.com/x/icebergs/base/tcp"
|
||||
@ -42,17 +40,6 @@ func AgentIs(m Message, arg ...string) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
func MergeURL2(m *ice.Message, url string, arg ...ice.Any) string {
|
||||
kit.If(m.Option(log.DEBUG) == ice.TRUE, func() { arg = append(arg, log.DEBUG, ice.TRUE) })
|
||||
kit.If(m.Option(ice.MSG_USERWEB) == "", func() {
|
||||
m.Option(ice.MSG_USERWEB, Domain(ice.Pulse.Cmdv(tcp.HOST, aaa.IP), ice.Pulse.Cmdv(SERVE, tcp.PORT)))
|
||||
})
|
||||
return kit.MergeURL2(m.Option(ice.MSG_USERWEB), url, arg...)
|
||||
}
|
||||
func MergeLink(m *ice.Message, url string, arg ...ice.Any) string {
|
||||
kit.If(m.Option(log.DEBUG) == ice.TRUE, func() { arg = append(arg, log.DEBUG, ice.TRUE) })
|
||||
return kit.MergeURL(strings.Split(MergeURL2(m, url), QS)[0], arg...)
|
||||
}
|
||||
func ParseLink(m *ice.Message, url string) ice.Maps {
|
||||
list := ice.Maps{}
|
||||
u := kit.ParseURL(url)
|
||||
|
@ -45,7 +45,7 @@ func Render(m *ice.Message, cmd string, args ...ice.Any) bool {
|
||||
case STATUS, ice.RENDER_STATUS: // [code [text]]
|
||||
RenderStatus(m.W, kit.Int(kit.Select("200", arg, 0)), kit.Select(m.Result(), strings.Join(kit.Slice(arg, 1), " ")))
|
||||
case ice.RENDER_REDIRECT: // url [arg...]
|
||||
http.Redirect(m.W, m.R, kit.MergeURL(arg[0], arg[1:]), http.StatusTemporaryRedirect)
|
||||
http.Redirect(m.W, m.R, m.MergeLink(arg[0], arg[1:]), http.StatusTemporaryRedirect)
|
||||
case ice.RENDER_DOWNLOAD: // file [type [name]]
|
||||
if strings.HasPrefix(arg[0], HTTP) {
|
||||
RenderRedirect(m, arg[0])
|
||||
|
@ -76,7 +76,7 @@ func init() {
|
||||
// kit.If(m.Option(mdb.TYPE) == LOGIN, func() { arg = append(arg, mdb.TEXT, tcp.PublishLocalhost(m, m.Option(mdb.TEXT))) })
|
||||
kit.If(m.Option(mdb.TYPE) == LOGIN && m.Option(mdb.TEXT) == "", func() { arg = append(arg, mdb.TEXT, tcp.PublishLocalhost(m, m.Option(ice.MSG_USERWEB))) })
|
||||
mdb.HashCreate(m, arg, SPACE, m.Option(ice.MSG_USERPOD), aaa.USERNICK, m.Option(ice.MSG_USERNICK), aaa.USERNAME, m.Option(ice.MSG_USERNAME), aaa.USERROLE, m.Option(ice.MSG_USERROLE))
|
||||
m.Option(mdb.LINK, _share_link(m, kit.MergeURL(P(SHARE, m.Result()), m.OptionSimple(ice.MSG_DEBUG))))
|
||||
m.Option(mdb.LINK, _share_link(m, m.MergeLink(P(SHARE, m.Result()))))
|
||||
}},
|
||||
LOGIN: {Help: "登录", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.EchoQRCode(m.Cmd(SHARE, mdb.CREATE, mdb.TYPE, LOGIN).Option(mdb.LINK)).ProcessInner()
|
||||
@ -107,7 +107,7 @@ func init() {
|
||||
m.RenderRedirect(msg.Append(mdb.TEXT))
|
||||
case STORM:
|
||||
RenderCookie(m, aaa.SessCreate(m, msg.Append(aaa.USERNAME)))
|
||||
m.RenderRedirect(kit.MergeURL(kit.Select(nfs.PS, msg.Append(mdb.TEXT)), msg.AppendSimple(RIVER, STORM)))
|
||||
m.RenderRedirect(m.MergeLink(kit.Select(nfs.PS, msg.Append(mdb.TEXT)), msg.AppendSimple(RIVER, STORM)))
|
||||
case FIELD:
|
||||
RenderPodCmd(m, msg.Append(SPACE), msg.Append(mdb.NAME), kit.UnMarshal(msg.Append(mdb.TEXT)))
|
||||
case DOWNLOAD:
|
||||
@ -144,9 +144,9 @@ func IsNotValidFieldShare(m *ice.Message, msg *ice.Message) bool {
|
||||
func SharePath(m *ice.Message, p string) string {
|
||||
kit.If(!kit.HasPrefix(p, nfs.PS, ice.HTTP), func() {
|
||||
if kit.HasPrefix(p, nfs.SRC, nfs.USR) && !kit.HasPrefix(p, nfs.USR_LOCAL) {
|
||||
p = kit.MergeURL(path.Join(nfs.REQUIRE, p), ice.POD, m.Option(ice.MSG_USERPOD))
|
||||
p = m.MergeLink(path.Join(nfs.REQUIRE, p), ice.POD, m.Option(ice.MSG_USERPOD))
|
||||
} else {
|
||||
p = kit.MergeURL(path.Join(SHARE_LOCAL, p), ice.POD, m.Option(ice.MSG_USERPOD))
|
||||
p = m.MergeLink(path.Join(SHARE_LOCAL, p), ice.POD, m.Option(ice.MSG_USERPOD))
|
||||
}
|
||||
})
|
||||
return p
|
||||
@ -184,7 +184,7 @@ func ProxyUpload(m *ice.Message, pod string, p string) string {
|
||||
kit.If(p == ice.BIN_ICE_BIN, func() { m.Option(ice.MSG_USERROLE, aaa.TECH) })
|
||||
share := m.Cmdx(SHARE, mdb.CREATE, mdb.TYPE, PROXY, mdb.NAME, p, mdb.TEXT, pod)
|
||||
defer m.Cmd(SHARE, mdb.REMOVE, mdb.HASH, share)
|
||||
url := tcp.PublishLocalhost(m, MergeLink(m, PP(SHARE, PROXY), SHARE, share))
|
||||
url := tcp.PublishLocalhost(m, m.MergeLink(PP(SHARE, PROXY), SHARE, share))
|
||||
m.Cmd(SPACE, pod, SPIDE, PROXY, URL, url, nfs.SIZE, size, CACHE, cache.Format(ice.MOD_TIME), UPLOAD, mdb.AT+p)
|
||||
return kit.Select(p, pp, file.ExistsFile(pp))
|
||||
}
|
||||
@ -192,5 +192,5 @@ func ShareLocal(m *ice.Message, p string) string {
|
||||
if kit.HasPrefix(p, nfs.PS, HTTP) {
|
||||
return p
|
||||
}
|
||||
return MergeLink(m, "/share/local/"+p)
|
||||
return m.MergeLink(PP(SHARE, LOCAL, p))
|
||||
}
|
||||
|
@ -367,7 +367,7 @@ func init() {
|
||||
m.Push(aaa.UA, value[aaa.UA])
|
||||
}
|
||||
if kit.IsIn(value[mdb.TYPE], WEIXIN, PORTAL) && value[mdb.NAME] != html.CHROME {
|
||||
m.Push(mdb.LINK, MergeURL2(m, value[mdb.TEXT]))
|
||||
m.Push(mdb.LINK, m.MergeLink(value[mdb.TEXT]))
|
||||
} else if kit.IsIn(value[mdb.TYPE], WORKER, SERVER) {
|
||||
m.Push(mdb.LINK, m.MergePod(value[mdb.NAME]))
|
||||
} else if kit.IsIn(value[mdb.TYPE], MASTER) {
|
||||
|
@ -72,7 +72,7 @@ func init() {
|
||||
m.Cmd("", mdb.CREATE, m.OptionSimple(mdb.TYPE, mdb.NAME, mdb.TEXT))
|
||||
}},
|
||||
web.DOWNLOAD: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.ProcessOpen(web.MergeURL2(m, web.SHARE_LOCAL+m.Option(mdb.TEXT), nfs.FILENAME, m.Option(mdb.NAME)))
|
||||
m.ProcessOpen(m.MergeLink(web.SHARE_LOCAL+m.Option(mdb.TEXT), nfs.FILENAME, m.Option(mdb.NAME)))
|
||||
}},
|
||||
web.PREVIEW: {Hand: FavorPreview},
|
||||
cli.OPENS: {Hand: func(m *ice.Message, arg ...string) { cli.Opens(m, m.Option(mdb.TEXT)) }},
|
||||
|
@ -7,7 +7,6 @@ import (
|
||||
"shylinux.com/x/icebergs/base/aaa"
|
||||
"shylinux.com/x/icebergs/base/cli"
|
||||
"shylinux.com/x/icebergs/base/gdb"
|
||||
"shylinux.com/x/icebergs/base/log"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
"shylinux.com/x/icebergs/base/tcp"
|
||||
@ -23,11 +22,11 @@ func init() {
|
||||
web.SPACE_LOGIN: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.GoSleep30ms(func() {
|
||||
p := m.Cmdx(web.SPACE, web.DOMAIN)
|
||||
link := tcp.PublishLocalhost(m, m.Options(ice.MSG_USERWEB, p).MergePodCmd("", "", web.SPACE, kit.Keys(web.ParseLink(m, p)[ice.POD], m.Option(mdb.NAME)), log.DEBUG, m.Option(ice.MSG_DEBUG)))
|
||||
link := tcp.PublishLocalhost(m, m.Options(ice.MSG_USERWEB, p).MergePodCmd("", "", web.SPACE, kit.Keys(web.ParseLink(m, p)[ice.POD], m.Option(mdb.NAME))))
|
||||
m.Cmd(web.SPACE, m.Option(mdb.NAME), cli.PWD, m.Option(mdb.NAME), link, m.Cmdx(cli.QRCODE, link))
|
||||
})
|
||||
}},
|
||||
web.HOME: {Help: "首页", Hand: func(m *ice.Message, arg ...string) { m.ProcessOpen(web.MergeLink(m, web.CHAT_PORTAL)) }},
|
||||
web.HOME: {Help: "首页", Hand: func(m *ice.Message, arg ...string) { m.ProcessOpen(m.MergeLink(web.CHAT_PORTAL)) }},
|
||||
aaa.CONFIRM: {Help: "授权", Role: aaa.VOID, Hand: func(m *ice.Message, arg ...string) {
|
||||
if m.Warn(m.R.Method == http.MethodGet, ice.ErrNotAllow) {
|
||||
return
|
||||
@ -44,7 +43,7 @@ func init() {
|
||||
aaa.SessCreate(m, m.Option(ice.MSG_USERNAME))
|
||||
}
|
||||
m.Cmd(web.SPACE, m.Option(web.SPACE), ice.MSG_SESSID, m.Option(ice.MSG_SESSID))
|
||||
m.ProcessLocation(web.MergeLink(m, msg.Append(mdb.TEXT)))
|
||||
m.ProcessLocation(m.MergeLink(msg.Append(mdb.TEXT)))
|
||||
kit.If(m.IsWeixinUA(), func() { m.Echo(ice.SUCCESS) })
|
||||
gdb.Event(m, web.SPACE_GRANT, m.OptionSimple(web.SPACE))
|
||||
}
|
||||
|
@ -4,7 +4,6 @@ import (
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/cli"
|
||||
"shylinux.com/x/icebergs/base/ctx"
|
||||
"shylinux.com/x/icebergs/base/log"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/web"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
@ -65,8 +64,8 @@ func init() {
|
||||
kit.If(m.Option(mdb.TYPE) == web.LINK, func() { ctx.ProcessField(m, m.PrefixKey(), m.Option(mdb.TEXT)) })
|
||||
}},
|
||||
}, FavorAction(), mdb.HashAction(mdb.SHORT, web.LINK, mdb.FIELD, "time,hash,type,name,link")), Hand: func(m *ice.Message, arg ...string) {
|
||||
list := []string{m.MergePodCmd("", web.WIKI_PORTAL, log.DEBUG, m.Option(log.DEBUG))}
|
||||
list = append(list, m.MergePodCmd("", web.CHAT_PORTAL, log.DEBUG, m.Option(log.DEBUG)))
|
||||
list := []string{m.MergePodCmd("", web.WIKI_PORTAL)}
|
||||
list = append(list, m.MergePodCmd("", web.CHAT_PORTAL))
|
||||
if mdb.HashSelect(m, arg...); len(arg) == 0 {
|
||||
for _, link := range list {
|
||||
if u := kit.ParseURL(link); u != nil {
|
||||
|
@ -149,7 +149,7 @@ func (s Client) OAuthURL(m *ice.Message) string {
|
||||
return kit.MergeURL2(m.Option(web.DOMAIN), m.Option(OAUTH_URL), RESPONSE_TYPE, CODE, m.OptionSimple(CLIENT_ID), REDIRECT_URI, s.RedirectURI(m), m.OptionSimple(SCOPE), STATE, m.Option(mdb.HASH))
|
||||
}
|
||||
func (s Client) RedirectURI(m *ice.Message) string {
|
||||
return strings.Split(web.MergeURL2(m.Message, web.ChatCmdPath(m.Message, m.PrefixKey(), ctx.ACTION, aaa.LOGIN)), web.QS)[0]
|
||||
return strings.Split(m.MergeLink(web.ChatCmdPath(m.Message, m.PrefixKey(), ctx.ACTION, aaa.LOGIN)), web.QS)[0]
|
||||
}
|
||||
|
||||
func (s Client) Get(m *ice.Message, hash, api string, arg ...string) ice.Any {
|
||||
|
@ -30,9 +30,9 @@ func init() {
|
||||
|
||||
func GetSSO(m *ice.Message) string {
|
||||
link := m.Cmdx(web.SPACE, web.DOMAIN)
|
||||
if !strings.Contains(link, web.PP(CHAT, POD)) {
|
||||
if !strings.Contains(link, web.S()) {
|
||||
return ""
|
||||
}
|
||||
ls := strings.Split(kit.ParseURL(link).Path, nfs.PS)
|
||||
return kit.MergeURL2(link, web.PP(CHAT, SSO), web.SPACE, kit.Select("", ls, 3), cli.BACK, m.R.Header.Get(html.Referer))
|
||||
return kit.MergeURL2(link, web.PP(CHAT, SSO), web.SPACE, kit.Select("", ls, 2), cli.BACK, m.R.Header.Get(html.Referer))
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ func init() {
|
||||
p := web.ProxyUpload(m, m.Option(FROM), m.Option(nfs.PATH))
|
||||
h := m.Cmdx(web.SHARE, mdb.CREATE, mdb.TYPE, web.DOWNLOAD, mdb.TEXT, p)
|
||||
defer m.Cmd(web.SHARE, mdb.REMOVE, mdb.HASH, h)
|
||||
m.Cmdy(web.SPACE, m.Option(TO), web.SPIDE, ice.DEV, web.SPIDE_SAVE, path.Join(m.Option("to_path"), path.Base(m.Option(nfs.PATH))), web.MergeLink(m, "/share/"+h))
|
||||
m.Cmdy(web.SPACE, m.Option(TO), web.SPIDE, ice.DEV, web.SPIDE_SAVE, path.Join(m.Option("to_path"), path.Base(m.Option(nfs.PATH))), m.MergeLink(web.PP(web.SHARE, h)))
|
||||
}},
|
||||
ctx.RUN: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Options(ice.MSG_USERPOD, m.Option(FROM), ice.POD, m.Option(FROM))
|
||||
|
@ -17,10 +17,10 @@ func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
HTML: {Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.EchoIFrame(kit.MergeURL(require(arg[2], arg[1]), "_v", kit.Hashs(mdb.UNIQ)))
|
||||
m.EchoIFrame(m.MergeLink(require(arg[2], arg[1]), "_v", kit.Hashs(mdb.UNIQ)))
|
||||
}},
|
||||
mdb.ENGINE: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.EchoIFrame(kit.MergeURL(require(arg[2], arg[1]), "_v", kit.Hashs(mdb.UNIQ)))
|
||||
m.EchoIFrame(m.MergeLink(require(arg[2], arg[1]), "_v", kit.Hashs(mdb.UNIQ)))
|
||||
}},
|
||||
TEMPLATE: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Echo(nfs.Template(m, DEMO_HTML))
|
||||
|
@ -60,7 +60,7 @@ func init() {
|
||||
}, mdb.ZoneAction(mdb.FIELD, "time,zone,count,binnary,service,seconds", mdb.FIELDS, "time,id,text,file", PPROF, kit.List(GO, "tool", PPROF))), Hand: func(m *ice.Message, arg ...string) {
|
||||
if mdb.ZoneSelect(m, arg...); len(arg) == 0 {
|
||||
m.PushAction(cli.START, mdb.REMOVE).Action(mdb.CREATE)
|
||||
m.StatusTimeCount(web.LINK, web.MergeLink(m, "/debug/pprof/"))
|
||||
m.StatusTimeCount(web.LINK, m.MergeLink("/debug/pprof/"))
|
||||
} else {
|
||||
m.Table(func(value ice.Maps) { m.PushDownload(mdb.LINK, "pprof.pd.gz", value[nfs.FILE]).PushButton(web.SERVE) })
|
||||
m.Action(cli.START)
|
||||
|
@ -19,7 +19,7 @@ func init() {
|
||||
return
|
||||
}
|
||||
appid := m.Cmd(APP).Append(APPID)
|
||||
home := web.MergeURL2(m, "/chat/lark/sso")
|
||||
home := m.MergeLink("/chat/lark/sso")
|
||||
if m.Option(cli.CODE) == "" {
|
||||
m.RenderRedirect(kit.MergeURL2(m.Cmd(web.SPIDE, LARK).Append("client.url"), "/open-apis/authen/v1/index"),
|
||||
"redirect_uri", kit.MergeURL(home, cli.BACK, m.R.Header.Get("Referer")), APP_ID, appid)
|
||||
@ -31,7 +31,7 @@ func init() {
|
||||
m.Cmd(aaa.USER, mdb.CREATE, m.Option(aaa.USERNAME), "", msg.Append(mdb.NAME), LARK, kit.Select(aaa.VOID, aaa.TECH, msg.Append("is_tenant_manager") == ice.TRUE))
|
||||
m.Cmd(aaa.USER, mdb.MODIFY, aaa.AVATAR, msg.Append("avatar_url"), aaa.GENDER, kit.Select("女", "男", msg.Append(aaa.GENDER) == "1"),
|
||||
msg.AppendSimple(aaa.MOBILE, aaa.EMAIL, aaa.CITY, aaa.COUNTRY))
|
||||
m.RenderRedirect(kit.MergeURL(kit.Select(home, m.Option(cli.BACK)), ice.MSG_SESSID, aaa.SessCreate(m, m.Option(aaa.USERNAME))))
|
||||
m.RenderRedirect(m.MergeLink(kit.Select(home, m.Option(cli.BACK)), ice.MSG_SESSID, aaa.SessCreate(m, m.Option(aaa.USERNAME))))
|
||||
}},
|
||||
})
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ func init() {
|
||||
m.Cmd(mdb.PRUNES, m.Prefix(IDE), "", mdb.HASH, m.OptionSimple(mdb.NAME))
|
||||
}},
|
||||
}, gdb.EventsAction(web.SPACE_GRANT, web.SPACE_LOGIN_CLOSE), mdb.ImportantHashAction(mdb.SHORT, ACCESS, mdb.FIELD, "time,type,access,icons,usernick,appid", tcp.SERVER, CGI_BIN)), Hand: func(m *ice.Message, arg ...string) {
|
||||
mdb.HashSelect(m, arg...).PushAction(web.SSO, mdb.REMOVE).StatusTimeCount(mdb.ConfigSimple(m, ACCESS, APPID), web.SERVE, web.MergeLink(m, "/chat/wx/login/"))
|
||||
mdb.HashSelect(m, arg...).PushAction(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
|
||||
|
@ -22,7 +22,7 @@ func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
EVENTS: {Help: "事件", Actions: ice.Actions{
|
||||
SUBSCRIBE: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(TEXT, web.LINK, kit.MergeURL2(m.Option(ice.MSG_USERWEB), nfs.PS))
|
||||
m.Cmdy(TEXT, web.LINK, m.MergeLink(nfs.PS))
|
||||
}},
|
||||
UNSUBSCRIBE: {Hand: func(m *ice.Message, arg ...string) {
|
||||
}},
|
||||
@ -39,7 +39,7 @@ func init() {
|
||||
msg := m.Cmd(MENU, m.Option(ACCESS), arg[0])
|
||||
m.Options(mdb.ICONS, msg.Append(mdb.ICONS), mdb.NAME, msg.Append(mdb.NAME), mdb.TEXT, kit.Select(msg.Append(ctx.INDEX), msg.Append(mdb.TEXT)))
|
||||
if msg.Append(ctx.INDEX) == "" {
|
||||
m.Cmdy(TEXT, web.LINK, kit.MergeURL2(m.Option(ice.MSG_USERWEB), nfs.PS))
|
||||
m.Cmdy(TEXT, web.LINK, m.MergeLink(nfs.PS))
|
||||
} else {
|
||||
m.Cmdy(TEXT, web.LINK, m.MergePodCmd("", msg.Append(ctx.INDEX), kit.Split(msg.Append(ctx.ARGS))))
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ func init() {
|
||||
if value[SCENE] == m.Option(SCENE) {
|
||||
key := kit.Keys("button", kit.Int(value[RIVER])-1)
|
||||
kit.If(value[STORM] != "1", func() { key = kit.Keys(key, "sub_button", kit.Int(value[STORM])-2) })
|
||||
kit.If(value[mdb.TYPE] == "view", func() { value[mdb.TEXT] = web.MergeLink(m, value[mdb.TEXT]) })
|
||||
kit.If(value[mdb.TYPE] == "view", func() { 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]))
|
||||
}
|
||||
})
|
||||
|
23
option.go
23
option.go
@ -45,25 +45,23 @@ func (m *Message) OptionCB(key string, cb ...Any) Any {
|
||||
}
|
||||
|
||||
func (m *Message) MergePod(pod string, arg ...Any) string {
|
||||
ls := []string{"chat"}
|
||||
kit.If(kit.Keys(m.Option(MSG_USERPOD), pod), func(p string) { ls = append(ls, POD, p) })
|
||||
kit.If(len(ls) == 1, func() { ls = ls[:0] })
|
||||
// ls := []string{}
|
||||
// kit.If(kit.Keys(m.Option(MSG_USERPOD), pod), func(p string) { ls = append(ls, "/s/", p) })
|
||||
kit.If(m.Option(DEBUG) == TRUE, func() { arg = append([]Any{DEBUG, TRUE}, arg...) })
|
||||
return kit.MergeURL2(strings.Split(kit.Select("http://localhost:9020", Info.Domain, m.Option(MSG_USERWEB)), QS)[0], path.Join(PS, path.Join(ls...)), arg...)
|
||||
ls := []string{}
|
||||
kit.If(kit.Keys(m.Option(MSG_USERPOD), pod), func(p string) { ls = append(ls, "s", p) })
|
||||
return m.MergeLink(PS+path.Join(ls...), arg...)
|
||||
}
|
||||
func (m *Message) MergePodCmd(pod, cmd string, arg ...Any) string {
|
||||
ls := []string{"chat"}
|
||||
ls := []string{}
|
||||
kit.If(kit.Keys(m.Option(MSG_USERPOD), pod), func(p string) { ls = append(ls, "s", p) })
|
||||
if cmd == "" {
|
||||
p, ok := Info.Index[m.CommandKey()]
|
||||
cmd = kit.Select(m.PrefixKey(), m.CommandKey(), ok && p == m.target)
|
||||
}
|
||||
ls = append(ls, "c", cmd)
|
||||
return m.MergeLink(PS+path.Join(ls...), arg...)
|
||||
}
|
||||
func (m *Message) MergeLink(url string, arg ...Any) string {
|
||||
kit.If(m.Option(DEBUG) == TRUE, func() { arg = append([]Any{DEBUG, TRUE}, arg...) })
|
||||
return kit.MergeURL2(strings.Split(kit.Select(Info.Domain, m.Option(MSG_USERWEB)), QS)[0], PS+kit.Join(ls[1:], PS), arg...)
|
||||
// return kit.MergeURL2(strings.Split(kit.Select(Info.Domain, m.Option(MSG_USERWEB)), QS)[0], PS+kit.Join(ls, PS), arg...)
|
||||
return kit.MergeURL2(strings.Split(kit.Select(Info.Domain, m.Option(MSG_USERWEB)), QS)[0], url, arg...)
|
||||
}
|
||||
func (m *Message) FieldsIsDetail() bool {
|
||||
ls := m.value(MSG_APPEND)
|
||||
@ -84,8 +82,7 @@ func (m *Message) Status(arg ...Any) *Message {
|
||||
}
|
||||
func (m *Message) StatusTime(arg ...Any) *Message {
|
||||
args := []string{}
|
||||
kit.If(m.Option(MSG_DEBUG) == TRUE, func() { args = append(args, kit.MDB_COST, m.FormatCost()) })
|
||||
kit.If(m.Option(MSG_DEBUG) == TRUE, func() { args = append(args, "msg", "") })
|
||||
kit.If(m.Option(MSG_DEBUG) == TRUE, func() { args = append(args, kit.MDB_COST, m.FormatCost(), "msg", "") })
|
||||
kit.If(m.Option(MSG_DEBUG) == TRUE, func() { args = append(args, m.OptionSimple(LOG_TRACEID)...) })
|
||||
return m.Status(TIME, m.Time(), arg, args)
|
||||
}
|
||||
@ -111,7 +108,7 @@ func (m *Message) ProcessSession(arg ...Any) {
|
||||
}
|
||||
func (m *Message) ProcessLocation(arg ...Any) { m.Process(PROCESS_LOCATION, arg...) }
|
||||
func (m *Message) ProcessReplace(url string, arg ...Any) {
|
||||
m.Process(PROCESS_REPLACE, kit.MergeURL(url, arg...))
|
||||
m.Process(PROCESS_REPLACE, m.MergeLink(url, arg...))
|
||||
}
|
||||
func (m *Message) ProcessHistory(arg ...Any) { m.Process(PROCESS_HISTORY, arg...) }
|
||||
func (m *Message) ProcessConfirm(arg ...Any) { m.Process(PROCESS_CONFIRM, arg...) }
|
||||
|
@ -233,7 +233,7 @@ func (m *Message) EchoDownload(arg ...string) *Message {
|
||||
}
|
||||
func (m *Message) Display(file string, arg ...Any) *Message {
|
||||
file = m.resource(file)
|
||||
m.Option(MSG_DISPLAY, kit.MergeURL(kit.Select(kit.ExtChange(file, JS), file, strings.Contains(file, QS)), arg...))
|
||||
m.Option(MSG_DISPLAY, m.MergeLink(kit.Select(kit.ExtChange(file, JS), file, strings.Contains(file, QS)), arg...))
|
||||
return m
|
||||
}
|
||||
func (m *Message) Resource(file string) string { return m.resource(file) }
|
||||
@ -246,5 +246,5 @@ func (m *Message) resource(file string) string {
|
||||
p = strings.Split(p, "/pkg/mod/")[1]
|
||||
}
|
||||
kit.If(file == "", func() { p = kit.ExtChange(p, JS) }, func() { p = path.Join(path.Dir(p), file) })
|
||||
return kit.MergeURL("/require/"+p, POD, m.Option(MSG_USERPOD))
|
||||
return m.MergeLink("/require/"+p, POD, m.Option(MSG_USERPOD))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user