diff --git a/static/style.css b/static/style.css index cb71759..c9daa98 100644 --- a/static/style.css +++ b/static/style.css @@ -45,7 +45,7 @@ body { .panel-icon { width: 100px; height: 100px; - background: center/contain url("https://cloud.lynnesbian.space/s/JZCPTs3DzMLAspC/preview"); + background: center/contain url("/img/bot_generic.png"); } .panel-icon.large { width: 150px; diff --git a/webui.py b/webui.py index fca24f9..294f740 100644 --- a/webui.py +++ b/webui.py @@ -1,4 +1,4 @@ -from flask import Flask, render_template, session, request, redirect, url_for +from flask import Flask, render_template, session, request, redirect, url_for, send_file from flask_mysqldb import MySQL from mastodon import Mastodon import requests @@ -81,6 +81,15 @@ def bot_delete(id): instance = id.split("@")[2] return render_template("bot_delete.html", instance = instance) +@app.route("/bot/toggle/") +def bot_toggle(id): + if bot_check(id): + c = mysql.connection.cursor() + c.execute("UPDATE `bots` SET `enabled` = NOT `enabled` WHERE `handle` = %s", (id,)) + mysql.connection.commit() + c.close() + return redirect(url_for("home"), 303) + @app.route("/bot/chat/") def bot_chat(id): return render_template("coming_soon.html") @@ -251,6 +260,10 @@ def do_login(): else: return "invalid login" +@app.route("/img/bot_generic.png") +def img_bot_generic(): + return send_file("static/bot_generic.png", mimetype="image/png") + 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']))