summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/middleware.py17
-rw-r--r--core/models/config.py4
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