From 78773d732672d8985795fb040a39dd7e946c7b7c Mon Sep 17 00:00:00 2001 From: Emilien Devos Date: Sat, 22 May 2021 17:42:23 +0200 Subject: [PATCH 001/473] add the ability to listen on unix sockets --- src/invidious.cr | 15 ++++++++++++--- src/invidious/helpers/helpers.cr | 1 + 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/invidious.cr b/src/invidious.cr index ae20e13e..65b1091b 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -3917,6 +3917,15 @@ add_context_storage_type(Preferences) add_context_storage_type(User) Kemal.config.logger = LOGGER -Kemal.config.host_binding = Kemal.config.host_binding != "0.0.0.0" ? Kemal.config.host_binding : CONFIG.host_binding -Kemal.config.port = Kemal.config.port != 3000 ? Kemal.config.port : CONFIG.port -Kemal.run + +Kemal.run do |config| + if CONFIG.bind_unix + if File.exists?(CONFIG.bind_unix.not_nil!) + File.delete(CONFIG.bind_unix.not_nil!) + end + config.server.not_nil!.bind_unix CONFIG.bind_unix.not_nil! + else + config.host_binding = config.host_binding != "0.0.0.0" ? config.host_binding : CONFIG.host_binding + config.port = config.port != 3000 ? config.port : CONFIG.port + end +end diff --git a/src/invidious/helpers/helpers.cr b/src/invidious/helpers/helpers.cr index e1d877b7..6a5789a0 100644 --- a/src/invidious/helpers/helpers.cr +++ b/src/invidious/helpers/helpers.cr @@ -98,6 +98,7 @@ class Config property force_resolve : Socket::Family = Socket::Family::UNSPEC # Connect to YouTube over 'ipv6', 'ipv4'. Will sometimes resolve fix issues with rate-limiting (see https://github.com/ytdl-org/youtube-dl/issues/21729) property port : Int32 = 3000 # Port to listen for connections (overrided by command line argument) property host_binding : String = "0.0.0.0" # Host to bind (overrided by command line argument) + property bind_unix : String? = nil # Make Invidious listening on UNIX sockets - Example: /tmp/invidious.sock property pool_size : Int32 = 100 # Pool size for HTTP requests to youtube.com and ytimg.com (each domain has a separate pool of `pool_size`) property use_quic : Bool = true # Use quic transport for youtube api From bf470704a5a3071cebb1d558efaef8542a16dde6 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Tue, 26 Sep 2023 21:45:52 +0200 Subject: [PATCH 002/473] Add option to control preloading of video data Fix #4110 by adding an option to control the preloading of video data on page load. If disabled ("false"), the browser will not preload any video data until the user explicitly hits the "Play" button. If enabled ("true"), the default behavior will be used, which means the browser decides how much of the video will be preloaded. --- assets/js/player.js | 5 ++++- config/config.example.yml | 14 ++++++++++++++ locales/de.json | 1 + locales/en-US.json | 1 + src/invidious/config.cr | 1 + src/invidious/routes/preferences.cr | 5 +++++ src/invidious/user/preferences.cr | 1 + src/invidious/videos/video_preferences.cr | 6 ++++++ src/invidious/views/components/player.ecr | 4 +++- src/invidious/views/user/preferences.ecr | 5 +++++ 10 files changed, 41 insertions(+), 2 deletions(-) diff --git a/assets/js/player.js b/assets/js/player.js index bb53ac24..398c66f8 100644 --- a/assets/js/player.js +++ b/assets/js/player.js @@ -3,7 +3,6 @@ var player_data = JSON.parse(document.getElementById('player_data').textContent) var video_data = JSON.parse(document.getElementById('video_data').textContent); var options = { - preload: 'auto', liveui: true, playbackRates: [0.25, 0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0], controlBar: { @@ -35,6 +34,10 @@ if (player_data.aspect_ratio) { options.aspectRatio = player_data.aspect_ratio; } +if (player_data.preload) { + options.preload = player_data.preload +} + var embed_url = new URL(location); embed_url.searchParams.delete('v'); var short_url = location.origin + '/' + video_data.id + embed_url.search; diff --git a/config/config.example.yml b/config/config.example.yml index b44fcc0e..b1a76edf 100644 --- a/config/config.example.yml +++ b/config/config.example.yml @@ -718,6 +718,20 @@ default_user_preferences: # Video player behavior # ----------------------------- + ## + ## Automatically preload video on page load. This option controls the + ## value for the "preload" attribute of the HTML5