linter fixes
Some checks failed
Docker Build / Build (push) Successful in 28s
Linter / Lint (3.11) (push) Failing after 42s

This commit is contained in:
Seaswimmer 2023-11-25 17:15:34 -05:00
parent a13dba19ad
commit 451f436a58
Signed by: cswimr
GPG key ID: 1EBC234EEDA901AE
12 changed files with 90 additions and 100 deletions

View file

@ -0,0 +1,6 @@
[MESSAGES CONTROL]
disable=
missing-module-docstring,
missing-function-docstring,
missing-class-docstring,
line-too-long

View file

@ -1,5 +1,11 @@
extends: default
rules:
- line-length:
max: 120
- document-start: disable
- truthy: disable
ignore:
- node_modules/
- __pycache__/

View file

@ -27,7 +27,7 @@ jobs:
- name: Analyzing Python files with Pylint
run: |
export PATH="$HOME/.local/bin:$PATH"
poetry run pylint $(git ls-files '*.py')
poetry run pylint --rcfile .forgejo/workflows/config/.pylintrc $(git ls-files '*.py')
- name: Analyzing HTML templates with djLint
if: ${{ !cancelled() }}
run: |

6
poetry.lock generated
View file

@ -300,13 +300,13 @@ files = [
[[package]]
name = "idna"
version = "3.5"
version = "3.6"
description = "Internationalized Domain Names in Applications (IDNA)"
optional = false
python-versions = ">=3.5"
files = [
{file = "idna-3.5-py3-none-any.whl", hash = "sha256:79b8f0ac92d2351be5f6122356c9a592c96d81c9a79e4b488bf2a6a15f88057a"},
{file = "idna-3.5.tar.gz", hash = "sha256:27009fe2735bf8723353582d48575b23c533cc2c2de7b5a68908d91b5eb18d08"},
{file = "idna-3.6-py3-none-any.whl", hash = "sha256:c05567e9c24a6b9faaa835c4821bad0590fbb9d5779e7caa6e1cc4978e7eb24f"},
{file = "idna-3.6.tar.gz", hash = "sha256:9ecdbbd083b06798ae1e86adcbfe8ab1479cf864e4ee30fe4e46a003d12491ca"},
]
[[package]]

View file

@ -22,6 +22,7 @@ yamllint = "^1.33.0"
[tool.djlint]
profile="jinja"
ignore="H006"
[build-system]
requires = ["poetry-core"]

View file

@ -17,9 +17,21 @@ app.config["DISCORD_BOT_TOKEN"] = config['discord']['bot_token']
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'])
@app.route("/me/")
@requires_authorization
def me():
return redirect(url_for(".index"))
@app.route("/login/")
def login():
return discord.create_session()
return discord.create_session(scope=['identify', 'guilds', 'guilds.members.read'])
@app.route("/logout/")
def logout():
@ -33,20 +45,8 @@ def callback():
@app.errorhandler(Unauthorized)
@app.errorhandler(AccessDenied)
def redirect_unauthorized(e):
def redirect_unauthorized():
return redirect(url_for(".index"))
@app.route("/")
def index():
if discord.authorized:
user = discord.fetch_user()
print(user.default_avatar_url, user.username, user.discriminator)
return render_template('index.html', name=config['name'], user=user)
return render_template('index.html', name=config['name'])
@app.route("/hello")
def hello():
return render_template('hello.html', name="Flask")
if __name__ == '__main__':
app.run(host="0.0.0.0", port=config['port'], debug=True)

View file

@ -1,9 +1,9 @@
body {
background-color: #2e3440;
color: #fff;
font-family: Arial, sans-serif;
background-color: #2e3440;
color: #fff;
font-family: Arial, sans-serif;
}
.txt-danger, .txt-danger:hover, .txt-danger:visited, .txt-danger:active {
color: #ff0000 !important;
color: #f00 !important;
}

View file

@ -1,20 +1,20 @@
@import url('../core.css');
#menu {
position: fixed;
left: 0;
top: 0;
bottom: 0;
width: 200px;
background-color: #3b4252;
padding: 20px;
position: fixed;
left: 0;
top: 0;
bottom: 0;
width: 200px;
background-color: #3b4252;
padding: 20px;
}
#menu ul {
list-style-type: none;
padding: 0;
list-style-type: none;
padding: 0;
}
#menu li {
margin-bottom: 10px;
margin-bottom: 10px;
}

