make the delete page look and work better

This commit is contained in:
Lynne Megido 2019-09-02 16:59:49 +10:00
parent 8f72d14243
commit 887aab6a71
3 changed files with 15 additions and 4 deletions

View File

@ -47,6 +47,10 @@ body {
height: 100px;
background: center/contain url("https://cloud.lynnesbian.space/s/JZCPTs3DzMLAspC/preview");
}
.panel-icon.large {
width: 150px;
height: 150px;
}
.panel-icon.online, .panel-icon.offline {
width: 105px;
}

View File

@ -9,14 +9,14 @@
<body>
<div class="container centred">
<h1 class="thin centred">Delete bot</h1>
<div class="panel-icon"></div>
</div>
<div class="container centred">
<form>
<div class="panel-icon large"></div>
<div class="container centred">
<p>Are you sure you want to <strong>permanently</strong> delete bot name?</p>
<p>The account on instan.ce will remain open, but your bot will stop posting from it.</p>
<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>
<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>

View File

@ -77,7 +77,9 @@ def bot_edit(id):
@app.route("/bot/delete/<id>")
def bot_delete(id):
return render_template("bot_delete.html")
if bot_check(id):
instance = id.split("@")[2]
return render_template("bot_delete.html", instance = instance)
@app.route("/bot/accounts/<id>")
def bot_accounts(id):
@ -240,3 +242,8 @@ def do_login():
else:
return "invalid login"
def bot_check(bot):
c = mysql.connection.cursor()
c.execute("SELECT COUNT(*) FROM `bots` WHERE `handle` = %s AND `user_id` = %s", (bot, session['user_id']))
return c.fetchone()[0] == 1