1
0
Fork 0
mirror of https://github.com/Lynnesbian/FediBooks/ synced 2024-12-27 14:58:59 +00:00

delete push subscription data when deleting bot

This commit is contained in:
Lynne Megido 2019-09-21 15:41:57 +10:00
parent 53c44ec8ac
commit 39d2be53ad

View file

@ -77,11 +77,20 @@ def bot_delete(id):
c = mysql.connection.cursor()
c.execute("SELECT `credentials_id` FROM `bots` WHERE `handle` = %s", (id,))
credentials_id = c.fetchone()[0]
c.execute("SELECT client_id, client_secret, secret FROM credentials WHERE id = %s", (credentials_id,))
credentials = c.fetchone()
client = Mastodon(
credentials[0],
credentials[1],
credentials[2],
"https://{}".format(id.split("@")[2])
)
client.push_subscription_delete()
c.execute("DELETE FROM `credentials` WHERE `id` = %s", (credentials_id,))
c.close()
mysql.connection.commit()
return redirect(url_for("home"), 303)
return redirect(url_for("render_home"), 303)
@app.route("/bot/toggle/<id>")
def bot_toggle(id):