diff --git a/base/web/serve.go b/base/web/serve.go index ad043fbd..39f2bdda 100644 --- a/base/web/serve.go +++ b/base/web/serve.go @@ -198,6 +198,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)) diff --git a/base/web/share.go b/base/web/share.go index 0a1a4665..bc79a589 100644 --- a/base/web/share.go +++ b/base/web/share.go @@ -125,7 +125,7 @@ func init() { RenderPodCmd(m, msg.Append(SPACE), msg.Append(mdb.NAME), kit.UnMarshal(msg.Append(mdb.TEXT))) } case DOWNLOAD: - m.RenderDownload(msg.Append(mdb.TEXT)) + m.RenderDownload(msg.Append(mdb.TEXT), msg.Append(mdb.TYPE), msg.Append(mdb.NAME)) default: RenderMain(m) } diff --git a/conf.go b/conf.go index 8e712b8e..f2dea947 100644 --- a/conf.go +++ b/conf.go @@ -235,6 +235,7 @@ const ( // MSG MSG_USERZONE = "user.zone" MSG_LANGUAGE = "user.lang" MSG_AVATAR = "user.avatar" + MSG_USERUID = "user.uid" MSG_BG = "sess.bg" MSG_FG = "sess.fg" diff --git a/core/chat/oauth/client.go b/core/chat/oauth/client.go index 281fab2a..8a129cff 100644 --- a/core/chat/oauth/client.go +++ b/core/chat/oauth/client.go @@ -170,7 +170,8 @@ func (s Client) Login2(m *ice.Message, arg ...string) { if msg.Option(SESS_CMD) != "" { m.Cmdy(kit.Split(msg.Option(SESS_CMD)), kit.Dict("user_uid", msg.Option("user_uid"))) } else { - m.ProcessCookie(ice.MSG_SESSID, aaa.SessCreate(m.Message, msg.Option(aaa.USERNAME)), "-2") + // m.ProcessCookie(ice.MSG_SESSID, aaa.SessCreate(m.Message, msg.Option(aaa.USERNAME)), "-2") + m.ProcessCookie(ice.MSG_SESSID, aaa.SessCreate(m.Message, msg.Option(aaa.USERNAME)), "-3") } } } diff --git a/core/chat/pod.go b/core/chat/pod.go index 41a82e61..d424434c 100644 --- a/core/chat/pod.go +++ b/core/chat/pod.go @@ -18,6 +18,22 @@ const POD = "pod" func init() { Index.MergeCommands(ice.Commands{ POD: {Help: "空间", Actions: web.ApiWhiteAction(), Hand: func(m *ice.Message, arg ...string) { + if m.IsWeixinUA() && m.Option(ice.MSG_USERNAME) == "" { + template := func(script string) string { return kit.Format(`
`, 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=%s;path=/"; location.href = "%s"`), + m.R.URL.String(), 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], m.Option("goback"))) + return + } + } + } if m.IsCliUA() { if len(arg) == 0 || arg[0] == "" { m.Option(ice.MSG_USERROLE, aaa.TECH)