mirror of
https://shylinux.com/x/icebergs
synced 2025-04-28 10:12:02 +08:00
opt header
This commit is contained in:
parent
a24e75a232
commit
099b1f67f8
@ -91,6 +91,8 @@ const (
|
|||||||
INVITE = "invite"
|
INVITE = "invite"
|
||||||
)
|
)
|
||||||
const (
|
const (
|
||||||
|
BACKGROUND = "background"
|
||||||
|
|
||||||
AVATAR = "avatar"
|
AVATAR = "avatar"
|
||||||
GENDER = "gender"
|
GENDER = "gender"
|
||||||
MOBILE = "mobile"
|
MOBILE = "mobile"
|
||||||
|
@ -181,7 +181,7 @@ func _space_search(m *ice.Message, kind, name, text string, arg ...string) {
|
|||||||
m.Richs(SPACE, nil, kit.MDB_FOREACH, func(key string, value map[string]interface{}) {
|
m.Richs(SPACE, nil, kit.MDB_FOREACH, func(key string, value map[string]interface{}) {
|
||||||
if value = kit.GetMeta(value); strings.Contains(kit.Format(value[kit.MDB_NAME]), name) && value[kit.MDB_TYPE] != MASTER {
|
if value = kit.GetMeta(value); strings.Contains(kit.Format(value[kit.MDB_NAME]), name) && value[kit.MDB_TYPE] != MASTER {
|
||||||
m.PushSearch(kit.SSH_CMD, SPACE, kit.MDB_TYPE, value[kit.MDB_TYPE], kit.MDB_NAME, value[kit.MDB_NAME],
|
m.PushSearch(kit.SSH_CMD, SPACE, kit.MDB_TYPE, value[kit.MDB_TYPE], kit.MDB_NAME, value[kit.MDB_NAME],
|
||||||
kit.MDB_TEXT, kit.MergeURL(m.Option(ice.MSG_USERWEB), kit.SSH_POD, kit.Keys(m.Option(ice.MSG_USERPOD), value)))
|
kit.MDB_TEXT, kit.MergeURL(m.Option(ice.MSG_USERWEB), kit.SSH_POD, kit.Keys(m.Option(ice.MSG_USERPOD), value[kit.MDB_NAME])), value)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -259,7 +259,7 @@ func init() {
|
|||||||
if m.Option(ice.MSG_USERNAME) != "" {
|
if m.Option(ice.MSG_USERNAME) != "" {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
link := kit.MergeURL(m.Conf(SHARE, kit.Keym(kit.MDB_DOMAIN)), "auth", name)
|
link := kit.MergeURL(m.Conf(SHARE, kit.Keym(kit.MDB_DOMAIN)), "grant", name)
|
||||||
go func() {
|
go func() {
|
||||||
m.Sleep("100ms").Cmd(SPACE, name, "pwd", name, link, m.Cmdx(cli.QRCODE, link))
|
m.Sleep("100ms").Cmd(SPACE, name, "pwd", name, link, m.Cmdx(cli.QRCODE, link))
|
||||||
}()
|
}()
|
||||||
|
@ -11,32 +11,35 @@ import (
|
|||||||
|
|
||||||
func _header_check(m *ice.Message) {
|
func _header_check(m *ice.Message) {
|
||||||
if m.Option(web.SHARE) != "" {
|
if m.Option(web.SHARE) != "" {
|
||||||
msg := m.Cmd(web.SHARE, m.Option(web.SHARE))
|
switch msg := m.Cmd(web.SHARE, m.Option(web.SHARE)); msg.Append(kit.MDB_TYPE) {
|
||||||
|
case web.LOGIN: // 扫码登录
|
||||||
switch msg.Append(kit.MDB_TYPE) {
|
|
||||||
case web.LOGIN:
|
|
||||||
if m.Option(ice.MSG_USERNAME) != msg.Append(aaa.USERNAME) {
|
if m.Option(ice.MSG_USERNAME) != msg.Append(aaa.USERNAME) {
|
||||||
web.Render(m, web.COOKIE, aaa.SessCreate(m, m.Option(ice.MSG_USERNAME, msg.Append(aaa.USERNAME))))
|
web.RenderCookie(m, aaa.SessCreate(m, m.Option(ice.MSG_USERNAME, msg.Append(aaa.USERNAME))))
|
||||||
}
|
}
|
||||||
case web.APPLY:
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m.Option(kit.MDB_TYPE, msg.Append(kit.MDB_TYPE))
|
|
||||||
m.Option(kit.MDB_NAME, msg.Append(kit.MDB_NAME))
|
|
||||||
m.Option(kit.MDB_TEXT, msg.Append(kit.MDB_TEXT))
|
|
||||||
m.Option(aaa.USERNAME, msg.Append(aaa.USERNAME))
|
|
||||||
}
|
}
|
||||||
m.Option(web.SSO, m.Conf(web.SERVE, kit.Keym(web.SSO)))
|
|
||||||
|
if m.Option(ice.MSG_USERNAME) == "" { // 单点登录
|
||||||
|
m.Option(web.SSO, m.Conf(web.SERVE, kit.Keym(web.SSO)))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func _header_grant(m *ice.Message, arg ...string) {
|
||||||
|
if pod := m.Option(kit.SSH_POD); pod != "" {
|
||||||
|
m.Option(kit.SSH_POD, "")
|
||||||
|
m.Cmd(web.SPACE, pod, m.Prefix(P_HEADER), kit.MDB_ACTION, GRANT, arg)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
m.Cmd(aaa.ROLE, kit.Select(aaa.TECH, aaa.VOID, m.Option(ice.MSG_USERROLE) == aaa.VOID), m.Option(ice.MSG_USERNAME))
|
||||||
|
m.Cmd(web.SPACE, m.Option(web.SPACE), ice.MSG_SESSID, aaa.SessCreate(m, m.Option(ice.MSG_USERNAME)))
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
APPLY = "apply"
|
TITLE = "title"
|
||||||
LOGIN = "login"
|
LOGIN = "login"
|
||||||
CHECK = "check"
|
CHECK = "check"
|
||||||
TITLE = "title"
|
GRANT = "grant"
|
||||||
AGENT = "agent"
|
AGENT = "agent"
|
||||||
|
|
||||||
BACKGROUND = "background"
|
|
||||||
)
|
)
|
||||||
const P_HEADER = "/header"
|
const P_HEADER = "/header"
|
||||||
const HEADER = "header"
|
const HEADER = "header"
|
||||||
@ -47,31 +50,10 @@ func init() {
|
|||||||
HEADER: {Name: HEADER, Help: "标题栏", Value: kit.Data(TITLE, "github.com/shylinux/contexts")},
|
HEADER: {Name: HEADER, Help: "标题栏", Value: kit.Data(TITLE, "github.com/shylinux/contexts")},
|
||||||
},
|
},
|
||||||
Commands: map[string]*ice.Command{
|
Commands: map[string]*ice.Command{
|
||||||
"toast": {Name: "toast target msg", Help: "命令行", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
|
||||||
m.Option(ice.MSG_USERUA, "chrome")
|
|
||||||
m.Cmd(web.SPACE, arg[0], "Header.user.toast", "", ice.Render(m, ice.RENDER_QRCODE, arg[1]), arg[2:])
|
|
||||||
}},
|
|
||||||
|
|
||||||
P_HEADER: {Name: "/header", Help: "标题栏", Action: map[string]*ice.Action{
|
P_HEADER: {Name: "/header", Help: "标题栏", Action: map[string]*ice.Action{
|
||||||
"auth": {Name: "auth space", Help: "用户授权", Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
if pod := m.Option(kit.SSH_POD); pod != "" {
|
|
||||||
m.Option(kit.SSH_POD, "")
|
|
||||||
m.Cmd(web.SPACE, pod, m.Prefix(P_HEADER), kit.MDB_ACTION, "auth", arg)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
m.Cmd(aaa.ROLE, kit.Select(aaa.TECH, aaa.VOID, m.Option(ice.MSG_USERROLE) == aaa.VOID), m.Option(ice.MSG_USERNAME))
|
|
||||||
m.Cmd(web.SPACE, m.Option(web.SPACE), ice.MSG_SESSID, aaa.SessCreate(m, m.Option(ice.MSG_USERNAME)))
|
|
||||||
}},
|
|
||||||
web.SHARE: {Name: "share type", Help: "共享", Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
m.Cmdy(web.SHARE, mdb.CREATE, kit.MDB_TYPE, LOGIN, arg)
|
|
||||||
}},
|
|
||||||
APPLY: {Name: "apply", Help: "用户登录", Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
m.Cmdy(web.SHARE, mdb.CREATE, kit.MDB_TYPE, web.APPLY, kit.MDB_NAME, m.Option(kit.MDB_NAME))
|
|
||||||
}},
|
|
||||||
LOGIN: {Name: "login", Help: "用户登录", Hand: func(m *ice.Message, arg ...string) {
|
LOGIN: {Name: "login", Help: "用户登录", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if aaa.UserLogin(m, arg[0], arg[1]) {
|
if aaa.UserLogin(m, arg[0], arg[1]) {
|
||||||
web.Render(m, web.COOKIE, aaa.SessCreate(m, arg[0]))
|
web.RenderCookie(m, aaa.SessCreate(m, arg[0]))
|
||||||
}
|
}
|
||||||
m.Echo(m.Option(ice.MSG_USERNAME))
|
m.Echo(m.Option(ice.MSG_USERNAME))
|
||||||
}},
|
}},
|
||||||
@ -79,16 +61,23 @@ func init() {
|
|||||||
_header_check(m)
|
_header_check(m)
|
||||||
m.Echo(m.Option(ice.MSG_USERNAME))
|
m.Echo(m.Option(ice.MSG_USERNAME))
|
||||||
}},
|
}},
|
||||||
BACKGROUND: {Name: "background", Help: "背景图片", Hand: func(m *ice.Message, arg ...string) {
|
GRANT: {Name: "grant space", Help: "用户授权", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Option(BACKGROUND, m.Conf(HEADER, kit.Keym(BACKGROUND), arg[0]))
|
_header_grant(m, arg...)
|
||||||
}},
|
}},
|
||||||
AGENT: {Name: "agent", Help: "宿主机", Hand: func(m *ice.Message, arg ...string) {
|
AGENT: {Name: "agent", Help: "应用宿主", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy("web.chat.wx.access", "config")
|
m.Cmdy("web.chat.wx.access", "config")
|
||||||
}},
|
}},
|
||||||
|
|
||||||
code.WEBPACK: {Name: "webpack", Help: "打包", Hand: func(m *ice.Message, arg ...string) {
|
code.WEBPACK: {Name: "webpack", Help: "网页打包", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(code.WEBPACK, mdb.CREATE)
|
m.Cmdy(code.WEBPACK, mdb.CREATE)
|
||||||
}},
|
}},
|
||||||
|
web.SHARE: {Name: "share type", Help: "用户共享", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
m.Cmdy(web.SHARE, mdb.CREATE, kit.MDB_TYPE, LOGIN, arg)
|
||||||
|
}},
|
||||||
|
aaa.BACKGROUND: {Name: "background", Help: "背景图片", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
m.Option(aaa.USERNAME, m.Option(ice.MSG_USERNAME))
|
||||||
|
m.Cmdy("aaa.user", kit.MDB_ACTION, mdb.MODIFY, aaa.BACKGROUND, m.Option(aaa.BACKGROUND, arg[0]))
|
||||||
|
}},
|
||||||
aaa.USERNICK: {Name: "usernick", Help: "用户昵称", Hand: func(m *ice.Message, arg ...string) {
|
aaa.USERNICK: {Name: "usernick", Help: "用户昵称", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Option(aaa.USERNAME, m.Option(ice.MSG_USERNAME))
|
m.Option(aaa.USERNAME, m.Option(ice.MSG_USERNAME))
|
||||||
m.Cmdy("aaa.user", kit.MDB_ACTION, mdb.MODIFY, aaa.USERNICK, arg[0])
|
m.Cmdy("aaa.user", kit.MDB_ACTION, mdb.MODIFY, aaa.USERNICK, arg[0])
|
||||||
@ -97,7 +86,7 @@ func init() {
|
|||||||
m.Echo(aaa.UserRole(m, m.Option("who")))
|
m.Echo(aaa.UserRole(m, m.Option("who")))
|
||||||
}},
|
}},
|
||||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
m.Option(BACKGROUND, m.Conf(HEADER, kit.Keym(BACKGROUND)))
|
m.Option(aaa.BACKGROUND, m.Cmd("aaa.user", m.Option(ice.MSG_USERNAME)).Append(aaa.BACKGROUND))
|
||||||
m.Echo(m.Conf(HEADER, kit.Keym(TITLE)))
|
m.Echo(m.Conf(HEADER, kit.Keym(TITLE)))
|
||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
|
@ -29,6 +29,7 @@ func _wx_sign(m *ice.Message, nonce, stamp string) string {
|
|||||||
}
|
}
|
||||||
func _wx_config(m *ice.Message, nonce string) {
|
func _wx_config(m *ice.Message, nonce string) {
|
||||||
m.Option(APPID, m.Conf(LOGIN, kit.Keym(APPID)))
|
m.Option(APPID, m.Conf(LOGIN, kit.Keym(APPID)))
|
||||||
|
m.Option("script", m.Conf(LOGIN, kit.Keym("script")))
|
||||||
m.Option("signature", _wx_sign(m, m.Option("noncestr", nonce), m.Option("timestamp", kit.Format(time.Now().Unix()))))
|
m.Option("signature", _wx_sign(m, m.Option("noncestr", nonce), m.Option("timestamp", kit.Format(time.Now().Unix()))))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,6 +109,7 @@ const WX = "wx"
|
|||||||
var Index = &ice.Context{Name: WX, Help: "公众号",
|
var Index = &ice.Context{Name: WX, Help: "公众号",
|
||||||
Configs: map[string]*ice.Config{
|
Configs: map[string]*ice.Config{
|
||||||
LOGIN: {Name: LOGIN, Help: "认证", Value: kit.Data(
|
LOGIN: {Name: LOGIN, Help: "认证", Value: kit.Data(
|
||||||
|
"script", "https://res.wx.qq.com/open/js/jweixin-1.6.0.js",
|
||||||
WEIXIN, "https://api.weixin.qq.com", APPID, "", APPMM, "", TOKEN, "",
|
WEIXIN, "https://api.weixin.qq.com", APPID, "", APPMM, "", TOKEN, "",
|
||||||
kit.MDB_TEMPLATE, kit.Dict(kit.MDB_TEXT, text), MENU, []interface{}{
|
kit.MDB_TEMPLATE, kit.Dict(kit.MDB_TEXT, text), MENU, []interface{}{
|
||||||
kit.Dict(wiki.TITLE, "网站主页", wiki.SPARK, "点击进入", wiki.REFER, "https://shylinux.com",
|
kit.Dict(wiki.TITLE, "网站主页", wiki.SPARK, "点击进入", wiki.REFER, "https://shylinux.com",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user