Compare commits

..

3 commits

3 changed files with 26 additions and 13 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

30
login.py → web.py Normal file → Executable file
View file

@ -4,22 +4,30 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import requests, sqlite3, json, argparse
import requests, sqlite3, json
from mastodon import Mastodon
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)")
from flask import Flask
cfg = json.load(open("meta.json"))
instance_url = input("Instance URL: ")
print("Registering app...")
client_id, client_secret = Mastodon.create_app(cfg['name'],
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)")
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_secret = client_secret,
api_base_url=instance_url)