This commit is contained in:
baiqwerdvd 2024-10-13 13:08:58 +08:00
parent d836d7dd8d
commit 89f5b8364d
No known key found for this signature in database
GPG Key ID: 7717E46E1797411A
3 changed files with 12 additions and 26 deletions

View File

@ -50,7 +50,7 @@ def transUnset(v: Union[T1, UnsetType], d: T2 = None) -> Union[T1, T2]:
class SklandLogin: class SklandLogin:
_HEADER: ClassVar[Dict[str, str]] = { _HEADER: ClassVar[Dict[str, str]] = {
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36 Edg/129.0.0.0", # noqa: E501 "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36", # noqa: E501
"content-type": "application/json;charset=UTF-8", "content-type": "application/json;charset=UTF-8",
"origin": "https://www.skland.com", "origin": "https://www.skland.com",
"referer": "https://www.skland.com", "referer": "https://www.skland.com",
@ -77,7 +77,7 @@ class SklandLogin:
else: else:
data = GeneralV1SendPhoneCodeRequest( data = GeneralV1SendPhoneCodeRequest(
phone=self.phone, phone=self.phone,
type=1, type=2,
) )
response = self.client.post( response = self.client.post(
ARK_LOGIN_SEND_PHONE_CODE, ARK_LOGIN_SEND_PHONE_CODE,
@ -116,16 +116,6 @@ class SklandLogin:
return result.msg return result.msg
def token_by_phone_code(self, code: str): def token_by_phone_code(self, code: str):
# data = UserAuthV2TokenByPhoneCodeRequest(
# phone=self.phone,
# code=code,
# )
# data = {
# "phone": self.phone,
# "code": code,
# }
# data = mscjson.decode(mscjson.encode(data))
# print(data)
response = self.client.post( response = self.client.post(
ARK_TOKEN_BY_PHONE_CODE, ARK_TOKEN_BY_PHONE_CODE,
json={ json={
@ -133,8 +123,8 @@ class SklandLogin:
"code": code, "code": code,
}, },
) )
response.raise_for_status()
result = convert(response.json(), UserAuthV2TokenByPhoneCodeResponse) result = convert(response.json(), UserAuthV2TokenByPhoneCodeResponse)
print(result)
status = result.status status = result.status
if status == 101: if status == 101:
msg = transUnset(result.msg) msg = transUnset(result.msg)

View File

@ -1,4 +1,4 @@
ARK_USER_ME = "https://zonai.skland.com/api/v1/user/me" ARK_WEB_USER = "https://zonai.skland.com/web/v1/user"
ARK_REFRESH_TOKEN = "https://zonai.skland.com/api/v1/auth/refresh" ARK_REFRESH_TOKEN = "https://zonai.skland.com/api/v1/auth/refresh"

View File

@ -19,25 +19,21 @@ from ...models.skland.models import (
ArknightsPlayerInfoModel, ArknightsPlayerInfoModel,
ArknightsUserMeModel, ArknightsUserMeModel,
) )
from .api import ARK_PLAYER_INFO, ARK_REFRESH_TOKEN, ARK_SKD_SIGN, ARK_USER_ME from .api import ARK_PLAYER_INFO, ARK_REFRESH_TOKEN, ARK_SKD_SIGN, ARK_WEB_USER
proxy_url = core_plugins_config.get_config("proxy").data proxy_url = core_plugins_config.get_config("proxy").data
ssl_verify = core_plugins_config.get_config("MhySSLVerify").data ssl_verify = core_plugins_config.get_config("MhySSLVerify").data
_HEADER: Dict[str, str] = { _HEADER: Dict[str, str] = {
"Host": "zonai.skland.com", "User-Agent": "Skland/1.5.1 (com.hypergryph.skland; build:100501001; Android 33; ) Okhttp/4.11.0",
"platform": "1", "Accept-Encoding": "gzip",
"Connection": "close",
"Origin": "https://www.skland.com", "Origin": "https://www.skland.com",
"Referer": "https://www.skland.com/", "Referer": "https://www.skland.com/",
"Content-Type": "application/json", "Content-Type": "application/json",
"User-Agent": "Skland/1.5.1 (com.hypergryph.skland; build:100501001; Android 33; ) Okhttp/4.11.0",
"vName": "1.5.1",
"vCode": "100501001",
"nId": "1",
"os": "33",
"manufacturer": "Xiaomi", "manufacturer": "Xiaomi",
"Connection": "close", "os": "33",
} }
@ -204,8 +200,8 @@ class BaseArkApi:
if cred is None: if cred is None:
return False return False
header["cred"] = cred header["cred"] = cred
header = await self.set_sign(ARK_USER_ME, header=header, token=token) header = await self.set_sign(ARK_WEB_USER, header=header, token=token)
raw_data = await self.ark_request(ARK_USER_ME, header=header) raw_data = await self.ark_request(ARK_WEB_USER, header=header)
if isinstance(raw_data, int) or not raw_data: if isinstance(raw_data, int) or not raw_data:
return False return False
if "code" in raw_data and raw_data["code"] == 10001: if "code" in raw_data and raw_data["code"] == 10001:
@ -256,7 +252,7 @@ class BaseArkApi:
"platform": header.get("platform", "1"), "platform": header.get("platform", "1"),
"timestamp": timestamp, "timestamp": timestamp,
"dId": dId, "dId": dId,
"vName": header.get("vName", ""), "vName": "1.5.1",
}, },
separators=(",", ":"), separators=(",", ":"),
) )