diff --git a/locales/en-US.json b/locales/en-US.json index b61515c9..0e099969 100644 --- a/locales/en-US.json +++ b/locales/en-US.json @@ -113,6 +113,7 @@ "Administrator preferences": "Administrator preferences", "Default homepage: ": "Default homepage: ", "Feed menu: ": "Feed menu: ", + "Show nickname on top: ": "Show nickname on top: ", "Top enabled: ": "Top enabled: ", "CAPTCHA enabled: ": "CAPTCHA enabled: ", "Login enabled: ": "Login enabled: ", @@ -384,4 +385,4 @@ "Playlists": "Playlists", "Community": "Community", "Current version: ": "Current version: " -} \ No newline at end of file +} diff --git a/locales/pl.json b/locales/pl.json index 36e739db..c55b3107 100644 --- a/locales/pl.json +++ b/locales/pl.json @@ -332,5 +332,6 @@ "Videos": "Filmy", "Playlists": "Playlisty", "Community": "Społeczność", - "Current version: ": "Aktualna wersja: " + "Current version: ": "Aktualna wersja: ", + "Show nickname on top: ": "Pokaż nazwę użytkownika na górze: " } diff --git a/src/invidious.cr b/src/invidious.cr index f5fe4b3d..5a6463cf 100644 --- a/src/invidious.cr +++ b/src/invidious.cr @@ -2042,6 +2042,10 @@ post "/preferences" do |env| notifications_only ||= "off" notifications_only = notifications_only == "on" + show_nick = env.params.body["show_nick"]?.try &.as(String) + show_nick ||= "off" + show_nick = show_nick == "on" + # Convert to JSON and back again to take advantage of converters used for compatability preferences = Preferences.from_json({ annotations: annotations, @@ -2058,6 +2062,7 @@ post "/preferences" do |env| locale: locale, max_results: max_results, notifications_only: notifications_only, + show_nick: show_nick, player_style: player_style, quality: quality, default_home: default_home, diff --git a/src/invidious/helpers/helpers.cr b/src/invidious/helpers/helpers.cr index 2341d3be..8a73bccc 100644 --- a/src/invidious/helpers/helpers.cr +++ b/src/invidious/helpers/helpers.cr @@ -150,6 +150,7 @@ struct ConfigPreferences unseen_only: {type: Bool, default: false}, video_loop: {type: Bool, default: false}, volume: {type: Int32, default: 100}, + show_nick: {type: Bool, default: true}, }) end diff --git a/src/invidious/users.cr b/src/invidious/users.cr index afb100f2..22186934 100644 --- a/src/invidious/users.cr +++ b/src/invidious/users.cr @@ -93,6 +93,7 @@ struct Preferences unseen_only: {type: Bool, default: CONFIG.default_user_preferences.unseen_only}, video_loop: {type: Bool, default: CONFIG.default_user_preferences.video_loop}, volume: {type: Int32, default: CONFIG.default_user_preferences.volume}, + show_nick: {type: Bool, default: CONFIG.default_user_preferences.show_nick}, }) end diff --git a/src/invidious/views/preferences.ecr b/src/invidious/views/preferences.ecr index 17e5804e..d3a209a5 100644 --- a/src/invidious/views/preferences.ecr +++ b/src/invidious/views/preferences.ecr @@ -161,6 +161,11 @@ function update_value(element) { <% end %> +
+ + checked<% end %>> +
+ <% if env.get? "user" %> <%= translate(locale, "Subscription preferences") %> diff --git a/src/invidious/views/template.ecr b/src/invidious/views/template.ecr index 4ed56de7..421d7c2d 100644 --- a/src/invidious/views/template.ecr +++ b/src/invidious/views/template.ecr @@ -66,9 +66,11 @@ -
- Welcome, <%= env.get("user").as(User).email %> -
+ <% if env.get("preferences").as(Preferences).show_nick %> +
+ Welcome, <%= env.get("user").as(User).email %> +
+ <% end %>
" method="post"> ">