From d96bd9f3556d31a0d789e0ce6851d498971c73a3 Mon Sep 17 00:00:00 2001 From: Zichao Lin Date: Fri, 19 Jul 2024 01:37:21 +0800 Subject: [PATCH] fix: read url from log Directly get url from `Player.log` Closes #2 --- src/main/getData.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/main/getData.js b/src/main/getData.js index 75ecb62..80ae89d 100644 --- a/src/main/getData.js +++ b/src/main/getData.js @@ -138,15 +138,8 @@ const readLog = async () => { } const promises = logPaths.map(async logpath => { const logText = await fs.readFile(logpath, 'utf8') - const gamePathMch = logText.match(/\w:\/.*?\/StarRail_Data\//i) - if (gamePathMch) { - const [cacheText, cacheFile] = await getCacheText(gamePathMch[0]) - const urlMch = cacheText.match(/https[^?]+?\?[^?]+?&auth_appid=webview_gacha&.+?authkey=.+?&game_biz=hkrpg_.+?&plat_type=pc/g) - if (urlMch) { - cacheFolder = cacheFile.replace(/Cache_Data[/\\]data_2$/, '') - return getLatestUrl(urlMch) - } - } + const url = logText.match(/https:\/\/.*?\/info/g) + return getLatestUrl(url) }) const result = await Promise.all(promises) for (let url of result) {