1
0
Fork 0
mirror of https://github.com/Lynnesbian/FediBooks/ synced 2024-11-25 16:48:58 +00:00

list accounts bot is learning from

This commit is contained in:
Lynne Megido 2019-09-02 20:26:45 +10:00
parent ca6e06668f
commit f4465219d0
2 changed files with 21 additions and 5 deletions

View file

@ -17,16 +17,19 @@
</div> </div>
<div class="container" style="min-height: 300px;"> <div class="container" style="min-height: 300px;">
{% for user in users %}
<div class="row light"> <div class="row light">
<div class="panel-icon"></div> <div class="panel-icon {{ "online" if user['enabled'] else "offline" }}"></div>
<div class="panel-text"> <div class="panel-text">
<div class="panel-name">@user<span class="subtle tiny">@instan.ce</span></div> {% set handle_list = user['fedi_id'].split('@') %}
<div class="panel-status">12345 posts stored</div> <div class="panel-name">@{{ handle_list[1] }}<span class="subtle tiny">@{{ handle_list[2] }}</span></div>
<div class="panel-status">{{ "Active" if user['enabled'] else "Inactive" }}</div>
</div> </div>
<div class="panel-actions"> <div class="panel-actions">
<a class="button btn-secondary" href="/bot/accounts/toggle/insert id here" title="Turn on/off"><i class="fas fa-power-off"></i></a><a class="button btn-dangerous" href="/bot/accounts/delete/insert id here" title="Delete"><i class="fas fa-trash"></i></a> <a class="button btn-secondary" href="/bot/accounts/toggle/insert id here" title="Turn on/off"><i class="fas fa-power-off"></i></a><a class="button btn-dangerous" href="/bot/accounts/delete/insert id here" title="Delete"><i class="fas fa-trash"></i></a>
</div> </div>
</div> </div>
{% endfor %}
</div> </div>
{% include 'footer.html' %} {% include 'footer.html' %}

View file

@ -78,7 +78,7 @@ def settings():
@app.route("/bot/edit/<id>") @app.route("/bot/edit/<id>")
def bot_edit(id): def bot_edit(id):
return render_template("bot_edit.html") return render_template("coming_soon.html")
@app.route("/bot/delete/<id>", methods=['GET', 'POST']) @app.route("/bot/delete/<id>", methods=['GET', 'POST'])
def bot_delete(id): def bot_delete(id):
@ -119,7 +119,20 @@ def bot_blacklist(id):
def bot_accounts(id): def bot_accounts(id):
if bot_check(id): if bot_check(id):
session['bot'] = id session['bot'] = id
return render_template("bot_accounts.html") c = mysql.connection.cursor()
c.execute("SELECT COUNT(*) FROM `bot_learned_accounts` WHERE `bot_id` = %s", (id,))
user_count = c.fetchone()[0]
users = {}
if user_count > 0:
dc = mysql.connection.cursor(MySQLdb.cursors.DictCursor)
dc.execute("SELECT `fedi_id`, `enabled` FROM `bot_learned_accounts` WHERE `bot_id` = %s", (id,))
users = dc.fetchall()
dc.close()
c.close()
return render_template("bot_accounts.html", users = users)
@app.route("/bot/accounts/add", methods = ['GET', 'POST']) @app.route("/bot/accounts/add", methods = ['GET', 'POST'])
def bot_accounts_add(): def bot_accounts_add():