Merge pull request #1043 from makos/display-username

Display username of currently logged in user
This commit is contained in:
syeopite 2021-06-19 05:28:30 -07:00 committed by GitHub
commit 75d04a92c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 72 additions and 0 deletions

View file

@ -117,6 +117,8 @@
"Administrator preferences": "إعدادات المدير",
"Default homepage: ": "الصفحة الرئيسية الافتراضية ",
"Feed menu: ": "قائمة التدفقات: ",
"Show nickname on top: ": "",
"Welcome, `x`": "",
"Top enabled: ": "تفعيل 'الأفضل' ؟ ",
"CAPTCHA enabled: ": "تفعيل الكابتشا: ",
"Login enabled: ": "تفعيل الولوج: ",

View file

@ -117,6 +117,8 @@
"Administrator preferences": "Administrator-Einstellungen",
"Default homepage: ": "Standard-Startseite: ",
"Feed menu: ": "Feed-Menü: ",
"Show nickname on top: ": "",
"Welcome, `x`": "",
"Top enabled: ": "Top aktiviert? ",
"CAPTCHA enabled: ": "CAPTCHA aktiviert? ",
"Login enabled: ": "Anmeldung aktiviert: ",

View file

@ -117,6 +117,8 @@
"Administrator preferences": "Προτιμήσεις διαχειριστή",
"Default homepage: ": "Προεπιλεγμένη αρχική: ",
"Feed menu: ": "Μενού ροής συνδρομών: ",
"Show nickname on top: ": "",
"Welcome, `x`": "",
"Top enabled: ": "Ενεργοποίηση κορυφαίων; ",
"CAPTCHA enabled: ": "Ενεργοποίηση CAPTCHA; ",
"Login enabled: ": "Ενεργοποίηση σύνδεσης; ",

View file

@ -117,6 +117,8 @@
"Administrator preferences": "Administrator preferences",
"Default homepage: ": "Default homepage: ",
"Feed menu: ": "Feed menu: ",
"Show nickname on top: ": "Show nickname on top: ",
"Welcome, `x`": "Welcome, `x`",
"Top enabled: ": "Top enabled: ",
"CAPTCHA enabled: ": "CAPTCHA enabled: ",
"Login enabled: ": "Login enabled: ",

View file

@ -117,6 +117,8 @@
"Administrator preferences": "Agordoj de administranto",
"Default homepage: ": "Defaŭlta hejmpaĝo: ",
"Feed menu: ": "Flua menuo: ",
"Show nickname on top: ": "",
"Welcome, `x`": "",
"Top enabled: ": "Ĉu pli bonaj ŝaltitaj? ",
"CAPTCHA enabled: ": "Ĉu CAPTCHA ŝaltita? ",
"Login enabled: ": "Ĉu ensaluto aktivita? ",

View file

@ -117,6 +117,8 @@
"Administrator preferences": "Preferencias de administrador",
"Default homepage: ": "Página de inicio por defecto: ",
"Feed menu: ": "Menú de fuentes: ",
"Show nickname on top: ": "",
"Welcome, `x`": "",
"Top enabled: ": "¿Habilitar los destacados? ",
"CAPTCHA enabled: ": "¿Habilitar los CAPTCHA? ",
"Login enabled: ": "¿Habilitar el inicio de sesión? ",

View file

@ -117,6 +117,8 @@
"Administrator preferences": "ترجیحات مدیریت",
"Default homepage: ": "صفحه خانه پیشفرض ",
"Feed menu: ": "منو خوراک: ",
"Show nickname on top: ": "",
"Welcome, `x`": "",
"Top enabled: ": "بالا فعال شده: ",
"CAPTCHA enabled: ": "CAPTCHA فعال شده: ",
"Login enabled: ": "ورود فعال شده: ",

View file

@ -117,6 +117,8 @@
"Administrator preferences": "Järjestelmänvalvojan asetukset",
"Default homepage: ": "Oletuskotisivu: ",
"Feed menu: ": "Syötevalikko: ",
"Show nickname on top: ": "",
"Welcome, `x`": "",
"Top enabled: ": "Yläosa käytössä: ",
"CAPTCHA enabled: ": "CAPTCHA käytössä: ",
"Login enabled: ": "Kirjautuminen käytössä: ",

View file

