|
|
@ -28,7 +28,7 @@ def read(id):
|
|
|
|
post = Post.get(id=id)
|
|
|
|
post = Post.get(id=id)
|
|
|
|
if not post.approved:
|
|
|
|
if not post.approved:
|
|
|
|
if not is_moderator(get_session_user()):
|
|
|
|
if not is_moderator(get_session_user()):
|
|
|
|
flash("That post has not been approved.")
|
|
|
|
flash("That post has not been approved.", "is-warning")
|
|
|
|
return redirect("/")
|
|
|
|
return redirect("/")
|
|
|
|
if wallet.connected:
|
|
|
|
if wallet.connected:
|
|
|
|
address = wallet.get_address(account=post.account_index)
|
|
|
|
address = wallet.get_address(account=post.account_index)
|
|
|
@ -47,7 +47,7 @@ def read(id):
|
|
|
|
qr_code=qr_code
|
|
|
|
qr_code=qr_code
|
|
|
|
)
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
flash("No meme there, brah")
|
|
|
|
flash("No meme there, brah", "is-warning")
|
|
|
|
return redirect(url_for("index"))
|
|
|
|
return redirect(url_for("index"))
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/post/create", methods=["GET", "POST"])
|
|
|
|
@bp.route("/post/create", methods=["GET", "POST"])
|
|
|
@ -58,21 +58,21 @@ def create():
|
|
|
|
submitter = get_session_user()
|
|
|
|
submitter = get_session_user()
|
|
|
|
if submitter in config.BANNED_USERS:
|
|
|
|
if submitter in config.BANNED_USERS:
|
|
|
|
reason = config.BANNED_USERS[submitter]
|
|
|
|
reason = config.BANNED_USERS[submitter]
|
|
|
|
flash(f"You can't post for now: {reason}")
|
|
|
|
flash(f"You can't post for now: {reason}", "is-danger")
|
|
|
|
return redirect("/")
|
|
|
|
return redirect("/")
|
|
|
|
post_title = request.form.get("title")
|
|
|
|
post_title = request.form.get("title")
|
|
|
|
# check if the post request has the file part
|
|
|
|
# check if the post request has the file part
|
|
|
|
if "file" not in request.files:
|
|
|
|
if "file" not in request.files:
|
|
|
|
flash("You didn't upload a caliente meme, bro! You're fuckin up!")
|
|
|
|
flash("You didn't upload a caliente meme, bro! You're fuckin up!", "is-danger")
|
|
|
|
return redirect(request.url)
|
|
|
|
return redirect(request.url)
|
|
|
|
file = request.files["file"]
|
|
|
|
file = request.files["file"]
|
|
|
|
# if user does not select file, browser also
|
|
|
|
# if user does not select file, browser also
|
|
|
|
# submit an empty part without filename
|
|
|
|
# submit an empty part without filename
|
|
|
|
if file.filename == "":
|
|
|
|
if file.filename == "":
|
|
|
|
flash("You didn't upload a caliente meme, bro! You're fuckin up!")
|
|
|
|
flash("You didn't upload a caliente meme, bro! You're fuckin up!", "is-danger")
|
|
|
|
return redirect(request.url)
|
|
|
|
return redirect(request.url)
|
|
|
|
if post_title == "":
|
|
|
|
if post_title == "":
|
|
|
|
flash("You didn't give your meme a spicy title, bro! You're fuckin up!")
|
|
|
|
flash("You didn't give your meme a spicy title, bro! You're fuckin up!", "is-danger")
|
|
|
|
return redirect(request.url)
|
|
|
|
return redirect(request.url)
|
|
|
|
if file and allowed_file(file.filename):
|
|
|
|
if file and allowed_file(file.filename):
|
|
|
|
filename = "{}-{}".format(
|
|
|
|
filename = "{}-{}".format(
|
|
|
@ -86,7 +86,7 @@ def create():
|
|
|
|
wallet = wownero.Wallet()
|
|
|
|
wallet = wownero.Wallet()
|
|
|
|
account_index = wallet.new_account()
|
|
|
|
account_index = wallet.new_account()
|
|
|
|
except:
|
|
|
|
except:
|
|
|
|
flash("Suchwow wallet is fucked up! Try again later.")
|
|
|
|
flash("Suchwow wallet is fucked up! Try again later.", "is-danger")
|
|
|
|
return redirect(request.url)
|
|
|
|
return redirect(request.url)
|
|
|
|
post = Post(
|
|
|
|
post = Post(
|
|
|
|
title=post_title,
|
|
|
|
title=post_title,
|
|
|
@ -100,7 +100,7 @@ def create():
|
|
|
|
post.save_thumbnail()
|
|
|
|
post.save_thumbnail()
|
|
|
|
url = url_for('post.read', id=post.id, _external=True)
|
|
|
|
url = url_for('post.read', id=post.id, _external=True)
|
|
|
|
post_webhook(f"New post :doge2: [{post.id}]({url}) by `{submitter}` :neckbeard:")
|
|
|
|
post_webhook(f"New post :doge2: [{post.id}]({url}) by `{submitter}` :neckbeard:")
|
|
|
|
flash("New post created and pending approval!")
|
|
|
|
flash("New post created and pending approval!", "is-success")
|
|
|
|
return redirect(url_for("index"))
|
|
|
|
return redirect(url_for("index"))
|
|
|
|
return render_template("post/create.html")
|
|
|
|
return render_template("post/create.html")
|
|
|
|
|
|
|
|
|
|
|
@ -114,7 +114,7 @@ def approve(id):
|
|
|
|
post.approved = True
|
|
|
|
post.approved = True
|
|
|
|
post.save()
|
|
|
|
post.save()
|
|
|
|
post_webhook(f"Post [{post.id}]({url}) approved :white_check_mark: by `{get_session_user()}` :fieri_parrot:")
|
|
|
|
post_webhook(f"Post [{post.id}]({url}) approved :white_check_mark: by `{get_session_user()}` :fieri_parrot:")
|
|
|
|
flash("Approved")
|
|
|
|
flash("Approved", "is-success")
|
|
|
|
if current_app.config["DEBUG"] is False:
|
|
|
|
if current_app.config["DEBUG"] is False:
|
|
|
|
# _r = None
|
|
|
|
# _r = None
|
|
|
|
# _d = None
|
|
|
|
# _d = None
|
|
|
@ -130,7 +130,7 @@ def approve(id):
|
|
|
|
post_webhook(f"Post [{post.id}]({url}) submitted :dab_parrot: to Discord.")
|
|
|
|
post_webhook(f"Post [{post.id}]({url}) submitted :dab_parrot: to Discord.")
|
|
|
|
return redirect(url_for("mod_queue"))
|
|
|
|
return redirect(url_for("mod_queue"))
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
flash("You can't approve this")
|
|
|
|
flash("You can't approve this", "is-success")
|
|
|
|
return redirect(url_for("index"))
|
|
|
|
return redirect(url_for("index"))
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/post/<id>/delete")
|
|
|
|
@bp.route("/post/<id>/delete")
|
|
|
@ -147,16 +147,16 @@ def delete(id):
|
|
|
|
remove(save_path)
|
|
|
|
remove(save_path)
|
|
|
|
post.delete_instance()
|
|
|
|
post.delete_instance()
|
|
|
|
post_webhook(f"Post {post.id} deleted :dumpsterfire: by `{user}` :godmode:")
|
|
|
|
post_webhook(f"Post {post.id} deleted :dumpsterfire: by `{user}` :godmode:")
|
|
|
|
flash("Deleted that shit, brah!")
|
|
|
|
flash("Deleted that shit, brah!", "is-success")
|
|
|
|
if is_mod:
|
|
|
|
if is_mod:
|
|
|
|
return redirect(url_for("mod_queue"))
|
|
|
|
return redirect(url_for("mod_queue"))
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
return redirect(url_for("index"))
|
|
|
|
return redirect(url_for("index"))
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
flash("You can't delete a meme you don't own, brah")
|
|
|
|
flash("You can't delete a meme you don't own, brah", "is-warning")
|
|
|
|
return redirect(url_for("post.read", id=post.id))
|
|
|
|
return redirect(url_for("post.read", id=post.id))
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
flash("No meme there, brah")
|
|
|
|
flash("No meme there, brah", "is-warning")
|
|
|
|
return redirect(url_for("index"))
|
|
|
|
return redirect(url_for("index"))
|
|
|
|
|
|
|
|
|
|
|
|
@bp.route("/uploads/<path:filename>")
|
|
|
|
@bp.route("/uploads/<path:filename>")
|
|
|
|