diff --git a/README.md b/README.md index 015b4e50..c379a2ac 100644 --- a/README.md +++ b/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 -- 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 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. diff --git a/src/invidious.cr b/src/invidious.cr index 31ea8561..33a2994e 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -210,14 +210,6 @@ Invidious::Jobs.register Invidious::Jobs::ClearExpiredItemsJob.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? Invidious::Jobs.register Invidious::Jobs::RefreshSessionTokens.new else diff --git a/src/invidious/config.cr b/src/invidious/config.cr index eb6967e3..0cea5d38 100644 --- a/src/invidious/config.cr +++ b/src/invidious/config.cr @@ -215,10 +215,6 @@ class Config # of the backend 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 server_id_cookie_name : String = "INVIDIOUS_SERVER_ID" diff --git a/src/invidious/http_server/utils.cr b/src/invidious/http_server/utils.cr index 9606e8ab..623a9177 100644 --- a/src/invidious/http_server/utils.cr +++ b/src/invidious/http_server/utils.cr @@ -4,30 +4,6 @@ module Invidious::HttpServer module Utils 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) url = URI.parse(raw_url) @@ -38,11 +14,7 @@ module Invidious::HttpServer url.query_params = params if absolute - if !@@proxy_alive.empty? - return "#{@@proxy_alive}#{url.request_target}" - else - return "#{HOST_URL}#{url.request_target}" - end + return "#{HOST_URL}#{url.request_target}" else return url.request_target end diff --git a/src/invidious/jobs/check_external_proxy.cr b/src/invidious/jobs/check_external_proxy.cr deleted file mode 100644 index 6924d50c..00000000 --- a/src/invidious/jobs/check_external_proxy.cr +++ /dev/null @@ -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 diff --git a/src/invidious/routes/api/manifest.cr b/src/invidious/routes/api/manifest.cr index d374788a..4bb2821f 100644 --- a/src/invidious/routes/api/manifest.cr +++ b/src/invidious/routes/api/manifest.cr @@ -222,19 +222,13 @@ module Invidious::Routes::API::Manifest raw_params["host"] = uri.host.not_nil! - proxy = Invidious::HttpServer::Utils.get_external_proxy - if CONFIG.https_only scheme = "https://" else scheme = "http://" end - if !proxy.empty? - "#{proxy}/videoplayback?#{raw_params}" - else - "#{scheme}#{env.request.headers["Host"]}/videoplayback?#{raw_params}" - end + "#{scheme}#{env.request.headers["Host"]}/videoplayback?#{raw_params}" end end diff --git a/src/invidious/routes/before_all.cr b/src/invidious/routes/before_all.cr index a60189ab..b1dc421a 100644 --- a/src/invidious/routes/before_all.cr +++ b/src/invidious/routes/before_all.cr @@ -54,13 +54,6 @@ module Invidious::Routes::BeforeAll extra_media_csp, extra_connect_csp = BackendInfo.get_csp(env.get("current_companion").as(Int32)) 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 # TODO: check if *.youtube.com can be removed if CONFIG.disabled?("local") || !preferences.local diff --git a/src/invidious/routes/video_playback.cr b/src/invidious/routes/video_playback.cr index 44a3474d..3fd484fb 100644 --- a/src/invidious/routes/video_playback.cr +++ b/src/invidious/routes/video_playback.cr @@ -313,16 +313,7 @@ module Invidious::Routes::VideoPlayback end if local - external_proxy = Invidious::HttpServer::Utils.get_external_proxy - 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 = URI.parse(url).request_target.not_nil! url += "&title=#{URI.encode_www_form(title, space_to_plus: false)}" if title end diff --git a/src/invidious/views/template.ecr b/src/invidious/views/template.ecr index 1aba0dc1..73bb6f39 100644 --- a/src/invidious/views/template.ecr +++ b/src/invidious/views/template.ecr @@ -1,7 +1,6 @@ <% locale = env.get("preferences").as(Preferences).locale dark_mode = env.get("preferences").as(Preferences).dark_mode - current_external_videoplayback_proxy = Invidious::HttpServer::Utils.get_external_proxy() %> @@ -336,9 +335,6 @@ current_backend = env.get?("current_companion").try &.as(Int32) %>