diff --git a/login.py b/login.py index a3a8db0..13f81e2 100644 --- a/login.py +++ b/login.py @@ -7,10 +7,19 @@ import requests, sqlite3, json, argparse from mastodon import Mastodon + db = sqlite3.connect("database.db") c = db.cursor() -c.execute("CREATE TABLE IF NOT EXISTS `data` (username 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)") + +cfg = json.load(open("meta.json")) + +instance_url = input("Instance URL: ") +print("Registering app...") +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") diff --git a/main.py b/main.py index e8f1518..91c7900 100644 --- a/main.py +++ b/main.py @@ -5,5 +5,5 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. import requests, sqlite3, json - +from mastodon import Mastodon