things
Some checks failed
Docker Build / Build (push) Successful in 26s
Linter / Lint (3.11) (push) Failing after 39s

This commit is contained in:
Seaswimmer 2023-11-25 18:36:25 -05:00
parent 6151e613f9
commit 9939421590
Signed by: cswimr
GPG key ID: 1EBC234EEDA901AE
6 changed files with 55 additions and 7 deletions

View file

@ -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)

View file

@ -23,7 +23,7 @@
background-color: #7289da;
color: #fff;
border: none;
padding: 3px 5px;
padding: 3px 3px;
border-radius: 5px;
cursor: pointer;
display: flex;

13
src/templates/guilds.html Normal file
View file

@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Discord Event Log</title>
<meta name="description" content="A Discord event log that tracks and displays all events in your Discord server.">
<meta name="keywords" content="Discord, Event Log, Server Events, Tracking">
<link rel="stylesheet" href="{{ url_for('static', filename='styles/pages/index.css') }}">
</head>
<body>
WIP
{% include "utils/login-logout.html" %}
</body>
</html>

12
src/templates/me.html Normal file
View file

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Discord Event Log</title>
<meta name="description" content="A Discord event log that tracks and displays all events in your Discord server.">
<meta name="keywords" content="Discord, Event Log, Server Events, Tracking">
<link rel="stylesheet" href="{{ url_for('static', filename='styles/pages/index.css') }}">
</head>
<body>
{% include "utils/login-logout.html" %}
</body>
</html>

View file

@ -0,0 +1,8 @@
{% if user.banner %}
<div class="banner">
<div>
<h1>Welcome to the site</h1>
<h5>Sign up for free today</h5>
<button>Get started</button>
</div>
</div>

View file

@ -14,13 +14,24 @@
{% else %}
<img src="{{ user.default_avatar_url }}" alt="User Avatar" class="log-button-icon">
{% endif %}
{% if user.to_json()['global_name'] %}
{{ user.to_json()['global_name']}}
{% if user.discriminator != "0" %}
({{ user.username }}#{{ user.discriminator }})
{% else %}
({{ user.username }})
{% endif %}
{% else %}
{% if user.discriminator != "0" %}
{{ user.username }}#{{ user.discriminator }}
{% else %}
{{ user.username }}
{% endif %}
{% endif %}
<div class="dropdown-content">
<a href="{{ url_for('.index') }}">User Info</a>
<a href="{{ url_for('.index') }}">Home</a>
<a href="{{ url_for('.guilds') }}">Guilds</a>
<a href="{{ url_for('.me') }}">User Info</a>
<a href="{{ url_for('.logout') }}" class="txt-danger">Log Out</a>
</div>
</button>