summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/invidious/helpers/helpers.cr1
-rw-r--r--src/invidious/routes/preferences.cr5
-rw-r--r--src/invidious/users.cr1
-rw-r--r--src/invidious/views/preferences.ecr6
-rw-r--r--src/invidious/views/template.ecr5
5 files changed, 18 insertions, 0 deletions
diff --git a/src/invidious/helpers/helpers.cr b/src/invidious/helpers/helpers.cr
index 0c70cb02..7353f2d9 100644
--- a/src/invidious/helpers/helpers.cr
+++ b/src/invidious/helpers/helpers.cr
@@ -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 %}
diff --git a/src/invidious/routes/preferences.cr b/src/invidious/routes/preferences.cr
index d6002ffd..21d79218 100644
--- a/src/invidious/routes/preferences.cr
+++ b/src/invidious/routes/preferences.cr
@@ -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"
diff --git a/src/invidious/users.cr b/src/invidious/users.cr
index 98ef8792..aff76b53 100644
--- a/src/invidious/users.cr
+++ b/src/invidious/users.cr
@@ -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
diff --git a/src/invidious/views/preferences.ecr b/src/invidious/views/preferences.ecr
index c5b64ad6..d98c3bb5 100644
--- a/src/invidious/views/preferences.ecr
+++ b/src/invidious/views/preferences.ecr
@@ -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>
diff --git a/src/invidious/views/template.ecr b/src/invidious/views/template.ecr
index a13d3928..070b3087 100644
--- a/src/invidious/views/template.ecr
+++ b/src/invidious/views/template.ecr
@@ -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) || "") %>">