From b2d457c0281e82568357f75e8464580ca9bea39e Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Sat, 10 Dec 2022 20:30:15 +0200 Subject: [PATCH] increase css limit from 4000 to 10000 --- files/helpers/const.py | 1 + files/routes/settings.py | 4 ++-- files/templates/settings/css.html | 8 ++++---- migrations/20221210-increase-css-limit.sql | 2 ++ schema.sql | 5 ++--- 5 files changed, 11 insertions(+), 9 deletions(-) create mode 100644 migrations/20221210-increase-css-limit.sql diff --git a/files/helpers/const.py b/files/helpers/const.py index ff2e0cf74..093f8b07a 100644 --- a/files/helpers/const.py +++ b/files/helpers/const.py @@ -390,6 +390,7 @@ POST_BODY_LENGTH_LIMIT = 20000 # do not make larger than 20000 without altering POST_BODY_HTML_LENGTH_LIMIT = 40000 # do not make larger than 40000 without altering the table COMMENT_BODY_LENGTH_LIMIT = 10000 # do not make larger than 10000 characters without altering the table COMMENT_BODY_HTML_LENGTH_LIMIT = 20000 # do not make larger than 20000 characters without altering the table +CSS_LENGTH_LIMIT = 10000 # do not make larger than 20000 characters without altering the table COMMENT_MAX_DEPTH = 200 TRANSFER_MESSAGE_LENGTH_LIMIT = 200 # do not make larger than 10000 characters (comment limit) without altering the table MIN_REPOST_CHECK_URL_LENGTH = 9 # also change the constant in checkRepost() of submit.js diff --git a/files/routes/settings.py b/files/routes/settings.py index 6ccf86b5c..9867a118e 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -599,7 +599,7 @@ def settings_css_get(v:User): @ratelimit_user() def settings_css(v): if v.agendaposter: abort(400, "Agendapostered users can't edit CSS!") - css = request.values.get("css", v.css).strip().replace('\\', '').strip()[:4000] + css = request.values.get("css", v.css).strip().replace('\\', '').strip()[:CSS_LENGTH_LIMIT] if '
- - Limit of 4000 characters + + Limit of {{CSS_LENGTH_LIMIT}} characters
@@ -29,8 +29,8 @@
- - Limit of 4000 characters + + Limit of {{CSS_LENGTH_LIMIT}} characters
diff --git a/migrations/20221210-increase-css-limit.sql b/migrations/20221210-increase-css-limit.sql new file mode 100644 index 000000000..7aae843b0 --- /dev/null +++ b/migrations/20221210-increase-css-limit.sql @@ -0,0 +1,2 @@ +alter table users alter column css type varchar(10000); +alter table users alter column profilecss type varchar(10000); diff --git a/schema.sql b/schema.sql index c9e6bfc07..02dbf67e9 100644 --- a/schema.sql +++ b/schema.sql @@ -973,8 +973,8 @@ CREATE TABLE public.users ( newtabexternal boolean DEFAULT true NOT NULL, customtitleplain character varying(100), themecolor character varying(6) NOT NULL, - css character varying(4000), - profilecss character varying(4000), + css character varying(10000), + profilecss character varying(10000), coins integer DEFAULT 0 NOT NULL, agendaposter integer DEFAULT 0 NOT NULL, post_count integer DEFAULT 0 NOT NULL, @@ -2737,4 +2737,3 @@ ALTER TABLE ONLY public.comments -- -- PostgreSQL database dump complete -- -