Add the ability to use custom css
This commit is contained in:
parent
ae8e5c4dbc
commit
7accdc4416
19 changed files with 67 additions and 12 deletions
|
@ -259,6 +259,7 @@ var translations = map[string]string{
|
|||
"form.prefs.select.older_first": "Älteste Artikel zuerst",
|
||||
"form.prefs.select.recent_first": "Neueste Artikel zuerst",
|
||||
"form.prefs.label.keyboard_shortcuts": "Tastaturkürzel aktivieren",
|
||||
"form.prefs.label.custom_css": "Benutzerdefiniertes CSS",
|
||||
"form.import.label.file": "OPML Datei",
|
||||
"form.import.label.url": "URL",
|
||||
"form.integration.fever_activate": "Fever API aktivieren",
|
||||
|
@ -593,6 +594,7 @@ var translations = map[string]string{
|
|||
"form.prefs.select.older_first": "Older entries first",
|
||||
"form.prefs.select.recent_first": "Recent entries first",
|
||||
"form.prefs.label.keyboard_shortcuts": "Enable keyboard shortcuts",
|
||||
"form.prefs.label.custom_css": "Custom CSS",
|
||||
"form.import.label.file": "OPML file",
|
||||
"form.import.label.url": "URL",
|
||||
"form.integration.fever_activate": "Activate Fever API",
|
||||
|
@ -907,6 +909,7 @@ var translations = map[string]string{
|
|||
"form.prefs.select.older_first": "Entradas más viejas primero",
|
||||
"form.prefs.select.recent_first": "Entradas recientes primero",
|
||||
"form.prefs.label.keyboard_shortcuts": "Habilitar atajos de teclado",
|
||||
"form.prefs.label.custom_css": "CSS personalizado",
|
||||
"form.import.label.file": "Archivo OPML",
|
||||
"form.import.label.url": "URL",
|
||||
"form.integration.fever_activate": "Activar API de Fever",
|
||||
|
@ -1221,6 +1224,7 @@ var translations = map[string]string{
|
|||
"form.prefs.select.older_first": "Ancien éléments en premier",
|
||||
"form.prefs.select.recent_first": "Éléments récents en premier",
|
||||
"form.prefs.label.keyboard_shortcuts": "Activer les raccourcis clavier",
|
||||
"form.prefs.label.custom_css": "CSS personnalisé",
|
||||
"form.import.label.file": "Fichier OPML",
|
||||
"form.import.label.url": "URL",
|
||||
"form.integration.fever_activate": "Activer l'API de Fever",
|
||||
|
@ -1555,6 +1559,7 @@ var translations = map[string]string{
|
|||
"form.prefs.select.older_first": "Prima i più recenti",
|
||||
"form.prefs.select.recent_first": "Prima i più vecchi",
|
||||
"form.prefs.label.keyboard_shortcuts": "Abilita le scorciatoie da tastiera",
|
||||
"form.prefs.label.custom_css": "CSS personalizzati",
|
||||
"form.import.label.file": "File OPML",
|
||||
"form.import.label.url": "URL",
|
||||
"form.integration.fever_activate": "Abilita l'API di Fever",
|
||||
|
@ -1869,6 +1874,7 @@ var translations = map[string]string{
|
|||
"form.prefs.select.older_first": "古い記事を最初に",
|
||||
"form.prefs.select.recent_first": "新しい記事を最初に",
|
||||
"form.prefs.label.keyboard_shortcuts": "キーボード・ショートカットを有効にする",
|
||||
"form.prefs.label.custom_css": "カスタムCSS",
|
||||
"form.import.label.file": "OPML ファイル",
|
||||
"form.import.label.url": "URL",
|
||||
"form.integration.fever_activate": "Fever API を有効にする",
|
||||
|
@ -2183,6 +2189,7 @@ var translations = map[string]string{
|
|||
"form.prefs.select.older_first": "Oudere items eerst",
|
||||
"form.prefs.select.recent_first": "Recente items eerst",
|
||||
"form.prefs.label.keyboard_shortcuts": "Schakel sneltoetsen in",
|
||||
"form.prefs.label.custom_css": "Aangepaste CSS",
|
||||
"form.import.label.file": "OPML-bestand",
|
||||
"form.import.label.url": "URL",
|
||||
"form.integration.fever_activate": "Activeer Fever API",
|
||||
|
@ -2517,6 +2524,7 @@ var translations = map[string]string{
|
|||
"form.prefs.select.older_first": "Najstarsze wpisy jako pierwsze",
|
||||
"form.prefs.label.keyboard_shortcuts": "Włącz skróty klawiaturowe",
|
||||
"form.prefs.select.recent_first": "Najnowsze wpisy jako pierwsze",
|
||||
"form.prefs.label.custom_css": "Niestandardowy CSS",
|
||||
"form.import.label.file": "Plik OPML",
|
||||
"form.import.label.url": "URL",
|
||||
"form.integration.fever_activate": "Aktywuj Fever API",
|
||||
|
@ -2857,6 +2865,7 @@ var translations = map[string]string{
|
|||
"form.prefs.select.older_first": "Сначала старые записи",
|
||||
"form.prefs.select.recent_first": "Сначала последние записи",
|
||||
"form.prefs.label.keyboard_shortcuts": "Включить сочетания клавиш",
|
||||
"form.prefs.label.custom_css": "Пользовательские CSS",
|
||||
"form.import.label.file": "OPML файл",
|
||||
"form.import.label.url": "URL",
|
||||
"form.integration.fever_activate": "Активировать Fever API",
|
||||
|
@ -3175,6 +3184,7 @@ var translations = map[string]string{
|
|||
"form.prefs.select.older_first": "旧->新",
|
||||
"form.prefs.select.recent_first": "新->旧",
|
||||
"form.prefs.label.keyboard_shortcuts": "启用键盘快捷键",
|
||||
"form.prefs.label.custom_css": "自定义CSS",
|
||||
"form.import.label.file": "OPML 文件",
|
||||
"form.import.label.url": "URL",
|
||||
"form.integration.fever_activate": "启用 Fever API",
|
||||
|
@ -3249,14 +3259,14 @@ var translations = map[string]string{
|
|||
}
|
||||
|
||||
var translationsChecksums = map[string]string{
|
||||
"de_DE": "1b69b48622854bdab214411c75e22bb66b51054354aae0c50222d966b5563dcd",
|
||||
"en_US": "c1cd8a4c6360881299609332bc930c0d59a30aea5ae90a6c87bcc06dbba7c69d",
|
||||
"es_ES": "94f4da8c6160ca30c59294ec520f8648496b94904b61ac47c7ca24bfa4fe793b",
|
||||
"fr_FR": "80a2d02c7a90e90024af4f5eb3aad710f245963df99538d7d71c0efcaae79f82",
|
||||
"it_IT": "b033ade2a67a273253d3251df97e6b2da7e2adbec60a33de5d0f41198e6783b2",
|
||||
"ja_JP": "2136cad37933c112a6e69f28936c216c8f262b28c47b57b18482c56a3f8932fb",
|
||||
"nl_NL": "4a3a4a117f11cf62de5cf515c5adc74c8467d05feac1844fee4f81d863173887",
|
||||
"pl_PL": "c088a74ad9e4dca6bdbf73b0b4fce97db60b5066cb03c6884a9462573b0f93ad",
|
||||
"ru_RU": "506a34fdfa35dacf2d86b16f44d47addf2e0f1f376d2a86a474619d6654967cc",
|
||||
"zh_CN": "463037b8bd51bb1e940f432fd621d62d4e81697298b8058124d287b5cbaee10f",
|
||||
"de_DE": "7c2c818451a72ac82bbdd0f27e7ea25454b8826f7032b219188644c8f20ffdb5",
|
||||
"en_US": "82bae5216e33a188a0eae633620be6c124295484214f38e6364127684c07b7d8",
|
||||
"es_ES": "f501a6e373bbef30175e6d944d6bed463a385341a41c54ba129dca261ff6a61d",
|
||||
"fr_FR": "5fa9d2745b3420d0cf29a8aab0ecbbe43d885b3058988f0b9afa35a7f791a7c6",
|
||||
"it_IT": "de975b7d55a7e83214bd7a8f6afd61bd1725feea61be848ebe062ceece4c4060",
|
||||
"ja_JP": "96101b6f5b073284304f052548da30334c3488324022d46c889f5dd85f4ae1df",
|
||||
"nl_NL": "dcb4a1e4c80479004d3e6ce639e7f1b48208b766754c4424d7be0a34d5682b19",
|
||||
"pl_PL": "f920466805f2e40bd83e65a0396723c7a922ca73406e4a3fdb9e9228d944ce2d",
|
||||
"ru_RU": "b3fdd388e001afe8878b1b58b41ccf7e2b593644b65c518366d60b09df374c8a",
|
||||
"zh_CN": "058a8f98e6a682d6cd32b451cb83f440c9731eedd36090deac429ddf7570d00c",
|
||||
}
|
||||
|
|
|
@ -254,6 +254,7 @@
|
|||
"form.prefs.select.older_first": "Älteste Artikel zuerst",
|
||||
"form.prefs.select.recent_first": "Neueste Artikel zuerst",
|
||||
"form.prefs.label.keyboard_shortcuts": "Tastaturkürzel aktivieren",
|
||||
"form.prefs.label.custom_css": "Benutzerdefiniertes CSS",
|
||||
"form.import.label.file": "OPML Datei",
|
||||
"form.import.label.url": "URL",
|
||||
"form.integration.fever_activate": "Fever API aktivieren",
|
||||
|
|
|
@ -254,6 +254,7 @@
|
|||
"form.prefs.select.older_first": "Older entries first",
|
||||
"form.prefs.select.recent_first": "Recent entries first",
|
||||
"form.prefs.label.keyboard_shortcuts": "Enable keyboard shortcuts",
|
||||
"form.prefs.label.custom_css": "Custom CSS",
|
||||
"form.import.label.file": "OPML file",
|
||||
"form.import.label.url": "URL",
|
||||
"form.integration.fever_activate": "Activate Fever API",
|
||||
|
|
|
@ -254,6 +254,7 @@
|
|||
"form.prefs.select.older_first": "Entradas más viejas primero",
|
||||
"form.prefs.select.recent_first": "Entradas recientes primero",
|
||||
"form.prefs.label.keyboard_shortcuts": "Habilitar atajos de teclado",
|
||||
"form.prefs.label.custom_css": "CSS personalizado",
|
||||
"form.import.label.file": "Archivo OPML",
|
||||
"form.import.label.url": "URL",
|
||||
"form.integration.fever_activate": "Activar API de Fever",
|
||||
|
|
|
@ -254,6 +254,7 @@
|
|||
"form.prefs.select.older_first": "Ancien éléments en premier",
|
||||
"form.prefs.select.recent_first": "Éléments récents en premier",
|
||||
"form.prefs.label.keyboard_shortcuts": "Activer les raccourcis clavier",
|
||||
"form.prefs.label.custom_css": "CSS personnalisé",
|
||||
"form.import.label.file": "Fichier OPML",
|
||||
"form.import.label.url": "URL",
|
||||
"form.integration.fever_activate": "Activer l'API de Fever",
|
||||
|
|
|
@ -254,6 +254,7 @@
|
|||
"form.prefs.select.older_first": "Prima i più recenti",
|
||||
"form.prefs.select.recent_first": "Prima i più vecchi",
|
||||
"form.prefs.label.keyboard_shortcuts": "Abilita le scorciatoie da tastiera",
|
||||
"form.prefs.label.custom_css": "CSS personalizzati",
|
||||
"form.import.label.file": "File OPML",
|
||||
"form.import.label.url": "URL",
|
||||
"form.integration.fever_activate": "Abilita l'API di Fever",
|
||||
|
|
|
@ -254,6 +254,7 @@
|
|||
"form.prefs.select.older_first": "古い記事を最初に",
|
||||
"form.prefs.select.recent_first": "新しい記事を最初に",
|
||||
"form.prefs.label.keyboard_shortcuts": "キーボード・ショートカットを有効にする",
|
||||
"form.prefs.label.custom_css": "カスタムCSS",
|
||||
"form.import.label.file": "OPML ファイル",
|
||||
"form.import.label.url": "URL",
|
||||
"form.integration.fever_activate": "Fever API を有効にする",
|
||||
|
|
|
@ -254,6 +254,7 @@
|
|||
"form.prefs.select.older_first": "Oudere items eerst",
|
||||
"form.prefs.select.recent_first": "Recente items eerst",
|
||||
"form.prefs.label.keyboard_shortcuts": "Schakel sneltoetsen in",
|
||||
"form.prefs.label.custom_css": "Aangepaste CSS",
|
||||
"form.import.label.file": "OPML-bestand",
|
||||
"form.import.label.url": "URL",
|
||||
"form.integration.fever_activate": "Activeer Fever API",
|
||||
|
|
|
@ -256,6 +256,7 @@
|
|||
"form.prefs.select.older_first": "Najstarsze wpisy jako pierwsze",
|
||||
"form.prefs.label.keyboard_shortcuts": "Włącz skróty klawiaturowe",
|
||||
"form.prefs.select.recent_first": "Najnowsze wpisy jako pierwsze",
|
||||
"form.prefs.label.custom_css": "Niestandardowy CSS",
|
||||
"form.import.label.file": "Plik OPML",
|
||||
"form.import.label.url": "URL",
|
||||
"form.integration.fever_activate": "Aktywuj Fever API",
|
||||
|
|
|
@ -256,6 +256,7 @@
|
|||
"form.prefs.select.older_first": "Сначала старые записи",
|
||||
"form.prefs.select.recent_first": "Сначала последние записи",
|
||||
"form.prefs.label.keyboard_shortcuts": "Включить сочетания клавиш",
|
||||
"form.prefs.label.custom_css": "Пользовательские CSS",
|
||||
"form.import.label.file": "OPML файл",
|
||||
"form.import.label.url": "URL",
|
||||
"form.integration.fever_activate": "Активировать Fever API",
|
||||
|
|
|
@ -252,6 +252,7 @@
|
|||
"form.prefs.select.older_first": "旧->新",
|
||||
"form.prefs.select.recent_first": "新->旧",
|
||||
"form.prefs.label.keyboard_shortcuts": "启用键盘快捷键",
|
||||
"form.prefs.label.custom_css": "自定义CSS",
|
||||
"form.import.label.file": "OPML 文件",
|
||||
"form.import.label.url": "URL",
|
||||
"form.integration.fever_activate": "启用 Fever API",
|
||||
|
|
|
@ -172,6 +172,11 @@ func (s *Storage) UpdateUser(user *model.User) error {
|
|||
if err != nil {
|
||||
return fmt.Errorf(`store: unable to update user: %v`, err)
|
||||
}
|
||||
|
||||
err = s.UpdateExtraField(user.ID, "custom_css", user.Extra["custom_css"])
|
||||
if err != nil {
|
||||
return fmt.Errorf(`store: unable to update user css: %v`, err)
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
@ -302,6 +302,9 @@ SOFTWARE.
|
|||
|
||||
<meta name="theme-color" content="{{ theme_color .theme }}">
|
||||
<link rel="stylesheet" type="text/css" href="{{ route "stylesheet" "name" .theme }}?{{ .theme_checksum }}">
|
||||
{{ if .user }} {{ if ne (index .user.Extra "custom_css") ("") }}
|
||||
<link rel="stylesheet" type="text/css" href="{{ route "stylesheet" "name" "custom_css" }}">
|
||||
{{ end }}{{ end }}
|
||||
|
||||
<script type="text/javascript" src="{{ route "javascript" "name" "app" }}?{{ .app_js_checksum }}" defer></script>
|
||||
<script type="text/javascript" src="{{ route "javascript" "name" "sw" }}?{{ .sw_js_checksum }}" defer id="service-worker-script"></script>
|
||||
|
@ -474,7 +477,7 @@ var templateCommonMapChecksums = map[string]string{
|
|||
"feed_menu": "318d8662dda5ca9dfc75b909c8461e79c86fb5082df1428f67aaf856f19f4b50",
|
||||
"icons": "f0d94c2cfa6655b44adaf97f0b95c52a9cff5c31f3a8829ad438e4db7114af7e",
|
||||
"item_meta": "a5b07cc6597e5c8f3ca849ee486acb3f16f062d8a1eaa47d2fb402ae6825b7ef",
|
||||
"layout": "a1f67b8908745ee4f9cee6f7bbbb0b242d4dcc101207ad4a9d67242b45683299",
|
||||
"layout": "a4ed0b69bf16342166358ca9c3cf23c27d61443eca2e5da9fa46ff7474afe55b",
|
||||
"pagination": "7b61288e86283c4cf0dc83bcbf8bf1c00c7cb29e60201c8c0b633b2450d2911f",
|
||||
"settings_menu": "e2b777630c0efdbc529800303c01d6744ed3af80ec505ac5a5b3f99c9b989156",
|
||||
}
|
||||
|
|
|
@ -35,6 +35,9 @@
|
|||
|
||||
<meta name="theme-color" content="{{ theme_color .theme }}">
|
||||
<link rel="stylesheet" type="text/css" href="{{ route "stylesheet" "name" .theme }}?{{ .theme_checksum }}">
|
||||
{{ if .user }} {{ if ne (index .user.Extra "custom_css") ("") }}
|
||||
<link rel="stylesheet" type="text/css" href="{{ route "stylesheet" "name" "custom_css" }}">
|
||||
{{ end }}{{ end }}
|
||||
|
||||
<script type="text/javascript" src="{{ route "javascript" "name" "app" }}?{{ .app_js_checksum }}" defer></script>
|
||||
<script type="text/javascript" src="{{ route "javascript" "name" "sw" }}?{{ .sw_js_checksum }}" defer id="service-worker-script"></script>
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
|
||||
<label><input type="checkbox" name="keyboard_shortcuts" value="1" {{ if .form.KeyboardShortcuts }}checked{{ end }}> {{ t "form.prefs.label.keyboard_shortcuts" }}</label>
|
||||
|
||||
<label>{{t "form.prefs.label.custom_css" }}</label><textarea name="custom_css" cols="40" rows="5">{{ .form.CustomCSS }}</textarea>
|
||||
<div class="buttons">
|
||||
<button type="submit" class="button button-primary" data-label-loading="{{ t "form.submit.saving" }}">{{ t "action.update" }}</button>
|
||||
</div>
|
||||
|
|
|
@ -1310,6 +1310,7 @@ var templateViewsMap = map[string]string{
|
|||
|
||||
<label><input type="checkbox" name="keyboard_shortcuts" value="1" {{ if .form.KeyboardShortcuts }}checked{{ end }}> {{ t "form.prefs.label.keyboard_shortcuts" }}</label>
|
||||
|
||||
<label>{{t "form.prefs.label.custom_css" }}</label><textarea name="custom_css" cols="40" rows="5">{{ .form.CustomCSS }}</textarea>
|
||||
<div class="buttons">
|
||||
<button type="submit" class="button button-primary" data-label-loading="{{ t "form.submit.saving" }}">{{ t "action.update" }}</button>
|
||||
</div>
|
||||
|
@ -1552,7 +1553,7 @@ var templateViewsMapChecksums = map[string]string{
|
|||
"login": "79ff2ca488c0a19b37c8fa227a21f73e94472eb357a51a077197c852f7713f11",
|
||||
"search_entries": "274950d03298c24f3942e209c0faed580a6d57be9cf76a6c236175a7e766ac6a",
|
||||
"sessions": "5d5c677bddbd027e0b0c9f7a0dd95b66d9d95b4e130959f31fb955b926c2201c",
|
||||
"settings": "d949ecdd28a33eadafaa3a727e548b3466c5aa44b0a4bbf86cc49784704ff7f6",
|
||||
"settings": "3ab566c3220c62edc3edc51f2e93c1101b728e9f62f52f23de6bc6322d86aeb6",
|
||||
"shared_entries": "19caea053664220bb9519df295eb2a17cf5836eaa9104b7ee24c60b88bb524e9",
|
||||
"unread_entries": "e38f7ffce17dfad3151b08cd33771a2cefe8ca9db42df04fc98bd1d675dd6075",
|
||||
"users": "d7ff52efc582bbad10504f4a04fa3adcc12d15890e45dff51cac281e0c446e45",
|
||||
|
|
|
@ -21,6 +21,7 @@ type SettingsForm struct {
|
|||
Timezone string
|
||||
EntryDirection string
|
||||
KeyboardShortcuts bool
|
||||
CustomCSS string
|
||||
}
|
||||
|
||||
// Merge updates the fields of the given user.
|
||||
|
@ -31,6 +32,7 @@ func (s *SettingsForm) Merge(user *model.User) *model.User {
|
|||
user.Timezone = s.Timezone
|
||||
user.EntryDirection = s.EntryDirection
|
||||
user.KeyboardShortcuts = s.KeyboardShortcuts
|
||||
user.Extra["custom_css"] = s.CustomCSS
|
||||
|
||||
if s.Password != "" {
|
||||
user.Password = s.Password
|
||||
|
@ -74,5 +76,6 @@ func NewSettingsForm(r *http.Request) *SettingsForm {
|
|||
Timezone: r.FormValue("timezone"),
|
||||
EntryDirection: r.FormValue("entry_direction"),
|
||||
KeyboardShortcuts: r.FormValue("keyboard_shortcuts") == "1",
|
||||
CustomCSS: r.FormValue("custom_css"),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ func (h *handler) showSettingsPage(w http.ResponseWriter, r *http.Request) {
|
|||
Timezone: user.Timezone,
|
||||
EntryDirection: user.EntryDirection,
|
||||
KeyboardShortcuts: user.KeyboardShortcuts,
|
||||
CustomCSS: user.Extra["custom_css"],
|
||||
}
|
||||
|
||||
timezones, err := h.store.Timezones()
|
||||
|
|
|
@ -16,6 +16,24 @@ import (
|
|||
|
||||
func (h *handler) showStylesheet(w http.ResponseWriter, r *http.Request) {
|
||||
filename := request.RouteStringParam(r, "name")
|
||||
if filename == "custom_css" {
|
||||
user, err := h.store.UserByID(request.UserID(r))
|
||||
if err != nil {
|
||||
html.NotFound(w, r)
|
||||
return
|
||||
}
|
||||
b := response.New(w, r)
|
||||
if user == nil {
|
||||
b.WithHeader("Content-Type", "text/css; charset=utf-8")
|
||||
b.WithBody("")
|
||||
b.Write()
|
||||
return
|
||||
}
|
||||
b.WithHeader("Content-Type", "text/css; charset=utf-8")
|
||||
b.WithBody(user.Extra["custom_css"])
|
||||
b.Write()
|
||||
return
|
||||
}
|
||||
etag, found := static.StylesheetsChecksums[filename]
|
||||
if !found {
|
||||
html.NotFound(w, r)
|
||||
|
|
Loading…
Reference in a new issue