hide comment area when not authenticated, outlaw more usernames

This commit is contained in:
Yusur 2025-07-14 14:47:02 +02:00
parent b0c815ea0a
commit 2214863496
5 changed files with 22 additions and 6 deletions

View file

@ -66,10 +66,19 @@ REPORT_UPDATE_ON_HOLD = 3
USERNAME_RE = r'[a-z2-9_-][a-z0-9_-]+' USERNAME_RE = r'[a-z2-9_-][a-z0-9_-]+'
ILLEGAL_USERNAMES = ( ILLEGAL_USERNAMES = (
## reserved for masspings and administrative claims ## masspings and administrative claims
'me', 'everyone', 'here', 'admin', 'mod', 'modteam', 'moderator', 'sysop', 'room', 'all', 'any', 'nobody', 'deleted', 'suspended', 'owner', 'administrator', 'ai', 'me', 'everyone', 'here', 'room', 'all', 'any', 'founder', 'owner',
'admin', 'administrator', 'mod', 'modteam', 'moderator', 'sysop', 'server', 'app'
## fictitious users and automations
'nobody', 'deleted', 'suspended', 'default', 'bot', 'developer', 'undefined', 'null',
'ai', 'automod', 'automoderator', 'assistant', 'privacy', 'anonymous', 'removed'
## law enforcement corps and slurs because yes ## law enforcement corps and slurs because yes
'pedo', 'rape', 'rapist', 'nigger', 'retard', 'ncmec', 'police', 'cops', '911', 'childsafety', 'report', 'dmca' 'pedo', 'rape', 'rapist', 'nigger', 'retard', 'ncmec', 'police', 'cops', '911', 'childsafety',
'report', 'dmca', 'login', 'logout', 'security', 'order66', 'gestapo', 'ss', 'hitler',
'pedophile', 'lolicon', 'giphy', 'tenor', 'csam', 'cp', 'pedobear', 'lolita',
'loli', 'kkk', 'pnf', 'adl', 'cop', 'tranny', 'google', 'trustandsafety', 'safety', 'ice',
## VVVVIP
'potus', 'realdonaldtrump', 'elonmusk', 'teddysphotos', 'mrbeast', 'jkrowling'
) )
def username_is_legal(username: str) -> bool: def username_is_legal(username: str) -> bool:

View file

@ -1,7 +1,8 @@
{% extends "base.html" %} {% extends "base.html" %}
{% from "macros/title.html" import title_tag with context %}
{% block title %} {% block title %}
<title>X _ X; on {{ app_name }}</title> <title>{{ title_tag('X _ X') }}</title>
{% endblock %} {% endblock %}
{% block body %} {% block body %}

View file

@ -1,7 +1,8 @@
{% extends "base.html" %} {% extends "base.html" %}
{% from "macros/title.html" import title_tag with context %}
{% block title %} {% block title %}
<title>O _ O; on {{ app_name }}</title> <title>{{ title_tag('O _ O') }}</title>
{% endblock %} {% endblock %}
{% block body %} {% block body %}

View file

@ -1,7 +1,8 @@
{% extends "base.html" %} {% extends "base.html" %}
{% from "macros/title.html" import title_tag with context %}
{% block title %} {% block title %}
<title>O _ O; on {{ app_name }}</title> <title>{{ title_tag('O _ O') }}</title>
{% endblock %} {% endblock %}
{% block body %} {% block body %}

View file

@ -23,6 +23,7 @@ disabled=""
{% endmacro %} {% endmacro %}
{% macro comment_area(url) %} {% macro comment_area(url) %}
{% if current_user.is_authenticated %}
<form id="comment-area" class="boundaryless" action="{{ url }}" method="POST" enctype="multipart/form-data"> <form id="comment-area" class="boundaryless" action="{{ url }}" method="POST" enctype="multipart/form-data">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" /> <input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
<input type="hidden" name="reply_to" value="" /> <input type="hidden" name="reply_to" value="" />
@ -34,4 +35,7 @@ disabled=""
<button type="submit" class="primary">Publish</button> <button type="submit" class="primary">Publish</button>
</div> </div>
</form> </form>
{% else %}
<div class="centered"><a href="/login">Log in</a> to leave a comment</div>
{% endif %}
{% endmacro %} {% endmacro %}