From 5d8aa010faececd662c8b5031598a60b8c810f78 Mon Sep 17 00:00:00 2001 From: Lynne Date: Mon, 20 Jan 2020 19:50:16 +1000 Subject: [PATCH] add an error message just in case --- app/pages/bot/accounts_add.py | 3 ++- app/webui.py | 7 ++++++- db/setup.sql | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/pages/bot/accounts_add.py b/app/pages/bot/accounts_add.py index 897e7e6..9f82370 100644 --- a/app/pages/bot/accounts_add.py +++ b/app/pages/bot/accounts_add.py @@ -81,7 +81,8 @@ def bot_accounts_add(mysql, cfg): username = client.account_verify_credentials()['username'] if username != session['username']: error = "Please authenticate as {}.".format(session['username']) - print("Auth error - {} is not {}".format(session['username'], username)) + if username.lower() == session['username'].lower(): + error += " Make sure you capitalised the name properly - @user and @USER are different." return render_template("bot/accounts_add.html", error = error) except: session['step'] = 1 diff --git a/app/webui.py b/app/webui.py index 40d80ac..8c0a965 100644 --- a/app/webui.py +++ b/app/webui.py @@ -1,4 +1,4 @@ -from flask import Flask, render_template, session, request, redirect, url_for, send_file +from flask import Flask, render_template, session, request, redirect, url_for, send_file, jsonify from flask_mysqldb import MySQL from mastodon import Mastodon @@ -370,6 +370,11 @@ def img_bot_generic(): def favicon(): return send_file("static/favicon.ico") +@app.route("/.well-known/webfinger") +def webfinger(): + return render_template("webfinger.json", base_uri = cfg['base_uri']), 200, {'Content-type':'application/json'} + + def bot_check(bot): # check to ensure bot is owned by user c = mysql.connection.cursor() diff --git a/db/setup.sql b/db/setup.sql index c42361a..0db0bec 100644 --- a/db/setup.sql +++ b/db/setup.sql @@ -76,3 +76,5 @@ CREATE TABLE IF NOT EXISTS `contact_history` ( `reply` BOOLEAN DEFAULT 0, FOREIGN KEY (`user_id`) REFERENCES users(id) ON DELETE CASCADE ) ENGINE=INNODB; + +you need to generate an RSA key and store it in a new table for authorised fetches