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 requests
|
||||||
import urllib3
|
import urllib3
|
||||||
|
from app import app
|
||||||
from sqlalchemy import or_, and_
|
from sqlalchemy import or_, and_
|
||||||
|
|
||||||
from app.markdown import get_links, render_markdown
|
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]:
|
def _check_for_dead_links(package: Package) -> dict[str, str]:
|
||||||
|
ignored_urls = set(app.config.get("LINK_CHECKER_IGNORED_URLS", ""))
|
||||||
|
|
||||||
links: set[Optional[str]] = {
|
links: set[Optional[str]] = {
|
||||||
package.repo,
|
package.repo,
|
||||||
package.website,
|
package.website,
|
||||||
@ -150,6 +153,9 @@ def _check_for_dead_links(package: Package) -> dict[str, str]:
|
|||||||
if url.scheme != "http" and url.scheme != "https":
|
if url.scheme != "http" and url.scheme != "https":
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if url.hostname in ignored_urls:
|
||||||
|
continue
|
||||||
|
|
||||||
res = _url_exists(link)
|
res = _url_exists(link)
|
||||||
if res != "":
|
if res != "":
|
||||||
bad_urls[link] = res
|
bad_urls[link] = res
|
||||||
|
@ -37,6 +37,7 @@ TEMPLATES_AUTO_RELOAD = False
|
|||||||
LOG_SQL = False
|
LOG_SQL = False
|
||||||
|
|
||||||
BLOCKED_DOMAINS = []
|
BLOCKED_DOMAINS = []
|
||||||
|
LINK_CHECKER_IGNORED_URLS = ["liberapay.com"]
|
||||||
|
|
||||||
ADMIN_CONTACT_URL = ""
|
ADMIN_CONTACT_URL = ""
|
||||||
MONITORING_URL = None
|
MONITORING_URL = None
|
||||||
|
Loading…
Reference in New Issue
Block a user