aboutsummaryrefslogtreecommitdiff
path: root/internal/ui/form/settings.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/ui/form/settings.go')
-rw-r--r--internal/ui/form/settings.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/internal/ui/form/settings.go b/internal/ui/form/settings.go
index cf18bd2e..1b9e48dd 100644
--- a/internal/ui/form/settings.go
+++ b/internal/ui/form/settings.go
@@ -10,6 +10,7 @@ import (
"miniflux.app/v2/internal/config"
"miniflux.app/v2/internal/locale"
"miniflux.app/v2/internal/model"
+ "miniflux.app/v2/internal/validator"
)
// MarkReadBehavior list all possible behaviors for automatically marking an entry as read
@@ -37,6 +38,7 @@ type SettingsForm struct {
ShowReadingTime bool
CustomCSS string
CustomJS string
+ ExternalFontHosts string
EntrySwipe bool
GestureNav string
DisplayMode string
@@ -101,6 +103,7 @@ func (s *SettingsForm) Merge(user *model.User) *model.User {
user.ShowReadingTime = s.ShowReadingTime
user.Stylesheet = s.CustomCSS
user.CustomJS = s.CustomJS
+ user.ExternalFontHosts = s.ExternalFontHosts
user.EntrySwipe = s.EntrySwipe
user.GestureNav = s.GestureNav
user.DisplayMode = s.DisplayMode
@@ -148,6 +151,12 @@ func (s *SettingsForm) Validate() *locale.LocalizedError {
return locale.NewLocalizedError("error.settings_media_playback_rate_range")
}
+ if s.ExternalFontHosts != "" {
+ if !validator.IsValidDomainList(s.ExternalFontHosts) {
+ return locale.NewLocalizedError("error.settings_invalid_domain_list")
+ }
+ }
+
return nil
}
@@ -183,6 +192,7 @@ func NewSettingsForm(r *http.Request) *SettingsForm {
ShowReadingTime: r.FormValue("show_reading_time") == "1",
CustomCSS: r.FormValue("custom_css"),
CustomJS: r.FormValue("custom_js"),
+ ExternalFontHosts: r.FormValue("external_font_hosts"),
EntrySwipe: r.FormValue("entry_swipe") == "1",
GestureNav: r.FormValue("gesture_nav"),
DisplayMode: r.FormValue("display_mode"),