From 67eff0a854da010cb6ecd119d84238ec3e119272 Mon Sep 17 00:00:00 2001 From: Dennis Fink Date: Sun, 9 Aug 2026 14:15:29 +0200 Subject: Implement received Webmention handling Add the Flask application setup, database models and migrations, authentication, and configuration for development and testing. Implement asynchronous Webmention verification with Huey, including HTML and plain-text source validation, retries, status tracking, and size limits. Add status, login, and paginated received-Webmention views together with comprehensive tests for forms, views, and receiver tasks. --- webmentions_ssg/templates/base.html | 44 +++++++++++++++++++++ webmentions_ssg/templates/login.html | 8 ++++ webmentions_ssg/templates/received.html | 69 +++++++++++++++++++++++++++++++++ webmentions_ssg/templates/status.html | 64 ++++++++++++++++++++++++++++++ 4 files changed, 185 insertions(+) create mode 100644 webmentions_ssg/templates/base.html create mode 100644 webmentions_ssg/templates/login.html create mode 100644 webmentions_ssg/templates/received.html create mode 100644 webmentions_ssg/templates/status.html (limited to 'webmentions_ssg/templates') diff --git a/webmentions_ssg/templates/base.html b/webmentions_ssg/templates/base.html new file mode 100644 index 0000000..237a437 --- /dev/null +++ b/webmentions_ssg/templates/base.html @@ -0,0 +1,44 @@ +{% from "bootstrap5/utils.html" import render_messages %} + + + + {% block head %} + + + + {% block styles %} + + {{ bootstrap.load_css() }} + {% endblock %} + {{ title }} + {% endblock %} + + +
+ +
+
{{ render_messages(container=True) }}
+
+ {% block content %} + {% endblock %} +
+ {% block scripts %} + + {{ bootstrap.load_js() }} + {% endblock %} + + diff --git a/webmentions_ssg/templates/login.html b/webmentions_ssg/templates/login.html new file mode 100644 index 0000000..e7d858c --- /dev/null +++ b/webmentions_ssg/templates/login.html @@ -0,0 +1,8 @@ +{% extends "base.html" %} +{% set title = "Login" %} +{% from "bootstrap5/form.html" import render_form %} +{% block content %} +
+
{{ render_form(form) }}
+
+{% endblock %} diff --git a/webmentions_ssg/templates/received.html b/webmentions_ssg/templates/received.html new file mode 100644 index 0000000..ea74557 --- /dev/null +++ b/webmentions_ssg/templates/received.html @@ -0,0 +1,69 @@ +{% extends "base.html" %} +{% from "bootstrap5/pagination.html" import render_pagination %} +{% block content %} +
+

Received Webmentions

+ {{ webmentions.total }} total +
+ {% if webmentions.items %} +
+ + + + + + + + + + + + + {% for webmention in webmentions %} + {% if webmention.status == "verified" %} + {% set row_class = "table-success" %} + {% set display_status = "Verified" %} + {% elif webmention.status in ("received", "verifying") %} + {% set row_class = "table-warning" %} + {% set display_status = "Pending" %} + {% else %} + {% set row_class = "table-danger" %} + {% set display_status = "Declined" %} + {% endif %} + + + + + + + + + {% endfor %} + +
StatusSourceTargetReceivedUpdatedReason
+ {{ display_status }} + + {{ webmention.source }} + + {{ webmention.target }} + + + + + {{ webmention.failure_reason or "—" }}
+
+ {% if webmentions.pages > 1 %} +
+ {{ render_pagination(webmentions, + align="center", + size="sm") }} +
+ {% endif %} + {% else %} +

No Webmentions have been received yet.

+ {% endif %} +{% endblock %} diff --git a/webmentions_ssg/templates/status.html b/webmentions_ssg/templates/status.html new file mode 100644 index 0000000..451f26f --- /dev/null +++ b/webmentions_ssg/templates/status.html @@ -0,0 +1,64 @@ +{% extends "base.html" %} +{% from "bootstrap5/utils.html" import render_icon %} +{% block content %} +
+
+ {% if webmention.status == "verified" %} +
{{ render_icon("check-circle-fill", size="5rem", title="Verified") }}
+

Webmention verified

+ {% elif webmention.status in ("received", "verifying") %} +
{{ render_icon("hourglass-split", size="5rem", title="Verification pending") }}
+

Webmention verification pending

+ {% elif webmention.status == "deleted" %} +
{{ render_icon("x-circle-fill", size="5rem", title="Not verified") }}
+

Webmention not verified

+ {% elif webmention.status == "failed" %} +
{{ render_icon("x-circle-fill", size="5rem", title="Verification failed") }}
+

Webmention verification failed

+ {% else %} +
{{ render_icon("question-circle-fill", size="5rem", title="Unknown status") }}
+

Unknown Webmention status

+ {% endif %} +
+
+
+
+
Status
+
+ {{ webmention.status }} +
+
Source
+
+ {{ webmention.source }} +
+
Target
+
+ {{ webmention.target }} +
+
Received
+
+ +
+
Last updated
+
+ +
+
ID
+
+ {{ webmention.uuid }} +
+ {% if webmention.failure_reason %} +
Reason
+
+ {{ webmention.failure_reason }} +
+ {% endif %} +
+
+
+
+{% endblock %} -- cgit v1.3.1