Use Ruff and fix all its warnings and errors

This commit is contained in:
2023-03-18 01:50:45 +01:00
parent 15284c5646
commit 948a5a2af9
27 changed files with 504 additions and 313 deletions

View File

@ -1,36 +1,42 @@
{% extends "base.html" %}
{% block title %}
| Add new webhook
| Add new webhook
{% endblock title %}
{% block content %}
<div class="p-2 border border-dark">
<form action="/add_webhook" method="post">
{# Webhook name #}
<div class="row pb-2">
<label for="webhook_name" class="col-sm-2 col-form-label">Webhook Name</label>
<div class="col-sm-10">
<input name="webhook_name"
type="text"
class="form-control bg-dark border-dark text-muted"
id="webhook_name"
placeholder="TheLovinator #RSS"/>
</div>
</div>
{# Webhook URL #}
<div class="row pb-2">
<label for="webhook_url" class="col-sm-2 col-form-label">Webhook URL</label>
<div class="col-sm-10">
<input name="webhook_url"
type="text"
class="form-control bg-dark border-dark text-muted"
id="webhook_url"
placeholder="https://discord.com/api/webhooks/1011224189471124054/CQMa4hJN4gz"/>
</div>
</div>
{# Submit button #}
<div class="d-md-flex">
<button class="btn btn-dark btn-sm">Add webhook</button>
</div>
</form>
</div>
<div class="p-2 border border-dark">
<form action="/add_webhook" method="post">
{# Webhook name #}
<div class="row pb-2">
<label for="webhook_name" class="col-sm-2 col-form-label">
Webhook Name
</label
>
<div class="col-sm-10">
<input name="webhook_name"
type="text"
class="form-control bg-dark border-dark text-muted"
id="webhook_name"
placeholder="TheLovinator #RSS"/>
</div>
</div>
{# Webhook URL #}
<div class="row pb-2">
<label for="webhook_url" class="col-sm-2 col-form-label">
Webhook URL
</label
>
<div class="col-sm-10">
<input name="webhook_url"
type="text"
class="form-control bg-dark border-dark text-muted"
id="webhook_url"
placeholder="https://discord.com/api/webhooks/1011224189471124054/CQMa4hJN4gz"/>
</div>
</div>
{# Submit button #}
<div class="d-md-flex">
<button class="btn btn-dark btn-sm">Add webhook</button>
</div>
</form>
</div>
{% endblock content %}

View File

@ -11,209 +11,215 @@
<div class="form-text">
<ul class="list-inline">
<li>You can modify the message that is sent to Discord.</li>
<li> You can use \n to create a new line.</li>
<li> You can remove the embed from links by adding < and > around the link. (For example <{% raw %}{{entry_link}}{% endraw %}>)</li>
<li>You can use \n to create a new line.</li>
<li>
You can remove the embed from links by adding < and > around the link. (For example <
{% raw %}
{{ entry_link }}
{% endraw %}
>)
</li>
<br/>
<li>
<code>
{% raw %}
{{feed_author}}
{{ feed_author }}
{% endraw %}
</code>{{feed.author}}
</code>{{ feed.author }}
</li>
<li>
<code>
{% raw %}
{{feed_added}}
{{ feed_added }}
{% endraw %}
</code>{{feed.added}}
</code>{{ feed.added }}
</li>
<li>
<code>
{% raw %}
{{feed_last_exception}}
{{ feed_last_exception }}
{% endraw %}
</code>{{feed.last_exception}}
</code>{{ feed.last_exception }}
</li>
<li>
<code>
{% raw %}
{{feed_last_updated}}
{{ feed_last_updated }}
{% endraw %}
</code>{{feed.last_updated}}
</code>{{ feed.last_updated }}
</li>
<li>
<code>
{% raw %}
{{feed_link}}
{{ feed_link }}
{% endraw %}
</code>{{feed.link}}
</code>{{ feed.link }}
</li>
<li>
<code>
{% raw %}
{{feed_subtitle}}
{{ feed_subtitle }}
{% endraw %}
</code>{{feed.subtitle}}
</code>{{ feed.subtitle }}
</li>
<li>
<code>
{% raw %}
{{feed_title}}
{{ feed_title }}
{% endraw %}
</code>{{feed.title}}
</code>{{ feed.title }}
</li>
<li>
<code>
{% raw %}
{{feed_updated}}
{{ feed_updated }}
{% endraw %}
</code>{{feed.updated}}
</code>{{ feed.updated }}
</li>
<li>
<code>
{% raw %}
{{feed_updates_enabled}}
{{ feed_updates_enabled }}
{% endraw %}
</code>{{feed.updates_enabled}}
</code>{{ feed.updates_enabled }}
</li>
<li>
<code>
{% raw %}
{{feed_url}}
{{ feed_url }}
{% endraw %}
</code>{{feed.url}}
</code>{{ feed.url }}
</li>
<li>
<code>
{% raw %}
{{feed_user_title}}
{{ feed_user_title }}
{% endraw %}
</code>{{feed.user_title}}
</code>{{ feed.user_title }}
</li>
<li>
<code>
{% raw %}
{{feed_version}}
{{ feed_version }}
{% endraw %}
</code>{{feed.version}}
</code>{{ feed.version }}
</li>
<br/>
{% if entry %}
<li>
<code>
{% raw %}
{{entry_added}}
{{ entry_added }}
{% endraw %}
</code>{{entry.added}}
</code>{{ entry.added }}
</li>
<li>
<code>
{% raw %}
{{entry_author}}
{{ entry_author }}
{% endraw %}
</code>{{entry.author}}
</code>{{ entry.author }}
</li>
{% if entry.content %}
<li>
<code>
{% raw %}
{{entry_content}}
{% endraw %}
</code>{{entry.content[0].value|discord_markdown}}
</li>
<li>
<code>
{% raw %}
{{entry_content_raw}}
{% endraw %}
</code>{{entry.content[0].value}}
</li>
<li>
<code>
{% raw %}
{{ entry_content }}
{% endraw %}
</code>{{ entry.content[0].value|discord_markdown }}
</li>
<li>
<code>
{% raw %}
{{ entry_content_raw }}
{% endraw %}
</code>{{ entry.content[0].value }}
</li>
{% endif %}
<li>
<code>
{% raw %}
{{entry_id}}
{{ entry_id }}
{% endraw %}
</code>{{entry.id}}
</code>{{ entry.id }}
</li>
<li>
<code>
{% raw %}
{{entry_important}}
{{ entry_important }}
{% endraw %}
</code>{{entry.important}}
</code>{{ entry.important }}
</li>
<li>
<code>
{% raw %}
{{entry_link}}
{{ entry_link }}
{% endraw %}
</code>{{entry.link}}
</code>{{ entry.link }}
</li>
<li>
<code>
{% raw %}
{{entry_published}}
{{ entry_published }}
{% endraw %}
</code>{{entry.published}}
</code>{{ entry.published }}
</li>
<li>
<code>
{% raw %}
{{entry_read}}
{{ entry_read }}
{% endraw %}
</code>{{entry.read}}
</code>{{ entry.read }}
</li>
<li>
<code>
{% raw %}
{{entry_read_modified}}
{{ entry_read_modified }}
{% endraw %}
</code>{{entry.read_modified}}
</code>{{ entry.read_modified }}
</li>
{% if entry.summary %}
<li>
<code>
{% raw %}
{{entry_summary}}
{% endraw %}
</code>{{entry.summary|discord_markdown}}
</li>
<li>
<code>
{% raw %}
{{entry_summary_raw}}
{% endraw %}
</code>{{entry.summary}}
</li>
<li>
<code>
{% raw %}
{{ entry_summary }}
{% endraw %}
</code>{{ entry.summary|discord_markdown }}
</li>
<li>
<code>
{% raw %}
{{ entry_summary_raw }}
{% endraw %}
</code>{{ entry.summary }}
</li>
{% endif %}
<li>
<code>
{% raw %}
{{entry_title}}
{{ entry_title }}
{% endraw %}
</code>{{entry.title}}
</code>{{ entry.title }}
</li>
<li>
<code>
{% raw %}
{{entry_text}}
{{ entry_text }}
{% endraw %}
</code> Same as entry_content if it exists, otherwise entry_summary
</li>
<li>
<code>
{% raw %}
{{entry_updated}}
{{ entry_updated }}
{% endraw %}
</code>{{entry.updated}}
</code>{{ entry.updated }}
</li>
<br/>
<li>
<code>
{% raw %}
{{image_1}}
{{ image_1 }}
{% endraw %}
</code>First image in the entry if it exists
</li>
@ -223,7 +229,7 @@
<li>
<code>
{% raw %}
{{feed_title}}\n{{entry_content}}
{{ feed_title }}\n{{ entry_content }}
{% endraw %}
</code>
</li>
@ -238,12 +244,12 @@
class="form-control bg-dark border-dark text-muted"
id="custom_message"
{% if custom_message %}
value="{{- custom_message -}}"
value="{{- custom_message -}}"
{% endif %}/>
</div>
</div>
<!-- Add a hidden feed_url field to the form -->
<input type="hidden" name="feed_url" value="{{feed.url}}"/>
<input type="hidden" name="feed_url" value="{{ feed.url }}"/>
<!-- Submit button -->
<div class="d-md-flex">
<button class="btn btn-dark btn-sm">Update message</button>

View File

@ -10,8 +10,19 @@
<br/>
{% for hook in hooks_with_data %}
<div class="p-2 border border-dark text-muted">
<img src="https://cdn.discordapp.com/avatars/{{ hook.id }}/{{ hook.avatar }}.webp"
class="img-thumbnail">
{% if hook.avatar is not none %}
<img src="https://cdn.discordapp.com/avatars/{{ hook.id }}/{{ hook.avatar }}.webp"
class="img-thumbnail"
height="128"
width="128"
alt="Webhook avatar"/>
{% else %}
<img src="https://cdn.discordapp.com/embed/avatars/{{ hook.avatar_mod }}.png"
class="img-thumbnail"
height="128"
width="128"
alt="Default Discord avatar"/>
{% endif %}
<h3>{{ hook.custom_name }}</h3>
<li>
<strong>Name</strong>: {{ hook.name }}
@ -23,13 +34,13 @@
<strong>Guild ID</strong>: {{ hook.guild_id }}
</li>
<li>
<strong>Webhook ID</strong>: {{ hook.id }}
<strong>Webhook ID</strong>: {{ hook.webhook_id }}
</li>
<li>
<strong>Webhook token</strong>: {{ hook.token }}
</li>
<li>
<strong>Webhook type</strong>: {{ hook.type }}
<strong>Webhook type</strong>: {{ hook.webhook_type }}
</li>
<li>
<strong>Webhook URL</strong>: <a href="{{ hook.url }}">{{ hook.url }}</a>