linter fixes
This commit is contained in:
parent
a13dba19ad
commit
451f436a58
12 changed files with 90 additions and 100 deletions
6
.forgejo/workflows/config/.pylintrc
Normal file
6
.forgejo/workflows/config/.pylintrc
Normal file
|
@ -0,0 +1,6 @@
|
|||
[MESSAGES CONTROL]
|
||||
disable=
|
||||
missing-module-docstring,
|
||||
missing-function-docstring,
|
||||
missing-class-docstring,
|
||||
line-too-long
|
|
@ -1,5 +1,11 @@
|
|||
extends: default
|
||||
|
||||
rules:
|
||||
- line-length:
|
||||
max: 120
|
||||
- document-start: disable
|
||||
- truthy: disable
|
||||
|
||||
ignore:
|
||||
- node_modules/
|
||||
- __pycache__/
|
||||
|
|
|
@ -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
6
poetry.lock
generated
|
@ -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]]
|
||||
|
|
|
@ -22,6 +22,7 @@ yamllint = "^1.33.0"
|
|||
|
||||
[tool.djlint]
|
||||
profile="jinja"
|
||||
ignore="H006"
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core"]
|
||||
|
|
28
src/main.py
28
src/main.py
|
@ -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)
|
||||
|
|
|
@ -5,5 +5,5 @@ body {
|
|||
}
|
||||
|
||||
.txt-danger, .txt-danger:hover, .txt-danger:visited, .txt-danger:active {
|
||||
color: #ff0000 !important;
|
||||
color: #f00 !important;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
background-color: #81B8F9;
|
||||
margin-left: 10px;
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -19,8 +19,6 @@
|
|||
|
||||
#logout:hover .dropdown-content {display: block;}
|
||||
|
||||
.log-button:hover {background-color: #6C91F6;}
|
||||
|
||||
.log-button {
|
||||
background-color: #7289da;
|
||||
color: #fff;
|
||||
|
@ -35,8 +33,12 @@
|
|||
right: 0;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.log-button:hover {background-color: #6C91F6;}
|
||||
|
||||
.log-button-icon {
|
||||
border-radius: 50%;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
|
|
@ -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>
|
|
@ -1,7 +1,9 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>Audit Log</title>
|
||||
<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>
|
||||
|
@ -10,6 +12,6 @@
|
|||
<li>Audit Log</li>
|
||||
</ul>
|
||||
</div>
|
||||
{% include 'utils/login-logout.html' %}
|
||||
{% include "utils/login-logout.html" %}
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in a new issue