Skip to content
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

[Feature Request]: Proxying videos through Invidious with HTTP Auth. #4475

Closed
3 tasks done
GamePlayer-8 opened this issue Dec 19, 2023 · 9 comments
Closed
3 tasks done

Comments

@GamePlayer-8
Copy link

Guidelines

  • I have searched the issue tracker for open and closed issues that are similar to the feature request I want to file, without success.
  • I have searched the documentation for information that matches the description of the feature request I want to file, without success.
  • This issue contains only one feature request.

Problem Description

By default FreeTube does not support HTTP Auth to private Invidious instances.

What's happening when I try to use HTTP Auth:
FreeTube displays an error:

TypeError: 
Failed to execute 'fetch' on 'Window': 
Request cannot be constructed from a URL that includes credentials: 
https://*user*:*password*@*domain*/api/v1/videos/*VIDEO_ID*

Steps to reproduce:

  1. Go to settings -> General Settings -> Current Invidious Instance.
  2. Set an instance what's under a HTTP Auth (use scheme like so https://<user>:<password>@<domain>).
  3. Go to settings -> Player Settings -> Enable Proxy Videos Through Invidious.
  4. Play a random video.

Proposed Solution

Making FreeTube authenticate to the HTTP Auth-protected Invidious instance and proxying videos through it.

Alternatives Considered

None as long as Invidious wouldn't get another way for authentication to the instance.

Issue Labels

improvement to existing feature

Additional Information

No response

@EchedelleLR
Copy link

This is a bug, not a feature. I don't understand why is not marked as such.

@absidue
Copy link
Member

absidue commented Mar 25, 2024

@EchedelleLR It is most certainly not a bug. There is no code in FreeTube to handle authentication for Invidious. That code needs to be added to implement the feature.

@absidue
Copy link
Member

absidue commented Mar 25, 2024

The only way it would be considered a bug, is if there were code to handle the authentication that wasn't working, but as that code literally doesn't exist yet, there is no way this could be considered a bug.

@absidue
Copy link
Member

absidue commented Mar 25, 2024

As there are no public instances that require authentication, someone will need to provide an instance that requires authentication and credentials to log into it, for us to even have a chance at implementing and testing it.

@EchedelleLR
Copy link

Understood, will check into the code if I have time and see if it is something that could be easily implemented. It works with AJAX requests by default, so I was initially confused about that.

@absidue
Copy link
Member

absidue commented Mar 25, 2024

AJAX/XMLHTTPRequest is the outdated and deprecated way of making requests in a web browser, which from what you are saying handles that for you, as the API is old enough to be from a time when including credentials in URLs was still considered secure.

The modern way is using the fetch API, which is where the error message you are seeing is coming from. Including credentials in URLs is deprecated in web browsers, Chrome for example will remove them from the URL bar and send the request without them, you can read up more on it here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Authentication#access_using_credentials_in_the_url

So what you will probably have to do is parse the URL, extract the credentials, create the relevant HTTP header and then make the request without the credentials in the URL but with that header.

@absidue
Copy link
Member

absidue commented Mar 25, 2024

You'll also need to figure out how to handle it for the videos and audio streams and images.

@EchedelleLR
Copy link

Thx for the information, I was not aware of the deprecation. Will try to figure it out.

@absidue
Copy link
Member

absidue commented Aug 29, 2024

Implemented in #5569

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

3 participants