diff --git a/src/main.py b/src/main.py index 79157d8..27b6aa7 100644 --- a/src/main.py +++ b/src/main.py @@ -20,18 +20,22 @@ discord = DiscordOAuth2Session(app) @app.route("/") def index(): if discord.authorized: - user = discord.fetch_user() - return render_template('index.html', name=config['name'], user=user) + return render_template('index.html', name=config['name'], user=discord.fetch_user()) return render_template('index.html', name=config['name']) @app.route("/me/") @requires_authorization def me(): - return redirect(url_for(".index")) + print(discord.fetch_user().to_json()) + return render_template('me.html', name=config['name'], user=discord.fetch_user()) + +@app.route("/guilds/") +@requires_authorization +def guilds(): + return render_template('guilds.html', name=config['name'], user=discord.fetch_user()) @app.route("/login/") def login(): - discord.redirect_uri = request.host + "/callback/" return discord.create_session(scope=['identify', 'guilds', 'guilds.members.read']) @app.route("/logout/") @@ -42,7 +46,7 @@ def logout(): @app.route("/callback/") def callback(): discord.callback() - return redirect(url_for(".index")) + return redirect(url_for(".me")) @app.errorhandler(Unauthorized) @app.errorhandler(AccessDenied) diff --git a/src/static/styles/utils/login-logout.css b/src/static/styles/utils/login-logout.css index ff37000..ff1c396 100644 --- a/src/static/styles/utils/login-logout.css +++ b/src/static/styles/utils/login-logout.css @@ -23,7 +23,7 @@ background-color: #7289da; color: #fff; border: none; - padding: 3px 5px; + padding: 3px 3px; border-radius: 5px; cursor: pointer; display: flex; diff --git a/src/templates/guilds.html b/src/templates/guilds.html new file mode 100644 index 0000000..50c7084 --- /dev/null +++ b/src/templates/guilds.html @@ -0,0 +1,13 @@ + + +
+