Skip to content

Commit

Permalink
Add LINK_CHECKER_IGNORED_URLS setting
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenwardy committed Jul 29, 2024
1 parent 0697934 commit ef868f7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/tasks/pkgtasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

import requests
import urllib3
from app import app
from sqlalchemy import or_, and_

from app.markdown import get_links, render_markdown
Expand Down Expand Up @@ -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,
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions config.example.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit ef868f7

Please sign in to comment.