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

23
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'],
app = Flask(cfg['name'])
@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 = Mastodon(client_id = client_id,
client_secret = client_secret,
api_base_url=instance_url)