From df188c032ca8f52d4960fb8dd35d5bda0f6f650f Mon Sep 17 00:00:00 2001 From: broquemonsieur Date: Sun, 3 Dec 2023 18:44:07 -0800 Subject: [PATCH] Complete the bifurcation of "list" and "comp" --- assets/js/embed.js | 2 +- assets/js/watch.js | 2 +- config/config.example.yml | 2 +- docker-compose.yml | 2 +- src/invidious/routes/compilations.cr | 18 +++++++++--------- src/invidious/routes/watch.cr | 4 ++-- src/invidious/views/edit_compilation.ecr | 8 -------- 7 files changed, 15 insertions(+), 23 deletions(-) diff --git a/assets/js/embed.js b/assets/js/embed.js index b5fa1b3f..f7940345 100644 --- a/assets/js/embed.js +++ b/assets/js/embed.js @@ -16,7 +16,7 @@ function get_compilation(compid) { player.on('ended', function () { var url = new URL('https://example.com/embed/' + response.nextVideo); - url.searchParams.set('list', compid); + url.searchParams.set('comp', compid); if (!compid.startsWith('RD')) url.searchParams.set('index', response.index); if (video_data.params.autoplay || video_data.params.continue_autoplay) diff --git a/assets/js/watch.js b/assets/js/watch.js index 50e1f82e..08ab490c 100644 --- a/assets/js/watch.js +++ b/assets/js/watch.js @@ -73,7 +73,7 @@ function get_compilation(compid) { player.on('ended', function () { var url = new URL('https://example.com/watch?v=' + response.nextVideo); - url.searchParams.set('list', compid); + url.searchParams.set('comp', compid); if (!compid.startsWith('RD')) url.searchParams.set('index', response.index); if (video_data.params.autoplay || video_data.params.continue_autoplay) diff --git a/config/config.example.yml b/config/config.example.yml index 4e4d6a8b..cfdef561 100644 --- a/config/config.example.yml +++ b/config/config.example.yml @@ -457,7 +457,7 @@ jobs: ## Accepted values: a string ## Default: ## -hmac_key: "CHANGE_ME!!" +hmac_key: "83646b9f96e6823d2c6e275911ade98f5e9436fa" ## ## List of video IDs where the "download" widget must be diff --git a/docker-compose.yml b/docker-compose.yml index d879919a..8a267b25 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -30,7 +30,7 @@ services: # domain: # https_only: false # statistics_enabled: false - hmac_key: "CHANGE_ME!!" + hmac_key: "83646b9f96e6823d2c6e275911ade98f5e9436fa" healthcheck: test: wget -nv --tries=1 --spider http://127.0.0.1:3000/api/v1/comments/jNQXAC9IVRw || exit 1 interval: 30s diff --git a/src/invidious/routes/compilations.cr b/src/invidious/routes/compilations.cr index 0ccc67c1..ccc6819d 100644 --- a/src/invidious/routes/compilations.cr +++ b/src/invidious/routes/compilations.cr @@ -67,7 +67,7 @@ module Invidious::Routes::Compilations user = user.as(User) sid = sid.as(String) - compid = env.params.query["list"]? + compid = env.params.query["comp"]? if !compid || compid.empty? return error_template(400, "A compilation ID is required") end @@ -91,7 +91,7 @@ module Invidious::Routes::Compilations return env.redirect "/" if user.nil? - compid = env.params.query["list"]? + compid = env.params.query["comp"]? return env.redirect referer if compid.nil? user = user.as(User) @@ -126,7 +126,7 @@ module Invidious::Routes::Compilations user = user.as(User) sid = sid.as(String) - compid = env.params.query["list"]? + compid = env.params.query["comp"]? if !compid || !compid.starts_with?("IVCMP") return env.redirect referer end @@ -159,7 +159,7 @@ module Invidious::Routes::Compilations return env.redirect "/" if user.nil? - compid = env.params.query["list"]? + compid = env.params.query["comp"]? return env.redirect referer if compid.nil? user = user.as(User) @@ -191,7 +191,7 @@ module Invidious::Routes::Compilations Invidious::Database::Compilations.update(compid, title, privacy, description, updated) - env.redirect "/compilation?list=#{compid}" + env.redirect "/compilation?comp=#{compid}" end def self.adjust_timestamps(env) @@ -204,7 +204,7 @@ module Invidious::Routes::Compilations return env.redirect "/" if user.nil? - compid = env.params.query["list"]? + compid = env.params.query["comp"]? return env.redirect referer if compid.nil? user = user.as(User) @@ -282,7 +282,7 @@ module Invidious::Routes::Compilations user = user.as(User) sid = sid.as(String) - compid = env.params.query["list"]? + compid = env.params.query["comp"]? if !compid || !compid.starts_with?("IVCMP") return env.redirect referer end @@ -304,7 +304,7 @@ module Invidious::Routes::Compilations query_encoded = URI.encode_www_form(query.try &.text || "", space_to_plus: true) page_nav_html = Frontend::Pagination.nav_numeric(locale, - base_url: "/add_compilation_items?list=#{compilation.id}&q=#{query_encoded}", + base_url: "/add_compilation_items?comp=#{compilation.id}&q=#{query_encoded}", current_page: page, show_next: (items.size >= 20) ) @@ -516,7 +516,7 @@ module Invidious::Routes::Compilations page_count += 1 if (compilation.video_count % 200) > 0 if page > page_count - return env.redirect "/compilation?list=#{compid}&page=#{page_count}" + return env.redirect "/compilation?comp=#{compid}&page=#{page_count}" end if compilation.privacy == CompilationPrivacy::Private && compilation.author != user.try &.email diff --git a/src/invidious/routes/watch.cr b/src/invidious/routes/watch.cr index f7529c84..8f4b602f 100644 --- a/src/invidious/routes/watch.cr +++ b/src/invidious/routes/watch.cr @@ -41,8 +41,8 @@ module Invidious::Routes::Watch if env.params.query["list"]?.try &.starts_with? "IVPL" plid = env.params.query["list"]?.try &.gsub(/[^a-zA-Z0-9_-]/, "") continuation = process_continuation(env.params.query, plid, id) - elsif env.params.query["list"]?.try &.starts_with? "IVCMP" - compid = env.params.query["list"]?.try &.gsub(/[^a-zA-Z0-9_-]/, "") + elsif env.params.query["comp"]?.try &.starts_with? "IVCMP" + compid = env.params.query["comp"]?.try &.gsub(/[^a-zA-Z0-9_-]/, "") if (!compid.nil?) index = Invidious::Database::CompilationVideos.select_index(compid, id) indices_array = Invidious::Database::Compilations.select_index_array(compid) diff --git a/src/invidious/views/edit_compilation.ecr b/src/invidious/views/edit_compilation.ecr index b6ec7ce1..a70a0db5 100644 --- a/src/invidious/views/edit_compilation.ecr +++ b/src/invidious/views/edit_compilation.ecr @@ -58,11 +58,3 @@ <% end %> - - - - - - - -