diff --git a/discord_rss_bot/static/styles.css b/discord_rss_bot/static/styles.css index c27b811..d10a205 100644 --- a/discord_rss_bot/static/styles.css +++ b/discord_rss_bot/static/styles.css @@ -10,5 +10,4 @@ body { .summary { max-height: 450px; overflow-y: auto -} - +} \ No newline at end of file diff --git a/discord_rss_bot/templates/add.html b/discord_rss_bot/templates/add.html index f11c0fb..1531fc9 100644 --- a/discord_rss_bot/templates/add.html +++ b/discord_rss_bot/templates/add.html @@ -1,5 +1,7 @@ {% extends "base.html" %} -{% block title %} | Add new feed{% endblock %} +{% block title %} + | Add new feed +{% endblock title %} {% block content %}
@@ -7,30 +9,35 @@
- +
-
- +
-
-
-{% endblock %} \ No newline at end of file +{% endblock content %} diff --git a/discord_rss_bot/templates/base.html b/discord_rss_bot/templates/base.html index 5f70645..680443e 100644 --- a/discord_rss_bot/templates/base.html +++ b/discord_rss_bot/templates/base.html @@ -1,47 +1,55 @@ - - - - - - - discord-rss-bot{% block title %}{% endblock %} - {% block head %}{% endblock %} - - -{% include "nav.html" %} -
-
-
- {% block content %}{% endblock %} - + + + + + + + + + discord-rss-bot + {% block title %} + {% endblock title %} + + {% block head %} + {% endblock head %} + + + {% include "nav.html" %} +
+
+
+ {% block content %} + {% endblock content %} + +
+
-
-
- - - \ No newline at end of file + + + diff --git a/discord_rss_bot/templates/blacklist.html b/discord_rss_bot/templates/blacklist.html index ebb6c26..349fc44 100644 --- a/discord_rss_bot/templates/blacklist.html +++ b/discord_rss_bot/templates/blacklist.html @@ -1,20 +1,21 @@ {% extends "base.html" %} -{% block title %} | Blacklist{% endblock %} +{% block title %} + | Blacklist +{% endblock title %} {% block content %}
-
    -
  • Comma separated list of words to blacklist. If a word is found in the +
  • + Comma separated list of words to blacklist. If a word is found in the corresponding blacklists, the feed will not be sent.
  • Whitelist always takes precedence over blacklist. Leave empty to disable.
  • Words are case-insensitive. No spaces should be used before or after the comma.
  • -
  • Correct: @@ -28,30 +29,40 @@
