1
0
Fork 0
mirror of https://github.com/Lynnesbian/FediBooks/ synced 2024-11-25 08:38:59 +00:00

implement bot back button

This commit is contained in:
Lynne Megido 2019-09-02 15:35:02 +10:00
parent c060f8d7ca
commit 1d3f9fbc73
2 changed files with 7 additions and 1 deletions

View file

@ -40,7 +40,7 @@
<div class="container centred"> <div class="container centred">
<a href="/" class="button btn-secondary"><i class="fas fa-times"></i> Cancel</a> <a href="/" class="button btn-secondary"><i class="fas fa-times"></i> Cancel</a>
{% if session['step'] != 1 %} {% if session['step'] != 1 %}
<button class="button btn-secondary"><i class="fas fa-arrow-left"></i> Back</button> <a href="/bot/create/back" class="button btn-secondary"><i class="fas fa-arrow-left"></i> Back</a>
{% endif %} {% endif %}
{% if session['step'] < 5 %} {% if session['step'] < 5 %}
<button class="button btn-primary"><i class="fas fa-arrow-right"></i> Next</button> <button class="button btn-primary"><i class="fas fa-arrow-right"></i> Next</button>

View file

@ -41,6 +41,7 @@ def home():
bot_users = {} bot_users = {}
for bot in bots: for bot in bots:
# multiple SELECTS is slow, maybe SELECT all at once and filter with python?
c.execute("SELECT COUNT(*) FROM `bot_learned_accounts` WHERE bot_id = %s", (bot['id'],)) c.execute("SELECT COUNT(*) FROM `bot_learned_accounts` WHERE bot_id = %s", (bot['id'],))
bot_users[bot['id']] = c.fetchone()[0] bot_users[bot['id']] = c.fetchone()[0]
@ -187,6 +188,11 @@ def bot_create():
return render_template("bot_create.html") return render_template("bot_create.html")
@app.route("/bot/create/back")
def bot_create_back():
session['step'] -= 1
return redirect(url_for("bot_create"), 303)
@app.route("/do/authenticate_bot") @app.route("/do/authenticate_bot")
def do_authenticate_bot(): def do_authenticate_bot():
session['code'] = request.args.get('code') session['code'] = request.args.get('code')