From cd83adfa8adf1aa608582304765ad5ba7caebad8 Mon Sep 17 00:00:00 2001 From: daydreamer-json Date: Sat, 7 Mar 2026 21:56:18 +0900 Subject: [PATCH] refactor: improve web api fetch function reliability --- .../launcher/web/1/sidebar/en-us/all.json | 17 +++++ .../launcher/web/1/sidebar/en-us/latest.json | 14 ++++ .../launcher/web/1/sidebar/ja-jp/all.json | 17 +++++ .../launcher/web/1/sidebar/ja-jp/latest.json | 14 ++++ .../launcher/web/1/sidebar/ko-kr/all.json | 17 +++++ .../launcher/web/1/sidebar/ko-kr/latest.json | 14 ++++ .../launcher/web/1/sidebar/zh-tw/all.json | 17 +++++ .../launcher/web/1/sidebar/zh-tw/latest.json | 14 ++++ .../launcher/web/2/sidebar/en-us/all.json | 17 +++++ .../launcher/web/2/sidebar/en-us/latest.json | 14 ++++ .../launcher/web/2/sidebar/ja-jp/all.json | 17 +++++ .../launcher/web/2/sidebar/ja-jp/latest.json | 14 ++++ .../launcher/web/2/sidebar/ko-kr/all.json | 17 +++++ .../launcher/web/2/sidebar/ko-kr/latest.json | 14 ++++ .../launcher/web/2/sidebar/zh-tw/all.json | 17 +++++ .../launcher/web/2/sidebar/zh-tw/latest.json | 14 ++++ src/cmds/archive.ts | 65 +++++++++++-------- 17 files changed, 285 insertions(+), 28 deletions(-) create mode 100644 output/akEndfield/launcher/web/1/sidebar/en-us/all.json create mode 100644 output/akEndfield/launcher/web/1/sidebar/en-us/latest.json create mode 100644 output/akEndfield/launcher/web/1/sidebar/ja-jp/all.json create mode 100644 output/akEndfield/launcher/web/1/sidebar/ja-jp/latest.json create mode 100644 output/akEndfield/launcher/web/1/sidebar/ko-kr/all.json create mode 100644 output/akEndfield/launcher/web/1/sidebar/ko-kr/latest.json create mode 100644 output/akEndfield/launcher/web/1/sidebar/zh-tw/all.json create mode 100644 output/akEndfield/launcher/web/1/sidebar/zh-tw/latest.json create mode 100644 output/akEndfield/launcher/web/2/sidebar/en-us/all.json create mode 100644 output/akEndfield/launcher/web/2/sidebar/en-us/latest.json create mode 100644 output/akEndfield/launcher/web/2/sidebar/ja-jp/all.json create mode 100644 output/akEndfield/launcher/web/2/sidebar/ja-jp/latest.json create mode 100644 output/akEndfield/launcher/web/2/sidebar/ko-kr/all.json create mode 100644 output/akEndfield/launcher/web/2/sidebar/ko-kr/latest.json create mode 100644 output/akEndfield/launcher/web/2/sidebar/zh-tw/all.json create mode 100644 output/akEndfield/launcher/web/2/sidebar/zh-tw/latest.json diff --git a/output/akEndfield/launcher/web/1/sidebar/en-us/all.json b/output/akEndfield/launcher/web/1/sidebar/en-us/all.json new file mode 100644 index 0000000..e14bf37 --- /dev/null +++ b/output/akEndfield/launcher/web/1/sidebar/en-us/all.json @@ -0,0 +1,17 @@ +[ + { + "updatedAt": "2026-03-07T21:43:25.899+09:00", + "req": { + "appCode": "6LL0KJuqHBVz33WK", + "channel": 1, + "subChannel": 1, + "lang": "en-us", + "region": "cn", + "platform": "Windows" + }, + "rsp": { + "data_version": "", + "sidebars": [] + } + } +] diff --git a/output/akEndfield/launcher/web/1/sidebar/en-us/latest.json b/output/akEndfield/launcher/web/1/sidebar/en-us/latest.json new file mode 100644 index 0000000..610c040 --- /dev/null +++ b/output/akEndfield/launcher/web/1/sidebar/en-us/latest.json @@ -0,0 +1,14 @@ +{ + "req": { + "appCode": "6LL0KJuqHBVz33WK", + "channel": 1, + "subChannel": 1, + "lang": "en-us", + "region": "cn", + "platform": "Windows" + }, + "rsp": { + "data_version": "", + "sidebars": [] + } +} diff --git a/output/akEndfield/launcher/web/1/sidebar/ja-jp/all.json b/output/akEndfield/launcher/web/1/sidebar/ja-jp/all.json new file mode 100644 index 0000000..36436f7 --- /dev/null +++ b/output/akEndfield/launcher/web/1/sidebar/ja-jp/all.json @@ -0,0 +1,17 @@ +[ + { + "updatedAt": "2026-03-07T21:43:25.384+09:00", + "req": { + "appCode": "6LL0KJuqHBVz33WK", + "channel": 1, + "subChannel": 1, + "lang": "ja-jp", + "region": "cn", + "platform": "Windows" + }, + "rsp": { + "data_version": "", + "sidebars": [] + } + } +] diff --git a/output/akEndfield/launcher/web/1/sidebar/ja-jp/latest.json b/output/akEndfield/launcher/web/1/sidebar/ja-jp/latest.json new file mode 100644 index 0000000..87b9865 --- /dev/null +++ b/output/akEndfield/launcher/web/1/sidebar/ja-jp/latest.json @@ -0,0 +1,14 @@ +{ + "req": { + "appCode": "6LL0KJuqHBVz33WK", + "channel": 1, + "subChannel": 1, + "lang": "ja-jp", + "region": "cn", + "platform": "Windows" + }, + "rsp": { + "data_version": "", + "sidebars": [] + } +} diff --git a/output/akEndfield/launcher/web/1/sidebar/ko-kr/all.json b/output/akEndfield/launcher/web/1/sidebar/ko-kr/all.json new file mode 100644 index 0000000..5e55f62 --- /dev/null +++ b/output/akEndfield/launcher/web/1/sidebar/ko-kr/all.json @@ -0,0 +1,17 @@ +[ + { + "updatedAt": "2026-03-07T21:43:25.807+09:00", + "req": { + "appCode": "6LL0KJuqHBVz33WK", + "channel": 1, + "subChannel": 1, + "lang": "ko-kr", + "region": "cn", + "platform": "Windows" + }, + "rsp": { + "data_version": "", + "sidebars": [] + } + } +] diff --git a/output/akEndfield/launcher/web/1/sidebar/ko-kr/latest.json b/output/akEndfield/launcher/web/1/sidebar/ko-kr/latest.json new file mode 100644 index 0000000..987c9a4 --- /dev/null +++ b/output/akEndfield/launcher/web/1/sidebar/ko-kr/latest.json @@ -0,0 +1,14 @@ +{ + "req": { + "appCode": "6LL0KJuqHBVz33WK", + "channel": 1, + "subChannel": 1, + "lang": "ko-kr", + "region": "cn", + "platform": "Windows" + }, + "rsp": { + "data_version": "", + "sidebars": [] + } +} diff --git a/output/akEndfield/launcher/web/1/sidebar/zh-tw/all.json b/output/akEndfield/launcher/web/1/sidebar/zh-tw/all.json new file mode 100644 index 0000000..f31a24e --- /dev/null +++ b/output/akEndfield/launcher/web/1/sidebar/zh-tw/all.json @@ -0,0 +1,17 @@ +[ + { + "updatedAt": "2026-03-07T21:43:28.092+09:00", + "req": { + "appCode": "6LL0KJuqHBVz33WK", + "channel": 1, + "subChannel": 1, + "lang": "zh-tw", + "region": "cn", + "platform": "Windows" + }, + "rsp": { + "data_version": "", + "sidebars": [] + } + } +] diff --git a/output/akEndfield/launcher/web/1/sidebar/zh-tw/latest.json b/output/akEndfield/launcher/web/1/sidebar/zh-tw/latest.json new file mode 100644 index 0000000..18a1756 --- /dev/null +++ b/output/akEndfield/launcher/web/1/sidebar/zh-tw/latest.json @@ -0,0 +1,14 @@ +{ + "req": { + "appCode": "6LL0KJuqHBVz33WK", + "channel": 1, + "subChannel": 1, + "lang": "zh-tw", + "region": "cn", + "platform": "Windows" + }, + "rsp": { + "data_version": "", + "sidebars": [] + } +} diff --git a/output/akEndfield/launcher/web/2/sidebar/en-us/all.json b/output/akEndfield/launcher/web/2/sidebar/en-us/all.json new file mode 100644 index 0000000..bc71027 --- /dev/null +++ b/output/akEndfield/launcher/web/2/sidebar/en-us/all.json @@ -0,0 +1,17 @@ +[ + { + "updatedAt": "2026-03-07T21:43:27.188+09:00", + "req": { + "appCode": "6LL0KJuqHBVz33WK", + "channel": 2, + "subChannel": 2, + "lang": "en-us", + "region": "cn", + "platform": "Windows" + }, + "rsp": { + "data_version": "", + "sidebars": [] + } + } +] diff --git a/output/akEndfield/launcher/web/2/sidebar/en-us/latest.json b/output/akEndfield/launcher/web/2/sidebar/en-us/latest.json new file mode 100644 index 0000000..f8b7026 --- /dev/null +++ b/output/akEndfield/launcher/web/2/sidebar/en-us/latest.json @@ -0,0 +1,14 @@ +{ + "req": { + "appCode": "6LL0KJuqHBVz33WK", + "channel": 2, + "subChannel": 2, + "lang": "en-us", + "region": "cn", + "platform": "Windows" + }, + "rsp": { + "data_version": "", + "sidebars": [] + } +} diff --git a/output/akEndfield/launcher/web/2/sidebar/ja-jp/all.json b/output/akEndfield/launcher/web/2/sidebar/ja-jp/all.json new file mode 100644 index 0000000..ad1fd03 --- /dev/null +++ b/output/akEndfield/launcher/web/2/sidebar/ja-jp/all.json @@ -0,0 +1,17 @@ +[ + { + "updatedAt": "2026-03-07T21:43:29.120+09:00", + "req": { + "appCode": "6LL0KJuqHBVz33WK", + "channel": 2, + "subChannel": 2, + "lang": "ja-jp", + "region": "cn", + "platform": "Windows" + }, + "rsp": { + "data_version": "", + "sidebars": [] + } + } +] diff --git a/output/akEndfield/launcher/web/2/sidebar/ja-jp/latest.json b/output/akEndfield/launcher/web/2/sidebar/ja-jp/latest.json new file mode 100644 index 0000000..29b7ae2 --- /dev/null +++ b/output/akEndfield/launcher/web/2/sidebar/ja-jp/latest.json @@ -0,0 +1,14 @@ +{ + "req": { + "appCode": "6LL0KJuqHBVz33WK", + "channel": 2, + "subChannel": 2, + "lang": "ja-jp", + "region": "cn", + "platform": "Windows" + }, + "rsp": { + "data_version": "", + "sidebars": [] + } +} diff --git a/output/akEndfield/launcher/web/2/sidebar/ko-kr/all.json b/output/akEndfield/launcher/web/2/sidebar/ko-kr/all.json new file mode 100644 index 0000000..d4dce56 --- /dev/null +++ b/output/akEndfield/launcher/web/2/sidebar/ko-kr/all.json @@ -0,0 +1,17 @@ +[ + { + "updatedAt": "2026-03-07T21:43:28.560+09:00", + "req": { + "appCode": "6LL0KJuqHBVz33WK", + "channel": 2, + "subChannel": 2, + "lang": "ko-kr", + "region": "cn", + "platform": "Windows" + }, + "rsp": { + "data_version": "", + "sidebars": [] + } + } +] diff --git a/output/akEndfield/launcher/web/2/sidebar/ko-kr/latest.json b/output/akEndfield/launcher/web/2/sidebar/ko-kr/latest.json new file mode 100644 index 0000000..194c5fb --- /dev/null +++ b/output/akEndfield/launcher/web/2/sidebar/ko-kr/latest.json @@ -0,0 +1,14 @@ +{ + "req": { + "appCode": "6LL0KJuqHBVz33WK", + "channel": 2, + "subChannel": 2, + "lang": "ko-kr", + "region": "cn", + "platform": "Windows" + }, + "rsp": { + "data_version": "", + "sidebars": [] + } +} diff --git a/output/akEndfield/launcher/web/2/sidebar/zh-tw/all.json b/output/akEndfield/launcher/web/2/sidebar/zh-tw/all.json new file mode 100644 index 0000000..02c0b94 --- /dev/null +++ b/output/akEndfield/launcher/web/2/sidebar/zh-tw/all.json @@ -0,0 +1,17 @@ +[ + { + "updatedAt": "2026-03-07T21:43:29.154+09:00", + "req": { + "appCode": "6LL0KJuqHBVz33WK", + "channel": 2, + "subChannel": 2, + "lang": "zh-tw", + "region": "cn", + "platform": "Windows" + }, + "rsp": { + "data_version": "", + "sidebars": [] + } + } +] diff --git a/output/akEndfield/launcher/web/2/sidebar/zh-tw/latest.json b/output/akEndfield/launcher/web/2/sidebar/zh-tw/latest.json new file mode 100644 index 0000000..a883814 --- /dev/null +++ b/output/akEndfield/launcher/web/2/sidebar/zh-tw/latest.json @@ -0,0 +1,14 @@ +{ + "req": { + "appCode": "6LL0KJuqHBVz33WK", + "channel": 2, + "subChannel": 2, + "lang": "zh-tw", + "region": "cn", + "platform": "Windows" + }, + "rsp": { + "data_version": "", + "sidebars": [] + } +} diff --git a/src/cmds/archive.ts b/src/cmds/archive.ts index da18e6b..8d734ea 100644 --- a/src/cmds/archive.ts +++ b/src/cmds/archive.ts @@ -445,43 +445,52 @@ async function fetchAndSaveAllGameResRawData(gameTargets: GameTarget[]) { for (const target of gameTargets) { for (const lang of apiUtils.akEndfield.defaultSettings.launcherWebLang) { { - const data: StoredData>>[] = await Bun.file( - path.join(infileBasePath, String(target.subChannel), 'banner', lang, 'all.json'), - ).json(); - for (const dataEntry of data) { - if (!dataEntry.rsp) continue; - dataEntry.rsp.banners.forEach((e) => urlSet.add(e.url)); + const allPath = path.join(infileBasePath, String(target.subChannel), 'banner', lang, 'all.json'); + if (await Bun.file(allPath).exists()) { + const data: StoredData>>[] = + await Bun.file(allPath).json(); + for (const dataEntry of data) { + if (!dataEntry.rsp) continue; + dataEntry.rsp.banners.forEach((e) => urlSet.add(e.url)); + } } } { - const data: StoredData>>[] = - await Bun.file( - path.join(infileBasePath, String(target.subChannel), 'main_bg_image', lang, 'all.json'), - ).json(); - for (const dataEntry of data) { - if (!dataEntry.rsp) continue; - urlSet.add(dataEntry.rsp.main_bg_image.url); - if (dataEntry.rsp.main_bg_image.video_url) urlSet.add(dataEntry.rsp.main_bg_image.video_url); + const allPath = path.join(infileBasePath, String(target.subChannel), 'main_bg_image', lang, 'all.json'); + if (await Bun.file(allPath).exists()) { + const data: StoredData>>[] = + await Bun.file(allPath).json(); + for (const dataEntry of data) { + if (!dataEntry.rsp) continue; + urlSet.add(dataEntry.rsp.main_bg_image.url); + if (dataEntry.rsp.main_bg_image.video_url) urlSet.add(dataEntry.rsp.main_bg_image.video_url); + } } } { - const data: StoredData>>[] = - await Bun.file(path.join(infileBasePath, String(target.subChannel), 'sidebar', lang, 'all.json')).json(); - for (const dataEntry of data) { - if (!dataEntry.rsp) continue; - dataEntry.rsp.sidebars.forEach((e) => { - if (e.pic !== null && e.pic.url) urlSet.add(e.pic.url); - }); + const allPath = path.join(infileBasePath, String(target.subChannel), 'sidebar', lang, 'all.json'); + if (await Bun.file(allPath).exists()) { + const data: StoredData>>[] = + await Bun.file(allPath).json(); + for (const dataEntry of data) { + if (!dataEntry.rsp) continue; + dataEntry.rsp.sidebars.forEach((e) => { + if (e.pic !== null && e.pic.url) urlSet.add(e.pic.url); + }); + } } } { - const data: StoredData>>[] = - await Bun.file(path.join(infileBasePath, String(target.subChannel), 'single_ent', lang, 'all.json')).json(); - for (const dataEntry of data) { - if (!dataEntry.rsp) continue; - [dataEntry.rsp.single_ent.version_url].forEach((e) => { - if (e) urlSet.add(e); - }); + const allPath = path.join(infileBasePath, String(target.subChannel), 'single_ent', lang, 'all.json'); + if (await Bun.file(allPath).exists()) { + const data: StoredData>>[] = + await Bun.file(allPath).json(); + for (const dataEntry of data) { + if (!dataEntry.rsp) continue; + [dataEntry.rsp.single_ent.version_url].forEach((e) => { + if (e) urlSet.add(e); + }); + } } } }