diff --git a/shelfmark/core/mirrors.py b/shelfmark/core/mirrors.py index 15fe783c..257637ec 100644 --- a/shelfmark/core/mirrors.py +++ b/shelfmark/core/mirrors.py @@ -107,17 +107,24 @@ def get_aa_mirrors() -> list[str]: return _normalize_configured_urls(config.get("AA_ADDITIONAL_URLS", "")) -def has_aa_mirror_configuration() -> bool: - """Return True when direct-download search has at least one AA base URL to use.""" - if get_aa_mirrors(): - return True +def get_pinned_aa_base_url() -> str | None: + """Return the AA URL the Primary Mirror setting pins, or None when it is Auto. + The pinned URL need not be in the mirror list. + """ configured_base_url = normalize_http_url( _string_config_value(_get_config().get("AA_BASE_URL", "auto")), default_scheme="https", allow_special=("auto",), ) - return bool(configured_base_url and configured_base_url != "auto") + if configured_base_url and configured_base_url != "auto": + return configured_base_url + return None + + +def has_aa_mirror_configuration() -> bool: + """Return True when direct-download search has at least one AA base URL to use.""" + return bool(get_aa_mirrors()) or get_pinned_aa_base_url() is not None def get_libgen_mirrors() -> list[str]: diff --git a/shelfmark/download/http.py b/shelfmark/download/http.py index 585428cd..c9e821da 100644 --- a/shelfmark/download/http.py +++ b/shelfmark/download/http.py @@ -890,7 +890,6 @@ def download_url( except network.UnsafeDestinationError as e: logger.warning("Blocked download: %s", e) return None - network.ensure_public_destination(current_url) # Build headers with optional referer headers = DOWNLOAD_HEADERS.copy() diff --git a/shelfmark/download/network.py b/shelfmark/download/network.py index 298b13e0..11427813 100644 --- a/shelfmark/download/network.py +++ b/shelfmark/download/network.py @@ -592,8 +592,10 @@ def _configured_mirror_hosts() -> set[str]: """Hostnames of every mirror the operator configured, which are trusted as given.""" from shelfmark.core import mirrors + pinned_aa_url = mirrors.get_pinned_aa_base_url() urls = [ *mirrors.get_aa_mirrors(), + *([pinned_aa_url] if pinned_aa_url else []), *mirrors.get_libgen_mirrors(), *mirrors.get_zlib_mirrors(), *mirrors.get_welib_mirrors(), diff --git a/src/frontend/src/components/AdvancedFilters.tsx b/src/frontend/src/components/AdvancedFilters.tsx index f9f7f733..87024b9f 100644 --- a/src/frontend/src/components/AdvancedFilters.tsx +++ b/src/frontend/src/components/AdvancedFilters.tsx @@ -131,10 +131,7 @@ export const AdvancedFilters = ({ const wrapperClassName = formClassName ? 'px-2' : 'px-2 lg:ml-16 lg:w-[calc(50vw+4rem)]'; const settingsForm = ( -
e.stopPropagation()} - > +
e.stopPropagation()}> {onClose && (