1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-26 01:24:05 +08:00
This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-07-26 21:38:07 +08:00
parent ccfffd917c
commit a5cd77e87d
18 changed files with 113 additions and 75 deletions

View File

@ -17,6 +17,7 @@ func _command_list(m *ice.Message, name string) *ice.Message {
if strings.HasPrefix(name, "can.") {
return m.Push(mdb.INDEX, name).Push(mdb.NAME, name).Push(mdb.HELP, "").Push(mdb.META, "").Push(mdb.LIST, "")
}
m.Option(ice.MSG_NODENAME, ice.Info.Titles)
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)))
m.Push(mdb.INDEX, kit.Keys(s.Prefix(), key))

View File

@ -141,6 +141,7 @@ const (
RENAME = "rename"
VENDOR = "vendor"
PRUNE = "prune"
TABLE = "table"
PAGE = "page"
NEXT = "next"

View File

@ -31,7 +31,7 @@ func _cat_line(m *ice.Message, p string) (n int) {
return
}
func _cat_list(m *ice.Message, p string) {
if m.Option(CAT_CONTENT) == "" && !aaa.Right(m, path.Join(m.Option(DIR_ROOT), p)) {
if m.Option(CAT_CONTENT) == "" && !kit.IsIn(kit.Ext(p), "css", "js") && !aaa.Right(m, path.Join(m.Option(DIR_ROOT), p)) {
return
}
f, e := _cat_find(m, p)

View File

@ -221,6 +221,7 @@ func init() {
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
aaa.White(m, ice.MAKEFILE, ice.README_MD, ice.LICENSE)
aaa.White(m, ice.SRC, ice.BIN, ice.USR)
aaa.Black(m, ice.SRC_PRIVATE)
aaa.Black(m, ice.USR_LOCAL)
}},
ice.APP: {Help: "本机", Hand: func(m *ice.Message, arg ...string) {

View File

@ -83,6 +83,7 @@ func Render(m *ice.Message, cmd string, args ...ice.Any) bool {
"$profile", fieldset+">div.output>div.layout>div.layout>div.profile",
"$content", fieldset+">div.output>div.layout>div.layout>div.content",
"$fieldset", fieldset, "$index", m.Option(ctx.INDEX),
"$input", "body>div.input.float."+m.Option(ctx.INDEX),
)))
break
}
@ -90,6 +91,8 @@ func Render(m *ice.Message, cmd string, args ...ice.Any) bool {
http.ServeFile(m.W, m.R, kit.Path(arg[0]))
} else if f, e := nfs.PackFile.OpenFile(arg[0]); e == nil {
defer f.Close()
t, _ := time.ParseInLocation("2006-01-02 15:04:05", ice.Info.Make.When, time.Local)
RenderHeader(m.W, "Last-Modified", t.UTC().Format(time.RFC1123))
io.Copy(m.W, f)
}
case ice.RENDER_RESULT:
@ -162,6 +165,7 @@ func RenderPodCmd(m *ice.Message, pod, cmd string, arg ...ice.Any) {
} else {
m.OptionDefault(mdb.ICONS, m.Resource(kit.Select(ice.Info.NodeIcon, msg.Append(mdb.ICONS))))
if !kit.IsIn(cmd, PORTAL, DESKTOP, ADMIN) {
pod = kit.Select(pod, msg.Option(ice.MSG_NODENAME))
m.OptionDefault(TITLE, kit.Select(cmd, msg.Append(mdb.HELP)+kit.Select("", " "+pod, pod != ""), !m.IsEnglish()))
}
RenderCmds(m, kit.Dict(msg.AppendSimple(), ctx.ARGS, kit.Simple(arg), ctx.DISPLAY, m.Option(ice.MSG_DISPLAY)))

View File

@ -95,7 +95,9 @@ func _serve_main(m *ice.Message, w http.ResponseWriter, r *http.Request) bool {
return true
}
func _serve_static(msg *ice.Message, w http.ResponseWriter, r *http.Request) bool {
ispod := kit.Contains(r.URL.String(), S(), "pod=") || kit.Contains(r.Header.Get(html.Referer), S(), "pod=")
_serve_params(msg, r.Header.Get(html.Referer))
_serve_params(msg, r.URL.String())
ispod := msg.Option(ice.MSG_USERPOD) != ""
if strings.HasPrefix(r.URL.Path, nfs.V) {
return Render(msg, ice.RENDER_DOWNLOAD, path.Join(ice.USR_VOLCANOS, strings.TrimPrefix(r.URL.Path, nfs.V)))
} else if kit.HasPrefix(r.URL.Path, nfs.P) {
@ -103,12 +105,19 @@ func _serve_static(msg *ice.Message, w http.ResponseWriter, r *http.Request) boo
return false
}
p := strings.TrimPrefix(r.URL.Path, nfs.P)
if pp := path.Join(nfs.USR_LOCAL_WORK, msg.Option(ice.MSG_USERPOD)); ispod && nfs.Exists(msg, pp) {
if pp = path.Join(pp, p); nfs.Exists(msg, pp) {
return Render(msg, ice.RENDER_DOWNLOAD, pp)
} else {
return Render(msg, ice.RENDER_DOWNLOAD, p)
}
}
return (!ispod && kit.HasPrefix(p, nfs.SRC) || kit.HasPrefix(p, ice.USR_ICEBERGS, ice.USR_ICONS)) && nfs.Exists(msg, p) && Render(msg, ice.RENDER_DOWNLOAD, p)
} else if kit.HasPrefix(path.Base(r.URL.Path), "MP_verify_") {
return Render(msg, ice.RENDER_DOWNLOAD, nfs.SRC_PRIVATE+path.Base(r.URL.Path))
} else if kit.HasPrefix(r.URL.Path, nfs.M) {
p := nfs.USR_MODULES + strings.TrimPrefix(r.URL.Path, nfs.M)
return nfs.Exists(msg, p) && Render(msg, ice.RENDER_DOWNLOAD, p)
} else if kit.HasPrefix(path.Base(r.URL.Path), "MP_verify_") {
return Render(msg, ice.RENDER_DOWNLOAD, nfs.ETC+path.Base(r.URL.Path))
} else if p := path.Join(kit.Select(ice.USR_VOLCANOS, ice.USR_INTSHELL, msg.IsCliUA()), r.URL.Path); nfs.Exists(msg, p) {
return Render(msg, ice.RENDER_DOWNLOAD, p)
} else if p = path.Join(nfs.USR, r.URL.Path); kit.HasPrefix(r.URL.Path, nfs.VOLCANOS, nfs.INTSHELL) && nfs.Exists(msg, p) {
@ -121,6 +130,19 @@ func _serve_static(msg *ice.Message, w http.ResponseWriter, r *http.Request) boo
return false
}
}
func _serve_params(m *ice.Message, p string) {
if u, e := url.Parse(p); e == nil {
switch arg := strings.Split(strings.TrimPrefix(u.Path, nfs.PS), nfs.PS); arg[0] {
case CHAT:
kit.For(arg[1:], func(k, v string) { m.Option(k, v) })
case SHARE:
m.Option(arg[0], arg[1])
case "s":
m.Option(ice.POD, kit.Select("", arg, 1))
}
kit.For(u.Query(), func(k string, v []string) { m.Optionv(k, v) })
}
}
func _serve_handle(key string, cmd *ice.Command, m *ice.Message, w http.ResponseWriter, r *http.Request) {
debug := strings.Contains(r.URL.String(), "debug=true") || strings.Contains(r.Header.Get(html.Referer), "debug=true")
m.Options(ice.LOG_DEBUG, ice.FALSE, ice.LOG_TRACEID, r.Header.Get(ice.LOG_TRACEID))
@ -131,19 +153,8 @@ func _serve_handle(key string, cmd *ice.Command, m *ice.Message, w http.Response
return m
}
kit.If(r.Header.Get(html.Referer), func(p string) { _log("page", html.Referer, p) })
if u, e := url.Parse(r.Header.Get(html.Referer)); e == nil {
add := func(k, v string) { _log(nfs.PATH, k, m.Option(k, v)) }
switch arg := strings.Split(strings.TrimPrefix(u.Path, nfs.PS), nfs.PS); arg[0] {
case CHAT:
kit.For(arg[1:], func(k, v string) { add(k, v) })
case SHARE:
add(arg[0], arg[1])
case "s":
add(ice.POD, kit.Select("", arg, 1))
}
kit.For(u.Query(), func(k string, v []string) { m.Optionv(k, v) })
}
kit.For(kit.ParseQuery(r.URL.RawQuery), func(k string, v []string) { m.Optionv(k, v) })
_serve_params(m, r.Header.Get(html.Referer))
_serve_params(m, r.URL.String())
if r.Method == http.MethodGet && m.Option(ice.MSG_CMDS) != "" {
_log(ctx.ARGS, ice.MSG_CMDS, m.Optionv(ice.MSG_CMDS))
}
@ -203,7 +214,9 @@ func _serve_auth(m *ice.Message, key string, cmds []string, w http.ResponseWrite
return cmds, true
}
defer func() { m.Options(ice.MSG_CMDS, "") }()
if aaa.SessCheck(m, m.Option(ice.MSG_SESSID)); m.Option(ice.MSG_USERNAME) == "" {
if strings.Contains(m.Option(ice.MSG_SESSID), " ") {
m.Cmdy(kit.Split(m.Option(ice.MSG_SESSID)))
} 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) {
return nil

View File

@ -171,7 +171,13 @@ func ShareLocalFile(m *ice.Message, arg ...string) {
return
}
}
if m.Option(ice.POD) == "" || (kit.HasPrefix(p, ice.USR_ICONS, ice.USR_VOLCANOS, ice.USR_ICEBERGS, ice.USR_INTSHELL) && nfs.Exists(m, p)) {
if m.Option(ice.POD) != "" && nfs.Exists(m, path.Join(ice.USR_LOCAL_WORK, m.Option(ice.POD))) {
if pp := kit.Path(ice.USR_LOCAL_WORK, m.Option(ice.POD), p); nfs.Exists(m, pp) {
m.RenderDownload(pp)
} else if nfs.Exists(m, p) {
m.RenderDownload(p)
}
} else if m.Option(ice.POD) == "" || (kit.HasPrefix(p, ice.USR_ICONS, ice.USR_VOLCANOS, ice.USR_ICEBERGS, ice.USR_INTSHELL) && nfs.Exists(m, p)) {
m.RenderDownload(p)
} else if pp := kit.Path(ice.USR_LOCAL_WORK, m.Option(ice.POD), p); nfs.Exists(m, pp) {
m.RenderDownload(pp)

View File

@ -129,7 +129,7 @@ func _space_handle(m *ice.Message, safe bool, name string, c *websocket.Conn) {
}
msg := m.Spawn(b)
if safe && msg.Option(ice.MSG_UNSAFE) != ice.TRUE { // 下行权限
if !aaa.IsTechOrRoot(msg) {
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))) })
@ -163,6 +163,8 @@ func _space_handle(m *ice.Message, safe bool, name string, c *websocket.Conn) {
}), SPACE, next) {
break
}
m.Info("what %v", m.FormatStack(1, 100))
m.Info("what %v", m.FormatChain())
m.Sleep3s()
}
}

