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:
parent
b2290cb977
commit
811a25c6a4
3 changed files with 22 additions and 16 deletions
4
meta.sample.json
Normal file
4
meta.sample.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"name":"Curious Greg",
|
||||
"website":"https://git.lynnesbian.space/lynnesbian/curious-greg",
|
||||
}
|
1
requirements.txt
Normal file
1
requirements.txt
Normal file
|
@ -0,0 +1 @@
|
|||
Flask==1.0.2
|
19
web.py
Normal file → Executable file
19
web.py
Normal file → Executable file
|
@ -6,22 +6,23 @@
|
|||
|
||||
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...")
|
||||
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",
|
||||
|
|
Loading…
Reference in a new issue