From 811a25c6a41a5c74852ce941de2bbadc03098556 Mon Sep 17 00:00:00 2001 From: Lynne Date: Fri, 2 Nov 2018 12:59:29 +1000 Subject: [PATCH] added secret key bit to meta.json, removed Flask-Session stuff because flask has builtin sessions now, added requirements.txt --- meta.sample.json | 4 ++++ requirements.txt | 1 + web.py | 33 +++++++++++++++++---------------- 3 files changed, 22 insertions(+), 16 deletions(-) create mode 100644 meta.sample.json create mode 100644 requirements.txt mode change 100644 => 100755 web.py diff --git a/meta.sample.json b/meta.sample.json new file mode 100644 index 0000000..0e5d7e5 --- /dev/null +++ b/meta.sample.json @@ -0,0 +1,4 @@ +{ + "name":"Curious Greg", + "website":"https://git.lynnesbian.space/lynnesbian/curious-greg", +} diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..ae09db0 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +Flask==1.0.2 \ No newline at end of file diff --git a/web.py b/web.py old mode 100644 new mode 100755 index 1c3c6e4..acf0b71 --- a/web.py +++ b/web.py @@ -6,27 +6,28 @@ import requests, sqlite3, json from mastodon import Mastodon -from flask import Flask, session -from flask.ext.session import Session +from flask import Flask cfg = json.load(open("meta.json")) -app = Flask(cfg['name']) -SESSION_TYPE = 'filesystem' -app.config.from_object(cfg['name']) -Session(app) - db = sqlite3.connect("database.db") c = db.cursor() - c.execute("CREATE TABLE IF NOT EXISTS `data` (username VARCHAR NOT NULL, appid VARCHAR NOT NULL, appsecret VARCHAR NOT NULL, secret VARCHAR NOT NULL, latest_post VARCHAR)") -print("Registering app...") -client_id, client_secret = Mastodon.create_app(cfg['name'], - api_base_url=instance_url, - scopes="write:statuses", - website="https://git.lynnesbian.space/lynnesbian/curious-greg") +app = Flask(cfg['name']) -client = Mastodon(client_id = client_id, - client_secret = client_secret, - api_base_url=instance_url) + +@app.route('/login') +def auth(): + + +@app.route('/internal/auth_a') +def internal_auth_a(): + client_id, client_secret = Mastodon.create_app(cfg['name'], + api_base_url=instance_url, + scopes="write:statuses", + website="https://git.lynnesbian.space/lynnesbian/curious-greg") + + client = Mastodon(client_id = client_id, + client_secret = client_secret, + api_base_url=instance_url)