dsfsfd
This commit is contained in:
parent
658c86b1f1
commit
59c619ff68
1 changed files with 24 additions and 26 deletions
|
@ -534,31 +534,6 @@ def submit_post(v):
|
|||
|
||||
if repost: return redirect(repost.permalink)
|
||||
|
||||
if not url and not request.values.get("body") and not request.files.get("file", None):
|
||||
if request.headers.get("Authorization"): return {"error": "`url` or `body` parameter required."}, 400
|
||||
else: return render_template("submit.html", v=v, error="Please enter a url or some text.", title=title, url=url, body=request.values.get("body", "")), 400
|
||||
|
||||
if not title:
|
||||
if request.headers.get("Authorization"): return {"error": "Please enter a better title"}, 400
|
||||
else: return render_template("submit.html", v=v, error="Please enter a better title.", title=title, url=url, body=request.values.get("body", "")), 400
|
||||
|
||||
|
||||
elif len(title) > 500:
|
||||
if request.headers.get("Authorization"): return {"error": "500 character limit for titles"}, 400
|
||||
else: render_template("submit.html", v=v, error="500 character limit for titles.", title=title[:500], url=url, body=request.values.get("body", "")), 400
|
||||
|
||||
body = request.values.get("body", "")
|
||||
dup = g.db.query(Submission).options(lazyload('*')).filter(
|
||||
Submission.author_id == v.id,
|
||||
Submission.deleted_utc == 0,
|
||||
Submission.title == title,
|
||||
Submission.url == url,
|
||||
Submission.body == body
|
||||
).first()
|
||||
|
||||
if dup: return redirect(dup.permalink)
|
||||
|
||||
if domain:
|
||||
domain_obj = get_domain(domain)
|
||||
if domain_obj:
|
||||
if domain_obj.reason==4: v.ban(days=30, reason="Digitally malicious content")
|
||||
|
@ -582,7 +557,30 @@ def submit_post(v):
|
|||
if "/" in id: id = id.split("/")[0]
|
||||
embed = id
|
||||
else: embed = None
|
||||
else: embed = None
|
||||
|
||||
if not url and not request.values.get("body") and not request.files.get("file", None):
|
||||
if request.headers.get("Authorization"): return {"error": "`url` or `body` parameter required."}, 400
|
||||
else: return render_template("submit.html", v=v, error="Please enter a url or some text.", title=title, url=url, body=request.values.get("body", "")), 400
|
||||
|
||||
if not title:
|
||||
if request.headers.get("Authorization"): return {"error": "Please enter a better title"}, 400
|
||||
else: return render_template("submit.html", v=v, error="Please enter a better title.", title=title, url=url, body=request.values.get("body", "")), 400
|
||||
|
||||
|
||||
elif len(title) > 500:
|
||||
if request.headers.get("Authorization"): return {"error": "500 character limit for titles"}, 400
|
||||
else: render_template("submit.html", v=v, error="500 character limit for titles.", title=title[:500], url=url, body=request.values.get("body", "")), 400
|
||||
|
||||
body = request.values.get("body", "")
|
||||
dup = g.db.query(Submission).options(lazyload('*')).filter(
|
||||
Submission.author_id == v.id,
|
||||
Submission.deleted_utc == 0,
|
||||
Submission.title == title,
|
||||
Submission.url == url,
|
||||
Submission.body == body
|
||||
).first()
|
||||
|
||||
if dup: return redirect(dup.permalink)
|
||||
|
||||
now = int(time.time())
|
||||
cutoff = now - 60 * 60 * 24
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue