mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-04-11.git
synced 2024-08-15 00:43:26 +00:00
Merge pull request #50 from omarroth/feed-redirect
Add option to redirect homepage to subscription feed
This commit is contained in:
commit
44eef9654a
3 changed files with 34 additions and 11 deletions
|
@ -258,6 +258,14 @@ before_all do |env|
|
|||
end
|
||||
|
||||
get "/" do |env|
|
||||
user = env.get? "user"
|
||||
if user
|
||||
user = user.as(User)
|
||||
if user.preferences.redirect_feed
|
||||
env.redirect "/feed/subscriptions"
|
||||
end
|
||||
end
|
||||
|
||||
templated "index"
|
||||
end
|
||||
|
||||
|
@ -1689,6 +1697,10 @@ post "/preferences" do |env|
|
|||
comments = env.params.body["comments"]?
|
||||
comments ||= "youtube"
|
||||
|
||||
redirect_feed = env.params.body["redirect_feed"]?.try &.as(String)
|
||||
redirect_feed ||= "off"
|
||||
redirect_feed = redirect_feed == "on"
|
||||
|
||||
dark_mode = env.params.body["dark_mode"]?.try &.as(String)
|
||||
dark_mode ||= "off"
|
||||
dark_mode = dark_mode == "on"
|
||||
|
@ -1714,6 +1726,7 @@ post "/preferences" do |env|
|
|||
"quality" => quality,
|
||||
"volume" => volume,
|
||||
"comments" => comments,
|
||||
"redirect_feed" => redirect_feed,
|
||||
"dark_mode" => dark_mode,
|
||||
"thin_mode" => thin_mode,
|
||||
"max_results" => max_results,
|
||||
|
|
|
@ -163,6 +163,11 @@ class Preferences
|
|||
nilable: true,
|
||||
default: "youtube",
|
||||
},
|
||||
redirect_feed: {
|
||||
type: Bool,
|
||||
nilable: true,
|
||||
default: false,
|
||||
},
|
||||
dark_mode: Bool,
|
||||
thin_mode: {
|
||||
type: Bool,
|
||||
|
|
|
@ -68,6 +68,11 @@ function update_value(element) {
|
|||
</div>
|
||||
|
||||
<legend>Subscription preferences</legend>
|
||||
<div class="pure-control-group">
|
||||
<label for="redirect_feed">Redirect homepage to feed: </label>
|
||||
<input name="redirect_feed" id="redirect_feed" type="checkbox" <% if user.preferences.redirect_feed %>checked<% end %>>
|
||||
</div>
|
||||
|
||||
<div class="pure-control-group">
|
||||
<label for="max_results">Number of videos shown in feed: </label>
|
||||
<input name="max_results" id="max_results" type="number" value="<%= user.preferences.max_results %>">
|
||||
|
|
Loading…
Reference in a new issue