Small download refactoring. See commit message

Wrap download widget around details box

Remove ability to disable dl on only certain vids
This commit is contained in:
syeopite 2021-06-26 21:24:07 -07:00
parent e50a9bfa77
commit fddca10b6b
No known key found for this signature in database
GPG key ID: 6FA616E5A5294A82
2 changed files with 39 additions and 33 deletions

View file

@ -92,7 +92,6 @@ class Config
property admins : Array(String) = [] of String
property external_port : Int32? = nil
property default_user_preferences : ConfigPreferences = ConfigPreferences.from_yaml("")
property dmca_content : Array(String) = [] of String # For compliance with DMCA, disables download widget using list of video IDs
property check_tables : Bool = false # Check table integrity, automatically try to add any missing columns, create tables, etc.
property cache_annotations : Bool = false # Cache annotations requested from IA, will not cache empty annotations or annotations that only contain cards
property banner : String? = nil # Optional banner to be displayed along top of page for announcements, etc.

View file

@ -161,12 +161,18 @@ we're going to need to do it here in order to allow for translations.
<% end %>
<% end %>
<% if CONFIG.dmca_content.includes?(video.id) || CONFIG.disabled?("downloads") %>
<p id="download"><%= translate(locale, "Download is disabled.") %></p>
<% if CONFIG.disabled?("downloads") %>
<% else %>
<details id="download-box">
<summary class="simulated_a">
<p>
<i style="margin: 0px 2px;" class="icon ion-md-download"></i>
<%= translate(locale, "Download") %>
</p>
</summary>
<form class="pure-form pure-form-stacked" action="/latest_version" method="get" rel="noopener" target="_blank">
<div class="pure-control-group">
<label for="download_widget"><%= translate(locale, "Download as: ") %></label>
<select style="width:100%" name="download_widget" id="download_widget">
<% fmt_stream.each do |option| %>
<option value='{"id":"<%= video.id %>","itag":"<%= option["itag"] %>","title":"<%= URI.encode_www_form(video.title) %>-<%= video.id %>.<%= option["mimeType"].as_s.split(";")[0].split("/")[1] %>"}'>
@ -184,8 +190,8 @@ we're going to need to do it here in order to allow for translations.
</option>
<% end %>
<% captions.each do |caption| %>
<option value='{"id":"<%= video.id %>","label":"<%= caption.name %>","title":"<%= URI.encode_www_form(video.title) %>-<%= video.id %>.<%= caption.languageCode %>.vtt"}'>
<%= translate(locale, "Subtitles - `x` (.vtt)", caption.name) %>
<option value='{"id":"<%= video.id %>","label":"<%= caption.name.simpleText %>","title":"<%= URI.encode_www_form(video.title) %>-<%= video.id %>.<%= caption.languageCode %>.vtt"}'>
<%= translate(locale, "Subtitles - `x` (.vtt)", caption.name.simpleText) %>
</option>
<% end %>
</select>
@ -195,6 +201,7 @@ we're going to need to do it here in order to allow for translations.
<b><%= translate(locale, "Download") %></b>
</button>
</form>
</details>
<% end %>
<p id="views"><i class="icon ion-ios-eye"></i> <%= number_with_separator(video.views) %></p>