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:
parent
53c44ec8ac
commit
39d2be53ad
1 changed files with 10 additions and 1 deletions
11
app/webui.py
11
app/webui.py
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue