random.invidious.io (automatically redirect to random instance) #46
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi all,
This is a proposal for improving the instances-api. For any URL that's not an instances-api endpoint, it redirects the user to a random instance. This is useful for sharing links with people who don't have a redirection extension installed; something that was requested before at iv-org/invidious-redirect#17.
I did not go all the way for this prototype, but I wanted to point out that its possible to filter which instances one is picked from. Adding
?iv-region=XX
is hopefully obvious;?iv-health=99
limits to only instances with at least 99% uptime (the default value if none was chosen is 95%). Also, it detects API requests and chooses from only instances with API enabled when necessary. This could be extended if needed.Note that for this version I decided to sniff the hostname and only enable this feature when it is
random.invidious.io
- not sure if such a restriction is necessary or useful; feel free to rip it out.