mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-15 03:30:29 +03:00
establish config/mirrors.yml as a way to set up mirrors
The mirrors: entry in config.yml is great for quick access and shorter mirror lists. Now that we are adding a lot more metadata to the mirrors, including potentially the full text of the privacy policy, having this in its own file should make these cases easier to manage.
This commit is contained in:
parent
7a0dad6dfc
commit
6d541e3ef6
4 changed files with 55 additions and 1 deletions
|
|
@ -117,11 +117,13 @@ GITLAB_COM_PAGES_MAX_SIZE = 1000000000
|
|||
ANTIFEATURES_CONFIG_NAME = 'antiFeatures'
|
||||
CATEGORIES_CONFIG_NAME = 'categories'
|
||||
CONFIG_CONFIG_NAME = 'config'
|
||||
MIRRORS_CONFIG_NAME = 'mirrors'
|
||||
RELEASECHANNELS_CONFIG_NAME = "releaseChannels"
|
||||
CONFIG_NAMES = (
|
||||
ANTIFEATURES_CONFIG_NAME,
|
||||
CATEGORIES_CONFIG_NAME,
|
||||
CONFIG_CONFIG_NAME,
|
||||
MIRRORS_CONFIG_NAME,
|
||||
RELEASECHANNELS_CONFIG_NAME,
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import re
|
|||
import shutil
|
||||
import tempfile
|
||||
import urllib.parse
|
||||
import yaml
|
||||
import zipfile
|
||||
import calendar
|
||||
import qrcode
|
||||
|
|
@ -42,7 +43,7 @@ from . import common
|
|||
from . import metadata
|
||||
from . import net
|
||||
from . import signindex
|
||||
from fdroidserver.common import ANTIFEATURES_CONFIG_NAME, CATEGORIES_CONFIG_NAME, CONFIG_CONFIG_NAME, RELEASECHANNELS_CONFIG_NAME, DEFAULT_LOCALE, FDroidPopen, FDroidPopenBytes, load_stats_fdroid_signing_key_fingerprints
|
||||
from fdroidserver.common import ANTIFEATURES_CONFIG_NAME, CATEGORIES_CONFIG_NAME, CONFIG_CONFIG_NAME, MIRRORS_CONFIG_NAME, RELEASECHANNELS_CONFIG_NAME, DEFAULT_LOCALE, FDroidPopen, FDroidPopenBytes, load_stats_fdroid_signing_key_fingerprints
|
||||
from fdroidserver.exception import FDroidException, VerificationException
|
||||
|
||||
|
||||
|
|
@ -1399,6 +1400,17 @@ def add_mirrors_to_repodict(repo_section, repodict):
|
|||
if type(mirrors_config) not in (list, tuple):
|
||||
mirrors_config = [mirrors_config]
|
||||
|
||||
mirrors_yml = Path(f'config/{MIRRORS_CONFIG_NAME}.yml')
|
||||
if mirrors_yml.exists():
|
||||
if mirrors_config:
|
||||
raise FDroidException(
|
||||
_('mirrors set twice, in config.yml and {path}!').format(
|
||||
path=mirrors_yml
|
||||
)
|
||||
)
|
||||
with mirrors_yml.open() as fp:
|
||||
mirrors_config = yaml.safe_load(fp)
|
||||
|
||||
mirrorcheckfailed = False
|
||||
mirrors = []
|
||||
urls = set()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue