feat: base panel

This commit is contained in:
bietiaop 2024-07-12 02:43:32 +08:00
parent cbef7478c2
commit ac0c3d0d6c
12 changed files with 361 additions and 149 deletions

View file

@ -15,29 +15,60 @@ export default class ZZZApiTool {
this.server = server;
this.game = 'zzz';
this.uuid = crypto.randomUUID();
if (['prod_gf_cn'].includes(this.server)) {
this.host = 'https://api-takumi.mihoyo.com/';
this.hostRecord = 'https://api-takumi-record.mihoyo.com/';
this.hostPublicData = 'https://public-data-api.mihoyo.com/';
} else {
this.host = 'https://sg-public-api.hoyolab.com/';
this.hostRecord = 'https://bbs-api-os.hoyolab.com/';
this.hostPublicData = 'https://sg-public-data-api.hoyoverse.com/';
}
this.zzzUrlMap = {
zzzUser: {
url: `${this.host}binding/api/getUserGameRolesByCookie`,
query: `game_biz=nap_cn&region=${this.server}&game_uid=${this.uid}`,
},
zzzNote: {
url: `${this.hostRecord}event/game_record_zzz/api/zzz/note`,
query: `role_id=${this.uid}&server=${this.server}`,
},
zzzIndex: {
url: `${this.hostRecord}event/game_record_zzz/api/zzz/index`,
query: `role_id=${this.uid}&server=${this.server}`,
},
zzzAvatarList: {
url: `${this.hostRecord}event/game_record_zzz/api/zzz/avatar/basic`,
query: `role_id=${this.uid}&server=${this.server}`,
},
zzzAvatarInfo: {
url: `${this.hostRecord}event/game_record_zzz/api/zzz/avatar/info`,
query: `role_id=${this.uid}&server=${this.server}&need_wiki=false`,
},
zzzBuddyList: {
url: `${this.hostRecord}event/game_record_zzz/api/zzz/buddy/info`,
query: `role_id=${this.uid}&server=${this.server}`,
},
zzzAuthKey: {
url: `${this.host}binding/api/genAuthKey`,
body: {
auth_appid: 'webview_gacha',
game_biz: 'nap_cn',
game_uid: this.uid * 1,
region: this.server,
},
dsSalt: 'web',
},
};
}
getUrlMap = (data = {}) => {
let host, hostRecord, hostPublicData;
if (['prod_gf_cn'].includes(this.server)) {
host = 'https://api-takumi.mihoyo.com/';
hostRecord = 'https://api-takumi-record.mihoyo.com/';
hostPublicData = 'https://public-data-api.mihoyo.com/';
} else {
host = 'https://sg-public-api.hoyolab.com/';
hostRecord = 'https://bbs-api-os.hoyolab.com/';
hostPublicData = 'https://sg-public-data-api.hoyoverse.com/';
}
let urlMap = {
zzz: {
...(['prod_gf_cn'].includes(this.server)
? {
zzzUser: {
url: `${host}binding/api/getUserGameRolesByCookie`,
query: `game_biz=nap_cn&region=${this.server}&game_uid=${this.uid}`,
},
getFp: {
url: `${hostPublicData}device-fp/api/getFp`,
url: `${this.hostPublicData}device-fp/api/getFp`,
body: {
seed_id: `${generateSeed(16)}`,
device_id: data.deviceId,
@ -51,12 +82,8 @@ export default class ZZZApiTool {
},
}
: {
zzzUser: {
url: `${host}binding/api/getUserGameRolesByCookie`,
query: `game_biz=nap_global&region=${this.server}&game_uid=${this.uid}`,
},
getFp: {
url: `${hostPublicData}device-fp/api/getFp`,
url: `${this.hostPublicData}device-fp/api/getFp`,
body: {
seed_id: `${this.uuid}`,
device_id: '35315696b7071100',
@ -70,45 +97,29 @@ export default class ZZZApiTool {
noDs: true,
},
}),
zzzNote: {
url: `${hostRecord}event/game_record_zzz/api/zzz/note`,
query: `role_id=${this.uid}&server=${this.server}`,
},
zzzIndex: {
url: `${hostRecord}event/game_record_zzz/api/zzz/index`,
query: `role_id=${this.uid}&server=${this.server}`,
},
zzzAvatarList: {
url: `${hostRecord}event/game_record_zzz/api/zzz/avatar/basic`,
query: `role_id=${this.uid}&server=${this.server}`,
},
zzzBuddyList: {
url: `${hostRecord}event/game_record_zzz/api/zzz/buddy/info`,
query: `role_id=${this.uid}&server=${this.server}`,
},
zzzAuthKey: {
url: `${host}binding/api/genAuthKey`,
body: {
auth_appid: 'webview_gacha',
game_biz: 'nap_cn',
game_uid: this.uid * 1,
region: this.server,
},
dsSalt: 'web',
},
...this.zzzUrlMap,
},
};
if (/_us|_eu|_jp|_sg/.test(this.server)) {
urlMap.zzz.zzzNote.url = 'https://sg-act-nap-api.hoyolab.com/event/game_record_zzz/api/zzz/note'
urlMap.zzz.zzzNote.query = `role_id=${this.uid}&server=${this.server}`
urlMap.zzz.zzzIndex.url = 'https://sg-act-nap-api.hoyolab.com/event/game_record_zzz/api/zzz/index'
urlMap.zzz.zzzIndex.query = `lang=zh-cn&role_id=${this.uid}&server=${this.server}`
urlMap.zzz.zzzAvatarList.url = 'https://sg-act-nap-api.hoyolab.com/event/game_record_zzz/api/zzz/avatar/basic'
urlMap.zzz.zzzAvatarList.query = `role_id=${this.uid}&server=${this.server}`
urlMap.zzz.zzzBuddyList.url = 'https://sg-act-nap-api.hoyolab.com/event/game_record_zzz/api/zzz/buddy/info'
urlMap.zzz.zzzBuddyList.query = `role_id=${this.uid}&server=${this.server}`
};
urlMap.zzz.zzzNote.url =
'https://sg-act-nap-api.hoyolab.com/event/game_record_zzz/api/zzz/note';
urlMap.zzz.zzzNote.query = `role_id=${this.uid}&server=${this.server}`;
urlMap.zzz.zzzIndex.url =
'https://sg-act-nap-api.hoyolab.com/event/game_record_zzz/api/zzz/index';
urlMap.zzz.zzzIndex.query = `lang=zh-cn&role_id=${this.uid}&server=${this.server}`;
urlMap.zzz.zzzAvatarList.url =
'https://sg-act-nap-api.hoyolab.com/event/game_record_zzz/api/zzz/avatar/basic';
urlMap.zzz.zzzAvatarList.query = `role_id=${this.uid}&server=${this.server}`;
urlMap.zzz.zzzAvatarInfo.url =
'https://sg-act-nap-api.hoyolab.com/event/game_record_zzz/api/zzz/avatar/info';
urlMap.zzz.zzzAvatarInfo.query = `role_id=${this.uid}&server=${this.server}&need_wiki=false`;
urlMap.zzz.zzzBuddyList.url =
'https://sg-act-nap-api.hoyolab.com/event/game_record_zzz/api/zzz/buddy/info';
urlMap.zzz.zzzBuddyList.query = `role_id=${this.uid}&server=${this.server}`;
urlMap.zzzUser.url = `${this.host}binding/api/getUserGameRolesByCookie`;
urlMap.zzzUser.query = `game_biz=nap_global&region=${this.server}&game_uid=${this.uid}`;
}
return urlMap[this.game];
};
}