Skip to content

Commit

Permalink
Filtering out invidious instances that don't support the API (#2714)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
MarmadileManteater authored Oct 13, 2022
1 parent 21a31cf commit f94d8a9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/renderer/store/modules/invidious.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'
]
}
}
Expand Down
3 changes: 0 additions & 3 deletions static/invidious-instances.json
Original file line number Diff line number Diff line change
@@ -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" },
Expand Down

0 comments on commit f94d8a9

Please sign in to comment.