28 lines
1001 B
Python
28 lines
1001 B
Python
"""YYB mall APIs require different session fields for WeChat and QQ OAuth."""
|
|
from __future__ import annotations
|
|
|
|
WECHAT_APPID = "wxd44977328b36e647"
|
|
QQ_APPID = "102033112"
|
|
|
|
|
|
def midas_login_params(cookies: dict[str, str]) -> dict[str, str]:
|
|
"""Build the provider-specific Midas session fields from OAuth cookies."""
|
|
login_type = str(cookies.get("logintype", cookies.get("login_type", "WX"))).upper()
|
|
if login_type == "QC":
|
|
return {
|
|
"openid": cookies.get("openid", ""),
|
|
"openkey": cookies.get("accesstoken", ""),
|
|
"session_id": "openid",
|
|
"session_type": "kp_accesstoken",
|
|
"wx_appid": "",
|
|
"qq_appid": cookies.get("appid", QQ_APPID),
|
|
}
|
|
return {
|
|
"openid": cookies.get("openid", ""),
|
|
"openkey": cookies.get("accesstoken", ""),
|
|
"session_id": "hy_gameid",
|
|
"session_type": "wc_actoken",
|
|
"wx_appid": cookies.get("appid", WECHAT_APPID),
|
|
"qq_appid": "",
|
|
}
|