From 6db157fd5ea2fac1254684c312397de031edc075 Mon Sep 17 00:00:00 2001 From: Fijxu Date: Mon, 2 Sep 2024 14:20:34 -0400 Subject: [PATCH] Revert "Merge branch 'playlist-link-listen-mode'" This reverts commit 8c0f03e83c8d58d6dda4c86d44fdddd6bba412f8, reversing changes made to a2d82ff8291b89d82e81370517478f0f69160918. This breaks videoplayback --- assets/js/watch.js | 4 ---- src/invidious/mixes.cr | 4 ++-- src/invidious/playlists.cr | 4 ++-- src/invidious/routes/api/v1/misc.cr | 10 ++-------- 4 files changed, 6 insertions(+), 16 deletions(-) diff --git a/assets/js/watch.js b/assets/js/watch.js index d869d40d..26ad138f 100644 --- a/assets/js/watch.js +++ b/assets/js/watch.js @@ -67,10 +67,6 @@ function get_playlist(plid) { '&format=html&hl=' + video_data.preferences.locale; } - if (video_data.params.listen) { - plid_url += '&listen=1' - } - helpers.xhr('GET', plid_url, {retries: 5, entity_name: 'playlist'}, { on200: function (response) { playlist.innerHTML = response.playlistHtml; diff --git a/src/invidious/mixes.cr b/src/invidious/mixes.cr index 28ff0ff6..823ca85b 100644 --- a/src/invidious/mixes.cr +++ b/src/invidious/mixes.cr @@ -81,7 +81,7 @@ def fetch_mix(rdid, video_id, cookies = nil, locale = nil) }) end -def template_mix(mix, listen) +def template_mix(mix) html = <<-END_HTML

@@ -95,7 +95,7 @@ def template_mix(mix, listen) mix["videos"].as_a.each do |video| html += <<-END_HTML
  • - +

    #{recode_length_seconds(video["lengthSeconds"].as_i)}

    diff --git a/src/invidious/playlists.cr b/src/invidious/playlists.cr index dd4a23df..3e6eef95 100644 --- a/src/invidious/playlists.cr +++ b/src/invidious/playlists.cr @@ -505,7 +505,7 @@ def extract_playlist_videos(initial_data : Hash(String, JSON::Any)) return videos end -def template_playlist(playlist, listen) +def template_playlist(playlist) html = <<-END_HTML

    @@ -519,7 +519,7 @@ def template_playlist(playlist, listen) playlist["videos"].as_a.each do |video| html += <<-END_HTML
  • - +

    #{recode_length_seconds(video["lengthSeconds"].as_i)}

    diff --git a/src/invidious/routes/api/v1/misc.cr b/src/invidious/routes/api/v1/misc.cr index 956ef589..093669fe 100644 --- a/src/invidious/routes/api/v1/misc.cr +++ b/src/invidious/routes/api/v1/misc.cr @@ -42,9 +42,6 @@ module Invidious::Routes::API::V1::Misc format = env.params.query["format"]? format ||= "json" - listenParam = env.params.query["listen"]? - listen = (listenParam == "true" || listenParam == "1") - if plid.starts_with? "RD" return env.redirect "/api/v1/mixes/#{plid}" end @@ -88,7 +85,7 @@ module Invidious::Routes::API::V1::Misc end if format == "html" - playlist_html = template_playlist(json_response, listen) + playlist_html = template_playlist(json_response) index, next_video = json_response["videos"].as_a.skip(1 + lookback).select { |video| !video["author"].as_s.empty? }[0]?.try { |v| {v["index"], v["videoId"]} } || {nil, nil} response = { @@ -114,9 +111,6 @@ module Invidious::Routes::API::V1::Misc format = env.params.query["format"]? format ||= "json" - listenParam = env.params.query["listen"]? - listen = (listenParam == "true" || listenParam == "1") - begin mix = fetch_mix(rdid, continuation, locale: locale) @@ -163,7 +157,7 @@ module Invidious::Routes::API::V1::Misc if format == "html" response = JSON.parse(response) - playlist_html = template_mix(response, listen) + playlist_html = template_mix(response) next_video = response["videos"].as_a.select { |video| !video["author"].as_s.empty? }[0]?.try &.["videoId"] response = {