mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-02 20:59:56 -05:00
Compare commits
5 commits
master
...
debian12-f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5c0109c099 | ||
|
|
2c595e6db0 | ||
|
|
73fcc24335 | ||
|
|
f0858af253 | ||
|
|
ac69ec101e |
7 changed files with 265 additions and 37 deletions
|
|
@ -1 +1 @@
|
||||||
Subproject commit 8bd80a152a08eed265d248f0acb4e4881f4035ce
|
Subproject commit a6cace93f8ebb00554d94dfee9116d2667b7c1ff
|
||||||
|
|
@ -12,6 +12,113 @@ cleanup() {
|
||||||
}
|
}
|
||||||
trap cleanup EXIT
|
trap cleanup EXIT
|
||||||
|
|
||||||
|
# --- Debian 12 (bookworm) hard cutoff --------------------------------------
|
||||||
|
# WROLPi's Debian 12 line ends at the signed tag `debian12-final`. Everything
|
||||||
|
# after it (the Postgres->SQLite move and the Debian 13 rebase) requires a
|
||||||
|
# fresh Debian 13 (trixie) system; there is no supported in-place 12 -> 13
|
||||||
|
# upgrade. ./upgrade.sh has already fetched and checked out the latest
|
||||||
|
# release by the time we run, so on a Debian 12 machine we pin back to
|
||||||
|
# `debian12-final` and never advance past it. On Debian 13+ this is a no-op
|
||||||
|
# and the normal upgrade proceeds.
|
||||||
|
GUARD_TAG="debian12-final"
|
||||||
|
GUARD_KEY="/opt/wrolpi/wrolpi/roland@learningselfreliance.com.gpg"
|
||||||
|
|
||||||
|
# True only on Debian 13 (trixie) or newer. A missing or non-numeric
|
||||||
|
# VERSION_ID is treated as "older" so the frozen line fails safe (pins).
|
||||||
|
os_is_debian_13_or_newer() {
|
||||||
|
local vid=""
|
||||||
|
[ -r /etc/os-release ] && vid=$(awk -F= '$1=="VERSION_ID"{gsub(/"/,"",$2);print $2}' /etc/os-release)
|
||||||
|
case "${vid}" in
|
||||||
|
'' | *[!0-9]*) return 1 ;;
|
||||||
|
esac
|
||||||
|
[ "${vid}" -ge 13 ]
|
||||||
|
}
|
||||||
|
|
||||||
|
# Verify the guard commit is signed by the trusted WROLPi key before we check
|
||||||
|
# it out and execute it. ./upgrade.sh only verified the release tip it landed
|
||||||
|
# on; `debian12-final` is off that line, so we re-verify here with a throwaway
|
||||||
|
# keyring (same trust model as ./upgrade.sh).
|
||||||
|
verify_guard_commit() {
|
||||||
|
local ghome rc=1
|
||||||
|
ghome=$(mktemp -d)
|
||||||
|
if GNUPGHOME="${ghome}" gpg --batch --quiet --import "${GUARD_KEY}" 2>/dev/null; then
|
||||||
|
# Mark the pinned key ultimately trusted to silence cosmetic web-of-trust
|
||||||
|
# warnings; validity (not trust) is what verify-commit actually checks.
|
||||||
|
GNUPGHOME="${ghome}" gpg --batch --list-keys --with-colons 2>/dev/null \
|
||||||
|
| awk -F: '/^fpr:/ {print $10":6:"; exit}' \
|
||||||
|
| GNUPGHOME="${ghome}" gpg --batch --quiet --import-ownertrust 2>/dev/null || :
|
||||||
|
GNUPGHOME="${ghome}" git -C /opt/wrolpi verify-commit "${GUARD_TAG}^{commit}" 2>&1 && rc=0
|
||||||
|
fi
|
||||||
|
rm -rf "${ghome}"
|
||||||
|
return "${rc}"
|
||||||
|
}
|
||||||
|
|
||||||
|
debian12_guard() {
|
||||||
|
if os_is_debian_13_or_newer; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Debian 12 (or older): make sure the cutoff tag is present AND current.
|
||||||
|
# `debian12-final` is off the release line, so a plain fetch of the branch
|
||||||
|
# would not follow it. Force (+ / --force) so a moved tag (e.g. a bumped
|
||||||
|
# final release) overwrites a stale local tag instead of being rejected as
|
||||||
|
# "would clobber existing tag" — otherwise the guard pins to the old target.
|
||||||
|
# Safe to force: the commit's signature is verified before checkout below.
|
||||||
|
git -C /opt/wrolpi fetch origin "+refs/tags/${GUARD_TAG}:refs/tags/${GUARD_TAG}" 2>/dev/null \
|
||||||
|
|| git -C /opt/wrolpi fetch --force --tags origin 2>/dev/null || :
|
||||||
|
|
||||||
|
# --verify --quiet: fail cleanly (empty, non-zero) instead of echoing the
|
||||||
|
# unresolved arg when the tag is absent.
|
||||||
|
local head target
|
||||||
|
head=$(git -C /opt/wrolpi rev-parse --verify --quiet HEAD 2>/dev/null || echo none)
|
||||||
|
target=$(git -C /opt/wrolpi rev-parse --verify --quiet "${GUARD_TAG}^{commit}" 2>/dev/null || echo none)
|
||||||
|
|
||||||
|
if [ "${target}" = "none" ]; then
|
||||||
|
echo "ERROR: Debian 12 cutoff tag '${GUARD_TAG}' not found; refusing to run newer code on Debian 12."
|
||||||
|
exit 10
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${head}" != "${target}" ]; then
|
||||||
|
# ./upgrade.sh checked out a newer release; roll back to the last
|
||||||
|
# supported commit, then hand off to ITS copy of this script via exec so
|
||||||
|
# we stop running the newer (already-overwritten) version.
|
||||||
|
if ! verify_guard_commit; then
|
||||||
|
echo "ERROR: '${GUARD_TAG}' is not signed by the trusted WROLPi key; aborting."
|
||||||
|
exit 11
|
||||||
|
fi
|
||||||
|
echo "Debian 12 detected: pinning WROLPi to its final supported version (${GUARD_TAG})."
|
||||||
|
git -C /opt/wrolpi checkout -f -B release "${GUARD_TAG}" \
|
||||||
|
|| { echo "ERROR: could not check out ${GUARD_TAG}; aborting."; exit 12; }
|
||||||
|
# Loop guard: never re-exec unless the rollback actually landed on the target.
|
||||||
|
if [ "$(git -C /opt/wrolpi rev-parse HEAD)" != "${target}" ]; then
|
||||||
|
echo "ERROR: rollback did not land on ${GUARD_TAG}; aborting."
|
||||||
|
exit 13
|
||||||
|
fi
|
||||||
|
exec /opt/wrolpi/scripts/upgrade.sh "$@"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Already on the final supported commit: warn loudly, then fall through so
|
||||||
|
# this (final) version's normal upgrade runs and leaves the box healthy with
|
||||||
|
# services restarted.
|
||||||
|
cat <<'EOF'
|
||||||
|
|
||||||
|
================================================================================
|
||||||
|
This is the FINAL WROLPi version for Debian 12 (bookworm).
|
||||||
|
|
||||||
|
No further updates will be installed on Debian 12. To keep receiving
|
||||||
|
updates, reinstall WROLPi on Debian 13 (trixie):
|
||||||
|
* Download the latest image from https://wrolpi.org
|
||||||
|
* Write it to your SD card / USB and boot it.
|
||||||
|
* Reconnect your media drive; your files and configuration are preserved
|
||||||
|
on the drive and will be re-indexed automatically.
|
||||||
|
================================================================================
|
||||||
|
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
debian12_guard "$@"
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
# Upgrade Controller first so users can monitor the rest of the upgrade.
|
# Upgrade Controller first so users can monitor the rest of the upgrade.
|
||||||
upgrade_controller() {
|
upgrade_controller() {
|
||||||
echo "Upgrading WROLPi Controller..."
|
echo "Upgrading WROLPi Controller..."
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,8 @@ __all__ = ['list_directories_contents', 'delete', 'split_path_stem_and_suffix',
|
||||||
'get_mimetype', 'split_file_name_words', 'get_primary_file', 'get_file_statistics',
|
'get_mimetype', 'split_file_name_words', 'get_primary_file', 'get_file_statistics',
|
||||||
'search_file_suggestion_count', 'glob_shared_stem', 'upsert_file', 'get_unique_files_by_stem',
|
'search_file_suggestion_count', 'glob_shared_stem', 'upsert_file', 'get_unique_files_by_stem',
|
||||||
'rename', 'delete_directory', 'handle_file_group_search_results', 'get_file_location_href',
|
'rename', 'delete_directory', 'handle_file_group_search_results', 'get_file_location_href',
|
||||||
'get_tagged_file_groups_by_ids', 'delete_file_groups']
|
'get_tagged_file_groups_by_ids', 'delete_file_groups', 'get_special_directories',
|
||||||
|
'get_normalized_ignored_directories', 'sanitize_ignored_directories']
|
||||||
|
|
||||||
|
|
||||||
def get_file_tag_names(session: Session, file: pathlib.Path) -> List[str]:
|
def get_file_tag_names(session: Session, file: pathlib.Path) -> List[str]:
|
||||||
|
|
@ -786,11 +787,7 @@ def _upsert_files(files: List[pathlib.Path], idempotency: datetime.datetime,
|
||||||
|
|
||||||
def remove_files_in_ignored_directories(files: List[pathlib.Path]) -> List[pathlib.Path]:
|
def remove_files_in_ignored_directories(files: List[pathlib.Path]) -> List[pathlib.Path]:
|
||||||
"""Return a new list which does not contain any file paths that are in ignored directories."""
|
"""Return a new list which does not contain any file paths that are in ignored directories."""
|
||||||
ignored_directories = list(map(str, get_wrolpi_config().ignored_directories))
|
ignored_directories = get_normalized_ignored_directories()
|
||||||
for idx, ignored_directory in enumerate(ignored_directories):
|
|
||||||
ignored_directory = pathlib.Path(ignored_directory)
|
|
||||||
if not ignored_directory.is_absolute():
|
|
||||||
ignored_directories[idx] = str(get_media_directory() / ignored_directory)
|
|
||||||
files = [i for i in files if not any(str(i).startswith(j) for j in ignored_directories)]
|
files = [i for i in files if not any(str(i).startswith(j) for j in ignored_directories)]
|
||||||
return files
|
return files
|
||||||
|
|
||||||
|
|
@ -1746,23 +1743,88 @@ async def rename(session: Session, path: pathlib.Path, new_name: str, send_event
|
||||||
return await rename_file(path, new_name)
|
return await rename_file(path, new_name)
|
||||||
|
|
||||||
|
|
||||||
|
def get_special_directories() -> List[pathlib.Path]:
|
||||||
|
"""Return absolute directories that must never be ignored by file refresh.
|
||||||
|
|
||||||
|
These are module destinations that depend on FileGroup indexing (or are the media root).
|
||||||
|
Map is intentionally excluded: it lists PMTiles by walking the filesystem and benefits
|
||||||
|
from being ignored during refresh (very large files).
|
||||||
|
|
||||||
|
Must not create directories — this runs during refresh ignore filtering and would
|
||||||
|
otherwise mkdir videos/ (and NO CHANNEL/) as a side effect of the videos helpers.
|
||||||
|
"""
|
||||||
|
from modules.archive.lib import get_archive_directory
|
||||||
|
from modules.videos.lib import format_videos_destination
|
||||||
|
|
||||||
|
media_directory = get_media_directory()
|
||||||
|
videos_directory = media_directory / format_videos_destination()
|
||||||
|
# Avoid importing modules.zim.lib here (circular import via files.worker).
|
||||||
|
zims_directory = media_directory / get_wrolpi_config().zims_destination
|
||||||
|
return [
|
||||||
|
media_directory.resolve(),
|
||||||
|
videos_directory.resolve(),
|
||||||
|
get_archive_directory().resolve(),
|
||||||
|
(videos_directory / 'NO CHANNEL').resolve(),
|
||||||
|
zims_directory.resolve(),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def get_normalized_ignored_directories() -> List[str]:
|
||||||
|
"""Return absolute ignored directory paths, excluding special directories.
|
||||||
|
|
||||||
|
Special directories (media root, videos, archives, zims, …) are never treated as ignored,
|
||||||
|
even if they appear in config from older installs or manual edits.
|
||||||
|
"""
|
||||||
|
media_directory = get_media_directory()
|
||||||
|
special = {str(p) for p in get_special_directories()}
|
||||||
|
result = []
|
||||||
|
for d in get_wrolpi_config().ignored_directories or []:
|
||||||
|
path = pathlib.Path(d)
|
||||||
|
absolute = str((media_directory / path).resolve() if not path.is_absolute() else path.resolve())
|
||||||
|
if absolute in special:
|
||||||
|
continue
|
||||||
|
result.append(absolute)
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
def sanitize_ignored_directories():
|
||||||
|
"""Persistently remove special directories from the ignored list if present."""
|
||||||
|
wrolpi_config = get_wrolpi_config()
|
||||||
|
ignored = list(wrolpi_config.ignored_directories or [])
|
||||||
|
if not ignored:
|
||||||
|
return
|
||||||
|
|
||||||
|
media_directory = get_media_directory()
|
||||||
|
special = {str(p) for p in get_special_directories()}
|
||||||
|
cleaned = []
|
||||||
|
removed = False
|
||||||
|
for d in ignored:
|
||||||
|
path = pathlib.Path(d)
|
||||||
|
absolute = str((media_directory / path).resolve() if not path.is_absolute() else path.resolve())
|
||||||
|
if absolute in special:
|
||||||
|
removed = True
|
||||||
|
logger.warning(f'Removing special directory from ignored_directories: {d}')
|
||||||
|
continue
|
||||||
|
cleaned.append(d)
|
||||||
|
|
||||||
|
if removed:
|
||||||
|
wrolpi_config.ignored_directories = cleaned
|
||||||
|
|
||||||
|
|
||||||
def add_ignore_directory(directory: Union[pathlib.Path, str]):
|
def add_ignore_directory(directory: Union[pathlib.Path, str]):
|
||||||
"""Add a directory to the `ignored_directories` in the WROLPi config. This directory will be ignored when
|
"""Add a directory to the `ignored_directories` in the WROLPi config. This directory will be ignored when
|
||||||
refreshing."""
|
refreshing."""
|
||||||
media_directory = get_media_directory()
|
media_directory = get_media_directory().resolve()
|
||||||
|
|
||||||
directory = pathlib.Path(directory)
|
directory = pathlib.Path(directory)
|
||||||
|
if not directory.is_absolute():
|
||||||
|
directory = media_directory / directory
|
||||||
|
directory = directory.resolve()
|
||||||
|
|
||||||
from modules.videos.common import get_videos_directory
|
# Drop any special directories that were previously saved as ignored.
|
||||||
from modules.archive.lib import get_archive_directory
|
sanitize_ignored_directories()
|
||||||
from modules.videos.common import get_no_channel_directory
|
|
||||||
special_directories = [
|
|
||||||
get_media_directory(),
|
|
||||||
get_videos_directory(),
|
|
||||||
get_archive_directory(),
|
|
||||||
get_no_channel_directory(),
|
|
||||||
]
|
|
||||||
|
|
||||||
|
special_directories = set(get_special_directories())
|
||||||
if directory in special_directories:
|
if directory in special_directories:
|
||||||
raise InvalidDirectory('Refusing to ignore special directory')
|
raise InvalidDirectory('Refusing to ignore special directory')
|
||||||
|
|
||||||
|
|
@ -1772,7 +1834,9 @@ def add_ignore_directory(directory: Union[pathlib.Path, str]):
|
||||||
wrolpi_config = get_wrolpi_config()
|
wrolpi_config = get_wrolpi_config()
|
||||||
ignored_directories = wrolpi_config.ignored_directories if wrolpi_config.ignored_directories else list()
|
ignored_directories = wrolpi_config.ignored_directories if wrolpi_config.ignored_directories else list()
|
||||||
|
|
||||||
if str(directory) in ignored_directories:
|
# Accept either absolute or relative forms already present in config.
|
||||||
|
relative = str(get_relative_to_media_directory(directory))
|
||||||
|
if str(directory) in ignored_directories or relative in ignored_directories:
|
||||||
logger.warning(f'Directory is already ignored: {directory}')
|
logger.warning(f'Directory is already ignored: {directory}')
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
@ -1782,13 +1846,27 @@ def add_ignore_directory(directory: Union[pathlib.Path, str]):
|
||||||
|
|
||||||
def remove_ignored_directory(directory: Union[pathlib.Path, str]):
|
def remove_ignored_directory(directory: Union[pathlib.Path, str]):
|
||||||
"""Remove a directory from the `ignored_directories` in the WROLPi config."""
|
"""Remove a directory from the `ignored_directories` in the WROLPi config."""
|
||||||
directory = str(pathlib.Path(directory)).rstrip('/')
|
media_directory = get_media_directory()
|
||||||
ignored_directories = get_wrolpi_config().ignored_directories
|
path = pathlib.Path(directory)
|
||||||
if directory in ignored_directories:
|
if not path.is_absolute():
|
||||||
ignored_directories.remove(directory)
|
path = media_directory / path
|
||||||
get_wrolpi_config().ignored_directories = ignored_directories
|
path = path.resolve()
|
||||||
else:
|
absolute = str(path)
|
||||||
|
|
||||||
|
ignored_directories = list(get_wrolpi_config().ignored_directories or [])
|
||||||
|
kept = []
|
||||||
|
removed = False
|
||||||
|
for d in ignored_directories:
|
||||||
|
entry = pathlib.Path(d)
|
||||||
|
entry_abs = str((media_directory / entry).resolve() if not entry.is_absolute() else entry.resolve())
|
||||||
|
if entry_abs == absolute:
|
||||||
|
removed = True
|
||||||
|
continue
|
||||||
|
kept.append(d)
|
||||||
|
|
||||||
|
if not removed:
|
||||||
raise UnknownDirectory('Directory is not ignored')
|
raise UnknownDirectory('Directory is not ignored')
|
||||||
|
get_wrolpi_config().ignored_directories = kept
|
||||||
|
|
||||||
|
|
||||||
async def upsert_file(file: pathlib.Path | str, tag_names: List[str] = None) -> FileGroup:
|
async def upsert_file(file: pathlib.Path | str, tag_names: List[str] = None) -> FileGroup:
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import hashlib
|
import hashlib
|
||||||
import json
|
import json
|
||||||
|
import pathlib
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
@ -1370,6 +1371,53 @@ async def test_ignore_directory(test_session, async_client, test_directory, make
|
||||||
assert response.status_code == HTTPStatus.BAD_REQUEST
|
assert response.status_code == HTTPStatus.BAD_REQUEST
|
||||||
assert len(get_wrolpi_config().ignored_directories) == 0
|
assert len(get_wrolpi_config().ignored_directories) == 0
|
||||||
|
|
||||||
|
# Zims directory depends on FileGroup indexing for Manage/search — cannot ignore.
|
||||||
|
content = dict(path=str(test_directory / 'zims'))
|
||||||
|
request, response = await async_client.post('/api/files/ignore_directory', json=content)
|
||||||
|
assert response.status_code == HTTPStatus.BAD_REQUEST
|
||||||
|
assert len(get_wrolpi_config().ignored_directories) == 0
|
||||||
|
|
||||||
|
# Relative form of zims is also refused.
|
||||||
|
content = dict(path='zims')
|
||||||
|
request, response = await async_client.post('/api/files/ignore_directory', json=content)
|
||||||
|
assert response.status_code == HTTPStatus.BAD_REQUEST
|
||||||
|
assert len(get_wrolpi_config().ignored_directories) == 0
|
||||||
|
|
||||||
|
# Map is allowed to be ignored (lists PMTiles from the filesystem, not FileGroups).
|
||||||
|
content = dict(path=str(test_directory / 'map'))
|
||||||
|
request, response = await async_client.post('/api/files/ignore_directory', json=content)
|
||||||
|
assert response.status_code == HTTPStatus.OK
|
||||||
|
assert any(pathlib.Path(i).name == 'map' or str(i).endswith('/map')
|
||||||
|
for i in get_wrolpi_config().ignored_directories)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.asyncio
|
||||||
|
async def test_sanitize_ignored_zims_directory(test_session, async_client, test_directory, test_wrolpi_config):
|
||||||
|
"""Zims previously saved as ignored is stripped so refresh can index them again."""
|
||||||
|
from wrolpi.files.lib import (
|
||||||
|
get_normalized_ignored_directories,
|
||||||
|
sanitize_ignored_directories,
|
||||||
|
)
|
||||||
|
|
||||||
|
# Simulate an older config that incorrectly ignored zims (and intentionally ignored map).
|
||||||
|
get_wrolpi_config().ignored_directories = ['config', 'tags', 'map', 'zims']
|
||||||
|
|
||||||
|
# Normalized list used by refresh must never exclude zims.
|
||||||
|
normalized = get_normalized_ignored_directories()
|
||||||
|
assert not any(pathlib.Path(i).name == 'zims' for i in normalized)
|
||||||
|
assert any(pathlib.Path(i).name == 'map' for i in normalized)
|
||||||
|
|
||||||
|
sanitize_ignored_directories()
|
||||||
|
assert 'zims' not in get_wrolpi_config().ignored_directories
|
||||||
|
assert 'map' in get_wrolpi_config().ignored_directories
|
||||||
|
|
||||||
|
# Settings endpoint also sanitizes so the UI eye-icon matches.
|
||||||
|
request, response = await async_client.get('/api/settings')
|
||||||
|
assert response.status_code == HTTPStatus.OK
|
||||||
|
ignored = [str(i) for i in response.json['ignored_directories']]
|
||||||
|
assert 'zims' not in ignored
|
||||||
|
assert 'map' in ignored
|
||||||
|
|
||||||
|
|
||||||
# --- Bulk Tagging API Tests ---
|
# --- Bulk Tagging API Tests ---
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ from wrolpi.files.lib import (
|
||||||
split_path_stem_and_suffix, _upsert_files, get_unique_files_by_stem, glob_shared_stem,
|
split_path_stem_and_suffix, _upsert_files, get_unique_files_by_stem, glob_shared_stem,
|
||||||
group_files_by_stem, get_primary_file, delete_directory, apply_indexers,
|
group_files_by_stem, get_primary_file, delete_directory, apply_indexers,
|
||||||
_move_file_group_files, _bulk_update_file_groups_db, MOVE_CHUNK_SIZE,
|
_move_file_group_files, _bulk_update_file_groups_db, MOVE_CHUNK_SIZE,
|
||||||
_bulk_update_file_groups_reorganize,
|
_bulk_update_file_groups_reorganize, get_normalized_ignored_directories,
|
||||||
)
|
)
|
||||||
|
|
||||||
logger = logger.getChild(__name__)
|
logger = logger.getChild(__name__)
|
||||||
|
|
@ -138,18 +138,9 @@ def _diff_to_paths(diff: FileGroupDiff) -> list[pathlib.Path]:
|
||||||
def _get_normalized_ignored_directories() -> list[str]:
|
def _get_normalized_ignored_directories() -> list[str]:
|
||||||
"""Get ignored directories as absolute paths.
|
"""Get ignored directories as absolute paths.
|
||||||
|
|
||||||
Matches the normalization logic in remove_files_in_ignored_directories().
|
Delegates to files.lib so special directories (zims, videos, …) are never excluded.
|
||||||
"""
|
"""
|
||||||
ignored = list(map(str, get_wrolpi_config().ignored_directories))
|
return get_normalized_ignored_directories()
|
||||||
media_dir = get_media_directory()
|
|
||||||
result = []
|
|
||||||
for d in ignored:
|
|
||||||
p = pathlib.Path(d)
|
|
||||||
if not p.is_absolute():
|
|
||||||
result.append(str(media_dir / d))
|
|
||||||
else:
|
|
||||||
result.append(d)
|
|
||||||
return result
|
|
||||||
|
|
||||||
|
|
||||||
async def count_files(directories: list[Path]) -> int:
|
async def count_files(directories: list[Path]) -> int:
|
||||||
|
|
|
||||||
|
|
@ -152,6 +152,10 @@ async def echo(request: Request):
|
||||||
def get_settings(_: Request):
|
def get_settings(_: Request):
|
||||||
wrolpi_config = get_wrolpi_config()
|
wrolpi_config = get_wrolpi_config()
|
||||||
|
|
||||||
|
# Drop special directories (e.g. zims) that must never be ignored, if present from older configs.
|
||||||
|
from wrolpi.files.lib import sanitize_ignored_directories
|
||||||
|
sanitize_ignored_directories()
|
||||||
|
|
||||||
ignored_directories = [get_relative_to_media_directory(i) for i in wrolpi_config.ignored_directories]
|
ignored_directories = [get_relative_to_media_directory(i) for i in wrolpi_config.ignored_directories]
|
||||||
|
|
||||||
settings = {
|
settings = {
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
0.27.2-beta
|
0.27.3-beta
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue