/", consumers.LiveEventConsumer.as_asgi()),
+ path(r"api/ws/script/", consumers.ExecuteScriptConsumer.as_asgi()),
]
diff --git a/backend/clubs/utils.py b/backend/clubs/utils.py
index 5ccfc2f0f..70c208329 100644
--- a/backend/clubs/utils.py
+++ b/backend/clubs/utils.py
@@ -4,6 +4,7 @@
import bleach
import requests
+from bleach.css_sanitizer import CSSSanitizer
from bs4 import BeautifulSoup, Comment, NavigableString
from django.conf import settings
from django.core.files.images import ImageFile
@@ -128,6 +129,15 @@ def clean(text):
"""
Uses bleach to sanitize HTML input with a larger group of exceptions.
"""
+ css_sanitizer = CSSSanitizer(
+ allowed_css_properties=[
+ "color",
+ "background-color",
+ "text-align",
+ "font-size",
+ "font-family",
+ ]
+ )
return bleach.clean(
text,
tags=bleach.sanitizer.ALLOWED_TAGS
@@ -159,7 +169,7 @@ def clean(text):
**bleach.sanitizer.ALLOWED_ATTRIBUTES,
**{"*": ["style"], "img": ["src", "alt"], "iframe": allow_iframe},
},
- styles=["color", "background-color", "text-align", "font-size", "font-family"],
+ css_sanitizer=css_sanitizer,
)
diff --git a/backend/clubs/views.py b/backend/clubs/views.py
index 7f368ec7c..e063f6635 100644
--- a/backend/clubs/views.py
+++ b/backend/clubs/views.py
@@ -45,7 +45,7 @@
from django.utils.text import slugify
from ics import Calendar as ICSCal
from ics import Event as ICSEvent
-from ics import parse as ICSParse
+from ics.grammar.parse import ContentLine as ICSParse
from options.models import Option
from rest_framework import filters, generics, parsers, serializers, status, viewsets
from rest_framework.decorators import action
@@ -3284,9 +3284,7 @@ def get(self, request, *args, **kwargs):
creator=f"{settings.BRANDING_SITE_NAME} ({settings.DOMAINS[0]})"
)
calendar.extra.append(
- ICSParse.ContentLine(
- name="X-WR-CALNAME", value=f"{settings.BRANDING_SITE_NAME} Events"
- )
+ ICSParse(name="X-WR-CALNAME", value=f"{settings.BRANDING_SITE_NAME} Events")
)
# only fetch events newer than the past month
@@ -4417,9 +4415,10 @@ def question_response(self, *args, **kwargs):
return Response(
{
"success": False,
- "detail": """You cannot submit to more than two committees for any particular club application.
- In case you'd like to change the committees you applied to,
- you can delete submissions on the submissions page""",
+ "detail": """You cannot submit to more than two committees for any
+ particular club application. In case you'd like to change the
+ committees you applied to, you can delete submissions on the
+ submissions page""",
}
)
submission = ApplicationSubmission.objects.create(
@@ -4849,10 +4848,11 @@ def perform_destroy(self, instance):
appears to have been deleted
"""
- instance.archived = True
- instance.archived_by = self.request.user
- instance.archived_on = timezone.now()
- instance.save()
+ ApplicationSubmission.objects.filter(
+ user=instance.user,
+ application=instance.application,
+ committee=instance.committee,
+ ).update(archived=True)
class ApplicationQuestionViewSet(viewsets.ModelViewSet):
diff --git a/backend/pennclubs/settings/base.py b/backend/pennclubs/settings/base.py
index 96ae167b3..ae20d0704 100644
--- a/backend/pennclubs/settings/base.py
+++ b/backend/pennclubs/settings/base.py
@@ -217,6 +217,7 @@
# Django Channels settings
+LANGUAGE_SESSION_KEY = "_language"
ASGI_APPLICATION = "pennclubs.routing.application"
diff --git a/backend/pennclubs/settings/development.py b/backend/pennclubs/settings/development.py
index b143b4cb9..39155088d 100644
--- a/backend/pennclubs/settings/development.py
+++ b/backend/pennclubs/settings/development.py
@@ -10,6 +10,9 @@
MIDDLEWARE = ["debug_toolbar.middleware.DebugToolbarMiddleware"] + MIDDLEWARE
INTERNAL_IPS = ["127.0.0.1"]
+# Trust frontend (http://localhost:3000) on development
+CSRF_TRUSTED_ORIGINS = ["http://**", "http://localhost:3000"]
+
# Allow http callback for DLA
os.environ["OAUTHLIB_INSECURE_TRANSPORT"] = "1"
diff --git a/backend/tests/clubs/test_views.py b/backend/tests/clubs/test_views.py
index ee0b6a6f4..7d6a9728d 100644
--- a/backend/tests/clubs/test_views.py
+++ b/backend/tests/clubs/test_views.py
@@ -1061,8 +1061,8 @@ def test_club_create_description_sanitize_good(self):
"""
Ensure that descriptions are properly sanitized.
"""
- test_good_string = """Here\'s some bold, italic, underline,
- and a link.
+ test_good_string = """Here\'s some bold, italic,
+ underline, and a link.
- One
- Two
diff --git a/frontend/yarn.lock b/frontend/yarn.lock
index 35ba28cda..0e30d19c3 100644
--- a/frontend/yarn.lock
+++ b/frontend/yarn.lock
@@ -4515,9 +4515,9 @@ camelize@^1.0.0:
integrity sha1-FkpUg+Yw+kMh5a8HAg5TGDGyYJs=
caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001125, caniuse-lite@^1.0.30001173, caniuse-lite@^1.0.30001179, caniuse-lite@^1.0.30001181:
- version "1.0.30001192"
- resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001192.tgz#b848ebc0ab230cf313d194a4775a30155d50ae40"
- integrity sha512-63OrUnwJj5T1rUmoyqYTdRWBqFFxZFlyZnRRjDR8NSUQFB6A+j/uBORU/SyJ5WzDLg4SPiZH40hQCBNdZ/jmAw==
+ version "1.0.30001390"
+ resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001390.tgz"
+ integrity sha512-sS4CaUM+/+vqQUlCvCJ2WtDlV81aWtHhqeEVkLokVJJa3ViN4zDxAGfq9R8i1m90uGHxo99cy10Od+lvn3hf0g==
capture-exit@^2.0.0:
version "2.0.0"