@ -117,6 +117,8 @@
"Administrator preferences": "Préferences d'Administration",
"Default homepage: ": "Page d'accueil par défaut : ",
"Feed menu: ": "Préferences des abonnements : ",
"Show nickname on top: ": "",
"Welcome, `x`": "",
"Top enabled: ": "Top activé : ",
"CAPTCHA enabled: ": "CAPTCHA activé : ",
"Login enabled: ": "Autoriser l'ouverture de sessions utilisateur : ",

View file

@ -117,6 +117,8 @@
"Administrator preferences": "הגדרות ניהול מערכת",
"Default homepage: ": "Default homepage: ",
"Feed menu: ": "תפריט ההזנה: ",
"Show nickname on top: ": "",
"Welcome, `x`": "",
"Top enabled: ": "",
"CAPTCHA enabled: ": "",
"Login enabled: ": "",

View file

@ -117,6 +117,8 @@
"Administrator preferences": "Postavke administratora",
"Default homepage: ": "Standardna početna stranica: ",
"Feed menu: ": "Izbornik za feedove: ",
"Show nickname on top: ": "",
"Welcome, `x`": "",
"Top enabled: ": "Najbolji aktivirani: ",
"CAPTCHA enabled: ": "Aktivirani CAPTCHA: ",
"Login enabled: ": "Prijava aktivirana: ",

View file

@ -117,6 +117,8 @@
"Administrator preferences": "Preferensi administrator",
"Default homepage: ": "Laman beranda default: ",
"Feed menu: ": "Menu umpan: ",
"Show nickname on top: ": "",
"Welcome, `x`": "",
"Top enabled: ": "Teratas diaktifkan: ",
"CAPTCHA enabled: ": "CAPTCHA diaktifkan: ",
"Login enabled: ": "Masuk diaktifkan: ",

View file

@ -117,6 +117,8 @@
"Administrator preferences": "Kjörstillingar stjórnanda",
"Default homepage: ": "Sjálfgefin heimasíða: ",
"Feed menu: ": "Straum valmynd: ",
"Show nickname on top: ": "",
"Welcome, `x`": "",
"Top enabled: ": "Toppur virkur? ",
"CAPTCHA enabled: ": "CAPTCHA virk? ",
"Login enabled: ": "Innskráning virk? ",

View file

@ -117,6 +117,8 @@
"Administrator preferences": "Preferenze amministratore",
"Default homepage: ": "Pagina principale predefinita: ",
"Feed menu: ": "Menu iscrizioni: ",
"Show nickname on top: ": "",
"Welcome, `x`": "",
"Top enabled: ": "Top abilitato: ",
"CAPTCHA enabled: ": "CAPTCHA attivati: ",
"Login enabled: ": "Accesso attivato: ",

View file

@ -117,6 +117,8 @@
"Administrator preferences": "管理者設定",
"Default homepage: ": "デフォルトのホーム: ",
"Feed menu: ": "フィードメニュー: ",
"Show nickname on top: ": "",
"Welcome, `x`": "",
"Top enabled: ": "トップページを有効化: ",
"CAPTCHA enabled: ": "CAPTCHA を有効化: ",
"Login enabled: ": "ログインを有効化: ",

View file

@ -117,6 +117,8 @@
"Administrator preferences": "Administratorinnstillinger",
"Default homepage: ": "Forvalgt hjemmeside: ",
"Feed menu: ": "Kilde-meny: ",
"Show nickname on top: ": "",
"Welcome, `x`": "",
"Top enabled: ": "Topp påskrudd? ",
"CAPTCHA enabled: ": "CAPTCHA påskrudd? ",
"Login enabled: ": "Innlogging påskrudd? ",

View file

@ -117,6 +117,8 @@
"Administrator preferences": "Beheerdersinstellingen",
"Default homepage: ": "Standaard startpagina: ",
"Feed menu: ": "Feedmenu: ",
"Show nickname on top: ": "",
"Welcome, `x`": "",
"Top enabled: ": "Bovenkant inschakelen? ",
"CAPTCHA enabled: ": "CAPTCHA gebruiken? ",
"Login enabled: ": "Inloggen toestaan? ",

View file

@ -117,6 +117,8 @@
"Administrator preferences": "Preferencje administratora",
"Default homepage: ": "Domyślna strona główna: ",
"Feed menu: ": "Menu aktualności: ",
"Show nickname on top: ": "",
"Welcome, `x`": "",
"Top enabled: ": "\"Top\" aktywne: ",
"CAPTCHA enabled: ": "CAPTCHA aktywna? ",
"Login enabled: ": "Logowanie włączone? ",

