From a285fdf29e59c3b957247ea9241943c7202e9a28 Mon Sep 17 00:00:00 2001 From: Dennis Fink Date: Fri, 13 Nov 2026 21:20:40 +0100 Subject: refactor(core): consolidate repeated helper logic Centralize SQL row counts, hostname parsing, and content-type normalization so tasks, forms, and scanners share consistent implementations. Simplify periodic task registration and admin lookups with table-driven setup and Flask-SQLAlchemy's built-in 404 helper. --- webmentions_ssg/tasks/source_parser.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'webmentions_ssg/tasks/source_parser.py') diff --git a/webmentions_ssg/tasks/source_parser.py b/webmentions_ssg/tasks/source_parser.py index 9cbe071..294402c 100644 --- a/webmentions_ssg/tasks/source_parser.py +++ b/webmentions_ssg/tasks/source_parser.py @@ -11,14 +11,14 @@ from fnmatch import fnmatchcase from itertools import chain from pathlib import Path from typing import Any -from urllib.parse import quote, urldefrag, urljoin, urlsplit +from urllib.parse import quote, urldefrag, urljoin import mf2py import xxhash from bs4 import BeautifulSoup, Tag from bs4.element import NavigableString, PageElement -from ..net import is_http_url +from ..net import hostname_of, is_http_url REACTION_PROPERTIES = ("in-reply-to", "like-of", "repost-of", "bookmark-of") @@ -283,7 +283,7 @@ def iter_targets( for value in chain(hrefs, reactions): target = normalize_target(value, base_url=base_url, source_url=source_url) if target is not None: - hostname = (urlsplit(target).hostname or "").rstrip(".") + hostname = hostname_of(target) or "" if not any(fnmatchcase(hostname, pattern) for pattern in ignored_hostnames): yield target -- cgit v1.3.1