-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add fallback to Bunny URLs if main URLs are not accessible #781
Conversation
@hkirat This approach is right ? like rn it makes HEAD requests to all the main URLs, which could potentially cause performance issues if there are many URLs to check Instead of checking the accessibility of all main URLs (1080p, 720p, and 360p) by making individual HEAD requests for each URL we can only checks the accessibility of the highest quality video URL (1080p). |
This should work fine, but can you implement a fallback mechanism that attempts to check other urls only if necessary? what i mean is: 1- check the highest quality url first, if available |
Yeah sure, let me do that. ( We got a new maintainer before GTA 6) |
@siinghd done |
still the same thing here:
{
|
Move const bunnyUrls = { above
|
Merging Thank you, will submit this pr, if it will satisfy bounty requirements, you will get it |
sure 👍 |
/bounty $30 |
PR Fixes: #776
This PR adds a new feature to the
ContentRenderer
component that checks if the main video URLs from the database are accessible or not. If any of the main URLs are not accessible, it falls back to using the Bunny URLs instead.Changes:
Added a new helper function
isUrlAccessible
that makes a HEAD request to a given URL and returns a boolean indicating whether the URL is accessible or not.Modified the
getMetadata
function:user.bunnyProxyEnabled
flag is true, it returns the Bunny URLs directly.bunnyProxyEnabled
is false, it creates an objectmainUrls
containing the main URLs from the database.Promise.all
and theisUrlAccessible
function to check if all the main URLs are accessible.mainUrls
.This change ensures that if the main video URLs are not accessible for any reason, the application falls back to using the Bunny URLs, providing a more reliable experience for users.
Checklist before requesting a review