mirror of
https://git.nadeko.net/Fijxu/invidious.git
synced 2025-06-28 01:48:26 +00:00
feat(frontend): config option to disable video downloads
This commit is contained in:
parent
ea587758a5
commit
b9114cbb9d
@ -244,6 +244,8 @@ class Config
|
|||||||
|
|
||||||
property max_popular_results : Int32 = 40
|
property max_popular_results : Int32 = 40
|
||||||
|
|
||||||
|
property disable_video_downloads : Bool = false
|
||||||
|
|
||||||
{% if flag?(:linux) %}
|
{% if flag?(:linux) %}
|
||||||
property reload_config_automatically : Bool = true
|
property reload_config_automatically : Bool = true
|
||||||
{% end %}
|
{% end %}
|
||||||
|
@ -52,28 +52,31 @@ module Invidious::Frontend::WatchPage
|
|||||||
|
|
||||||
# Non-DASH videos (audio+video)
|
# Non-DASH videos (audio+video)
|
||||||
|
|
||||||
video_assets.full_videos.each do |option|
|
if !CONFIG.disable_video_downloads
|
||||||
mimetype = option["mimeType"].as_s.split(";")[0]
|
video_assets.full_videos.each do |option|
|
||||||
|
mimetype = option["mimeType"].as_s.split(";")[0]
|
||||||
|
|
||||||
height = Invidious::Videos::Formats.itag_to_metadata?(option["itag"]).try &.["height"]?
|
height = Invidious::Videos::Formats.itag_to_metadata?(option["itag"]).try &.["height"]?
|
||||||
|
|
||||||
value = {"itag": option["itag"], "ext": mimetype.split("/")[1]}.to_json
|
value = {"itag": option["itag"], "ext": mimetype.split("/")[1]}.to_json
|
||||||
|
|
||||||
str << "\t\t\t<option value='" << value << "'>"
|
str << "\t\t\t<option value='" << value << "'>"
|
||||||
str << (height || "~240") << "p - " << mimetype
|
str << (height || "~240") << "p - " << mimetype
|
||||||
str << "</option>\n"
|
str << "</option>\n"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# DASH video streams
|
# DASH video streams
|
||||||
|
|
||||||
video_assets.video_streams.each do |option|
|
if !CONFIG.disable_video_downloads
|
||||||
mimetype = option["mimeType"].as_s.split(";")[0]
|
video_assets.video_streams.each do |option|
|
||||||
|
mimetype = option["mimeType"].as_s.split(";")[0]
|
||||||
|
|
||||||
value = {"itag": option["itag"], "ext": mimetype.split("/")[1]}.to_json
|
value = {"itag": option["itag"], "ext": mimetype.split("/")[1]}.to_json
|
||||||
|
|
||||||
str << "\t\t\t<option value='" << value << "'>"
|
str << "\t\t\t<option value='" << value << "'>"
|
||||||
str << option["qualityLabel"] << " - " << mimetype << " @ " << option["fps"] << "fps - video only"
|
str << option["qualityLabel"] << " - " << mimetype << " @ " << option["fps"] << "fps - video only"
|
||||||
str << "</option>\n"
|
str << "</option>\n"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# DASH audio streams
|
# DASH audio streams
|
||||||
|
Loading…
Reference in New Issue
Block a user