feat: check url from cache

1. NEVER MODIFY THE `yarn.lock` YOU GET. YOU NEVER KNOW WHAT IT CRASHES
2. FUCK REGEX
This commit is contained in:
Zichao Lin 2024-07-20 19:24:01 +08:00
parent 5f9fc94709
commit 681e664e32
Signed by: earthjasonlin
GPG Key ID: 406D9913DE2E42FB
2 changed files with 1818 additions and 1664 deletions

@ -139,7 +139,19 @@ const readLog = async () => {
const promises = logPaths.map(async logpath => {
const logText = await fs.readFile(logpath, 'utf8')
const url = logText.match(/https:\/\/.*?\/info/g)
return getLatestUrl(url)
if (url) {
return getLatestUrl(url)
}
const gamePathMch = logText.match(/([A-Z]:\/.*?\/)(?=ZenlessZoneZero_Data)/i)
if (gamePathMch) {
const[cacheText, cacheFile] = await getCacheText("F:/zzz_game/ZenlessZoneZero_Data") /* getCacheText(gamePathMch[0]+"/ZenlessZoneZero_Data") */
const urlMch = cacheText.match(/https.+?authkey=.+?end_id=/g)
if (urlMch) {
cacheFolder = cacheFile.replace(/Cache_Data[/\\]data_2$/, '')
return getLatestUrl(urlMch)
}
}
})
const result = await Promise.all(promises)
for (let url of result) {

3468
yarn.lock

File diff suppressed because it is too large Load Diff