diff --git a/suchwow/routes/post.py b/suchwow/routes/post.py index 6722a45..e5dd803 100644 --- a/suchwow/routes/post.py +++ b/suchwow/routes/post.py @@ -18,9 +18,17 @@ def read(id): comments = Comment.select().where(Comment.post==post.id) if wallet.connected: address = wallet.addresses(account=post.account_index)[0] + transfers = wallet.transfers(account=post.account_index) else: address = "?" - return render_template("post/read.html", post=post, address=address, comments=comments) + transfers = "?" + return render_template( + "post/read.html", + post=post, + address=address, + comments=comments, + transfers=transfers + ) else: return "no meme there brah" diff --git a/suchwow/routes/profile.py b/suchwow/routes/profile.py index c181494..f017ccb 100644 --- a/suchwow/routes/profile.py +++ b/suchwow/routes/profile.py @@ -9,16 +9,27 @@ bp = Blueprint("profile", "profile") @bp.route("/profile/edit", methods=["GET", "POST"]) @login_required def edit(): + un = session["auth"]["preferred_username"] + profile_exists = Profile.filter(username=un) if request.method == "POST": address = request.form.get("address") if len(address) in [97, 108]: - profile = Profile( - username=session["auth"]["preferred_username"], - address=address - ) - profile.save() + if profile_exists: + profile = Profile.get(username=un) + profile.address = address + profile.save() + else: + profile = Profile( + username=un, + address=address + ) + profile.save() return redirect(request.args.get("redirect", "/")) else: flash("WTF bro, that's not a valid Wownero address") return redirect(request.url) - return render_template("profile/edit.html") + if profile_exists: + profile = Profile.get(username=un) + else: + profile = None + return render_template("profile/edit.html", profile=profile) diff --git a/suchwow/templates/about.html b/suchwow/templates/about.html index 302bfe2..a8d7646 100644 --- a/suchwow/templates/about.html +++ b/suchwow/templates/about.html @@ -5,7 +5,7 @@
Post memes! Have fun! Comment and talk shit! Earn WOW! (soon :tm:)
Post memes! Have fun! Comment and talk shit! Earn WOW! (soon :tm:)
{{ post.text }}
Submitted by {{ post.submitter }} at {{ post.timestamp }}
Vote for this post by sending WOW to the following address:
{{ address }}
No WOW received yet. Show this post some love!
+ {% endif %} +No payouts yet. Exit scam underway?
+ {% endif %} + {% endif %}+
#{{ comment.id }} - {{ comment.commenter.username }} - {{ comment.comment }}
{% endfor %} {% else %}No comments yet.
{% endif %} + {% endif %} -Existing Address:
{{ profile.address }}