Compare commits
No commits in common. "811a25c6a41a5c74852ce941de2bbadc03098556" and "7d0aa37116e9100a947bce3dad7d452f7fcd0656" have entirely different histories.
811a25c6a4
...
7d0aa37116
3 changed files with 10 additions and 23 deletions
20
web.py → login.py
Executable file → Normal file
20
web.py → login.py
Executable file → Normal file
|
@ -4,30 +4,22 @@
|
||||||
# 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
|
import requests, sqlite3, json, argparse
|
||||||
from mastodon import Mastodon
|
from mastodon import Mastodon
|
||||||
from flask import Flask
|
|
||||||
|
|
||||||
cfg = json.load(open("meta.json"))
|
|
||||||
|
|
||||||
db = sqlite3.connect("database.db")
|
db = sqlite3.connect("database.db")
|
||||||
c = db.cursor()
|
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)")
|
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'])
|
cfg = json.load(open("meta.json"))
|
||||||
|
|
||||||
|
instance_url = input("Instance URL: ")
|
||||||
@app.route('/login')
|
print("Registering app...")
|
||||||
def auth():
|
|
||||||
|
|
||||||
|
|
||||||
@app.route('/internal/auth_a')
|
|
||||||
def internal_auth_a():
|
|
||||||
client_id, client_secret = Mastodon.create_app(cfg['name'],
|
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)
|
|
|
@ -1,4 +0,0 @@
|
||||||
{
|
|
||||||
"name":"Curious Greg",
|
|
||||||
"website":"https://git.lynnesbian.space/lynnesbian/curious-greg",
|
|
||||||
}
|
|
|
@ -1 +0,0 @@
|
||||||
Flask==1.0.2
|
|
Loading…
Reference in a new issue