forked from midou/invidious
Display username in header
This commit is contained in:
committed by
syeopite
parent
00425670d7
commit
90c907710c
@@ -54,6 +54,7 @@ struct ConfigPreferences
|
||||
property extend_desc : Bool = false
|
||||
property volume : Int32 = 100
|
||||
property vr_mode : Bool = true
|
||||
property show_nick : Bool = true
|
||||
|
||||
def to_tuple
|
||||
{% begin %}
|
||||
|
@@ -68,6 +68,10 @@ class Invidious::Routes::PreferencesRoute < Invidious::Routes::BaseRoute
|
||||
vr_mode ||= "off"
|
||||
vr_mode = vr_mode == "on"
|
||||
|
||||
show_nick = env.params.body["show_nick"]?.try &.as(String)
|
||||
show_nick ||= "off"
|
||||
show_nick = show_nick == "on"
|
||||
|
||||
comments = [] of String
|
||||
2.times do |i|
|
||||
comments << (env.params.body["comments[#{i}]"]?.try &.as(String) || CONFIG.default_user_preferences.comments[i])
|
||||
@@ -155,6 +159,7 @@ class Invidious::Routes::PreferencesRoute < Invidious::Routes::BaseRoute
|
||||
volume: volume,
|
||||
extend_desc: extend_desc,
|
||||
vr_mode: vr_mode,
|
||||
show_nick: show_nick,
|
||||
}.to_json).to_json
|
||||
|
||||
if user = env.get? "user"
|
||||
|
@@ -55,6 +55,7 @@ struct Preferences
|
||||
property listen : Bool = CONFIG.default_user_preferences.listen
|
||||
property local : Bool = CONFIG.default_user_preferences.local
|
||||
property vr_mode : Bool = CONFIG.default_user_preferences.vr_mode
|
||||
property show_nick : Bool = CONFIG.default_user_preferences.show_nick
|
||||
|
||||
@[JSON::Field(converter: Preferences::ProcessString)]
|
||||
property locale : String = CONFIG.default_user_preferences.locale
|
||||
|
@@ -175,6 +175,12 @@
|
||||
</select>
|
||||
<% end %>
|
||||
</div>
|
||||
<% if env.get? "user" %>
|
||||
<div class="pure-control-group">
|
||||
<label for="show_nick"><%= translate(locale, "Show nickname on top: ") %></label>
|
||||
<input name="show_nick" id="show_nick" type="checkbox" <% if preferences.show_nick %>checked<% end %>>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<legend><%= translate(locale, "Miscellaneous preferences") %></legend>
|
||||
|
||||
|
@@ -67,6 +67,11 @@
|
||||
<i class="icon ion-ios-cog"></i>
|
||||
</a>
|
||||
</div>
|
||||
<% if env.get("preferences").as(Preferences).show_nick %>
|
||||
<div class="pure-u-1-4">
|
||||
<span id="user_name"><%= translate(locale, "Welcome, `x`", env.get("user").as(User).email) %></span>
|
||||
</div>
|
||||
<% end %>
|
||||
<div class="pure-u-1-4">
|
||||
<form action="/signout?referer=<%= env.get?("current_page") %>" method="post">
|
||||
<input type="hidden" name="csrf_token" value="<%= URI.encode_www_form(env.get?("csrf_token").try &.as(String) || "") %>">
|
||||
|
Reference in New Issue
Block a user