deprecate support for external video playback proxy
All checks were successful
Invidious CI / build (push) Successful in 5m6s
All checks were successful
Invidious CI / build (push) Successful in 5m6s
This commit is contained in:
parent
743d682ffb
commit
015a68d01e
9 changed files with 3 additions and 92 deletions
10
README.md
10
README.md
|
@ -37,16 +37,6 @@ https://git.nadeko.net/Fijxu/-/packages/container/invidious/latest
|
||||||
|
|
||||||
- [Removal of materialized views on PostgreSQL](github.com/iv-org/invidious/pull/2469): If you don't have this on your Invidious public instance, your SSD will suffer and it will catch on fire https://github.com/iv-org/invidious/pull/2469#issuecomment-2012623454
|
- [Removal of materialized views on PostgreSQL](github.com/iv-org/invidious/pull/2469): If you don't have this on your Invidious public instance, your SSD will suffer and it will catch on fire https://github.com/iv-org/invidious/pull/2469#issuecomment-2012623454
|
||||||
|
|
||||||
- External video playback proxy: Let's you use an external video playback proxy like https://git.nadeko.net/Fijxu/http3-ytproxy or https://github.com/TeamPiped/piped-proxy instead of the one that is bundled with Invidious. It's useful if you are proxying video and your throughput is not low. I did this to distribute the traffic across different servers. If you are selfhosting only for a few amount of people, this is not really useful for you.
|
|
||||||
|
|
||||||
It can be set using this on `config.yml`:
|
|
||||||
```yaml
|
|
||||||
external_videoplayback_proxy: "https://inv-proxy.example.com"
|
|
||||||
```
|
|
||||||
|
|
||||||
> [!NOTE]
|
|
||||||
> If you setup this, Invidious will check if the proxy is alive doing a request to `https://inv-proxy.example.com/health`, and if it doesn't get a response code of 200, Invidious will fallback to the local videoplayback proxy! This is only currently supported by https://git.nadeko.net/Fijxu/http3-ytproxy
|
|
||||||
|
|
||||||
- Limit the DASH resolution sent to the clients: It can be set using `max_dash_resolution` on the config. Example: `max_dash_resolution: 1080`
|
- Limit the DASH resolution sent to the clients: It can be set using `max_dash_resolution` on the config. Example: `max_dash_resolution: 1080`
|
||||||
|
|
||||||
- [Limit requests made to Youtube API when pulling subscriptions (feeds)](https://git.nadeko.net/Fijxu/invidious/commit/df94f1c0b82d95846574487231ea251530838ef0): Due to the recent changes of Youtube ("This helps protect out community", "Sign in to confirm you are not a bot"), subscriptions now have limited information, this is because Invidious by default, makes a video request to youtube to be able to get more information about the video, like `length_seconds`, `live_now`, `premiere_timestamp`, and `views`. If you have a lot of users with a ton of subscriptions, Invidious will basically spam youtube API all the time, resulting in a block from youtube.
|
- [Limit requests made to Youtube API when pulling subscriptions (feeds)](https://git.nadeko.net/Fijxu/invidious/commit/df94f1c0b82d95846574487231ea251530838ef0): Due to the recent changes of Youtube ("This helps protect out community", "Sign in to confirm you are not a bot"), subscriptions now have limited information, this is because Invidious by default, makes a video request to youtube to be able to get more information about the video, like `length_seconds`, `live_now`, `premiere_timestamp`, and `views`. If you have a lot of users with a ton of subscriptions, Invidious will basically spam youtube API all the time, resulting in a block from youtube.
|
||||||
|
|
|
@ -210,14 +210,6 @@ Invidious::Jobs.register Invidious::Jobs::ClearExpiredItemsJob.new
|
||||||
|
|
||||||
Invidious::Jobs.register Invidious::Jobs::InstanceListRefreshJob.new
|
Invidious::Jobs.register Invidious::Jobs::InstanceListRefreshJob.new
|
||||||
|
|
||||||
if !CONFIG.external_videoplayback_proxy.empty?
|
|
||||||
Invidious::Jobs.register Invidious::Jobs::CheckExternalProxy.new
|
|
||||||
else
|
|
||||||
# Invidious will it's own videoplayback proxy unless the admin decides to rewrite
|
|
||||||
# the /videoplayback location in the reverse proxy configuration (NGINX, Caddy, etc)
|
|
||||||
LOGGER.info("jobs: Disabling CheckExternalProxy job. Invidious will it's own videoplayback proxy")
|
|
||||||
end
|
|
||||||
|
|
||||||
if !CONFIG.tokens_server.empty?
|
if !CONFIG.tokens_server.empty?
|
||||||
Invidious::Jobs.register Invidious::Jobs::RefreshSessionTokens.new
|
Invidious::Jobs.register Invidious::Jobs::RefreshSessionTokens.new
|
||||||
else
|
else
|
||||||
|
|
|
@ -215,10 +215,6 @@ class Config
|
||||||
# of the backend
|
# of the backend
|
||||||
property backends_delimiter : String = "|"
|
property backends_delimiter : String = "|"
|
||||||
|
|
||||||
# External videoplayback proxies list. They should include `https://`
|
|
||||||
# at the start of the URI
|
|
||||||
property external_videoplayback_proxy : Array(String) = [] of String
|
|
||||||
|
|
||||||
property pubsub_domain : String = ""
|
property pubsub_domain : String = ""
|
||||||
|
|
||||||
property server_id_cookie_name : String = "INVIDIOUS_SERVER_ID"
|
property server_id_cookie_name : String = "INVIDIOUS_SERVER_ID"
|
||||||
|
|
|
@ -4,30 +4,6 @@ module Invidious::HttpServer
|
||||||
module Utils
|
module Utils
|
||||||
extend self
|
extend self
|
||||||
|
|
||||||
@@proxy_alive : String = ""
|
|
||||||
|
|
||||||
def check_external_proxy
|
|
||||||
CONFIG.external_videoplayback_proxy.each do |proxy|
|
|
||||||
begin
|
|
||||||
response = HTTP::Client.get("#{proxy}/health")
|
|
||||||
if response.status_code == 200
|
|
||||||
@@proxy_alive = proxy
|
|
||||||
LOGGER.debug("CheckExternalProxy: Proxy set to: '#{proxy}'")
|
|
||||||
break
|
|
||||||
end
|
|
||||||
rescue
|
|
||||||
LOGGER.debug("CheckExternalProxy: Proxy '#{proxy}' is not available")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if @@proxy_alive.empty?
|
|
||||||
LOGGER.warn("CheckExternalProxy: No proxies alive! Using own server proxy")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def get_external_proxy
|
|
||||||
return @@proxy_alive
|
|
||||||
end
|
|
||||||
|
|
||||||
def proxy_video_url(raw_url : String, *, region : String? = nil, absolute : Bool = false)
|
def proxy_video_url(raw_url : String, *, region : String? = nil, absolute : Bool = false)
|
||||||
url = URI.parse(raw_url)
|
url = URI.parse(raw_url)
|
||||||
|
|
||||||
|
@ -38,11 +14,7 @@ module Invidious::HttpServer
|
||||||
url.query_params = params
|
url.query_params = params
|
||||||
|
|
||||||
if absolute
|
if absolute
|
||||||
if !@@proxy_alive.empty?
|
return "#{HOST_URL}#{url.request_target}"
|
||||||
return "#{@@proxy_alive}#{url.request_target}"
|
|
||||||
else
|
|
||||||
return "#{HOST_URL}#{url.request_target}"
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
return url.request_target
|
return url.request_target
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
class Invidious::Jobs::CheckExternalProxy < Invidious::Jobs::BaseJob
|
|
||||||
def initialize
|
|
||||||
end
|
|
||||||
|
|
||||||
def begin
|
|
||||||
loop do
|
|
||||||
HttpServer::Utils.check_external_proxy
|
|
||||||
LOGGER.info("CheckExternalProxy: Done, sleeping for 10 seconds")
|
|
||||||
sleep 10.seconds
|
|
||||||
Fiber.yield
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -222,19 +222,13 @@ module Invidious::Routes::API::Manifest
|
||||||
|
|
||||||
raw_params["host"] = uri.host.not_nil!
|
raw_params["host"] = uri.host.not_nil!
|
||||||
|
|
||||||
proxy = Invidious::HttpServer::Utils.get_external_proxy
|
|
||||||
|
|
||||||
if CONFIG.https_only
|
if CONFIG.https_only
|
||||||
scheme = "https://"
|
scheme = "https://"
|
||||||
else
|
else
|
||||||
scheme = "http://"
|
scheme = "http://"
|
||||||
end
|
end
|
||||||
|
|
||||||
if !proxy.empty?
|
"#{scheme}#{env.request.headers["Host"]}/videoplayback?#{raw_params}"
|
||||||
"#{proxy}/videoplayback?#{raw_params}"
|
|
||||||
else
|
|
||||||
"#{scheme}#{env.request.headers["Host"]}/videoplayback?#{raw_params}"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -53,13 +53,6 @@ module Invidious::Routes::BeforeAll
|
||||||
extra_media_csp, extra_connect_csp = BackendInfo.get_csp(env.get("current_companion").as(Int32))
|
extra_media_csp, extra_connect_csp = BackendInfo.get_csp(env.get("current_companion").as(Int32))
|
||||||
end
|
end
|
||||||
|
|
||||||
if !CONFIG.external_videoplayback_proxy.empty?
|
|
||||||
CONFIG.external_videoplayback_proxy.each do |proxy|
|
|
||||||
extra_media_csp += " #{proxy}"
|
|
||||||
extra_connect_csp += " #{proxy}"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Allow media resources to be loaded from google servers
|
# Allow media resources to be loaded from google servers
|
||||||
# TODO: check if *.youtube.com can be removed
|
# TODO: check if *.youtube.com can be removed
|
||||||
if CONFIG.disabled?("local") || !preferences.local
|
if CONFIG.disabled?("local") || !preferences.local
|
||||||
|
|
|
@ -313,16 +313,7 @@ module Invidious::Routes::VideoPlayback
|
||||||
end
|
end
|
||||||
|
|
||||||
if local
|
if local
|
||||||
external_proxy = Invidious::HttpServer::Utils.get_external_proxy
|
url = URI.parse(url).request_target.not_nil!
|
||||||
if !external_proxy.empty?
|
|
||||||
url = URI.parse(url)
|
|
||||||
external_proxy = URI.parse(external_proxy)
|
|
||||||
url.host = external_proxy.host
|
|
||||||
url.port = external_proxy.port
|
|
||||||
url = url.to_s
|
|
||||||
else
|
|
||||||
url = URI.parse(url).request_target.not_nil!
|
|
||||||
end
|
|
||||||
url += "&title=#{URI.encode_www_form(title, space_to_plus: false)}" if title
|
url += "&title=#{URI.encode_www_form(title, space_to_plus: false)}" if title
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<%
|
<%
|
||||||
locale = env.get("preferences").as(Preferences).locale
|
locale = env.get("preferences").as(Preferences).locale
|
||||||
dark_mode = env.get("preferences").as(Preferences).dark_mode
|
dark_mode = env.get("preferences").as(Preferences).dark_mode
|
||||||
current_external_videoplayback_proxy = Invidious::HttpServer::Utils.get_external_proxy()
|
|
||||||
%>
|
%>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="<%= locale %>">
|
<html lang="<%= locale %>">
|
||||||
|
@ -336,9 +335,6 @@
|
||||||
current_backend = env.get?("current_companion").try &.as(Int32)
|
current_backend = env.get?("current_companion").try &.as(Int32)
|
||||||
%>
|
%>
|
||||||
<div class="box">You are currently using Backend: <%= current_backend ? CONFIG.invidious_companion[current_backend].public_url : "Unable to get backend, this is bug, please report it!" %></div>
|
<div class="box">You are currently using Backend: <%= current_backend ? CONFIG.invidious_companion[current_backend].public_url : "Unable to get backend, this is bug, please report it!" %></div>
|
||||||
<% end %>
|
|
||||||
<% if !current_external_videoplayback_proxy.empty? %>
|
|
||||||
<div class="box">External Videoplayback Proxy: <%= current_external_videoplayback_proxy %></div>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
<span class="left">
|
<span class="left">
|
||||||
<% if CONFIG.modified_source_code_url %>
|
<% if CONFIG.modified_source_code_url %>
|
||||||
|
|
Loading…
Add table
Reference in a new issue