diff --git a/main.py b/main.py deleted file mode 100644 index 1b0ada8..0000000 --- a/main.py +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env python3 -#Curious Greg - Curious Cat to Mastodon crossposter -# This Source Code Form is subject to the terms of the Mozilla Public -# 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 -from mastodon import Mastodon - -cfg = json.load(open('meta.json')) diff --git a/static/style.css b/static/style.css index 38c1f25..40c9cd6 100644 --- a/static/style.css +++ b/static/style.css @@ -46,6 +46,7 @@ button { border-radius:2px; padding:10px 25px; transition:0.2s all ease-in; + cursor: pointer; } button:hover{ background-color:#2b90d9; diff --git a/templates/home.html b/templates/home.html new file mode 100644 index 0000000..ae83a59 --- /dev/null +++ b/templates/home.html @@ -0,0 +1,24 @@ + + + + Curious Greg - Home + + + + + +

Welcome, {{ acct }}

+

You're all set up and ready to go.

+ + +
+ You haven't posted to Curious Cat in a while, so we'll wait 14 minutes until we check for new answers. +
+ + + \ No newline at end of file diff --git a/templates/landing_page.html b/templates/landing_page.html index b5e4ae2..ce07f32 100644 --- a/templates/landing_page.html +++ b/templates/landing_page.html @@ -19,7 +19,7 @@ diff --git a/web.py b/web.py index 802e7ee..5a98970 100755 --- a/web.py +++ b/web.py @@ -6,7 +6,7 @@ import requests, sqlite3, json from mastodon import Mastodon -from flask import Flask, render_template, request +from flask import Flask, render_template, request, session, redirect, url_for cfg = json.load(open("meta.json")) @@ -17,10 +17,16 @@ c.execute("CREATE TABLE IF NOT EXISTS `data` (username VARCHAR NOT NULL, appid V app = Flask(cfg['name']) app.secret_key = cfg['flask_key'] - @app.route('/') def main(): - return render_template("landing_page.html") + if 'acct' not in session: + return render_template("landing_page.html") + else: + return redirect(url_for('home')) + +@app.route('/home') +def home(): + return render_templae("home.html") @app.route('/internal/auth_a') def internal_auth_a(): @@ -39,11 +45,17 @@ def internal_auth_a(): #example URL: #https://fedi.lynnesbian.space/oauth/authorize?scope=read:favourites&response_type=code&redirect_uri=https://t5.codesections.com&client_id=CLIENT_ID_HERE&client_secret=CLIENT_SECRET_HERE - client_info = { - "client_id": client_id, - "client_secret":client_secret, - "scopes":"write:statuses", - "website": cfg['website'] - } + # client_info = { + # "client_id": client_id, + # "client_secret":client_secret, + # "scopes":"write:statuses", + # "website": cfg['website'] + # } - return(json.dumps(client_info)) + url = "{}/oauth/authorize?scope=write:statuses&response_type=code&redirect_url=https://lynnesbian.space/cg/internal/auth_b&client_id={}&client_secret={}".format( + instance_url, client_id, client_secret + ) + + return url + + # return(json.dumps(client_info))