restore IGNORE_DOMAIN_BAN janny perm

master
Aevann 2023-06-02 16:48:58 +03:00
parent 498f77bcff
commit 27330e1d62
3 changed files with 20 additions and 17 deletions

View File

@ -504,6 +504,7 @@ PERMS = { # Minimum admin_level to perform action.
'MODS_EVERY_HOLE': 5,
'MODS_EVERY_GROUP': 5,
'IGNORE_AWARD_IMMUNITY': 5,
'IGNORE_DOMAIN_BAN': 5,
}
FEATURES = {

View File

@ -505,6 +505,17 @@ def sanitize(sanitized, golden=True, limit_pings=0, showmore=True, count_emojis=
links = soup.find_all("a")
def error(error):
if chat:
return error, 403
else:
abort(403, error)
if g.v and g.v.admin_level >= PERMS["IGNORE_DOMAIN_BAN"]:
banned_domains = []
else:
if discord_username_regex.match(sanitized):
return error("Stop grooming!")
banned_domains = [x.domain for x in g.db.query(BannedDomain.domain).all()]
for link in links:
@ -559,16 +570,6 @@ def sanitize(sanitized, golden=True, limit_pings=0, showmore=True, count_emojis=
sanitized = str(soup).replace('<html><body>','').replace('</body></html>','')
def error(error):
if chat:
return error, 403
else:
abort(403, error)
if discord_username_regex.match(sanitized):
return error("Stop grooming!")
if '<pre>' not in sanitized and blackjack != "rules":
sanitized = sanitized.replace('\n','')

View File

@ -525,6 +525,7 @@ def submit_post(v:User, sub=None):
if repost and FEATURES['REPOST_DETECTION'] and not v.admin_level >= PERMS['POST_BYPASS_REPOST_CHECKING']:
return {"post_id": repost.id, "success": False}
if v.admin_level < PERMS["IGNORE_DOMAIN_BAN"]:
y = tldextract.extract(url).registered_domain + parsed_url.path
y = y.lower()
banned_domains = g.db.query(BannedDomain).all()