diff --git a/app/tasks/pkgtasks.py b/app/tasks/pkgtasks.py index 4f902d0d..4dce26ef 100644 --- a/app/tasks/pkgtasks.py +++ b/app/tasks/pkgtasks.py @@ -24,6 +24,7 @@ from typing import Optional import requests import urllib3 +from app import app from sqlalchemy import or_, and_ from app.markdown import get_links, render_markdown @@ -125,6 +126,8 @@ def _url_exists(url: str) -> str: def _check_for_dead_links(package: Package) -> dict[str, str]: + ignored_urls = set(app.config.get("LINK_CHECKER_IGNORED_URLS", "")) + links: set[Optional[str]] = { package.repo, package.website, @@ -150,6 +153,9 @@ def _check_for_dead_links(package: Package) -> dict[str, str]: if url.scheme != "http" and url.scheme != "https": continue + if url.hostname in ignored_urls: + continue + res = _url_exists(link) if res != "": bad_urls[link] = res diff --git a/config.example.cfg b/config.example.cfg index 56a5c8c7..92708711 100644 --- a/config.example.cfg +++ b/config.example.cfg @@ -37,6 +37,7 @@ TEMPLATES_AUTO_RELOAD = False LOG_SQL = False BLOCKED_DOMAINS = [] +LINK_CHECKER_IGNORED_URLS = ["liberapay.com"] ADMIN_CONTACT_URL = "" MONITORING_URL = None