mirror of
https://github.com/daydreamer-json/ak-endfield-api-archive.git
synced 2026-04-06 23:52:21 +02:00
feat: add launcher protocol data archive
- Add protocol data for multiple locales and versions - Implement protocol archiving in archive command - Update Api types and default settings for protocol support
This commit is contained in:
@@ -24,4 +24,5 @@ export default {
|
||||
'zh-cn',
|
||||
'zh-tw',
|
||||
] as const,
|
||||
launcherWebLangCN: ['zh-cn'] as const,
|
||||
};
|
||||
|
||||
@@ -7,6 +7,39 @@ import defaultSettings from './defaultSettings.js';
|
||||
import launcherWeb from './launcherWeb.js';
|
||||
|
||||
export default {
|
||||
protocol: async (
|
||||
appCode: string,
|
||||
channel: number,
|
||||
subChannel: number,
|
||||
language: (typeof defaultSettings.launcherWebLang)[number],
|
||||
region: 'os' | 'cn',
|
||||
dataVersion: string = '',
|
||||
): Promise<TypesApiAkEndfield.LauncherProtocol> => {
|
||||
const apiBase =
|
||||
region === 'cn'
|
||||
? appConfig.network.api.akEndfield.base.launcherCN
|
||||
: appConfig.network.api.akEndfield.base.launcher;
|
||||
const rsp = await ky
|
||||
.post(`https://${apiBase}/proxy/batch_proxy`, {
|
||||
...defaultSettings.ky,
|
||||
json: {
|
||||
proxy_reqs: [
|
||||
{
|
||||
kind: 'get_protocol',
|
||||
get_protocol_req: {
|
||||
appcode: appCode,
|
||||
channel: String(channel),
|
||||
sub_channel: String(subChannel),
|
||||
language,
|
||||
dataVersion,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
})
|
||||
.json();
|
||||
return (rsp as any).proxy_rsps[0].get_protocol as TypesApiAkEndfield.LauncherProtocol;
|
||||
},
|
||||
latestGame: async (
|
||||
appCode: string,
|
||||
launcherAppCode: string,
|
||||
|
||||
Reference in New Issue
Block a user