privacy-redirect
privacy-redirect copied to clipboard
Invidious, Bibliogram & Nitter instances no longer statically defined
Instead, background.js now sends requests to the Invidious / Bibliogram instance APIs and dynamically populates the instance lists based on uptime at the moment of the request. The results of the requests are cached for a minimum of 15 minutes before another request is sent, so there shouldn't be any noticeable performance bump caused by these changes.
If my code gets merged, I also plan to implement the same for Nitter and Teddit instances. However, that would require a bit more work, as there are no JSON APIs around for these sites (HTML only -- I wouldn't want to deal with parsing HTML in the extension code). I will try to figure out a solution for that only if my work so far is found to be useful.
This directly addresses #292, #264. In particular, it also fixes #325, while preventing future issues of the same kind.
Small fix also for #324.
Now Nitter instances are also dynamically populated based on the statuses from here. This is the JSON requested in the background by xnaas's uptime monitor frontend.
@Pasarel this is brilliant, need to spend a bit of time with it in the browser but from the brief look I just had at the code it looks great.
I fully understand the use of the synchronous XHR request, no judgement here 🙂
I'd love if Chrome supported async code in extensions but by the looks of it that isn't gonna happen without some massive tradeoffs in their manifest v3 spec, which btw will probably kill this extension on Chrome... but when that happens we'll finally be able to move to async code on Firefox 🙂
this absolutely. most of the other pr's here are people just changing what instances there are, and i think that this is the most logical solution.