added secret key bit to meta.json, removed Flask-Session stuff because flask has builtin sessions now, added requirements.txt

This commit is contained in:
Lynne Megido 2018-11-02 12:59:29 +10:00
parent b2290cb977
commit 811a25c6a4
Signed by: lynnesbian
GPG Key ID: FB7B970303ACE499
3 changed files with 22 additions and 16 deletions

4
meta.sample.json Normal file
View File

@ -0,0 +1,4 @@
{
"name":"Curious Greg",
"website":"https://git.lynnesbian.space/lynnesbian/curious-greg",
}

1
requirements.txt Normal file
View File

@ -0,0 +1 @@
Flask==1.0.2

33
web.py Normal file → Executable file
View File

@ -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)