Add logic to show/hide transcripts without JS

This commit is contained in:
syeopite
2024-06-12 10:23:48 -07:00
parent 654f5fd45e
commit 786e40afb0
3 changed files with 23 additions and 2 deletions

View File

@@ -38,6 +38,11 @@ module Invidious::Routes::Watch
nojs ||= "0"
nojs = nojs == "1"
show_transcripts = env.params.query["show_transcripts"]?
show_transcripts ||= "0"
show_transcripts = show_transcripts == "1"
preferences = env.get("preferences").as(Preferences)
user = env.get?("user").try &.as(User)
@@ -156,6 +161,13 @@ module Invidious::Routes::Watch
}
captions = captions - preferred_captions
if show_transcripts
# Placeholder
transcript = true
else
transcript = nil
end
aspect_ratio = "16:9"
thumbnail = "/vi/#{video.id}/maxres.jpg"