diff options
author | Andrew Godwin | 2022-11-18 00:09:04 -0700 |
---|---|---|
committer | Andrew Godwin | 2022-11-18 00:09:04 -0700 |
commit | 1b44a253316a84f40070264ea8134c86d1223441 (patch) | |
tree | 2caa56d54a8e81f14649b826f9f3ef5a7c1326ae /core | |
parent | b3072c81ba73a16381366960841b6c294cc1fa6e (diff) | |
download | takahe-1b44a253316a84f40070264ea8134c86d1223441.tar.gz takahe-1b44a253316a84f40070264ea8134c86d1223441.tar.bz2 takahe-1b44a253316a84f40070264ea8134c86d1223441.zip |
Signup and invite tweaks
Diffstat (limited to 'core')
-rw-r--r-- | core/middleware.py | 17 | ||||
-rw-r--r-- | core/models/config.py | 4 |
2 files changed, 20 insertions, 1 deletions
diff --git a/core/middleware.py b/core/middleware.py index 8e95f06..fdb08a8 100644 --- a/core/middleware.py +++ b/core/middleware.py @@ -1,3 +1,6 @@ +from core.models import Config + + class AlwaysSecureMiddleware: """ Locks the request object as always being secure, for when it's behind @@ -11,3 +14,17 @@ class AlwaysSecureMiddleware: request.__class__.scheme = "https" response = self.get_response(request) return response + + +class ConfigLoadingMiddleware: + """ + Caches the system config every request + """ + + def __init__(self, get_response): + self.get_response = get_response + + def __call__(self, request): + Config.system = Config.load_system() + response = self.get_response(request) + return response diff --git a/core/models/config.py b/core/models/config.py index 4ba8375..2a27d2e 100644 --- a/core/models/config.py +++ b/core/models/config.py @@ -160,7 +160,9 @@ class Config(models.Model): site_icon: UploadedImage = static("img/icon-128.png") site_banner: UploadedImage = static("img/fjords-banner-600.jpg") - allow_signups: bool = False + signup_allowed: bool = False + signup_invite_only: bool = False + signup_text: str = "" post_length: int = 500 identity_max_per_user: int = 5 |