things
This commit is contained in:
parent
6151e613f9
commit
9939421590
6 changed files with 55 additions and 7 deletions
14
src/main.py
14
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)
|
||||
|
|
|
@ -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
13
src/templates/guilds.html
Normal 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
12
src/templates/me.html
Normal 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>
|
8
src/templates/utils/banner.html
Normal file
8
src/templates/utils/banner.html
Normal 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>
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue