From 5587b415dc7c8e551fff12a446b1cc7d3282d1ea Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Wed, 14 Sep 2022 10:01:25 +0200 Subject: [PATCH] fix kofi webhook --- files/routes/comments.py | 2 +- files/routes/users.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/files/routes/comments.py b/files/routes/comments.py index f154d3a16..c9ae52659 100644 --- a/files/routes/comments.py +++ b/files/routes/comments.py @@ -261,7 +261,7 @@ def comment(v): Comment.parent_comment_id == parent_comment_id, Comment.parent_submission == parent_submission, Comment.body_html == body_html - ).one_or_none() + ).first() if existing: return {"error": f"You already made that comment: /comment/{existing.id}"}, 409 if parent.author.any_block_exists(v) and v.admin_level < 2: diff --git a/files/routes/users.py b/files/routes/users.py index 265aa0e07..071db4ce8 100644 --- a/files/routes/users.py +++ b/files/routes/users.py @@ -703,7 +703,7 @@ def message2(v, username): body_html = sanitize(message) - if not (SITE == 'rdrama.net' and message == '!withdrawall' and user.id == 12732): + if not (SITE == 'rdrama.net' and user.id == 12732): existing = g.db.query(Comment.id).filter(Comment.author_id == v.id, Comment.sentto == user.id, Comment.body_html == body_html, @@ -1390,7 +1390,7 @@ def kofi(): if verification_token != KOFI_TOKEN: abort(400) id = data['kofi_transaction_id'] - created_utc = int(time.mktime(time.strptime(data['timestamp'].split('.')[0], "%Y-%m-%dT%H:%M:%S"))) + created_utc = int(time.mktime(time.strptime(data['timestamp'].split('.')[0], "%Y-%m-%dT%H:%M:%SZ"))) type = data['type'] amount = int(float(data['amount'])) email = data['email']