From 887aab6a713ff0ec92681ac6b8cbbe4afbfe028d Mon Sep 17 00:00:00 2001 From: Lynne Date: Mon, 2 Sep 2019 16:59:49 +1000 Subject: [PATCH] make the delete page look and work better --- static/style.css | 4 ++++ templates/bot_delete.html | 6 +++--- webui.py | 9 ++++++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/static/style.css b/static/style.css index ec7bc3a..1b7bf25 100644 --- a/static/style.css +++ b/static/style.css @@ -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; } diff --git a/templates/bot_delete.html b/templates/bot_delete.html index 01e4f1e..6ecdc69 100644 --- a/templates/bot_delete.html +++ b/templates/bot_delete.html @@ -9,14 +9,14 @@

Delete bot

-
+
-

Are you sure you want to permanently delete bot name?

-

The account on instan.ce will remain open, but your bot will stop posting from it.

+

Are you sure you want to permanently delete this bot?

+

The account on {{ instance }} will remain open, but your bot will stop posting from it.

Cancel
diff --git a/webui.py b/webui.py index 30ca0ed..9dd6e4d 100644 --- a/webui.py +++ b/webui.py @@ -77,7 +77,9 @@ def bot_edit(id): @app.route("/bot/delete/") 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/") 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