Filtering out invidious instances that don't support the API (#2714)

* Adding two additional checks to the instance filter

- Checking if the instance supports the api at all
- Checking if the instance supports cors in web environments

* Removing instances without API from instances json

* Modifying the hardcoded fallbacks
This commit is contained in:
Emma 2022-10-13 18:09:15 -04:00 committed by GitHub
parent 21a31cf6f5
commit f94d8a9df2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 6 deletions

View File

@ -24,7 +24,7 @@ const actions = {
const response = await fetch(requestUrl)
const json = await response.json()
instances = json.filter((instance) => {
if (instance[0].includes('.onion') || instance[0].includes('.i2p')) {
if (instance[0].includes('.onion') || instance[0].includes('.i2p') || !instance[1].api || (!process.env.IS_ELECTRON && !instance[1].cors)) {
return false
} else {
return true
@ -51,8 +51,8 @@ const actions = {
} else {
console.error('unable to read static file for invidious instances')
instances = [
'https://invidious.snopyta.org',
'https://invidious.kavin.rocks/'
'https://invidious.sethforprivacy.com',
'https://invidious.namazso.eu'
]
}
}

View File

@ -1,8 +1,5 @@
[
{ "url": "https://yewtu.be" },
{ "url": "https://vid.puffyan.us" },
{ "url": "https://invidious.snopyta.org" },
{ "url": "https://invidious.kavin.rocks" },
{ "url": "https://inv.riverside.rocks" },
{ "url": "https://invidious.osi.kr" },
{ "url": "https://y.com.sb" },