diff --git a/routes.py b/routes.py index 64091e6..239ecd5 100644 --- a/routes.py +++ b/routes.py @@ -108,12 +108,26 @@ def register_routes(app, ctx): MAX_WEBSITE_LENGTH = constants["MAX_WEBSITE_LENGTH"] MAX_LOCATION_LENGTH = constants["MAX_LOCATION_LENGTH"] MAX_CUSTOM_CSS_LENGTH = constants["MAX_CUSTOM_CSS_LENGTH"] + MAX_PROFILE_BADGE_LENGTH = constants["MAX_PROFILE_BADGE_LENGTH"] MAX_OWNED_TEAMS_PER_USER = constants["MAX_OWNED_TEAMS_PER_USER"] ROOM_VISIBILITIES = constants["ROOM_VISIBILITIES"] ROLES = constants["ROLES"] STATUSES = constants["STATUSES"] + PRIVATE_ACCESS_KEY = ctx["PRIVATE_ACCESS_KEY"] + + ROLES = constants["ROLES"] + STATUSES = constants["STATUSES"] + html_module = ctx["html"] + + def private_access_key_valid(candidate: object) -> bool: + configured = (PRIVATE_ACCESS_KEY or "").strip() + if not configured: + return True + if not isinstance(candidate, str): + return False + return candidate.strip() == configured def build_message_payload(row, user): return richer_message_payload(