View File

@ -174,6 +174,7 @@ const ( // DIR
SRC_BINPACK_GO = "src/binpack.go"
SRC_BINPACK_USR_GO = "src/binpack_usr.go"
SRC_TEMPLATE = "src/template/"
SRC_PRIVATE = "src/private/"
SRC_SCRIPT = "src/script/"
USR_SCRIPT = "usr/script/"
README_MD = "README.md"

View File

@ -140,19 +140,17 @@ func init() {
}
}},
}, 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 ice.Info.NodeType == web.WORKER {
return
}
kit.If(m.Option(ice.MSG_USERPOD), func(p string) {
m.Option(ice.MSG_NODETYPE, m.Cmdx(web.SPACE, p, cli.RUNTIME, ice.MSG_NODETYPE))
m.Option(ice.MSG_NODENAME, m.Cmdx(web.SPACE, p, cli.RUNTIME, ice.MSG_NODENAME))
m.Option("favicon", m.Cmd(web.SPACE, m.Option(ice.MSG_USERPOD), web.SPACE, ice.INFO).Append(mdb.ICONS))
m.Cmdy(web.SPACE, p, m.PrefixKey(), ice.Maps{ice.MSG_USERPOD: ""})
}, func() {
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", 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 kit.Select("", "zh-cn", strings.Contains(m.Option(ice.MSG_USERUA), "zh_CN")) },
func() string { return kit.Select("", kit.Split(m.R.Header.Get(html.AcceptLanguage), ",;"), 0) },
@ -160,31 +158,27 @@ func init() {
), " ."), 0)), "_", "-"))
m.Option("language.list", m.Cmd(nfs.DIR, nfs.TemplatePath(m, aaa.LANGUAGE)+nfs.PS, nfs.FILE).Appendv(nfs.FILE))
m.Option("theme.list", m.Cmd(nfs.DIR, nfs.TemplatePath(m, aaa.THEME)+nfs.PS, nfs.FILE).Appendv(nfs.FILE))
m.Option(nfs.REPOS, m.Cmdv(web.SPIDE, nfs.REPOS, web.CLIENT_URL))
m.Option("icon.lib", mdb.Conf(m, ICON, kit.Keym(nfs.PATH)))
m.Option("diy", mdb.Config(m, "diy"))
m.Echo(mdb.Config(m, TITLE))
mdb.HashSelect(m, arg...).Sort(mdb.ORDER, ice.INT)
m.Table(func(value ice.Maps) { m.Push(mdb.STATUS, kit.Select(mdb.ENABLE, mdb.DISABLE, value[mdb.ORDER] == "")) })
kit.If(m.Length() == 0, func() {
m.Push(mdb.TIME, m.Time()).Push(mdb.NAME, cli.QRCODE).Push(mdb.HELP, "扫码登录").Push(mdb.ICONS, nfs.USR_ICONS_VOLCANOS).Push(mdb.TYPE, cli.QRCODE).Push(web.LINK, "").Push(mdb.ORDER, "10")
})
kit.If(GetSSO(m), func(p string) {
m.Push(mdb.TIME, m.Time()).Push(mdb.NAME, web.SERVE).Push(mdb.ICONS, nfs.USR_ICONS_ICEBERGS).Push(mdb.TYPE, "oauth").Push(web.LINK, p)
})
m.StatusTimeCount(kit.Dict(mdb.ConfigSimple(m, ice.DEMO)))
kit.If(kit.IsIn(m.Option(ice.MSG_USERROLE), aaa.TECH, aaa.ROOT), func() { m.Action(mdb.CREATE, ice.DEMO) })
if m.Option(ice.MSG_USERNAME) == "" || m.Option(ice.MSG_INDEX) == m.PrefixKey() {
mdb.HashSelect(m, arg...).Sort(mdb.ORDER, ice.INT)
m.Table(func(value ice.Maps) { m.Push(mdb.STATUS, kit.Select(mdb.ENABLE, mdb.DISABLE, value[mdb.ORDER] == "")) })
defer m.StatusTimeCount(kit.Dict(mdb.ConfigSimple(m, ice.DEMO)))
}
if gdb.Event(m, HEADER_AGENT); !_header_check(m, arg...) {
return
kit.If(m.Length() == 0, func() {
m.Push(mdb.TIME, m.Time()).Push(mdb.NAME, cli.QRCODE).Push(mdb.HELP, "扫码登录").Push(mdb.ICONS, nfs.USR_ICONS_VOLCANOS).Push(mdb.TYPE, cli.QRCODE).Push(web.LINK, "").Push(mdb.ORDER, "10")
})
kit.If(GetSSO(m), func(p string) {
m.Push(mdb.TIME, m.Time()).Push(mdb.NAME, web.SERVE).Push(mdb.ICONS, nfs.USR_ICONS_ICEBERGS).Push(mdb.TYPE, "oauth").Push(web.LINK, p)
})
} else {
kit.If(kit.IsIn(m.Option(ice.MSG_USERROLE), aaa.TECH, aaa.ROOT), func() { m.Action(mdb.CREATE, ice.DEMO) })
msg := m.Cmd(aaa.USER, m.Option(ice.MSG_USERNAME))
if role := msg.Append(aaa.USERROLE); role != m.Option(ice.MSG_USERROLE) {
m.Cmd(aaa.SESS, mdb.MODIFY, mdb.HASH, m.Option(ice.MSG_SESSID), aaa.USERROLE, m.Option(ice.MSG_USERROLE, role))
}
kit.For([]string{aaa.USERNICK, aaa.LANGUAGE, aaa.EMAIL}, func(k string) { kit.If(msg.Append(k), func(v string) { m.Option(k, v) }) })
kit.For([]string{aaa.AVATAR, aaa.BACKGROUND}, func(k string) { m.Option(k, msg.Append(k)) })
}
msg := m.Cmd(aaa.USER, m.Option(ice.MSG_USERNAME))
if role := msg.Append(aaa.USERROLE); role != m.Option(ice.MSG_USERROLE) {
m.Cmd(aaa.SESS, mdb.MODIFY, mdb.HASH, m.Option(ice.MSG_SESSID), aaa.USERROLE, role)
m.Option(ice.MSG_USERROLE, role)
}
kit.For([]string{aaa.USERNICK, aaa.LANGUAGE, aaa.EMAIL}, func(k string) { kit.If(msg.Append(k), func(v string) { m.Option(k, v) }) })
// kit.For([]string{aaa.AVATAR, aaa.BACKGROUND}, func(k string) { m.Option(k, web.RequireFile(m, msg.Append(k))) })
kit.For([]string{aaa.AVATAR, aaa.BACKGROUND}, func(k string) { m.Option(k, msg.Append(k)) })
}},
})
}

