forked from midou/invidious
Add 'local' option to preferences
This commit is contained in:
@ -1231,6 +1231,10 @@ post "/preferences" do |env|
|
||||
listen ||= "off"
|
||||
listen = listen == "on"
|
||||
|
||||
local = env.params.body["local"]?.try &.as(String)
|
||||
local ||= "off"
|
||||
local = local == "on"
|
||||
|
||||
speed = env.params.body["speed"]?.try &.as(String).to_f?
|
||||
speed ||= DEFAULT_USER_PREFERENCES.speed
|
||||
|
||||
@ -1292,6 +1296,7 @@ post "/preferences" do |env|
|
||||
"autoplay" => autoplay,
|
||||
"continue" => continue,
|
||||
"listen" => listen,
|
||||
"local" => local,
|
||||
"speed" => speed,
|
||||
"quality" => quality,
|
||||
"volume" => volume,
|
||||
|
@ -31,6 +31,7 @@ DEFAULT_USER_PREFERENCES = Preferences.from_json({
|
||||
"video_loop" => false,
|
||||
"autoplay" => false,
|
||||
"continue" => false,
|
||||
"local" => false,
|
||||
"listen" => false,
|
||||
"speed" => 1.0,
|
||||
"quality" => "hd720",
|
||||
@ -80,6 +81,10 @@ class Preferences
|
||||
type: Bool,
|
||||
default: DEFAULT_USER_PREFERENCES.continue,
|
||||
},
|
||||
local: {
|
||||
type: Bool,
|
||||
default: DEFAULT_USER_PREFERENCES.local,
|
||||
},
|
||||
listen: {
|
||||
type: Bool,
|
||||
default: DEFAULT_USER_PREFERENCES.listen,
|
||||
|
@ -747,10 +747,11 @@ def process_video_params(query, preferences)
|
||||
# region ||= preferences.region
|
||||
autoplay ||= preferences.autoplay.to_unsafe
|
||||
continue ||= preferences.continue.to_unsafe
|
||||
related_videos ||= preferences.related_videos.to_unsafe
|
||||
listen ||= preferences.listen.to_unsafe
|
||||
local ||= preferences.local.to_unsafe
|
||||
preferred_captions ||= preferences.captions
|
||||
quality ||= preferences.quality
|
||||
related_videos ||= preferences.related_videos.to_unsafe
|
||||
speed ||= preferences.speed
|
||||
video_loop ||= preferences.video_loop.to_unsafe
|
||||
volume ||= preferences.volume
|
||||
@ -758,10 +759,11 @@ def process_video_params(query, preferences)
|
||||
|
||||
autoplay ||= DEFAULT_USER_PREFERENCES.autoplay.to_unsafe
|
||||
continue ||= DEFAULT_USER_PREFERENCES.continue.to_unsafe
|
||||
related_videos ||= DEFAULT_USER_PREFERENCES.related_videos.to_unsafe
|
||||
listen ||= DEFAULT_USER_PREFERENCES.listen.to_unsafe
|
||||
local ||= DEFAULT_USER_PREFERENCES.local.to_unsafe
|
||||
preferred_captions ||= DEFAULT_USER_PREFERENCES.captions
|
||||
quality ||= DEFAULT_USER_PREFERENCES.quality
|
||||
related_videos ||= DEFAULT_USER_PREFERENCES.related_videos.to_unsafe
|
||||
speed ||= DEFAULT_USER_PREFERENCES.speed
|
||||
video_loop ||= DEFAULT_USER_PREFERENCES.video_loop.to_unsafe
|
||||
volume ||= DEFAULT_USER_PREFERENCES.volume
|
||||
|
@ -28,6 +28,11 @@ function update_value(element) {
|
||||
<input name="continue" id="continue" type="checkbox" <% if preferences.continue %>checked<% end %>>
|
||||
</div>
|
||||
|
||||
<div class="pure-control-group">
|
||||
<label for="local"><%= translate(locale, "Proxy videos? ") %></label>
|
||||
<input name="local" id="local" type="checkbox" <% if preferences.local %>checked<% end %>>
|
||||
</div>
|
||||
|
||||
<div class="pure-control-group">
|
||||
<label for="listen"><%= translate(locale, "Listen by default: ") %></label>
|
||||
<input name="listen" id="listen" type="checkbox" <% if preferences.listen %>checked<% end %>>
|
||||
|
Reference in New Issue
Block a user