limit chat on rdrama to jannoids
parent
ca4ffdb91a
commit
d30d6b8314
|
@ -6516,3 +6516,7 @@ div.markdown {
|
|||
background-color: var(--gray-600);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#root > div.App {
|
||||
background-color: rgb(var(--background));
|
||||
}
|
||||
|
|
|
@ -379,6 +379,7 @@ PERMS = { # Minimum admin_level to perform action.
|
|||
'ADMIN_ACTIONS_REVERT': 3,
|
||||
'ADMIN_MOP_VISIBLE': 2,
|
||||
'ADMIN_HOME_VISIBLE': 2,
|
||||
'CHAT': 0,
|
||||
'CHAT_BYPASS_MUTE': 2,
|
||||
'DOMAINS_BAN': 3,
|
||||
'HOLE_CREATE': 0,
|
||||
|
@ -656,6 +657,7 @@ if SITE == 'rdrama.net':
|
|||
FEATURES['USERS_PERMANENT_WORD_FILTERS'] = True
|
||||
FEATURES['ASSET_SUBMISSIONS'] = True
|
||||
PERMS['ADMIN_ADD'] = 4
|
||||
PERMS['CHAT'] = 3
|
||||
|
||||
SIDEBAR_THREAD = 37696
|
||||
BANNER_THREAD = 37697
|
||||
|
|
|
@ -37,7 +37,7 @@ socket_ids_to_user_ids = {}
|
|||
user_ids_to_socket_ids = {}
|
||||
|
||||
@app.get("/chat")
|
||||
@is_not_permabanned
|
||||
@admin_level_required(PERMS['CHAT'])
|
||||
def chat(v):
|
||||
if TRUESCORE_CHAT_MINIMUM and v.truescore < TRUESCORE_CHAT_MINIMUM:
|
||||
abort(403, f"Need at least {TRUESCORE_CHAT_MINIMUM} truescore for access to chat.")
|
||||
|
@ -46,7 +46,7 @@ def chat(v):
|
|||
|
||||
@socketio.on('speak')
|
||||
@limiter.limit("3/second;10/minute")
|
||||
@is_not_permabanned
|
||||
@admin_level_required(PERMS['CHAT'])
|
||||
@ratelimit_user("3/second;10/minute")
|
||||
def speak(data, v):
|
||||
limiter.check()
|
||||
|
@ -107,7 +107,7 @@ def speak(data, v):
|
|||
return '', 204
|
||||
|
||||
@socketio.on('connect')
|
||||
@is_not_permabanned
|
||||
@admin_level_required(PERMS['CHAT'])
|
||||
def connect(v):
|
||||
if v.username not in online:
|
||||
online.append(v.username)
|
||||
|
@ -124,7 +124,7 @@ def connect(v):
|
|||
return '', 204
|
||||
|
||||
@socketio.on('disconnect')
|
||||
@is_not_permabanned
|
||||
@admin_level_required(PERMS['CHAT'])
|
||||
def disconnect(v):
|
||||
if v.username in online:
|
||||
online.remove(v.username)
|
||||
|
@ -141,7 +141,7 @@ def disconnect(v):
|
|||
return '', 204
|
||||
|
||||
@socketio.on('typing')
|
||||
@is_not_permabanned
|
||||
@admin_level_required(PERMS['CHAT'])
|
||||
def typing_indicator(data, v):
|
||||
|
||||
if data and v.username not in typing: typing.append(v.username)
|
||||
|
|
|
@ -112,9 +112,9 @@ def admin_level_required(x):
|
|||
def wrapper(*args, **kwargs):
|
||||
v = get_logged_in_user()
|
||||
if not v: abort(401)
|
||||
if v.admin_level < x: abort(403)
|
||||
if x and not IS_LOCALHOST and not v.mfa_secret:
|
||||
abort(403, "You need to enable 2FA to use admin features!")
|
||||
if v.admin_level < x: abort(403)
|
||||
return make_response(f(*args, v=v, **kwargs))
|
||||
|
||||
wrapper.__name__ = f.__name__
|
||||
|
|
Loading…
Reference in New Issue