View File

@ -58,9 +58,7 @@ func init() {
web.DREAM_REMOVE: {Hand: func(m *ice.Message, arg ...string) {
MessageInsertPlug(m, web.DREAM, "", "", web.DREAM, m.Option(mdb.NAME))
}},
web.SPACE_LOGIN: {Hand: func(m *ice.Message, arg ...string) {
MessageInsertPlug(m, aaa.APPLY, "", "", web.CHAT_GRANT, m.Option(mdb.NAME))
}},
// web.SPACE_LOGIN: {Hand: func(m *ice.Message, arg ...string) { MessageInsertPlug(m, aaa.APPLY, "", "", web.CHAT_GRANT, m.Option(mdb.NAME)) }},
aaa.OFFER_CREATE: {Hand: func(m *ice.Message, arg ...string) {
MessageInsertPlug(m, aaa.APPLY, "", "", aaa.OFFER, m.Option(mdb.HASH))
}},

View File

@ -44,7 +44,7 @@ const (
type Client struct {
ice.Hash
short string `data:"domain,client_id"`
field string `data:"time,hash,domain,client_id,client_secret,oauth_url,grant_url,token_url,users_url,scope,login,user_key,nick_key,icon_key,api_prefix,token_prefix"`
field string `data:"time,hash,domain,client_id,client_secret,oauth_url,grant_url,token_url,users_url,scope,login,user_key,user_cmd,sess_cmd,nick_key,icon_key,api_prefix,token_prefix"`
sso string `name:"sso name* help icons*" help:"登录"`
auth string `name:"auth" help:"授权" icon:"bi bi-person-check"`
user string `name:"user" help:"用户" icon:"bi bi-person-vcard"`
@ -103,6 +103,10 @@ func (s Client) User(m *ice.Message, arg ...string) {
if res := s.Get(m, m.Option(mdb.HASH), m.Option(USERS_URL), arg...); res != nil {
m.Info("what %v", kit.Format(res))
m.Options(res)
if m.Option("user_cmd") != "" {
m.Cmdy(kit.Split(m.Option("user_cmd")), kit.Simple(res))
return
}
username := m.Option(aaa.USERNAME, m.Option(kit.Select(aaa.USERNAME, m.Option(USER_KEY))))
if m.Cmd(aaa.USER, username).Length() > 0 {
m.Cmd(aaa.USER, mdb.MODIFY, aaa.USERNAME, username,
@ -154,11 +158,19 @@ func (s Client) Login2(m *ice.Message, arg ...string) {
kit.Value(res, EXPIRES_IN, m.Time(kit.Format("%vs", kit.Int(kit.Value(res, EXPIRES_IN)))))
m.Info("what %v", kit.Format(res))
m.Options(res)
if s.User(m, m.OptionSimple("openid")...); !m.WarnNotValid(m.Option(aaa.USERNAME) == "") && m.R != nil {
if s.User(m, m.OptionSimple("openid")...); m.Option(aaa.USERNAME) != "" && m.R != nil {
if m.Option("sess_cmd") != "" {
m.Cmdy(kit.Split(m.Option("sess_cmd")), kit.Simple(res))
return
}
m.Cmd(aaa.USER, mdb.MODIFY, m.OptionSimple(aaa.USERNAME), kit.Simple(res))
web.RenderCookie(m.Message, aaa.SessCreate(m.Message, m.Option(aaa.USERNAME)))
m.ProcessBack("-2")
} else {
if m.Option("sess_cmd") != "" {
m.Cmdy(kit.Split(m.Option("sess_cmd")), kit.Simple(res))
return
}
m.ProcessClose()
}
}

View File

@ -40,7 +40,8 @@ func init() {
} else if len(arg) == 0 || arg[0] == "" {
web.RenderMain(m)
} else {
if m.Cmd(web.SPACE, arg[0]).Length() == 0 && nfs.Exists(m, path.Join(ice.USR_LOCAL_WORK, arg[0])) {
msg := m.Cmd(web.SPACE, arg[0])
if msg.Length() == 0 && nfs.Exists(m, path.Join(ice.USR_LOCAL_WORK, arg[0])) {
m.Cmd(web.DREAM, cli.START, kit.Dict(mdb.NAME, arg[0]))
}
if m.Option(ice.MSG_USERPOD, arg[0]); len(arg) == 1 {
@ -49,8 +50,7 @@ func init() {
if kit.IsIn(arg[2], web.ADMIN) {
m.Cmdy(web.SPACE, arg[0], arg[2], arg[3:])
} else {
m.Options(m.Cmd(web.SPACE, arg[0]).AppendSimple())
m.Options(mdb.ICONS, "")
m.Options(msg.AppendSimple()).Options(mdb.ICONS, "")
web.RenderPodCmd(m, arg[0], arg[2], arg[3:])
}
}

View File

@ -152,7 +152,7 @@ func init() {
_vimer_make(m, nfs.PWD, msg)
}
}},
REPOS: {Hand: func(m *ice.Message, arg ...string) {
REPOS: {Role: aaa.VOID, Hand: func(m *ice.Message, arg ...string) {
m.Cmdy(REPOS, ice.OptionFields(nfs.PATH)).Sort(nfs.PATH)
}},
ice.APP: {Help: "本机", Hand: func(m *ice.Message, arg ...string) {

10
lock.go
View File

@ -63,8 +63,8 @@ func (m *Message) setDetail(key string, arg ...string) *Message {
m._meta[KEY][i] = m._meta[KEY][i+1]
m._meta[VALUE][i] = m._meta[VALUE][i+1]
}
m._meta[KEY] = m._meta[KEY][0:len(m._meta[KEY])-1]
m._meta[VALUE] = m._meta[VALUE][0:len(m._meta[VALUE])-1]
m._meta[KEY] = m._meta[KEY][0 : len(m._meta[KEY])-1]
m._meta[VALUE] = m._meta[VALUE][0 : len(m._meta[VALUE])-1]
return m
}
}
@ -89,7 +89,11 @@ func (m *Message) Optionv(key string, arg ...Any) Any {
case []string:
m._meta[key] = v
default:
m._data[key] = v
if len(arg) > 1 {
m._data[key] = arg
} else {
m._data[key] = v
}
}
} else {
unlock = m.lock.RLock()

View File

@ -11,7 +11,7 @@ import (
"shylinux.com/x/icebergs/base/gdb"
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/nfs"
"shylinux.com/x/icebergs/base/web/html"
// "shylinux.com/x/icebergs/base/web/html"
"shylinux.com/x/icebergs/core/chat"
"shylinux.com/x/icebergs/core/chat/location"
kit "shylinux.com/x/toolkits"
@ -20,7 +20,8 @@ import (
func _wx_sign(m *ice.Message, nonce, stamp string) string {
return kit.Format(sha1.Sum([]byte(kit.Join(kit.Sort(kit.Simple(
kit.Format("jsapi_ticket=%s", m.Cmdx(ACCESS, TICKET)),
kit.Format("url=%s", m.R.Header.Get(html.Referer)),
// kit.Format("url=%s", m.R.Header.Get(html.Referer)),
kit.Format("url=%s", m.Option(ice.MSG_REFERER)),
kit.Format("timestamp=%s", stamp),
kit.Format("noncestr=%s", nonce),
)), "&"))))
@ -42,12 +43,9 @@ func init() {
}},
"getLocation": {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(location.LOCATION, mdb.CREATE, arg) }},
"scanQRCode1": {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(chat.FAVOR, mdb.CREATE, arg) }},
"oauth": {Hand: func(m *ice.Message, arg ...string) {
mdb.Config(m, "oauth", arg[0])
}},
"oauth": {Hand: func(m *ice.Message, arg ...string) { mdb.Config(m, "oauth", arg[0]) }},
}, gdb.EventsAction(chat.HEADER_AGENT), ctx.ConfAction(
"oauth", "",
nfs.SCRIPT, "https://res.wx.qq.com/open/js/jweixin-1.6.0.js",
"oauth", "", 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("")
ctx.OptionFromConfig(m, nfs.SCRIPT, "oauth")

View File

@ -32,16 +32,15 @@ Volcanos(chat.ONIMPORT, {
]), openTagList: ["wx-open-subscribe"],
})
wx.ready(function () {
function share(title, icons) {
wx.updateAppMessageShareData({title: title, desc: can.user.info.titles, link: location.href, imgUrl: icons})
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)
share(document.title, p)
can.user.agent.init = function(can) { if (!can) { return }
can.user.agent.init = function(can, content) { if (!can) { return }
p = can.misc.Resource(can, can.Conf(mdb.ICONS))||p; can.base.beginWith(p, "/") && (p = location.origin + p)
share(document.title, p)
}, can.user.agent.init(can.user.agent.cmd)
share(document.title, p, content)
}, can.user.agent.init(can.user.agent.cmd, can.user.agent._init_content)
})
})
},

View File

@ -33,7 +33,11 @@ func init() {
kit.If(value[STORM] != "1", func() { key = kit.Keys(key, "sub_button", kit.Int(value[STORM])-2) })
kit.If(value[mdb.TYPE] == "view", func() {
if value[mdb.TEXT] == "" {
value[mdb.TEXT] = web.C(value[ctx.INDEX])
if value[web.SPACE] != "" {
value[mdb.TEXT] = web.S(value[web.SPACE]) + web.C(value[ctx.INDEX])
} else {
value[mdb.TEXT] = web.C(value[ctx.INDEX])
}
}
value[mdb.TEXT] = m.MergeLink(value[mdb.TEXT])
})