Compare commits
3 Commits
f8691df4e3
...
7a62c3fc4a
Author | SHA1 | Date |
---|---|---|
Aevann | 7a62c3fc4a | |
Aevann | 337e243e9f | |
Aevann | ae7a4ffa7c |
|
@ -392,7 +392,10 @@ class User(Base):
|
||||||
user_forced_hats = []
|
user_forced_hats = []
|
||||||
for k, val in forced_hats.items():
|
for k, val in forced_hats.items():
|
||||||
if getattr(self, k) and getattr(self, k) > 1:
|
if getattr(self, k) and getattr(self, k) > 1:
|
||||||
user_forced_hats.append(val)
|
if isinstance(val[0], tuple):
|
||||||
|
user_forced_hats.append(random.choice(val))
|
||||||
|
else:
|
||||||
|
user_forced_hats.append(val)
|
||||||
if user_forced_hats: return random.choice(user_forced_hats)
|
if user_forced_hats: return random.choice(user_forced_hats)
|
||||||
else: return None
|
else: return None
|
||||||
|
|
||||||
|
@ -1088,7 +1091,7 @@ class User(Base):
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
def json(self):
|
def json(self):
|
||||||
if self.is_banned:
|
if self.is_suspended:
|
||||||
return {'username': self.username,
|
return {'username': self.username,
|
||||||
'original_username': self.original_username,
|
'original_username': self.original_username,
|
||||||
'url': self.url,
|
'url': self.url,
|
||||||
|
@ -1135,6 +1138,12 @@ class User(Base):
|
||||||
self.ban_reason = reason
|
self.ban_reason = reason
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@property
|
||||||
|
@lazy
|
||||||
|
def is_suspended(self):
|
||||||
|
return (self.is_banned and (not self.unban_utc or self.unban_utc > time.time()))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@lazy
|
@lazy
|
||||||
def is_permabanned(self):
|
def is_permabanned(self):
|
||||||
|
|
|
@ -985,9 +985,31 @@ forced_hats = {
|
||||||
"sharpen": ("Bane Mask", "No one understands..."),
|
"sharpen": ("Bane Mask", "No one understands..."),
|
||||||
"earlylife": ("The Merchant", "SHUT IT DOWN, the goys know!"),
|
"earlylife": ("The Merchant", "SHUT IT DOWN, the goys know!"),
|
||||||
"marsify": ("Marsified", "I can't pick my own Marseys, help!"),
|
"marsify": ("Marsified", "I can't pick my own Marseys, help!"),
|
||||||
"is_banned": ("Behind Bars", "This user is banned and needs to do better!"),
|
"is_suspended": ("Behind Bars", "This user is banned and needs to do better!"),
|
||||||
"chud": ("Egg_irl", "This user is getting in touch with xir identity!"),
|
"chud": (
|
||||||
"queen": ("Flower Crown I", "This user is getting in touch with her feminine side 🥰"),
|
("Egg_irl", "This user is getting in touch with xir identity!"),
|
||||||
|
("Trans Flag", "Just in case you forgot, trans lives matter."),
|
||||||
|
("Trans Flag II", "Your egg is cracked; wear it with pride!"),
|
||||||
|
("Pride Flag", "Never forget that this is a primarily gay community. Dude bussy lmao."),
|
||||||
|
("Pride Flag II", "This user is a proud supporter of LGBTQ+ rights."),
|
||||||
|
),
|
||||||
|
"queen": (
|
||||||
|
("Flower Crown I", "This user is getting in touch with her feminine side 🥰"),
|
||||||
|
("Flower Crown II", "This user is getting in touch with her feminine side 🥰"),
|
||||||
|
("Flower Crown III", "This user is getting in touch with her feminine side 🥰"),
|
||||||
|
("Flower Crown IV", "This user is getting in touch with her feminine side 🥰"),
|
||||||
|
("Flower Crown V", "This user is getting in touch with her feminine side 🥰"),
|
||||||
|
("Flower Crown VI", "This user is getting in touch with her feminine side 🥰"),
|
||||||
|
("Flower Crown VII", "This user is getting in touch with her feminine side 🥰"),
|
||||||
|
("Flower Crown VIII", "This user is getting in touch with her feminine side 🥰"),
|
||||||
|
("Flower Crown IX", "This user is getting in touch with her feminine side 🥰"),
|
||||||
|
("Flower Crown X", "This user is getting in touch with her feminine side 🥰"),
|
||||||
|
("Flower Crown XI", "This user is getting in touch with her feminine side 🥰"),
|
||||||
|
("Flower Crown XII", "This user is getting in touch with her feminine side 🥰"),
|
||||||
|
("Flower Crown XIII", "This user is getting in touch with her feminine side 🥰"),
|
||||||
|
("Flower Crown XIV", "This user is getting in touch with her feminine side 🥰"),
|
||||||
|
("Emoji Crown (hearts and shooting stars)", "This user is getting in touch with her feminine side 🥰")
|
||||||
|
),
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -364,13 +364,13 @@ def award_thing(v, thing_type, id):
|
||||||
if not emoji:
|
if not emoji:
|
||||||
abort(404, f'an Emoji with the name "{award.note}" was not found!')
|
abort(404, f'an Emoji with the name "{award.note}" was not found!')
|
||||||
elif kind == "ban":
|
elif kind == "ban":
|
||||||
if not author.is_banned:
|
if not author.is_suspended:
|
||||||
author.ban(reason=ban_reason, days=quantity)
|
author.ban(reason=ban_reason, days=quantity)
|
||||||
elif author.unban_utc:
|
elif author.unban_utc:
|
||||||
author.unban_utc += 86400 * quantity
|
author.unban_utc += 86400 * quantity
|
||||||
send_repeatable_notification(author.id, f"Your account has been banned for **{quantity} day{s}** for {obj.textlink}. It sucked and you should feel bad.")
|
send_repeatable_notification(author.id, f"Your account has been banned for **{quantity} day{s}** for {obj.textlink}. It sucked and you should feel bad.")
|
||||||
elif kind == "unban":
|
elif kind == "unban":
|
||||||
if not author.is_banned or not author.unban_utc:
|
if not author.is_suspended or not author.unban_utc:
|
||||||
abort(403)
|
abort(403)
|
||||||
|
|
||||||
if not author.ban_reason.startswith('Ban award'):
|
if not author.ban_reason.startswith('Ban award'):
|
||||||
|
|
|
@ -58,7 +58,7 @@ def refresh_chat(chat_id):
|
||||||
@socketio.on('speak')
|
@socketio.on('speak')
|
||||||
@auth_required_socketio
|
@auth_required_socketio
|
||||||
def speak(data, v):
|
def speak(data, v):
|
||||||
if v.is_banned: return ''
|
if v.is_suspended: return ''
|
||||||
|
|
||||||
try: chat_id = int(data['chat_id'])
|
try: chat_id = int(data['chat_id'])
|
||||||
except: return ''
|
except: return ''
|
||||||
|
@ -270,7 +270,7 @@ def heartbeat(v):
|
||||||
@socketio.on('typing')
|
@socketio.on('typing')
|
||||||
@auth_required_socketio
|
@auth_required_socketio
|
||||||
def typing_indicator(data, v):
|
def typing_indicator(data, v):
|
||||||
if v.is_banned: return ''
|
if v.is_suspended: return ''
|
||||||
|
|
||||||
if not request.referrer: return ''
|
if not request.referrer: return ''
|
||||||
room = request.referrer
|
room = request.referrer
|
||||||
|
|
|
@ -461,7 +461,7 @@ def is_repost(v):
|
||||||
def submit_post(v, hole=None):
|
def submit_post(v, hole=None):
|
||||||
flag_draft = request.values.get("draft", False, bool)
|
flag_draft = request.values.get("draft", False, bool)
|
||||||
|
|
||||||
if v.is_permabanned or (v.is_banned and not flag_draft):
|
if v.is_permabanned or (v.is_suspended and not flag_draft):
|
||||||
abort(403, "You can't perform this action while banned!")
|
abort(403, "You can't perform this action while banned!")
|
||||||
|
|
||||||
url = request.values.get("url", "").strip()
|
url = request.values.get("url", "").strip()
|
||||||
|
|
|
@ -162,7 +162,7 @@ def is_not_banned(f):
|
||||||
v = get_logged_in_user()
|
v = get_logged_in_user()
|
||||||
if not v:
|
if not v:
|
||||||
abort(401, "You need to login to perform this action!")
|
abort(401, "You need to login to perform this action!")
|
||||||
if v.is_banned:
|
if v.is_suspended:
|
||||||
abort(403, "You can't perform this action while banned!")
|
abort(403, "You can't perform this action while banned!")
|
||||||
return make_response(f(*args, v=v, **kwargs))
|
return make_response(f(*args, v=v, **kwargs))
|
||||||
wrapper.__name__ = f.__name__
|
wrapper.__name__ = f.__name__
|
||||||
|
|
|
@ -504,7 +504,7 @@
|
||||||
{% if v.admin_level >= PERMS['USER_BAN'] and v.id != c.author_id %}
|
{% if v.admin_level >= PERMS['USER_BAN'] and v.id != c.author_id %}
|
||||||
<button type="button" class="{% if c.author.switched.is_permabanned %}d-none{% endif %} dropdown-item list-inline-item d-mob-none text-danger" data-bs-toggle="modal" data-bs-target="#banModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'ban', '/comment/{{c.id}}', '{{c.author_name_punish_modal}}', '{{c.fullname}}')"><i class="fas fa-user-slash text-danger fa-fw"></i>Ban user</button>
|
<button type="button" class="{% if c.author.switched.is_permabanned %}d-none{% endif %} dropdown-item list-inline-item d-mob-none text-danger" data-bs-toggle="modal" data-bs-target="#banModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'ban', '/comment/{{c.id}}', '{{c.author_name_punish_modal}}', '{{c.fullname}}')"><i class="fas fa-user-slash text-danger fa-fw"></i>Ban user</button>
|
||||||
|
|
||||||
<button type="button" id="unban-{{c.fullname}}" class="dropdown-item list-inline-item d-mob-none {% if not c.author.switched.is_banned %}d-none{% endif %} text-success" data-nonce="{{g.nonce}}" data-onclick="unchud_or_unban(this,'/unban_user/{{c.fullname}}')"><i class="fas fa-user-slash text-success fa-fw"></i>Unban user</button>
|
<button type="button" id="unban-{{c.fullname}}" class="dropdown-item list-inline-item d-mob-none {% if not c.author.switched.is_suspended %}d-none{% endif %} text-success" data-nonce="{{g.nonce}}" data-onclick="unchud_or_unban(this,'/unban_user/{{c.fullname}}')"><i class="fas fa-user-slash text-success fa-fw"></i>Unban user</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if v.admin_level >= PERMS['USER_CHUD'] and v.id != c.author_id %}
|
{% if v.admin_level >= PERMS['USER_CHUD'] and v.id != c.author_id %}
|
||||||
|
@ -736,7 +736,7 @@
|
||||||
|
|
||||||
{% if v.id != c.author_id and v.admin_level >= PERMS['USER_BAN'] %}
|
{% if v.id != c.author_id and v.admin_level >= PERMS['USER_BAN'] %}
|
||||||
<button type="button" class="list-group-item text-danger {% if c.author.switched.is_permabanned %}d-none{% endif %}" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#banModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'ban', '/comment/{{c.id}}', '{{c.author_name_punish_modal}}', '{{c.fullname}}')"><i class="fas fa-user-slash text-danger fa-fw mr-2"></i>Ban user</button>
|
<button type="button" class="list-group-item text-danger {% if c.author.switched.is_permabanned %}d-none{% endif %}" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#banModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'ban', '/comment/{{c.id}}', '{{c.author_name_punish_modal}}', '{{c.fullname}}')"><i class="fas fa-user-slash text-danger fa-fw mr-2"></i>Ban user</button>
|
||||||
<button type="button" id="unban2-{{c.fullname}}" class="{% if not c.author.switched.is_banned %}d-none{% endif %} list-group-item text-success" data-nonce="{{g.nonce}}" data-onclick="unchud_or_unban(this,'/unban_user/{{c.fullname}}')" data-bs-dismiss="modal"><i class="fas fa-user-minus fa-fw text-success mr-2"></i>Unban user</button>
|
<button type="button" id="unban2-{{c.fullname}}" class="{% if not c.author.switched.is_suspended %}d-none{% endif %} list-group-item text-success" data-nonce="{{g.nonce}}" data-onclick="unchud_or_unban(this,'/unban_user/{{c.fullname}}')" data-bs-dismiss="modal"><i class="fas fa-user-minus fa-fw text-success mr-2"></i>Unban user</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if v.id != c.author_id and v.admin_level >= PERMS['USER_CHUD'] %}
|
{% if v.id != c.author_id and v.admin_level >= PERMS['USER_CHUD'] %}
|
||||||
|
|
|
@ -113,7 +113,7 @@
|
||||||
{% if v.admin_level >= PERMS['USER_BAN'] and v.id != p.author_id %}
|
{% if v.admin_level >= PERMS['USER_BAN'] and v.id != p.author_id %}
|
||||||
<button type="button" class="dropdown-item list-inline-item text-danger {% if p.author.is_permabanned %}d-none{% endif %}" data-bs-toggle="modal" data-bs-target="#banModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'ban', '/post/{{p.id}}', '{{p.author_name_punish_modal}}', '{{p.fullname}}')"><i class="fas fa-user-slash text-danger fa-fw"></i>Ban user</button>
|
<button type="button" class="dropdown-item list-inline-item text-danger {% if p.author.is_permabanned %}d-none{% endif %}" data-bs-toggle="modal" data-bs-target="#banModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'ban', '/post/{{p.id}}', '{{p.author_name_punish_modal}}', '{{p.fullname}}')"><i class="fas fa-user-slash text-danger fa-fw"></i>Ban user</button>
|
||||||
|
|
||||||
<button type="button" id="unban-{{p.fullname}}" class="dropdown-item list-inline-item text-success {% if not p.author.is_banned %}d-none{% endif %}" id="unexile2-user-{{p.id}}" data-nonce="{{g.nonce}}" data-onclick="unchud_or_unban(this,'/unban_user/{{p.fullname}}')"><i class="fas fa-user-slash"></i>Unban user</button>
|
<button type="button" id="unban-{{p.fullname}}" class="dropdown-item list-inline-item text-success {% if not p.author.is_suspended %}d-none{% endif %}" id="unexile2-user-{{p.id}}" data-nonce="{{g.nonce}}" data-onclick="unchud_or_unban(this,'/unban_user/{{p.fullname}}')"><i class="fas fa-user-slash"></i>Unban user</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if v.admin_level >= PERMS['USER_CHUD'] and v.id != p.author_id %}
|
{% if v.admin_level >= PERMS['USER_CHUD'] and v.id != p.author_id %}
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
{% if v.id != p.author_id and v.admin_level >= PERMS['USER_BAN'] %}
|
{% if v.id != p.author_id and v.admin_level >= PERMS['USER_BAN'] %}
|
||||||
<button type="button" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#banModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'ban', '/post/{{p.id}}', '{{p.author_name_punish_modal}}', '{{p.fullname}}')" class="nobackground btn btn-link btn-block btn-lg text-danger text-left {% if p.author.is_permabanned %}d-none{% endif %}"><i class="fas fa-user-minus mr-2"></i>Ban user</button>
|
<button type="button" data-bs-dismiss="modal" data-bs-toggle="modal" data-bs-target="#banModal" data-nonce="{{g.nonce}}" data-onclick="punishModal(this, 'ban', '/post/{{p.id}}', '{{p.author_name_punish_modal}}', '{{p.fullname}}')" class="nobackground btn btn-link btn-block btn-lg text-danger text-left {% if p.author.is_permabanned %}d-none{% endif %}"><i class="fas fa-user-minus mr-2"></i>Ban user</button>
|
||||||
|
|
||||||
<button type="button" id="unban2-{{p.fullname}}" class="{% if not p.author.is_banned %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-success text-left" data-nonce="{{g.nonce}}" data-onclick="unchud_or_unban(this,'/unban_user/{{p.fullname}}')" data-bs-dismiss="modal"><i class="fas fa-user-minus mr-2"></i>Unban user</button>
|
<button type="button" id="unban2-{{p.fullname}}" class="{% if not p.author.is_suspended %}d-none{% endif %} nobackground btn btn-link btn-block btn-lg text-success text-left" data-nonce="{{g.nonce}}" data-onclick="unchud_or_unban(this,'/unban_user/{{p.fullname}}')" data-bs-dismiss="modal"><i class="fas fa-user-minus mr-2"></i>Unban user</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if v.id != p.author_id and v.admin_level >= PERMS['USER_CHUD'] %}
|
{% if v.id != p.author_id and v.admin_level >= PERMS['USER_CHUD'] %}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
(by {{u.chudder | safe}}) - {{u.unchud_string}}
|
(by {{u.chudder | safe}}) - {{u.unchud_string}}
|
||||||
</h5>
|
</h5>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if u.is_banned %}
|
{% if u.is_suspended %}
|
||||||
<h5 class="text-primary" id="profile-{{deviceType}}--banned">BANNED USER:
|
<h5 class="text-primary" id="profile-{{deviceType}}--banned">BANNED USER:
|
||||||
{{u.ban_reason | safe}}
|
{{u.ban_reason | safe}}
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@
|
||||||
<input autocomplete="off" id="user-ban-submit-{{deviceType}}" type="submit" class="btn btn-danger" value="Ban user" disabled>
|
<input autocomplete="off" id="user-ban-submit-{{deviceType}}" type="submit" class="btn btn-danger" value="Ban user" disabled>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<button type="button" id="unban-{{deviceType}}" class="mt-1 {% if not u.is_banned %}d-none{% endif %} btn btn-success" data-nonce="{{g.nonce}}" data-onclick="unchud_or_unban(this,'/unban_user/{{u.id}}')">Unban user</button>
|
<button type="button" id="unban-{{deviceType}}" class="mt-1 {% if not u.is_suspended %}d-none{% endif %} btn btn-success" data-nonce="{{g.nonce}}" data-onclick="unchud_or_unban(this,'/unban_user/{{u.id}}')">Unban user</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if v.admin_level >= PERMS['USER_SHADOWBAN'] %}
|
{% if v.admin_level >= PERMS['USER_SHADOWBAN'] %}
|
||||||
<form id="shadowban-{{deviceType}}" class="mt-3 {% if u.shadowbanned %}d-none{% endif %}" action="/shadowban/{{u.id}}" method="post" data-nonce="{{g.nonce}}" data-onsubmit="sendFormXHRSwitch(this)">
|
<form id="shadowban-{{deviceType}}" class="mt-3 {% if u.shadowbanned %}d-none{% endif %}" action="/shadowban/{{u.id}}" method="post" data-nonce="{{g.nonce}}" data-onsubmit="sendFormXHRSwitch(this)">
|
||||||
|
|
Loading…
Reference in New Issue