forked from MarseyWorld/MarseyWorld
restore IGNORE_DOMAIN_BAN janny perm
parent
498f77bcff
commit
27330e1d62
|
@ -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 = {
|
||||
|
|
|
@ -505,7 +505,18 @@ def sanitize(sanitized, golden=True, limit_pings=0, showmore=True, count_emojis=
|
|||
|
||||
links = soup.find_all("a")
|
||||
|
||||
banned_domains = [x.domain for x in g.db.query(BannedDomain.domain).all()]
|
||||
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:
|
||||
#remove empty 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','')
|
||||
|
||||
|
|
|
@ -525,12 +525,13 @@ 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}
|
||||
|
||||
y = tldextract.extract(url).registered_domain + parsed_url.path
|
||||
y = y.lower()
|
||||
banned_domains = g.db.query(BannedDomain).all()
|
||||
for x in banned_domains:
|
||||
if y.startswith(x.domain):
|
||||
abort(400, f'Remove the banned link "{x.domain}" and try again!\nReason for link ban: "{x.reason}"')
|
||||
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()
|
||||
for x in banned_domains:
|
||||
if y.startswith(x.domain):
|
||||
abort(400, f'Remove the banned link "{x.domain}" and try again!\nReason for link ban: "{x.reason}"')
|
||||
|
||||
if "twitter.com" == domain:
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue