master
Aevann1 2022-02-01 07:35:05 +02:00
parent 93f950370f
commit 66296cac73
3 changed files with 5 additions and 10 deletions

View File

@ -700,13 +700,7 @@ def edit_comment(cid, v):
if ban.reason: reason += f" {ban.reason}"
if request.headers.get("Authorization"): return {'error': 'A blacklisted domain was used.'}, 400
return render_template("comment_failed.html",
action=f"/edit_comment/{c.id}",
badlinks=[x.domain for x in bans],
body=body,
v=v
)
return {'error': reason}, 400
if AGENDAPOSTER_PHRASE not in body.lower():
now = int(time.time())
cutoff = now - 60 * 60 * 24

View File

@ -823,8 +823,9 @@ def submit_post(v):
domain_obj = get_domain(domain)
if domain_obj:
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error":domain_obj.reason}, 400
return render_template("submit.html", v=v, error=domain_obj.reason, title=title, url=url, body=request.values.get("body", "")), 400
reason = f"Remove the {domain_obj.domain} link from your post and try again. {domain_obj.reason}"
if request.headers.get("Authorization") or request.headers.get("xhr"): return {"error":reason}, 400
return render_template("submit.html", v=v, error=reason, title=title, url=url, body=request.values.get("body", "")), 400
elif "twitter.com" == domain:
try: embed = requests.get("https://publish.twitter.com/oembed", timeout=5, params={"url":url, "omit_script":"t"}).json()["html"]
except: embed = None

View File

@ -30,7 +30,7 @@
<form action="/admin/banned_domains" method="post">
<input autocomplete="off" type="hidden" name="formkey" value="{{v.formkey}}">
<input autocomplete="off" name="domain" placeholder="Enter domain here.." class="form-control" required>
<input autocomplete="off" name="reason" placeholder="Enter ban reason here.." onchange="document.getElementById('ban-submit').disabled=false" class="form-control">
<input autocomplete="off" name="reason" placeholder="Enter ban reason here.." oninput="document.getElementById('ban-submit').disabled=false" class="form-control">
<input autocomplete="off" id="ban-submit" type="submit" class="btn btn-primary" value="Toggle ban" disabled>
</form>