View file

@ -1,42 +1,44 @@
.dropdown-content {
display: none;
position: relative;
background-color: #81B8F9;
margin-left: 10px;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
display: none;
position: relative;
background-color: #81B8F9;
margin-left: 10px;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgb(0, 0, 0 / 20%);
z-index: 1;
}
.dropdown-content a {
color: white;
padding: 12px 16px;
text-decoration: none;
display: block;
}
color: white;
padding: 12px 16px;
text-decoration: none;
display: block;
}
.dropdown-content a:hover {background-color: #7289da;}
#logout:hover .dropdown-content {display: block;}
.log-button {
background-color: #7289da;
color: #fff;
border: none;
padding: 3px 5px;
border-radius: 5px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
position: absolute;
right: 0;
margin-right: 20px;
}
.log-button:hover {background-color: #6C91F6;}
.log-button {
background-color: #7289da;
color: #fff;
border: none;
padding: 3px 5px;
border-radius: 5px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
position: absolute;
right: 0;
margin-right: 20px;
}
.log-button-icon {
border-radius: 50%;
width: 40px;
margin-right: 10px;
border-radius: 50%;
width: 40px;
height: 40px;
margin-right: 10px;
}

View file

@ -1,27 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ name }}</title>
<style>
body {
background-color: #36393f;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
h1 {
color: #ffffff;
font-size: 36px;
text-align: center;
}
</style>
</head>
<body>
<h1>{{ name }}</h1>
</body>
</html>

View file

@ -1,8 +1,10 @@
<!DOCTYPE html>
<html>
<html lang="en">
<head>
<title>Audit Log</title>
<link rel="stylesheet" href="{{url_for('static', filename='styles/pages/index.css')}}">
<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>
<div id="menu">
@ -10,6 +12,6 @@
<li>Audit Log</li>
</ul>
</div>
{% include 'utils/login-logout.html' %}
{% include "utils/login-logout.html" %}
</body>
</html>

View file

@ -1,18 +1,18 @@
<link rel="stylesheet" href="{{url_for('static', filename='styles/utils/login-logout.css')}}">
<link rel="stylesheet" href="{{ url_for('static', filename='styles/utils/login-logout.css') }}">
{% if not user %}
<div id="login">
<button id="discord-login" class="log-button" onclick="window.location.href='/login'">
<img src="{{url_for('static', filename='img/discord.svg')}}" alt="Log in with Discord" class="log-button-icon">
<img src="{{ url_for('static', filename='img/discord.svg') }}" alt="Log in with Discord" class="log-button-icon">
Log in with Discord
</button>
</div>
{% elif user %}
<div id = "logout">
<div id="logout">
<button id="discord-logout" class="log-button">
{% if user.avatar_url %}
<img src="{{user.avatar_url}}" alt="User Avatar" class="log-button-icon">
<img src="{{ user.avatar_url }}" alt="User Avatar" class="log-button-icon">
{% else %}
<img src="{{user.default_avatar_url}}" alt="User Avatar" class="log-button-icon">
<img src="{{ user.default_avatar_url }}" alt="User Avatar" class="log-button-icon">
{% endif %}
{% if user.discriminator != "0" %}
{{ user.username }}#{{ user.discriminator }}
@ -20,8 +20,8 @@
{{ user.username }}
{% endif %}
<div class="dropdown-content">
<a href="{{url_for('.index')}}">User Info</a>
<a href="{{url_for('.logout')}}" class="txt-danger">Log Out</a>
<a href="{{ url_for('.index') }}">User Info</a>
<a href="{{ url_for('.logout') }}" class="txt-danger">Log Out</a>
</div>
</button>
</div>