mirror of
https://github.com/Lynnesbian/FediBooks/
synced 2024-12-27 14:58:59 +00:00
show profile picture on bot delete page, clean up icon display code
This commit is contained in:
parent
11d6d06695
commit
8f6dbfeaf4
3 changed files with 8 additions and 5 deletions
|
@ -13,10 +13,10 @@
|
|||
|
||||
<div class="container centred">
|
||||
<form method='POST'>
|
||||
<div class="panel-icon large"></div>
|
||||
<div class="panel-icon large" style="{{ 'background-image: url(\'' + icon + '\')' if icon else '' }}"></div>
|
||||
<div class="container centred">
|
||||
<p>Are you sure you want to <strong>permanently</strong> delete this bot?</p>
|
||||
<p>The account on {{ instance }} will remain open, but your bot will stop posting from it.</p>
|
||||
<p>The account on {{ instance }} will remain open, but FediBooks will stop posting from it.</p>
|
||||
<a class="button btn-secondary" href="/"><i class="fas fa-times"></i> Cancel</a>
|
||||
<button class="button btn-dangerous"><i class="fas fa-trash"></i> Delete bot</button>
|
||||
</div>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<div class="container" style="min-height: 300px;">
|
||||
{% for bot in bots %}
|
||||
<div class="row light">
|
||||
<div class="panel-icon {{ "online" if bot['enabled'] else "offline"}}" style="{{ "background-image: url('" + bot['icon'] + "')" if bot['icon'] else "" }}"></div>
|
||||
<div class="panel-icon {{ 'online' if bot['enabled'] else 'offline'}}" style="{{ 'background-image: url(\'' + bot['icon'] + '\')' if bot['icon'] else '' }}"></div>
|
||||
<div class="panel-text">
|
||||
{% set handle_list = bot['handle'].split('@') %}
|
||||
<div class="panel-name">@{{ handle_list[1] }}<span class="subtle tiny">@{{ handle_list[2] }}</span></div>
|
||||
|
|
|
@ -70,12 +70,15 @@ def bot_delete(id):
|
|||
if bot_check(id):
|
||||
if request.method == 'GET':
|
||||
instance = id.split("@")[2]
|
||||
return render_template("bot/delete.html", instance = instance)
|
||||
c = mysql.connection.cursor()
|
||||
c.execute("SELECT icon FROM bots WHERE handle = %s", (id,))
|
||||
icon = c.fetchone()[0]
|
||||
return render_template("bot/delete.html", instance = instance, icon = icon)
|
||||
else:
|
||||
# delete bot by deleting its credentials
|
||||
# FK constraint will delete bot
|
||||
c = mysql.connection.cursor()
|
||||
c.execute("SELECT `credentials_id` FROM `bots` WHERE `handle` = %s", (id,))
|
||||
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()
|
||||
|
|
Loading…
Reference in a new issue