Fix reading instances from the Invidious fallback file (#3712)

This commit is contained in:
absidue 2023-06-28 08:15:44 +02:00 committed by GitHub
parent d989af2326
commit afffbf69fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -45,7 +45,7 @@ const actions = {
const filePath = `${fileLocation}${fileName}`
if (!process.env.IS_ELECTRON || await pathExists(filePath)) {
console.warn('reading static file for invidious instances')
const fileData = process.env.IS_ELECTRON ? JSON.parse(await fs.readFile(filePath)) : await (await fetch(createWebURL(filePath))).text()
const fileData = process.env.IS_ELECTRON ? await fs.readFile(filePath, 'utf8') : await (await fetch(createWebURL(filePath))).text()
instances = JSON.parse(fileData).filter(e => {
return process.env.IS_ELECTRON || e.cors
}).map(e => {