diff --git a/templates/bot_accounts.html b/templates/bot_accounts.html index 43eae1c..180ab7d 100644 --- a/templates/bot_accounts.html +++ b/templates/bot_accounts.html @@ -26,7 +26,7 @@
{{ "Active" if user['enabled'] else "Inactive" }}
- +
{% endfor %} diff --git a/webui.py b/webui.py index 0f7b5e9..6897ad9 100644 --- a/webui.py +++ b/webui.py @@ -172,10 +172,19 @@ def bot_accounts_add(): c.close() mysql.connection.commit() - return redirect("/bot/accounts/{}".format(session['bot'])) + return redirect("/bot/accounts/{}".format(session['bot']), 303) return render_template("bot_accounts_add.html") +@app.route("/bot/accounts/toggle/") +def bot_accounts_toggle(id): + c = mysql.connection.cursor() + c.execute("UPDATE `bot_learned_accounts` SET `enabled` = NOT `enabled` WHERE `fedi_id` = %s AND `bot_id` = %s", (id, session['bot'])) + mysql.connection.commit() + c.close() + return redirect("/bot/accounts/{}".format(session['bot']), 303) + + @app.route("/bot/create/", methods=['GET', 'POST']) def bot_create(): #TODO: error handling