View file

@ -117,6 +117,8 @@
"Administrator preferences": "Preferências de administrador",
"Default homepage: ": "Página de início padrão: ",
"Feed menu: ": "Menu do feed: ",
"Show nickname on top: ": "",
"Welcome, `x`": "",
"Top enabled: ": "Habilitar destaques: ",
"CAPTCHA enabled: ": "Habilitar CAPTCHA: ",
"Login enabled: ": "Habilitar login: ",

View file

@ -117,6 +117,8 @@
"Administrator preferences": "Preferências de administrador",
"Default homepage: ": "Página inicial predefinida: ",
"Feed menu: ": "Menu de subscrições: ",
"Show nickname on top: ": "",
"Welcome, `x`": "",
"Top enabled: ": "Top ativado: ",
"CAPTCHA enabled: ": "CAPTCHA ativado: ",
"Login enabled: ": "Iniciar sessão ativado: ",

View file

@ -117,6 +117,8 @@
"Administrator preferences": "Preferințele Administratorului",
"Default homepage: ": "Pagina principală implicită: ",
"Feed menu: ": "Preferințe legate de pagina de abonamente: ",
"Show nickname on top: ": "",
"Welcome, `x`": "",
"Top enabled: ": "Top activat: ",
"CAPTCHA enabled: ": "CAPTCHA activat : ",
"Login enabled: ": "Autentificare activată : ",

View file

@ -117,6 +117,8 @@
"Administrator preferences": "Администраторские настройки",
"Default homepage: ": "Главная страница по умолчанию: ",
"Feed menu: ": "Меню ленты видео: ",
"Show nickname on top: ": "",
"Welcome, `x`": "",
"Top enabled: ": "Включить топ видео? ",
"CAPTCHA enabled: ": "Включить капчу? ",
"Login enabled: ": "Включить авторизацию? ",

View file

@ -117,6 +117,8 @@
"Administrator preferences": "Administratörsinställningar",
"Default homepage: ": "Förvald hemsida: ",
"Feed menu: ": "Flödesmeny: ",
"Show nickname on top: ": "",
"Welcome, `x`": "",
"Top enabled: ": "Topp påslaget? ",
"CAPTCHA enabled: ": "CAPTCHA påslaget? ",
"Login enabled: ": "Inloggning påslaget? ",

View file

@ -117,6 +117,8 @@
"Administrator preferences": "Yönetici tercihleri",
"Default homepage: ": "Öntanımlı ana sayfa: ",
"Feed menu: ": "Akış menüsü: ",
"Show nickname on top: ": "",
"Welcome, `x`": "",
"Top enabled: ": "Top etkin: ",
"CAPTCHA enabled: ": "CAPTCHA etkin: ",
"Login enabled: ": "Oturum açma etkin: ",

View file

@ -117,6 +117,8 @@
"Administrator preferences": "Адміністраторські налаштування",
"Default homepage: ": "Усталена домашня сторінка: ",
"Feed menu: ": "Меню потоку з відео: ",
"Show nickname on top: ": "",
"Welcome, `x`": "",
"Top enabled: ": "Увімкнути топ відео? ",
"CAPTCHA enabled: ": "Увімкнути капчу? ",
"Login enabled: ": "Увімкнути авторизацію? ",

View file

@ -117,6 +117,8 @@
"Administrator preferences": "管理员选项",
"Default homepage: ": "默认主页: ",
"Feed menu: ": "Feed 菜单: ",
"Show nickname on top: ": "",
"Welcome, `x`": "",
"Top enabled: ": "是否启用“热门视频”页: ",
"CAPTCHA enabled: ": "是否启用验证码: ",
"Login enabled: ": "是否启用登录: ",

View file

@ -117,6 +117,8 @@
"Administrator preferences": "管理員偏好設定",
"Default homepage: ": "預設首頁: ",
"Feed menu: ": "Feed 選單: ",
"Show nickname on top: ": "",
"Welcome, `x`": "",
"Top enabled: ": "頂部啟用: ",
"CAPTCHA enabled: ": "CAPTCHA 啟用: ",
"Login enabled: ": "啟用登入: ",

View file

@ -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 %}

View file

@ -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"

View file

@ -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

View file

@ -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>

View file

@ -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) || "") %>">