aboutsummaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
Diffstat (limited to 'service')
-rw-r--r--service/service.go4
-rw-r--r--service/transport.go2
2 files changed, 6 insertions, 0 deletions
diff --git a/service/service.go b/service/service.go
index a29345e..5d80c28 100644
--- a/service/service.go
+++ b/service/service.go
@@ -64,6 +64,7 @@ func (s *service) authenticate(c *client, sid string, csrf string, ref string, t
CSRFToken: c.s.CSRFToken,
UserID: c.s.UserID,
AntiDopamineMode: sett.AntiDopamineMode,
+ UserCSS: sett.CSS,
Referrer: ref,
}
}()
@@ -888,6 +889,9 @@ func (s *service) SaveSettings(c *client, settings *model.Settings) (err error)
default:
return errInvalidArgument
}
+ if len(settings.CSS) > 1<<20 {
+ return errInvalidArgument
+ }
sess, err := s.sessionRepo.Get(c.s.ID)
if err != nil {
return
diff --git a/service/transport.go b/service/transport.go
index 50bf9be..f448cc3 100644
--- a/service/transport.go
+++ b/service/transport.go
@@ -463,6 +463,7 @@ func NewHandler(s *service, logger *log.Logger, staticDir string) http.Handler {
fluorideMode := c.r.FormValue("fluoride_mode") == "true"
darkMode := c.r.FormValue("dark_mode") == "true"
antiDopamineMode := c.r.FormValue("anti_dopamine_mode") == "true"
+ css := c.r.FormValue("css")
settings := &model.Settings{
DefaultVisibility: visibility,
@@ -475,6 +476,7 @@ func NewHandler(s *service, logger *log.Logger, staticDir string) http.Handler {
FluorideMode: fluorideMode,
DarkMode: darkMode,
AntiDopamineMode: antiDopamineMode,
+ CSS: css,
}
err := s.SaveSettings(c, settings)