Compare commits
3 commits
7d0aa37116
...
811a25c6a4
Author | SHA1 | Date | |
---|---|---|---|
811a25c6a4 | |||
b2290cb977 | |||
a75c6d8e88 |
3 changed files with 26 additions and 13 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
|
30
login.py → web.py
Normal file → Executable file
30
login.py → web.py
Normal file → Executable file
|
@ -4,22 +4,30 @@
|
||||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
# 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/.
|
# 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
|
from mastodon import Mastodon
|
||||||
|
from flask import Flask
|
||||||
|
|
||||||
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)")
|
|
||||||
|
|
||||||
cfg = json.load(open("meta.json"))
|
cfg = json.load(open("meta.json"))
|
||||||
|
|
||||||
instance_url = input("Instance URL: ")
|
db = sqlite3.connect("database.db")
|
||||||
print("Registering app...")
|
c = db.cursor()
|
||||||
client_id, client_secret = Mastodon.create_app(cfg['name'],
|
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,
|
api_base_url=instance_url,
|
||||||
scopes="write:statuses",
|
scopes="write:statuses",
|
||||||
website="https://git.lynnesbian.space/lynnesbian/curious-greg")
|
website="https://git.lynnesbian.space/lynnesbian/curious-greg")
|
||||||
|
|
||||||
|
client = Mastodon(client_id = client_id,
|
||||||
|
client_secret = client_secret,
|
||||||
|
api_base_url=instance_url)
|
Loading…
Reference in a new issue