diff --git a/.gitignore b/.gitignore index 30a7a91..50368f6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +config + # dependencies (bun install) node_modules diff --git a/output/akEndfield/launcher/launcher/EndField/6/all.json b/output/akEndfield/launcher/launcher/EndField/6/all.json index 6dc1fe2..d8f8f65 100644 --- a/output/akEndfield/launcher/launcher/EndField/6/all.json +++ b/output/akEndfield/launcher/launcher/EndField/6/all.json @@ -18,4 +18,4 @@ "description": "" } } -] \ No newline at end of file +] diff --git a/output/akEndfield/launcher/launcher/EndField/6/latest.json b/output/akEndfield/launcher/launcher/EndField/6/latest.json index 1e27b3c..21a76ce 100644 --- a/output/akEndfield/launcher/launcher/EndField/6/latest.json +++ b/output/akEndfield/launcher/launcher/EndField/6/latest.json @@ -15,4 +15,4 @@ "total_size": "360836427", "description": "" } -} \ No newline at end of file +} diff --git a/output/akEndfield/launcher/launcher/EndField/6/v1.0.0.json b/output/akEndfield/launcher/launcher/EndField/6/v1.0.0.json index 1e27b3c..21a76ce 100644 --- a/output/akEndfield/launcher/launcher/EndField/6/v1.0.0.json +++ b/output/akEndfield/launcher/launcher/EndField/6/v1.0.0.json @@ -15,4 +15,4 @@ "total_size": "360836427", "description": "" } -} \ No newline at end of file +} diff --git a/output/akEndfield/launcher/launcher/official/6/all.json b/output/akEndfield/launcher/launcher/official/6/all.json index 856587b..5f02c64 100644 --- a/output/akEndfield/launcher/launcher/official/6/all.json +++ b/output/akEndfield/launcher/launcher/official/6/all.json @@ -18,4 +18,4 @@ "description": "" } } -] \ No newline at end of file +] diff --git a/output/akEndfield/launcher/launcher/official/6/latest.json b/output/akEndfield/launcher/launcher/official/6/latest.json index b1fa277..3714b9a 100644 --- a/output/akEndfield/launcher/launcher/official/6/latest.json +++ b/output/akEndfield/launcher/launcher/official/6/latest.json @@ -15,4 +15,4 @@ "total_size": "360836427", "description": "" } -} \ No newline at end of file +} diff --git a/output/akEndfield/launcher/launcher/official/6/v1.0.0.json b/output/akEndfield/launcher/launcher/official/6/v1.0.0.json index b1fa277..3714b9a 100644 --- a/output/akEndfield/launcher/launcher/official/6/v1.0.0.json +++ b/output/akEndfield/launcher/launcher/official/6/v1.0.0.json @@ -15,4 +15,4 @@ "total_size": "360836427", "description": "" } -} \ No newline at end of file +} diff --git a/src/cmds/test.ts b/src/cmds/test.ts index 19e0784..5295727 100644 --- a/src/cmds/test.ts +++ b/src/cmds/test.ts @@ -5,48 +5,29 @@ import apiUtils from '../utils/api.js'; import argvUtils from '../utils/argv.js'; import appConfig from '../utils/config.js'; import logger from '../utils/logger.js'; +import mathUtils from '../utils/math.js'; async function mainCmdHandler() { const cfg = appConfig.network.api.akEndfield; - await (async () => { - const channel = appConfig.network.api.akEndfield.channel.osWinRel; - logger.debug('apiAkEndfield.launcher.latestGame fetching ...'); - console.log( - await apiUtils.apiAkEndfield.launcher.latestGame( - appConfig.network.api.akEndfield.appCode.osWinRel, - appConfig.network.api.akEndfield.launcherAppCode.osWinRel, - channel, - channel, - channel, - null, - ), - ); - logger.debug('apiAkEndfield.launcher.latestLauncher fetching ...'); - console.log( - await apiUtils.apiAkEndfield.launcher.latestLauncher( - appConfig.network.api.akEndfield.launcherAppCode.osWinRel, - channel, - channel, - null, - null, - ), - ); - logger.debug('apiAkEndfield.launcher.web fetching ...'); - for (const fn of [ - apiUtils.apiAkEndfield.launcher.web.sidebar, - apiUtils.apiAkEndfield.launcher.web.singleEnt, - apiUtils.apiAkEndfield.launcher.web.mainBgImage, - apiUtils.apiAkEndfield.launcher.web.banner, - apiUtils.apiAkEndfield.launcher.web.announcement, - ]) { - console.dir(await fn(appConfig.network.api.akEndfield.appCode.osWinRel, channel, channel, 'ja-jp'), { - depth: null, - }); - } - })(); + // await (async () => { + // const channel = appConfig.network.api.akEndfield.channel.osWinRel; + // logger.debug('apiAkEndfield.launcher.web fetching ...'); + // for (const fn of [ + // apiUtils.apiAkEndfield.launcher.web.sidebar, + // apiUtils.apiAkEndfield.launcher.web.singleEnt, + // apiUtils.apiAkEndfield.launcher.web.mainBgImage, + // apiUtils.apiAkEndfield.launcher.web.banner, + // apiUtils.apiAkEndfield.launcher.web.announcement, + // ]) { + // console.dir(await fn(appConfig.network.api.akEndfield.appCode.osWinRel, channel, channel, 'ja-jp'), { + // depth: null, + // }); + // } + // })(); await (async () => { + logger.debug('Fetching latestGame ...'); const rsp = await apiUtils.apiAkEndfield.launcher.latestGame( cfg.appCode.osWinRel, cfg.launcherAppCode.osWinRel, @@ -55,6 +36,19 @@ async function mainCmdHandler() { cfg.channel.osWinRel, null, ); + logger.info( + `Fetched latestGame: v${rsp.version}, ${mathUtils.formatFileSize( + parseInt(rsp.pkg.total_size) - mathUtils.arrayTotal(rsp.pkg.packs.map((e) => parseInt(e.package_size))), + { + decimals: 2, + decimalPadding: true, + useBinaryUnit: true, + useBitUnit: false, + unitVisible: true, + unit: null, + }, + )}`, + ); const prettyRsp = { req: { appCode: cfg.appCode.osWinRel, @@ -98,6 +92,8 @@ async function mainCmdHandler() { })(); await (async () => { + logger.debug('Fetching latestGameRes ...'); + const versionInfoList = ( ( await Bun.file( @@ -134,6 +130,7 @@ async function mainCmdHandler() { versionInfoEntry.version, versionInfoEntry.randStr, ); + logger.info(`Fetched latestGameRes: v${versionInfoEntry.version}, ${rsp.res_version}`); const prettyRsp = { req: { appCode: cfg.appCode.osWinRel, @@ -177,6 +174,7 @@ async function mainCmdHandler() { })(); await (async () => { + logger.debug('Fetching latestLauncher ...'); const launcherTargetAppList = ['EndField', 'official'] as const; for (const launcherTargetAppEntry of launcherTargetAppList) { const rsp = await apiUtils.apiAkEndfield.launcher.latestLauncher( @@ -186,6 +184,7 @@ async function mainCmdHandler() { null, launcherTargetAppEntry === 'official' ? null : launcherTargetAppEntry, ); + logger.info(`Fetched latestLauncher: v${rsp.version}, ${launcherTargetAppEntry}`); const prettyRsp = { req: { appCode: cfg.launcherAppCode.osWinRel,