mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-22 05:52:24 +01:00
Add LINK_CHECKER_IGNORED_URLS setting
This commit is contained in:
parent
06979345c7
commit
ef868f776c
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user