-
- - + - - + - - +
- - - +
-{% endblock %} \ No newline at end of file +{% endblock content %} diff --git a/discord_rss_bot/templates/custom.html b/discord_rss_bot/templates/custom.html index a905457..b8c2c2e 100644 --- a/discord_rss_bot/templates/custom.html +++ b/discord_rss_bot/templates/custom.html @@ -1,77 +1,241 @@ -{% extends "base.html" %}( -{% block title %} | Custom message{% endblock %} +{% extends "base.html" %} +{% block title %} + | Custom message +{% endblock title %} {% block content %}
-
  • You can modify the message that is sent to Discord.
  • -
    -
  • {% raw %}{{feed_url}}{% endraw %} will be replaced with the feed URL. You can use \n for new lines.
  • -
    -
  • {% raw %}{{feed_author}}{% endraw %} - {{feed.author}}
  • -
  • {% raw %}{{feed_added}}{% endraw %} - {{feed.added}}
  • -
  • {% raw %}{{feed_last_exception}}{% endraw %} - {{feed.last_exception}}
  • -
  • {% raw %}{{feed_last_updated}}{% endraw %} - {{feed.last_updated}}
  • -
  • {% raw %}{{feed_link}}{% endraw %} - {{feed.link}}
  • -
  • {% raw %}{{feed_subtitle}}{% endraw %} - {{feed.subtitle}}
  • -
  • {% raw %}{{feed_title}}{% endraw %} - {{feed.title}}
  • -
  • {% raw %}{{feed_updated}}{% endraw %} - {{feed.updated}}
  • -
  • {% raw %}{{feed_updates_enabled}}{% endraw %} - {{feed.updates_enabled}}
  • -
  • {% raw %}{{feed_url}}{% endraw %} - {{feed.url}}
  • -
  • {% raw %}{{feed_user_title}}{% endraw %} - {{feed.user_title}}
  • -
  • {% raw %}{{feed_version}}{% endraw %} - {{feed.version}}
  • -
    +
    +
  • + + {% raw %} + {{ feed_author }} + {% endraw %} + {{ feed.author }} +
  • +
  • + + {% raw %} + {{ feed_added }} + {% endraw %} + {{ feed.added }} +
  • +
  • + + {% raw %} + {{ feed_last_exception }} + {% endraw %} + {{ feed.last_exception }} +
  • +
  • + + {% raw %} + {{ feed_last_updated }} + {% endraw %} + {{ feed.last_updated }} +
  • +
  • + + {% raw %} + {{ feed_link }} + {% endraw %} + {{ feed.link }} +
  • +
  • + + {% raw %} + {{ feed_subtitle }} + {% endraw %} + {{ feed.subtitle }} +
  • +
  • + + {% raw %} + {{ feed_title }} + {% endraw %} + {{ feed.title }} +
  • +
  • + + {% raw %} + {{ feed_updated }} + {% endraw %} + {{ feed.updated }} +
  • +
  • + + {% raw %} + {{ feed_updates_enabled }} + {% endraw %} + {{ feed.updates_enabled }} +
  • +
  • + + {% raw %} + {{ feed_url }} + {% endraw %} + {{ feed.url }} +
  • +
  • + + {% raw %} + {{ feed_user_title }} + {% endraw %} + {{ feed.user_title }} +
  • +
  • + + {% raw %} + {{ feed_version }} + {% endraw %} + {{ feed.version }} +
  • +
    {% if entry %} -
  • {% raw %}{{entry_added}}{% endraw %} - {{entry.added}}
  • -
  • {% raw %}{{entry_author}}{% endraw %} - {{entry.author}}
  • -
  • {% raw %}{{entry_content}}{% endraw %} - {{entry.content[0].value|discord_markdown}}
  • -
  • {% raw %}{{entry_content_raw}}{% endraw %} - {{entry.content[0].value}}
  • -
  • {% raw %}{{entry_id}}{% endraw %} - {{entry.id}}
  • -
  • {% raw %}{{entry_important}}{% endraw %} - {{entry.important}}
  • -
  • {% raw %}{{entry_link}}{% endraw %} - {{entry.link}}
  • -
  • {% raw %}{{entry_published}}{% endraw %} - {{entry.published}}
  • -
  • {% raw %}{{entry_read}}{% endraw %} - {{entry.read}}
  • -
  • {% raw %}{{entry_read_modified}}{% endraw %} - {{entry.read_modified}}
  • -
  • {% raw %}{{entry_summary}}{% endraw %} - {{entry.summary|discord_markdown}}
  • -
  • {% raw %}{{entry_summary_raw}}{% endraw %} - {{entry.summary}}
  • -
  • {% raw %}{{entry_title}}{% endraw %} - {{entry.title}}
  • -
  • {% raw %}{{entry_updated}}{% endraw %} - {{entry.updated}}
  • - -
-
    -
  • Examples:
  • -
  • {% raw %}Hello {{entry_author}}\n{{feed_title}}\n{{entry_read}}{% endraw %}
  • -
    -
  • Will become:
  • -
  • - Hello {{entry.author}} - {{feed.title}} - {{entry.read}} -
  • -
+
  • + + {% raw %} + {{ entry_added }} + {% endraw %} + {{ entry.added }} +
  • +
  • + + {% raw %} + {{ entry_author }} + {% endraw %} + {{ entry.author }} +
  • +
  • + + {% raw %} + {{ entry_content }} + {% endraw %} + {{ entry.content[0].value|discord_markdown }} +
  • +
  • + + {% raw %} + {{ entry_content_raw }} + {% endraw %} + {{ entry.content[0].value }} +
  • +
  • + + {% raw %} + {{ entry_id }} + {% endraw %} + {{ entry.id }} +
  • +
  • + + {% raw %} + {{ entry_important }} + {% endraw %} + {{ entry.important }} +
  • +
  • + + {% raw %} + {{ entry_link }} + {% endraw %} + {{ entry.link }} +
  • +
  • + + {% raw %} + {{ entry_published }} + {% endraw %} + {{ entry.published }} +
  • +
  • + + {% raw %} + {{ entry_read }} + {% endraw %} + {{ entry.read }} +
  • +
  • + + {% raw %} + {{ entry_read_modified }} + {% endraw %} + {{ entry.read_modified }} +
  • +
  • + + {% raw %} + {{ entry_summary }} + {% endraw %} + {{ entry.summary|discord_markdown }} +
  • +
  • + + {% raw %} + {{ entry_summary_raw }} + {% endraw %} + {{ entry.summary }} +
  • +
  • + + {% raw %} + {{ entry_title }} + {% endraw %} + {{ entry.title }} +
  • +
  • + + {% raw %} + {{ entry_updated }} + {% endraw %} + {{ entry.updated }} +
  • + +
      +
    • Examples:
    • +
    • + + {% raw %} + Hello {{ entry_author }}\n{{ feed_title }}\n{{ entry_read }} + {% endraw %} + +
    • +
      +
    • Will become:
    • +
    • + +
      +Hello {{ entry.author }}
      +{{ feed.title }}
      +{{ entry.read }}
      +                            
      +
      +
    • +
    {% else %} - Something went wrong, there was no entry found. If this feed has entries and you still see this message, please contact the developer. + Something went wrong, there was no entry found. If this feed has entries and you still see this message, please contact the developer. {% endif %}
    - - +
    - - - +
    -{% endblock %} \ No newline at end of file +{% endblock content %} diff --git a/discord_rss_bot/templates/feed.html b/discord_rss_bot/templates/feed.html index 402ef3f..bacb4fe 100644 --- a/discord_rss_bot/templates/feed.html +++ b/discord_rss_bot/templates/feed.html @@ -1,26 +1,27 @@ {% extends "base.html" %} -{% block title %} | {{ feed.title }}{% endblock %} +{% block title %} + | {{ feed.title }} +{% endblock title %} {% block content %}
    -

    {{ feed.title }}

    - +

    + {{ feed.title }} +

    {% if not feed.updates_enabled %}Disabled{% endif %} - {% if feed.last_exception %} -

    {{ feed.last_exception.type_name }}:

    - {{ feed.last_exception.value_str }} - -
    {{ feed.last_exception.traceback_str }}
    - +

    {{ feed.last_exception.type_name }}:

    + {{ feed.last_exception.value_str }} +
    {{ feed.last_exception.traceback_str }}
    {% endif %} -
    -
    - {% if not feed.updates_enabled %}
    @@ -30,46 +31,30 @@
    {% endif %} - Whitelist - Blacklist + Whitelist + Blacklist Custom message -
    {% for entry in entries %}
    - {% if entry|entry_is_blacklisted %} - Blacklisted - {% endif %} - {% if entry|entry_is_whitelisted %} - Whitelisted - {% endif %} - + {% if entry|entry_is_blacklisted %}Blacklisted{% endif %} + {% if entry|entry_is_whitelisted %}Whitelisted{% endif %}

    - - {{ entry.title }} - + {{ entry.title }}

    - {% if entry.author %} - By {{ entry.author }} @ - {% endif %} + {% if entry.author %}By {{ entry.author }} @{% endif %} {% if entry.published %} {{ entry.published.strftime('%Y-%m-%d, %T') }} {% endif %} - - {% if entry.summary%} -
    - {{ entry.summary|discord_markdown }} -
    + {% if entry.summary %} +
    {{ entry.summary|discord_markdown }}
    {% elif entry.content[0].value %} -
    - {{ entry.content[0].value|discord_markdown }} -
    +
    {{ entry.content[0].value|discord_markdown }}
    {% else %} -
    - No content available. -
    +
    No content available.
    {% endif %} -
    {% endfor %} -{% endblock %} +{% endblock content %} diff --git a/discord_rss_bot/templates/index.html b/discord_rss_bot/templates/index.html index 625f1b1..fc84023 100644 --- a/discord_rss_bot/templates/index.html +++ b/discord_rss_bot/templates/index.html @@ -9,67 +9,62 @@ {% if feed_count.broken %} - - + - {% else %} - - + - {% endif %} - {{ feed_count.broken }} broken - - - - {% if feed_count.total != feed_count.updates_enabled %} + {{ feed_count.broken }} broken + + + + {% if feed_count.total != feed_count.updates_enabled %} - - {% else %} + {% else %} - - {% endif %} - {{ feed_count.updates_enabled }} enabled - - - - - {{ entry_count.total }} entries - - ({{ entry_count.averages[0]|round(1) }}, - {{ entry_count.averages[1]|round(1) }}, - {{ entry_count.averages[2]|round(1) }}) - -

    - - - {% for hook_from_context in webhooks %} -
    - -
    + {% endif %} + {{ feed_count.updates_enabled }} enabled
    + + - {{ entry_count.total }} entries + + ({{ entry_count.averages[0]|round(1) }}, + {{ entry_count.averages[1]|round(1) }}, + {{ entry_count.averages[2]|round(1) }}) + +

    + + {% for hook_from_context in webhooks %} +
    + +
    + {% endfor %} +{% else %} +

    + No feeds yet. Add one here. +

    +{% endif %} + +{% if broken_feeds %} +
    +
      + Feeds without webhook: + {% for broken_feed in broken_feeds %} + {{ broken_feed.url }} {% endfor %} - {% else %} -

      - No feeds yet. Add one here. -

      - {% endif %} - - - {% if broken_feeds %} -
      - -
      - {% endif %} -
    -{% endblock %} \ No newline at end of file + +
    +{% endif %} + +{% endblock content %} diff --git a/discord_rss_bot/templates/nav.html b/discord_rss_bot/templates/nav.html index 50cd403..12061ef 100644 --- a/discord_rss_bot/templates/nav.html +++ b/discord_rss_bot/templates/nav.html @@ -1,6 +1,9 @@ \ No newline at end of file + diff --git a/discord_rss_bot/templates/search.html b/discord_rss_bot/templates/search.html index 99be792..0694a55 100644 --- a/discord_rss_bot/templates/search.html +++ b/discord_rss_bot/templates/search.html @@ -1,8 +1,10 @@ {% extends "base.html" %} -{% block title %} | Search{% endblock %} +{% block title %} + | Search +{% endblock title %} {% block content %}
    Your search for "{{ query }}" returned {{ search_amount.total }} results.
    {{ search_html | safe }} -{% endblock %} \ No newline at end of file +{% endblock content %} diff --git a/discord_rss_bot/templates/webhooks.html b/discord_rss_bot/templates/webhooks.html index fc25632..479e40a 100644 --- a/discord_rss_bot/templates/webhooks.html +++ b/discord_rss_bot/templates/webhooks.html @@ -1,5 +1,7 @@ {% extends "base.html" %} -{% block title %} | Add new webhook{% endblock %} +{% block title %} + | Add new webhook +{% endblock title %} {% block content %}
    @@ -7,27 +9,28 @@
    - + placeholder="TheLovinator #RSS"/>
    - {# Webhook URL #}
    - + placeholder="https://discord.com/api/webhooks/1011224189471124054/CQMa4hJN4gz..."/>
    - {# Submit button #}
    - -{% endblock %} \ No newline at end of file +{% endblock content %} diff --git a/discord_rss_bot/templates/whitelist.html b/discord_rss_bot/templates/whitelist.html index d28e825..f102ee9 100644 --- a/discord_rss_bot/templates/whitelist.html +++ b/discord_rss_bot/templates/whitelist.html @@ -1,20 +1,21 @@ {% extends "base.html" %} -{% block title %} | Blacklist{% endblock %} +{% block title %} + | Blacklist +{% endblock title %} {% block content %}
    -
      -
    • Comma separated list of words to whitelist. Only send message to +
    • + Comma separated list of words to whitelist. Only send message to Discord if one of these words are present in the corresponding fields.
    • Whitelist always takes precedence over blacklist. Leave empty to disable.
    • Words are case-insensitive. No spaces should be used before or after the comma.
    • -
    • Correct: @@ -29,28 +30,33 @@
    - - - + - - + - +
    - - - +
    -{% endblock %} \ No newline at end of file +{% endblock content %} diff --git a/pyproject.toml b/pyproject.toml index 5fc3c10..c8edabf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,3 +32,9 @@ profile = "black" [tool.black] line-length = 120 target-version = ["py311"] + +[tool.djlint] +ignore = "D018,J018" +profile = "jinja" +max_line_length = 120 +format_attribute_template_tags = true