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 extends: default
rules:
- line-length:
max: 120
- document-start: disable
- truthy: disable
ignore: ignore:
- node_modules/ - node_modules/
- __pycache__/ - __pycache__/

View file

@ -27,7 +27,7 @@ jobs:
- name: Analyzing Python files with Pylint - name: Analyzing Python files with Pylint
run: | run: |
export PATH="$HOME/.local/bin:$PATH" 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 - name: Analyzing HTML templates with djLint
if: ${{ !cancelled() }} if: ${{ !cancelled() }}
run: | run: |

6
poetry.lock generated
View file

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

View file

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

View file

@ -17,9 +17,21 @@ app.config["DISCORD_BOT_TOKEN"] = config['discord']['bot_token']
discord = DiscordOAuth2Session(app) 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/") @app.route("/login/")
def login(): def login():
return discord.create_session() return discord.create_session(scope=['identify', 'guilds', 'guilds.members.read'])
@app.route("/logout/") @app.route("/logout/")
def logout(): def logout():
@ -33,20 +45,8 @@ def callback():
@app.errorhandler(Unauthorized) @app.errorhandler(Unauthorized)
@app.errorhandler(AccessDenied) @app.errorhandler(AccessDenied)
def redirect_unauthorized(e): def redirect_unauthorized():
return redirect(url_for(".index")) 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__': if __name__ == '__main__':
app.run(host="0.0.0.0", port=config['port'], debug=True) app.run(host="0.0.0.0", port=config['port'], debug=True)

View file

@ -5,5 +5,5 @@ body {
} }
.txt-danger, .txt-danger:hover, .txt-danger:visited, .txt-danger:active { .txt-danger, .txt-danger:hover, .txt-danger:visited, .txt-danger:active {
color: #ff0000 !important; color: #f00 !important;
} }

View file

@ -4,23 +4,21 @@
background-color: #81B8F9; background-color: #81B8F9;
margin-left: 10px; margin-left: 10px;
min-width: 160px; min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); box-shadow: 0px 8px 16px 0px rgb(0, 0, 0 / 20%);
z-index: 1; z-index: 1;
} }
.dropdown-content a { .dropdown-content a {
color: white; color: white;
padding: 12px 16px; padding: 12px 16px;
text-decoration: none; text-decoration: none;
display: block; display: block;
} }
.dropdown-content a:hover {background-color: #7289da;} .dropdown-content a:hover {background-color: #7289da;}
#logout:hover .dropdown-content {display: block;} #logout:hover .dropdown-content {display: block;}
.log-button:hover {background-color: #6C91F6;}
.log-button { .log-button {
background-color: #7289da; background-color: #7289da;
color: #fff; color: #fff;
@ -35,8 +33,12 @@
right: 0; right: 0;
margin-right: 20px; margin-right: 20px;
} }
.log-button:hover {background-color: #6C91F6;}
.log-button-icon { .log-button-icon {
border-radius: 50%; border-radius: 50%;
width: 40px; width: 40px;
height: 40px;
margin-right: 10px; 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> <!DOCTYPE html>
<html> <html lang="en">
<head> <head>
<title>Audit Log</title> <title>Discord Event Log</title>
<link rel="stylesheet" href="{{url_for('static', filename='styles/pages/index.css')}}"> <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> </head>
<body> <body>
<div id="menu"> <div id="menu">
@ -10,6 +12,6 @@
<li>Audit Log</li> <li>Audit Log</li>
</ul> </ul>
</div> </div>
{% include 'utils/login-logout.html' %} {% include "utils/login-logout.html" %}
</body> </body>
</html> </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 %} {% if not user %}
<div id="login"> <div id="login">
<button id="discord-login" class="log-button" onclick="window.location.href='/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 Log in with Discord
</button> </button>
</div> </div>
{% elif user %} {% elif user %}
<div id = "logout"> <div id="logout">
<button id="discord-logout" class="log-button"> <button id="discord-logout" class="log-button">
{% if user.avatar_url %} {% 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 %} {% 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 %} {% endif %}
{% if user.discriminator != "0" %} {% if user.discriminator != "0" %}
{{ user.username }}#{{ user.discriminator }} {{ user.username }}#{{ user.discriminator }}
@ -20,8 +20,8 @@
{{ user.username }} {{ user.username }}
{% endif %} {% endif %}
<div class="dropdown-content"> <div class="dropdown-content">
<a href="{{url_for('.index')}}">User Info</a> <a href="{{ url_for('.index') }}">User Info</a>
<a href="{{url_for('.logout')}}" class="txt-danger">Log Out</a> <a href="{{ url_for('.logout') }}" class="txt-danger">Log Out</a>
</div> </div>
</button> </button>
</div> </div>