diff --git a/.gitignore b/.gitignore
index 7286c248d..ca9fb9d49 100644
--- a/.gitignore
+++ b/.gitignore
@@ -62,8 +62,8 @@ frontend/assets/pico8
backend/romm_test/resources
backend/romm_test/logs
backend/romm_test/assets
-backend/romm_test/webdav_cloud_sync_blobs
-backend/romm_test/cache/webdav_cloud_sync
+backend/romm_test/retroarch_sync_blobs
+backend/romm_test/cache/retroarch_sync
.pytest_cache
.hypothesis
/romm_test
diff --git a/backend/config/__init__.py b/backend/config/__init__.py
index 647dfff8e..8605cfd17 100644
--- a/backend/config/__init__.py
+++ b/backend/config/__init__.py
@@ -330,20 +330,14 @@ SYNC_SSH_KEYS_PATH: Final[str] = _get_env(
SYNC_SSH_KNOWN_HOSTS_PATH: Final[str] = _get_env(
"SYNC_SSH_KNOWN_HOSTS_PATH", f"{SYNC_BASE_PATH}/known_hosts"
)
-
-# WEBDAV CLOUD SYNC
# RetroArch Cloud Sync's config/, thumbnails/ and system/ files, which no ROM owns.
-WEBDAV_CLOUD_SYNC_BLOB_BASE_PATH: Final[str] = (
- f"{ROMM_BASE_PATH}/webdav_cloud_sync_blobs"
-)
+SYNC_RETROARCH_BLOB_BASE_PATH: Final[str] = f"{ROMM_BASE_PATH}/retroarch_sync_blobs"
# PSP save folder files buffered until the folder resolves to a rom.
-WEBDAV_CLOUD_SYNC_PSP_PENDING_PATH: Final[str] = (
- f"{ROMM_BASE_PATH}/cache/webdav_cloud_sync"
-)
+SYNC_RETROARCH_PSP_PENDING_PATH: Final[str] = f"{ROMM_BASE_PATH}/cache/retroarch_sync"
# JSON map of PSP serial to extensionless rom file name, for saves whose title
# matches no rom, e.g. {"ULUS10336": "Crisis Core - Final Fantasy VII (USA)"}.
-WEBDAV_CLOUD_SYNC_PSP_SERIAL_MAP: Final[dict[str, str]] = json.loads(
- _get_env("WEBDAV_CLOUD_SYNC_PSP_SERIAL_MAP", "{}")
+SYNC_RETROARCH_PSP_SERIAL_MAP: Final[dict[str, str]] = json.loads(
+ _get_env("SYNC_RETROARCH_PSP_SERIAL_MAP", "{}")
)
# EMULATION
diff --git a/backend/endpoints/sync.py b/backend/endpoints/sync/__init__.py
similarity index 99%
rename from backend/endpoints/sync.py
rename to backend/endpoints/sync/__init__.py
index 6616a4757..61f141f25 100644
--- a/backend/endpoints/sync.py
+++ b/backend/endpoints/sync/__init__.py
@@ -34,10 +34,13 @@ from utils.datetime import to_utc
from utils.router import APIRouter
from utils.validation import MAX_ROM_IDS_PER_QUERY, RomIdScope
+from .retroarch import router as retroarch_router
+
router = APIRouter(
prefix="/sync",
tags=["sync"],
)
+router.include_router(retroarch_router)
class ClientSaveState(BaseModel):
diff --git a/backend/endpoints/webdav_cloud_sync.py b/backend/endpoints/sync/retroarch.py
similarity index 92%
rename from backend/endpoints/webdav_cloud_sync.py
rename to backend/endpoints/sync/retroarch.py
index 5a6e8272e..ef3f6a040 100644
--- a/backend/endpoints/webdav_cloud_sync.py
+++ b/backend/endpoints/sync/retroarch.py
@@ -3,8 +3,8 @@
RetroArch issues OPTIONS, GET, PUT, DELETE, MKCOL and MOVE, and diffs a
manifest instead of listing collections. PROPFIND, LOCK and UNLOCK exist only
for read-only browsing from generic WebDAV clients. See
-`handler/webdav_cloud_sync/sync_handler.py` for how the client-side paths map onto RomM's
-asset storage.
+`handler/sync/retroarch/sync_handler.py` for how the client-side paths map onto
+RomM's asset storage.
Error responses are deliberately body-less: RetroArch logs failure responses
from a fixed-size buffer, and a large body has been observed to corrupt its
@@ -29,15 +29,15 @@ from handler.database import (
db_screenshot_handler,
db_state_handler,
)
-from handler.filesystem import fs_asset_handler, fs_webdav_cloud_sync_blob_handler
+from handler.filesystem import fs_asset_handler, fs_retroarch_sync_blob_handler
from handler.filesystem.assets_handler import build_asset_file_response
from handler.filesystem.base_handler import FSHandler
from handler.scan_handler import scan_save, scan_screenshot, scan_state
-from handler.webdav_cloud_sync import browser, psp, sync_handler
-from handler.webdav_cloud_sync.sync_handler import (
+from handler.sync.retroarch import browser, psp, sync_handler
+from handler.sync.retroarch.sync_handler import (
MANIFEST_FILE_NAME,
AssetKind,
- WebDAVCloudSyncPath,
+ RetroArchSyncPath,
)
from logger.formatter import BLUE
from logger.formatter import highlight as hl
@@ -47,7 +47,7 @@ from models.rom import Rom
from models.user import User
from utils.filesystem import sanitize_filename
-router = APIRouter(prefix="/webdav-cloud-sync", tags=["webdav-cloud-sync"])
+router = APIRouter(prefix="/retroarch")
ALLOWED_METHODS = "OPTIONS, PROPFIND, GET, HEAD, PUT, DELETE, MKCOL, MOVE, LOCK, UNLOCK"
@@ -93,9 +93,7 @@ def _resolve_rom(request: Request, kind: AssetKind, file_name: str) -> Rom | Non
)
-def _get_asset(
- user: User, rom: Rom, parsed: WebDAVCloudSyncPath
-) -> Save | State | None:
+def _get_asset(user: User, rom: Rom, parsed: RetroArchSyncPath) -> Save | State | None:
if parsed.kind == "saves":
file_path = sync_handler.build_asset_file_path(
user, rom, parsed.kind, parsed.emulator
@@ -127,7 +125,7 @@ def _serve(handler: FSHandler, path: str, filename: str) -> Response:
@router.api_route("/{file_path:path}", methods=["OPTIONS"], include_in_schema=False)
-def webdav_cloud_sync_options(request: Request, file_path: str) -> Response:
+def retroarch_sync_options(request: Request, file_path: str) -> Response:
"""Advertise DAV support. RetroArch stats the base URL before syncing."""
denied = _authorize(request, Scope.ASSETS_READ)
if denied:
@@ -142,7 +140,7 @@ def webdav_cloud_sync_options(request: Request, file_path: str) -> Response:
@router.api_route("/{file_path:path}", methods=["LOCK"], include_in_schema=False)
-def webdav_cloud_sync_lock(request: Request, file_path: str) -> Response:
+def retroarch_sync_lock(request: Request, file_path: str) -> Response:
"""Always-granted fake lock, for clients that won't mount without one."""
denied = _authorize(request, Scope.ASSETS_READ)
if denied:
@@ -167,7 +165,7 @@ def webdav_cloud_sync_lock(request: Request, file_path: str) -> Response:
@router.api_route("/{file_path:path}", methods=["UNLOCK"], include_in_schema=False)
-def webdav_cloud_sync_unlock(request: Request, file_path: str) -> Response:
+def retroarch_sync_unlock(request: Request, file_path: str) -> Response:
denied = _authorize(request, Scope.ASSETS_READ)
if denied:
return denied
@@ -176,7 +174,7 @@ def webdav_cloud_sync_unlock(request: Request, file_path: str) -> Response:
@router.api_route("/{file_path:path}", methods=["PROPFIND"], include_in_schema=False)
-async def webdav_cloud_sync_propfind(request: Request, file_path: str) -> Response:
+async def retroarch_sync_propfind(request: Request, file_path: str) -> Response:
"""Read-only browsing of `roms/` and the manifest's current `saves/`/`states/`.
RetroArch never sends PROPFIND; this serves generic WebDAV clients.
@@ -343,7 +341,7 @@ def _manifest_file_entry(entry: dict[str, str]) -> browser.PropfindEntry:
@router.api_route("/{file_path:path}", methods=["GET", "HEAD"], include_in_schema=False)
-async def webdav_cloud_sync_get(request: Request, file_path: str) -> Response:
+async def retroarch_sync_get(request: Request, file_path: str) -> Response:
"""Serve the manifest, or the bytes of a single save/state."""
denied = _authorize(request, Scope.ASSETS_READ)
if denied:
@@ -355,10 +353,10 @@ async def webdav_cloud_sync_get(request: Request, file_path: str) -> Response:
)
return JSONResponse(content=manifest)
- blob_path = sync_handler.parse_webdav_cloud_sync_blob_path(file_path)
+ blob_path = sync_handler.parse_retroarch_sync_blob_path(file_path)
if blob_path:
return _serve(
- fs_webdav_cloud_sync_blob_handler,
+ fs_retroarch_sync_blob_handler,
sync_handler.user_blob_path(request.user, blob_path),
os.path.basename(blob_path),
)
@@ -392,7 +390,7 @@ async def webdav_cloud_sync_get(request: Request, file_path: str) -> Response:
status_code=status.HTTP_307_TEMPORARY_REDIRECT,
)
- parsed = sync_handler.parse_webdav_cloud_sync_path(file_path)
+ parsed = sync_handler.parse_retroarch_sync_path(file_path)
if not parsed:
return _empty(status.HTTP_404_NOT_FOUND)
@@ -415,7 +413,7 @@ async def webdav_cloud_sync_get(request: Request, file_path: str) -> Response:
@router.api_route("/{file_path:path}", methods=["PUT"], include_in_schema=False)
-async def webdav_cloud_sync_put(request: Request, file_path: str) -> Response:
+async def retroarch_sync_put(request: Request, file_path: str) -> Response:
"""Store an uploaded save/state against the ROM its file name points at."""
denied = _authorize(request, Scope.ASSETS_WRITE)
if denied:
@@ -428,12 +426,12 @@ async def webdav_cloud_sync_put(request: Request, file_path: str) -> Response:
# config/, thumbnails/ and system/ belong to no ROM, so they're stored as
# opaque per-user blobs.
- blob_path = sync_handler.parse_webdav_cloud_sync_blob_path(file_path)
+ blob_path = sync_handler.parse_retroarch_sync_blob_path(file_path)
if blob_path:
disk_path = sync_handler.user_blob_path(request.user, blob_path)
try:
- existed = await fs_webdav_cloud_sync_blob_handler.file_exists(disk_path)
- await fs_webdav_cloud_sync_blob_handler.write_file(
+ existed = await fs_retroarch_sync_blob_handler.file_exists(disk_path)
+ await fs_retroarch_sync_blob_handler.write_file(
file=await request.body(),
path=os.path.dirname(disk_path),
filename=os.path.basename(disk_path),
@@ -461,7 +459,7 @@ async def webdav_cloud_sync_put(request: Request, file_path: str) -> Response:
return _empty(status.HTTP_409_CONFLICT)
return _empty(status.HTTP_201_CREATED)
- parsed = sync_handler.parse_webdav_cloud_sync_path(file_path)
+ parsed = sync_handler.parse_retroarch_sync_path(file_path)
if not parsed:
return _empty(status.HTTP_409_CONFLICT)
@@ -595,7 +593,7 @@ async def webdav_cloud_sync_put(request: Request, file_path: str) -> Response:
@router.api_route(
"/{file_path:path}", methods=["DELETE", "MOVE"], include_in_schema=False
)
-async def webdav_cloud_sync_delete(request: Request, file_path: str) -> Response:
+async def retroarch_sync_delete(request: Request, file_path: str) -> Response:
"""Drop a save/state the client no longer has.
MOVE lands here too. RetroArch uses it in non-destructive mode to shelve the
@@ -606,10 +604,10 @@ async def webdav_cloud_sync_delete(request: Request, file_path: str) -> Response
if denied:
return denied
- blob_path = sync_handler.parse_webdav_cloud_sync_blob_path(file_path)
+ blob_path = sync_handler.parse_retroarch_sync_blob_path(file_path)
if blob_path:
try:
- await fs_webdav_cloud_sync_blob_handler.remove_file(
+ await fs_retroarch_sync_blob_handler.remove_file(
file_path=sync_handler.user_blob_path(request.user, blob_path)
)
except FileNotFoundError:
@@ -625,7 +623,7 @@ async def webdav_cloud_sync_delete(request: Request, file_path: str) -> Response
)
return _empty(status.HTTP_204_NO_CONTENT)
- parsed = sync_handler.parse_webdav_cloud_sync_path(file_path)
+ parsed = sync_handler.parse_retroarch_sync_path(file_path)
if not parsed:
return _empty(status.HTTP_404_NOT_FOUND)
@@ -665,7 +663,7 @@ async def webdav_cloud_sync_delete(request: Request, file_path: str) -> Response
@router.api_route("/{file_path:path}", methods=["MKCOL"], include_in_schema=False)
-def webdav_cloud_sync_mkcol(request: Request, file_path: str) -> Response:
+def retroarch_sync_mkcol(request: Request, file_path: str) -> Response:
"""Accept directory creation. Storage layout is derived from the ROM, so
there is nothing to create; failing here would abort the client's sync."""
denied = _authorize(request, Scope.ASSETS_WRITE)
diff --git a/backend/handler/filesystem/__init__.py b/backend/handler/filesystem/__init__.py
index 3a2aea304..0b2bd9a44 100644
--- a/backend/handler/filesystem/__init__.py
+++ b/backend/handler/filesystem/__init__.py
@@ -3,12 +3,12 @@ from .firmware_handler import FSFirmwareHandler
from .launchbox_handler import FSLaunchboxHandler, get_fs_launchbox_handler
from .platforms_handler import FSPlatformsHandler
from .resources_handler import FSResourcesHandler
+from .retroarch_sync_blob_handler import FSRetroArchSyncBlobHandler
from .roms_handler import FSRomsHandler
from .sync_handler import FSSyncHandler, get_fs_sync_handler
-from .webdav_cloud_sync_blob_handler import FSWebDAVCloudSyncBlobHandler
fs_asset_handler = FSAssetsHandler()
-fs_webdav_cloud_sync_blob_handler = FSWebDAVCloudSyncBlobHandler()
+fs_retroarch_sync_blob_handler = FSRetroArchSyncBlobHandler()
fs_firmware_handler = FSFirmwareHandler()
fs_platform_handler = FSPlatformsHandler()
fs_rom_handler = FSRomsHandler()
@@ -16,7 +16,7 @@ fs_resource_handler = FSResourcesHandler()
__all__ = [
"FSAssetsHandler",
- "FSWebDAVCloudSyncBlobHandler",
+ "FSRetroArchSyncBlobHandler",
"FSFirmwareHandler",
"FSLaunchboxHandler",
"FSPlatformsHandler",
@@ -24,7 +24,7 @@ __all__ = [
"FSRomsHandler",
"FSSyncHandler",
"fs_asset_handler",
- "fs_webdav_cloud_sync_blob_handler",
+ "fs_retroarch_sync_blob_handler",
"fs_firmware_handler",
"fs_platform_handler",
"fs_resource_handler",
diff --git a/backend/handler/filesystem/webdav_cloud_sync_blob_handler.py b/backend/handler/filesystem/retroarch_sync_blob_handler.py
similarity index 78%
rename from backend/handler/filesystem/webdav_cloud_sync_blob_handler.py
rename to backend/handler/filesystem/retroarch_sync_blob_handler.py
index 25204b5ea..28e3d31fc 100644
--- a/backend/handler/filesystem/webdav_cloud_sync_blob_handler.py
+++ b/backend/handler/filesystem/retroarch_sync_blob_handler.py
@@ -1,14 +1,14 @@
"""Opaque per-user storage for the Cloud Sync categories no ROM owns: config/,
thumbnails/ and system/."""
-from config import WEBDAV_CLOUD_SYNC_BLOB_BASE_PATH
+from config import SYNC_RETROARCH_BLOB_BASE_PATH
from .base_handler import FSHandler
-class FSWebDAVCloudSyncBlobHandler(FSHandler):
+class FSRetroArchSyncBlobHandler(FSHandler):
def __init__(self) -> None:
- super().__init__(base_path=WEBDAV_CLOUD_SYNC_BLOB_BASE_PATH)
+ super().__init__(base_path=SYNC_RETROARCH_BLOB_BASE_PATH)
async def list_blob_paths(self, prefix: str) -> list[str]:
"""Posix paths of every file under `prefix` (relative to the blob root),
diff --git a/backend/handler/webdav_cloud_sync/__init__.py b/backend/handler/sync/retroarch/__init__.py
similarity index 100%
rename from backend/handler/webdav_cloud_sync/__init__.py
rename to backend/handler/sync/retroarch/__init__.py
diff --git a/backend/handler/webdav_cloud_sync/browser.py b/backend/handler/sync/retroarch/browser.py
similarity index 98%
rename from backend/handler/webdav_cloud_sync/browser.py
rename to backend/handler/sync/retroarch/browser.py
index 0bc2c4665..edfa8830d 100644
--- a/backend/handler/webdav_cloud_sync/browser.py
+++ b/backend/handler/sync/retroarch/browser.py
@@ -37,7 +37,7 @@ class RomFile:
# Clients expect absolute s; relative ones make them render the
# requested collection as an endlessly nested subfolder of itself.
-WEBDAV_MOUNT_PREFIX = "/api/webdav-cloud-sync"
+WEBDAV_MOUNT_PREFIX = "/api/sync/retroarch"
def _href_escape(path: str) -> str:
diff --git a/backend/handler/webdav_cloud_sync/emulator_names.py b/backend/handler/sync/retroarch/emulator_names.py
similarity index 100%
rename from backend/handler/webdav_cloud_sync/emulator_names.py
rename to backend/handler/sync/retroarch/emulator_names.py
diff --git a/backend/handler/webdav_cloud_sync/psp.py b/backend/handler/sync/retroarch/psp.py
similarity index 95%
rename from backend/handler/webdav_cloud_sync/psp.py
rename to backend/handler/sync/retroarch/psp.py
index d5cddb9c5..306df9b8d 100644
--- a/backend/handler/webdav_cloud_sync/psp.py
+++ b/backend/handler/sync/retroarch/psp.py
@@ -20,13 +20,13 @@ from dataclasses import dataclass
from io import BytesIO
from typing import Literal
-from config import WEBDAV_CLOUD_SYNC_PSP_PENDING_PATH, WEBDAV_CLOUD_SYNC_PSP_SERIAL_MAP
+from config import SYNC_RETROARCH_PSP_PENDING_PATH, SYNC_RETROARCH_PSP_SERIAL_MAP
from handler.database import db_platform_handler, db_rom_handler, db_save_handler
from handler.filesystem import fs_asset_handler
from handler.filesystem.assets_handler import hash_zip_contents
from handler.filesystem.base_handler import FSHandler
-from handler.webdav_cloud_sync import sync_handler
-from handler.webdav_cloud_sync.emulator_names import to_romm_emulator
+from handler.sync.retroarch import sync_handler
+from handler.sync.retroarch.emulator_names import to_romm_emulator
from logger.formatter import highlight as hl
from logger.logger import log
from models.assets import Save
@@ -44,7 +44,7 @@ _BUNDLE_MAX_UNCOMPRESSED_BYTES = 64 * 1024 * 1024
_BUNDLE_FOLDER_PATTERN = re.compile(r"^PSP-(.+?)(?: \[.*])?\.zip$")
-fs_psp_pending_handler = FSHandler(base_path=WEBDAV_CLOUD_SYNC_PSP_PENDING_PATH)
+fs_psp_pending_handler = FSHandler(base_path=SYNC_RETROARCH_PSP_PENDING_PATH)
class PspFolderUnresolved(Exception):
@@ -219,15 +219,15 @@ def _match_by_normalized_title(
def _resolve_rom(
save_folder: str, sfo_title: str | None, can_see: Callable[[Rom], bool]
) -> Rom | None:
- """The ROM a save folder belongs to, via WEBDAV_CLOUD_SYNC_PSP_SERIAL_MAP, else its PARAM.SFO title."""
+ """The ROM a save folder belongs to, via SYNC_RETROARCH_PSP_SERIAL_MAP, else its PARAM.SFO title."""
serial = _derive_serial(save_folder)
- mapped_title = WEBDAV_CLOUD_SYNC_PSP_SERIAL_MAP.get(serial)
+ mapped_title = SYNC_RETROARCH_PSP_SERIAL_MAP.get(serial)
if mapped_title:
rom = sync_handler.resolve_rom(mapped_title, can_see)
if rom:
return rom
log.warning(
- f"WEBDAV_CLOUD_SYNC_PSP_SERIAL_MAP entry for {hl(serial)} ({hl(mapped_title)}) "
+ f"SYNC_RETROARCH_PSP_SERIAL_MAP entry for {hl(serial)} ({hl(mapped_title)}) "
"didn't match any rom in the library"
)
@@ -242,7 +242,7 @@ def _resolve_rom(
log.warning(
f"Couldn't auto-match PARAM.SFO title {hl(sfo_title)} for PSP save "
f"folder {hl(save_folder)}; add serial {hl(serial)} to "
- "WEBDAV_CLOUD_SYNC_PSP_SERIAL_MAP if this keeps happening"
+ "SYNC_RETROARCH_PSP_SERIAL_MAP if this keeps happening"
)
return None
@@ -446,7 +446,7 @@ async def delete_psp_file(
) -> None:
"""Drops one member from its folder's bundle, and the bundle once empty.
- A missing bundle or member is a no-op, like every other webdav-cloud-sync delete.
+ A missing bundle or member is a no-op, like every other RetroArch sync delete.
"""
async with _folder_locks[f"{user.id}:{info.save_folder}"]:
bundle = _find_bundle_by_folder(user, info.save_folder, can_see)
@@ -482,7 +482,7 @@ async def build_psp_manifest_entries(
for member_name, data in members.items():
entries.append(
{
- "path": sync_handler.build_webdav_cloud_sync_path(
+ "path": sync_handler.build_retroarch_sync_path(
"saves",
save.emulator,
f"PSP/SAVEDATA/{save_folder}/{member_name}",
diff --git a/backend/handler/webdav_cloud_sync/sync_handler.py b/backend/handler/sync/retroarch/sync_handler.py
similarity index 91%
rename from backend/handler/webdav_cloud_sync/sync_handler.py
rename to backend/handler/sync/retroarch/sync_handler.py
index b54bd0444..39a41926d 100644
--- a/backend/handler/webdav_cloud_sync/sync_handler.py
+++ b/backend/handler/sync/retroarch/sync_handler.py
@@ -16,10 +16,10 @@ from handler.database import (
db_screenshot_handler,
db_state_handler,
)
-from handler.filesystem import fs_asset_handler, fs_webdav_cloud_sync_blob_handler
+from handler.filesystem import fs_asset_handler, fs_retroarch_sync_blob_handler
from handler.redis_handler import async_cache
-from handler.webdav_cloud_sync import psp
-from handler.webdav_cloud_sync.emulator_names import (
+from handler.sync.retroarch import psp
+from handler.sync.retroarch.emulator_names import (
to_retroarch_dir_name,
to_romm_emulator,
)
@@ -47,7 +47,7 @@ _HASH_CACHE_TTL_SECONDS = 60 * 60 * 24
@dataclass(frozen=True)
-class WebDAVCloudSyncPath:
+class RetroArchSyncPath:
"""A parsed client-side path, e.g. ``saves/Snes9x/Super Mario World.srm``."""
kind: AssetKind
@@ -67,7 +67,7 @@ def split_segments(path: str) -> list[str] | None:
return segments
-def parse_webdav_cloud_sync_path(path: str) -> WebDAVCloudSyncPath | None:
+def parse_retroarch_sync_path(path: str) -> RetroArchSyncPath | None:
"""Parse a ``/[/]`` client path, or None if unsupported."""
segments = split_segments(path)
if segments is None or not 2 <= len(segments) <= 3:
@@ -79,7 +79,7 @@ def parse_webdav_cloud_sync_path(path: str) -> WebDAVCloudSyncPath | None:
# RomM's web player matches saves on the lowercase libretro core id, not
# RetroArch's display-cased folder name.
- return WebDAVCloudSyncPath(
+ return RetroArchSyncPath(
kind=kind,
emulator=to_romm_emulator(segments[1]) if len(segments) == 3 else None,
file_name=segments[-1],
@@ -182,7 +182,7 @@ def resolve_state_screenshot_by_slot(
return state_screenshot(state) if state else None
-def build_webdav_cloud_sync_path(
+def build_retroarch_sync_path(
kind: AssetKind, emulator: str | None, file_name: str
) -> str:
if emulator:
@@ -206,7 +206,7 @@ def build_asset_file_path(
)
-def parse_webdav_cloud_sync_blob_path(path: str) -> str | None:
+def parse_retroarch_sync_blob_path(path: str) -> str | None:
"""A blob-category client path as ``category/...``, or None if it isn't one.
Nesting is arbitrary: RetroArch mirrors its on-device tree here.
@@ -243,13 +243,13 @@ async def _cached_md5(
async def blob_md5(user: User, blob_path: str) -> str | None:
disk_path = user_blob_path(user, blob_path)
try:
- stat = fs_webdav_cloud_sync_blob_handler.validate_path(disk_path).stat()
+ stat = fs_retroarch_sync_blob_handler.validate_path(disk_path).stat()
except (ValueError, OSError):
return None
return await _cached_md5(
- f"romm:webdav_cloud_sync:blob_md5:{user.id}:{blob_path}:{stat.st_size}:{stat.st_mtime}",
- lambda: fs_webdav_cloud_sync_blob_handler.compute_file_md5(disk_path),
+ f"romm:retroarch_sync:blob_md5:{user.id}:{blob_path}:{stat.st_size}:{stat.st_mtime}",
+ lambda: fs_retroarch_sync_blob_handler.compute_file_md5(disk_path),
)
@@ -257,7 +257,7 @@ async def build_blob_manifest_entries(user: User) -> list[dict[str, str]]:
entries: list[dict[str, str]] = []
for category in BLOB_CATEGORIES:
prefix = f"{fs_asset_handler.user_folder_path(user)}/{category}"
- for relative in await fs_webdav_cloud_sync_blob_handler.list_blob_paths(prefix):
+ for relative in await fs_retroarch_sync_blob_handler.list_blob_paths(prefix):
blob_path = f"{category}/{relative}"
digest = await blob_md5(user, blob_path)
if not digest:
@@ -270,7 +270,7 @@ async def build_blob_manifest_entries(user: User) -> list[dict[str, str]]:
def resolve_roms(
game_names: Iterable[str], can_see: Callable[[Rom], bool]
) -> dict[str, Rom]:
- """The ROM each webdav-cloud-sync game name belongs to, matched on file name alone.
+ """The ROM each RetroArch sync game name belongs to, matched on file name alone.
An ambiguous name resolves to its first visible ROM by id, so it stays
stable across syncs.
@@ -294,7 +294,7 @@ def resolve_rom(game_name: str, can_see: Callable[[Rom], bool]) -> Rom | None:
async def asset_md5(asset: Save | State | Screenshot) -> str | None:
return await _cached_md5(
- f"romm:webdav_cloud_sync:md5:{asset.full_path}"
+ f"romm:retroarch_sync:md5:{asset.full_path}"
f":{asset.file_size_bytes}:{asset.updated_at.timestamp()}",
lambda: fs_asset_handler.compute_file_md5(asset.full_path),
)
@@ -348,7 +348,7 @@ async def build_manifest(
for save in listed_saves:
if is_addressable(save.rom, "saves", save.file_name):
await add(
- build_webdav_cloud_sync_path("saves", save.emulator, save.file_name),
+ build_retroarch_sync_path("saves", save.emulator, save.file_name),
save,
)
@@ -356,7 +356,7 @@ async def build_manifest(
if not is_addressable(state.rom, "states", file_name):
continue
- state_path = build_webdav_cloud_sync_path("states", emulator, file_name)
+ state_path = build_retroarch_sync_path("states", emulator, file_name)
if not await add(state_path, state):
continue
diff --git a/backend/main.py b/backend/main.py
index 8551a1d92..e430170dd 100644
--- a/backend/main.py
+++ b/backend/main.py
@@ -62,7 +62,6 @@ from endpoints.streaming import router as streaming_router
from endpoints.sync import router as sync_router
from endpoints.tasks import router as tasks_router
from endpoints.user import router as user_router
-from endpoints.webdav_cloud_sync import router as webdav_cloud_sync_router
from handler.auth.constants import SESSION_COOKIE_NAME
from handler.auth.hybrid_auth import HybridAuthBackend
from handler.auth.middleware.csrf_middleware import CSRFMiddleware
@@ -135,7 +134,7 @@ app.add_middleware(
re.compile(r"^/api/saves"),
re.compile(r"^/api/states"),
re.compile(r"^/api/screenshots"),
- re.compile(r"^/api/webdav-cloud-sync"),
+ re.compile(r"^/api/sync/retroarch"),
],
)
@@ -202,7 +201,6 @@ app.include_router(search_router, prefix="/api")
app.include_router(saves_router, prefix="/api")
app.include_router(states_router, prefix="/api")
app.include_router(sync_router, prefix="/api")
-app.include_router(webdav_cloud_sync_router, prefix="/api")
app.include_router(tasks_router, prefix="/api")
app.include_router(feeds_router, prefix="/api")
app.include_router(configs_router, prefix="/api")
diff --git a/backend/tests/endpoints/test_webdav_cloud_sync.py b/backend/tests/endpoints/test_sync_retroarch.py
similarity index 79%
rename from backend/tests/endpoints/test_webdav_cloud_sync.py
rename to backend/tests/endpoints/test_sync_retroarch.py
index 0e784af4b..a064816a8 100644
--- a/backend/tests/endpoints/test_webdav_cloud_sync.py
+++ b/backend/tests/endpoints/test_sync_retroarch.py
@@ -10,8 +10,8 @@ from handler.database import (
db_state_handler,
)
from handler.filesystem import fs_asset_handler
-from handler.webdav_cloud_sync import psp, sync_handler
-from handler.webdav_cloud_sync.emulator_names import (
+from handler.sync.retroarch import psp, sync_handler
+from handler.sync.retroarch.emulator_names import (
to_retroarch_dir_name,
to_romm_emulator,
)
@@ -35,10 +35,10 @@ def saves_path(admin_user: User, rom: Rom):
@pytest.fixture
def synced_save(admin_user: User, rom: Rom, saves_path: str):
- """A save stored where the webdav-cloud-sync path `saves/Snes9x/test_rom.srm`
+ """A save stored where the RetroArch sync path `saves/Snes9x/test_rom.srm`
resolves to, unlike the shared fixtures' legacy layout. `emulator` is
RomM's own convention (lowercase), not RetroArch's directory casing --
- see `parse_webdav_cloud_sync_path`."""
+ see `parse_retroarch_sync_path`."""
return db_save_handler.add_save(
Save(
rom_id=rom.id,
@@ -106,7 +106,7 @@ def web_state(admin_user: User, rom: Rom, states_path: str):
)
-class TestWebDAVCloudSyncEmulatorNames:
+class TestRetroArchSyncEmulatorNames:
@pytest.mark.parametrize(
("retroarch_dir_name", "romm_emulator"),
[
@@ -154,7 +154,7 @@ class TestWebDAVCloudSyncEmulatorNames:
assert to_retroarch_dir_name(romm_emulator) == retroarch_dir_name
-class TestWebDAVCloudSyncPathParsing:
+class TestRetroArchSyncPathParsing:
@pytest.mark.parametrize(
("path", "kind", "emulator", "file_name"),
[
@@ -172,7 +172,7 @@ class TestWebDAVCloudSyncPathParsing:
],
)
def test_parses_supported_paths(self, path, kind, emulator, file_name):
- parsed = sync_handler.parse_webdav_cloud_sync_path(path)
+ parsed = sync_handler.parse_retroarch_sync_path(path)
assert parsed is not None
assert parsed.kind == kind
@@ -192,7 +192,7 @@ class TestWebDAVCloudSyncPathParsing:
],
)
def test_rejects_unsupported_paths(self, path):
- assert sync_handler.parse_webdav_cloud_sync_path(path) is None
+ assert sync_handler.parse_retroarch_sync_path(path) is None
@pytest.mark.parametrize(
("kind", "file_name", "game_name"),
@@ -209,16 +209,16 @@ class TestWebDAVCloudSyncPathParsing:
assert sync_handler.game_name_from_file_name(kind, file_name) == game_name
-class TestWebDAVCloudSyncAuth:
+class TestRetroArchSyncAuth:
def test_options_without_credentials_challenges(self, client):
- response = client.options("/api/webdav-cloud-sync/")
+ response = client.options("/api/sync/retroarch/")
assert response.status_code == status.HTTP_401_UNAUTHORIZED
assert response.headers["www-authenticate"].startswith("Basic")
assert response.content == b""
def test_options_with_basic_auth_advertises_dav(self, client, admin_user: User):
- response = client.options("/api/webdav-cloud-sync/", auth=ADMIN_AUTH)
+ response = client.options("/api/sync/retroarch/", auth=ADMIN_AUTH)
assert response.status_code == status.HTTP_200_OK
assert response.headers["dav"] == "1, 2"
@@ -226,19 +226,17 @@ class TestWebDAVCloudSyncAuth:
assert "PROPFIND" in response.headers["allow"]
def test_get_without_credentials_challenges(self, client):
- response = client.get("/api/webdav-cloud-sync/manifest.server")
+ response = client.get("/api/sync/retroarch/manifest.server")
assert response.status_code == status.HTTP_401_UNAUTHORIZED
def test_put_without_credentials_challenges(self, client):
- response = client.put(
- "/api/webdav-cloud-sync/saves/test_rom.srm", content=b"data"
- )
+ response = client.put("/api/sync/retroarch/saves/test_rom.srm", content=b"data")
assert response.status_code == status.HTTP_401_UNAUTHORIZED
-class TestWebDAVCloudSyncStateSlotResolution:
+class TestRetroArchSyncStateSlotResolution:
def test_resolves_canonical_name_to_the_web_created_row(
self, admin_user: User, rom: Rom, web_state: State
):
@@ -305,9 +303,9 @@ class TestWebDAVCloudSyncStateSlotResolution:
assert resolved is None
-class TestWebDAVCloudSyncManifest:
+class TestRetroArchSyncManifest:
@mock.patch(
- "handler.webdav_cloud_sync.sync_handler.asset_md5",
+ "handler.sync.retroarch.sync_handler.asset_md5",
new_callable=mock.AsyncMock,
return_value="d41d8cd98f00b204e9800998ecf8427e",
)
@@ -319,7 +317,7 @@ class TestWebDAVCloudSyncManifest:
synced_save: Save,
synced_state: State,
):
- response = client.get("/api/webdav-cloud-sync/manifest.server", auth=ADMIN_AUTH)
+ response = client.get("/api/sync/retroarch/manifest.server", auth=ADMIN_AUTH)
assert response.status_code == status.HTTP_200_OK
assert response.json() == [
@@ -334,7 +332,7 @@ class TestWebDAVCloudSyncManifest:
]
@mock.patch(
- "handler.webdav_cloud_sync.sync_handler.asset_md5",
+ "handler.sync.retroarch.sync_handler.asset_md5",
new_callable=mock.AsyncMock,
return_value="d41d8cd98f00b204e9800998ecf8427e",
)
@@ -349,7 +347,7 @@ class TestWebDAVCloudSyncManifest:
was surfaced as-is). It still belongs to slot 0 like any other
untagged state, so the manifest advertises it under RetroArch's own
canonical name for that slot instead of its raw file name."""
- response = client.get("/api/webdav-cloud-sync/manifest.server", auth=ADMIN_AUTH)
+ response = client.get("/api/sync/retroarch/manifest.server", auth=ADMIN_AUTH)
assert response.status_code == status.HTTP_200_OK
assert response.json() == [
@@ -360,7 +358,7 @@ class TestWebDAVCloudSyncManifest:
]
@mock.patch(
- "handler.webdav_cloud_sync.sync_handler.asset_md5",
+ "handler.sync.retroarch.sync_handler.asset_md5",
new_callable=mock.AsyncMock,
return_value="d41d8cd98f00b204e9800998ecf8427e",
)
@@ -395,7 +393,7 @@ class TestWebDAVCloudSyncManifest:
)
assert newer.id > older.id
- response = client.get("/api/webdav-cloud-sync/manifest.server", auth=ADMIN_AUTH)
+ response = client.get("/api/sync/retroarch/manifest.server", auth=ADMIN_AUTH)
assert response.status_code == status.HTTP_200_OK
assert response.json() == [
@@ -406,26 +404,26 @@ class TestWebDAVCloudSyncManifest:
]
@mock.patch(
- "handler.webdav_cloud_sync.sync_handler.asset_md5",
+ "handler.sync.retroarch.sync_handler.asset_md5",
new_callable=mock.AsyncMock,
return_value="d41d8cd98f00b204e9800998ecf8427e",
)
def test_excludes_slotted_saves(
self, _asset_md5: mock.AsyncMock, client, admin_user: User, save: Save
):
- response = client.get("/api/webdav-cloud-sync/manifest.server", auth=ADMIN_AUTH)
+ response = client.get("/api/sync/retroarch/manifest.server", auth=ADMIN_AUTH)
assert response.status_code == status.HTTP_200_OK
assert response.json() == []
def test_empty_library_returns_empty_manifest(self, client, admin_user: User):
- response = client.get("/api/webdav-cloud-sync/manifest.server", auth=ADMIN_AUTH)
+ response = client.get("/api/sync/retroarch/manifest.server", auth=ADMIN_AUTH)
assert response.status_code == status.HTTP_200_OK
assert response.json() == []
@mock.patch(
- "handler.webdav_cloud_sync.sync_handler.asset_md5",
+ "handler.sync.retroarch.sync_handler.asset_md5",
new_callable=mock.AsyncMock,
return_value="d41d8cd98f00b204e9800998ecf8427e",
)
@@ -433,7 +431,7 @@ class TestWebDAVCloudSyncManifest:
self, _asset_md5: mock.AsyncMock, client, admin_user: User, synced_save: Save
):
"""The manifest uses RetroArch's directory casing (`Snes9x`), not RomM's."""
- response = client.get("/api/webdav-cloud-sync/manifest.server", auth=ADMIN_AUTH)
+ response = client.get("/api/sync/retroarch/manifest.server", auth=ADMIN_AUTH)
assert response.status_code == status.HTTP_200_OK
assert response.json() == [
@@ -444,7 +442,7 @@ class TestWebDAVCloudSyncManifest:
]
@mock.patch(
- "handler.webdav_cloud_sync.sync_handler.asset_md5",
+ "handler.sync.retroarch.sync_handler.asset_md5",
new_callable=mock.AsyncMock,
return_value="d41d8cd98f00b204e9800998ecf8427e",
)
@@ -485,7 +483,7 @@ class TestWebDAVCloudSyncManifest:
)
)
- response = client.get("/api/webdav-cloud-sync/manifest.server", auth=ADMIN_AUTH)
+ response = client.get("/api/sync/retroarch/manifest.server", auth=ADMIN_AUTH)
assert response.status_code == status.HTTP_200_OK
assert response.json() == [
@@ -496,7 +494,7 @@ class TestWebDAVCloudSyncManifest:
]
-class TestWebDAVCloudSyncStateScreenshots:
+class TestRetroArchSyncStateScreenshots:
def test_game_name_strips_png_before_state_suffix(self):
"""`test_rom.state.png` resolves to game `test_rom`, not `test_rom.state`."""
assert (
@@ -513,7 +511,7 @@ class TestWebDAVCloudSyncStateScreenshots:
)
@mock.patch(
- "handler.webdav_cloud_sync.sync_handler.asset_md5",
+ "handler.sync.retroarch.sync_handler.asset_md5",
new_callable=mock.AsyncMock,
return_value="d41d8cd98f00b204e9800998ecf8427e",
)
@@ -525,7 +523,7 @@ class TestWebDAVCloudSyncStateScreenshots:
synced_state: State,
synced_state_screenshot: Screenshot,
):
- response = client.get("/api/webdav-cloud-sync/manifest.server", auth=ADMIN_AUTH)
+ response = client.get("/api/sync/retroarch/manifest.server", auth=ADMIN_AUTH)
assert response.status_code == status.HTTP_200_OK
assert response.json() == [
@@ -540,12 +538,10 @@ class TestWebDAVCloudSyncStateScreenshots:
]
@mock.patch(
- "endpoints.webdav_cloud_sync.fs_asset_handler.write_file",
+ "endpoints.sync.retroarch.fs_asset_handler.write_file",
new_callable=mock.AsyncMock,
)
- @mock.patch(
- "endpoints.webdav_cloud_sync.scan_screenshot", new_callable=mock.AsyncMock
- )
+ @mock.patch("endpoints.sync.retroarch.scan_screenshot", new_callable=mock.AsyncMock)
def test_creates_screenshot_for_a_new_state(
self,
mock_scan_screenshot: mock.AsyncMock,
@@ -562,7 +558,7 @@ class TestWebDAVCloudSyncStateScreenshots:
)
response = client.put(
- "/api/webdav-cloud-sync/states/Snes9x/test_rom.state.png",
+ "/api/sync/retroarch/states/Snes9x/test_rom.state.png",
content=b"pngdata",
auth=ADMIN_AUTH,
)
@@ -574,12 +570,10 @@ class TestWebDAVCloudSyncStateScreenshots:
assert screenshots is not None
@mock.patch(
- "endpoints.webdav_cloud_sync.fs_asset_handler.write_file",
+ "endpoints.sync.retroarch.fs_asset_handler.write_file",
new_callable=mock.AsyncMock,
)
- @mock.patch(
- "endpoints.webdav_cloud_sync.scan_screenshot", new_callable=mock.AsyncMock
- )
+ @mock.patch("endpoints.sync.retroarch.scan_screenshot", new_callable=mock.AsyncMock)
def test_overwrites_existing_screenshot_for_a_state(
self,
mock_scan_screenshot: mock.AsyncMock,
@@ -597,7 +591,7 @@ class TestWebDAVCloudSyncStateScreenshots:
)
response = client.put(
- "/api/webdav-cloud-sync/states/Snes9x/test_rom.state.png",
+ "/api/sync/retroarch/states/Snes9x/test_rom.state.png",
content=b"newpngdata",
auth=ADMIN_AUTH,
)
@@ -625,7 +619,7 @@ class TestWebDAVCloudSyncStateScreenshots:
response = client.request(
"DELETE",
- "/api/webdav-cloud-sync/states/Snes9x/test_rom.state1.png",
+ "/api/sync/retroarch/states/Snes9x/test_rom.state1.png",
auth=ADMIN_AUTH,
)
@@ -637,12 +631,12 @@ class TestWebDAVCloudSyncStateScreenshots:
)
-class TestWebDAVCloudSyncUpload:
+class TestRetroArchSyncUpload:
@mock.patch(
- "endpoints.webdav_cloud_sync.fs_asset_handler.write_file",
+ "endpoints.sync.retroarch.fs_asset_handler.write_file",
new_callable=mock.AsyncMock,
)
- @mock.patch("endpoints.webdav_cloud_sync.scan_save", new_callable=mock.AsyncMock)
+ @mock.patch("endpoints.sync.retroarch.scan_save", new_callable=mock.AsyncMock)
def test_creates_save_for_matching_rom(
self,
mock_scan_save: mock.AsyncMock,
@@ -660,7 +654,7 @@ class TestWebDAVCloudSyncUpload:
)
response = client.put(
- "/api/webdav-cloud-sync/saves/Snes9x/test_rom.srm",
+ "/api/sync/retroarch/saves/Snes9x/test_rom.srm",
content=b"data",
auth=ADMIN_AUTH,
)
@@ -675,10 +669,10 @@ class TestWebDAVCloudSyncUpload:
assert saves[0].slot is None
@mock.patch(
- "endpoints.webdav_cloud_sync.fs_asset_handler.write_file",
+ "endpoints.sync.retroarch.fs_asset_handler.write_file",
new_callable=mock.AsyncMock,
)
- @mock.patch("endpoints.webdav_cloud_sync.scan_save", new_callable=mock.AsyncMock)
+ @mock.patch("endpoints.sync.retroarch.scan_save", new_callable=mock.AsyncMock)
def test_overwrites_existing_save_in_place(
self,
mock_scan_save: mock.AsyncMock,
@@ -695,7 +689,7 @@ class TestWebDAVCloudSyncUpload:
content_hash="8d777f385d3dfec8815d20f7496026dc",
)
client.put(
- "/api/webdav-cloud-sync/saves/Snes9x/test_rom.srm",
+ "/api/sync/retroarch/saves/Snes9x/test_rom.srm",
content=b"data",
auth=ADMIN_AUTH,
)
@@ -707,7 +701,7 @@ class TestWebDAVCloudSyncUpload:
content_hash="9a0364b9e99bb480dd25e1f0284c8555",
)
response = client.put(
- "/api/webdav-cloud-sync/saves/Snes9x/test_rom.srm",
+ "/api/sync/retroarch/saves/Snes9x/test_rom.srm",
content=b"newdata",
auth=ADMIN_AUTH,
)
@@ -719,10 +713,10 @@ class TestWebDAVCloudSyncUpload:
assert saves[0].file_size_bytes == 7
@mock.patch(
- "endpoints.webdav_cloud_sync.fs_asset_handler.write_file",
+ "endpoints.sync.retroarch.fs_asset_handler.write_file",
new_callable=mock.AsyncMock,
)
- @mock.patch("endpoints.webdav_cloud_sync.scan_save", new_callable=mock.AsyncMock)
+ @mock.patch("endpoints.sync.retroarch.scan_save", new_callable=mock.AsyncMock)
def test_overwrite_clears_missing_from_fs(
self,
mock_scan_save: mock.AsyncMock,
@@ -741,7 +735,7 @@ class TestWebDAVCloudSyncUpload:
)
response = client.put(
- "/api/webdav-cloud-sync/saves/Snes9x/test_rom.srm",
+ "/api/sync/retroarch/saves/Snes9x/test_rom.srm",
content=b"data",
auth=ADMIN_AUTH,
)
@@ -755,7 +749,7 @@ class TestWebDAVCloudSyncUpload:
self, client, admin_user: User, rom: Rom
):
response = client.put(
- "/api/webdav-cloud-sync/saves/Snes9x/test_rom%3F.srm",
+ "/api/sync/retroarch/saves/Snes9x/test_rom%3F.srm",
content=b"data",
auth=ADMIN_AUTH,
)
@@ -763,10 +757,10 @@ class TestWebDAVCloudSyncUpload:
assert response.status_code == status.HTTP_409_CONFLICT
@mock.patch(
- "endpoints.webdav_cloud_sync.fs_asset_handler.write_file",
+ "endpoints.sync.retroarch.fs_asset_handler.write_file",
new_callable=mock.AsyncMock,
)
- @mock.patch("endpoints.webdav_cloud_sync.scan_state", new_callable=mock.AsyncMock)
+ @mock.patch("endpoints.sync.retroarch.scan_state", new_callable=mock.AsyncMock)
def test_creates_state_from_auto_savestate_name(
self,
mock_scan_state: mock.AsyncMock,
@@ -788,7 +782,7 @@ class TestWebDAVCloudSyncUpload:
)
response = client.put(
- "/api/webdav-cloud-sync/states/Snes9x/test_rom.state.auto",
+ "/api/sync/retroarch/states/Snes9x/test_rom.state.auto",
content=b"statedat",
auth=ADMIN_AUTH,
)
@@ -801,7 +795,7 @@ class TestWebDAVCloudSyncUpload:
def test_rejects_upload_with_no_matching_rom(self, client, admin_user: User):
response = client.put(
- "/api/webdav-cloud-sync/saves/Snes9x/not_in_library.srm",
+ "/api/sync/retroarch/saves/Snes9x/not_in_library.srm",
content=b"data",
auth=ADMIN_AUTH,
)
@@ -813,7 +807,7 @@ class TestWebDAVCloudSyncUpload:
def test_rejects_unsupported_sync_root(self, client, admin_user: User, rom: Rom):
response = client.put(
- "/api/webdav-cloud-sync/deleted/saves/test_rom.srm",
+ "/api/sync/retroarch/deleted/saves/test_rom.srm",
content=b"data",
auth=ADMIN_AUTH,
)
@@ -822,25 +816,25 @@ class TestWebDAVCloudSyncUpload:
def test_accepts_and_drops_client_manifest(self, client, admin_user: User):
response = client.put(
- "/api/webdav-cloud-sync/manifest.server", content=b"[]", auth=ADMIN_AUTH
+ "/api/sync/retroarch/manifest.server", content=b"[]", auth=ADMIN_AUTH
)
assert response.status_code == status.HTTP_204_NO_CONTENT
-class TestWebDAVCloudSyncDownload:
+class TestRetroArchSyncDownload:
def test_missing_file_is_not_found(self, client, admin_user: User, rom: Rom):
response = client.get(
- "/api/webdav-cloud-sync/saves/Snes9x/test_rom.srm", auth=ADMIN_AUTH
+ "/api/sync/retroarch/saves/Snes9x/test_rom.srm", auth=ADMIN_AUTH
)
assert response.status_code == status.HTTP_404_NOT_FOUND
assert response.content == b""
-class TestWebDAVCloudSyncDelete:
+class TestRetroArchSyncDelete:
@mock.patch(
- "endpoints.webdav_cloud_sync.fs_asset_handler.remove_file",
+ "endpoints.sync.retroarch.fs_asset_handler.remove_file",
new_callable=mock.AsyncMock,
)
def test_delete_removes_the_save(
@@ -853,7 +847,7 @@ class TestWebDAVCloudSyncDelete:
):
response = client.request(
"DELETE",
- "/api/webdav-cloud-sync/saves/Snes9x/test_rom.srm",
+ "/api/sync/retroarch/saves/Snes9x/test_rom.srm",
auth=ADMIN_AUTH,
)
@@ -862,7 +856,7 @@ class TestWebDAVCloudSyncDelete:
assert db_save_handler.get_saves(user_id=admin_user.id, rom_ids=[rom.id]) == []
@mock.patch(
- "endpoints.webdav_cloud_sync.fs_asset_handler.remove_file",
+ "endpoints.sync.retroarch.fs_asset_handler.remove_file",
new_callable=mock.AsyncMock,
)
def test_move_is_treated_as_a_delete(
@@ -875,10 +869,8 @@ class TestWebDAVCloudSyncDelete:
):
response = client.request(
"MOVE",
- "/api/webdav-cloud-sync/saves/Snes9x/test_rom.srm",
- headers={
- "Destination": "/api/webdav-cloud-sync/deleted/saves/test_rom.srm"
- },
+ "/api/sync/retroarch/saves/Snes9x/test_rom.srm",
+ headers={"Destination": "/api/sync/retroarch/deleted/saves/test_rom.srm"},
auth=ADMIN_AUTH,
)
@@ -887,29 +879,29 @@ class TestWebDAVCloudSyncDelete:
def test_delete_of_unknown_file_is_not_found(self, client, admin_user: User):
response = client.request(
- "DELETE", "/api/webdav-cloud-sync/saves/Snes9x/nope.srm", auth=ADMIN_AUTH
+ "DELETE", "/api/sync/retroarch/saves/Snes9x/nope.srm", auth=ADMIN_AUTH
)
assert response.status_code == status.HTTP_404_NOT_FOUND
-class TestWebDAVCloudSyncPsp:
+class TestRetroArchSyncPsp:
"""PSP save-folder bundling through the endpoints and the manifest.
- WEBDAV_CLOUD_SYNC_PSP_SERIAL_MAP resolves the rom, so no test depends on fulltext search.
+ SYNC_RETROARCH_PSP_SERIAL_MAP resolves the rom, so no test depends on fulltext search.
"""
@pytest.fixture(autouse=True)
def _serial_map(self, monkeypatch: pytest.MonkeyPatch, rom: Rom):
monkeypatch.setattr(
psp,
- "WEBDAV_CLOUD_SYNC_PSP_SERIAL_MAP",
+ "SYNC_RETROARCH_PSP_SERIAL_MAP",
{"TEST12345": rom.fs_name_no_ext},
)
def test_ignores_system_cache_files(self, client, admin_user: User):
response = client.put(
- "/api/webdav-cloud-sync/saves/PPSSPP/PSP/SYSTEM/CACHE/shader.bin",
+ "/api/sync/retroarch/saves/PPSSPP/PSP/SYSTEM/CACHE/shader.bin",
content=b"cache data",
auth=ADMIN_AUTH,
)
@@ -920,14 +912,14 @@ class TestWebDAVCloudSyncPsp:
self, client, admin_user: User, rom: Rom
):
put_sfo = client.put(
- "/api/webdav-cloud-sync/saves/PPSSPP/PSP/SAVEDATA/TEST12345DATA0/PARAM.SFO",
- content=b"not real sfo bytes, resolved via WEBDAV_CLOUD_SYNC_PSP_SERIAL_MAP instead",
+ "/api/sync/retroarch/saves/PPSSPP/PSP/SAVEDATA/TEST12345DATA0/PARAM.SFO",
+ content=b"not real sfo bytes, resolved via SYNC_RETROARCH_PSP_SERIAL_MAP instead",
auth=ADMIN_AUTH,
)
assert put_sfo.status_code == status.HTTP_201_CREATED
put_data = client.put(
- "/api/webdav-cloud-sync/saves/PPSSPP/PSP/SAVEDATA/TEST12345DATA0/SAVE.BIN",
+ "/api/sync/retroarch/saves/PPSSPP/PSP/SAVEDATA/TEST12345DATA0/SAVE.BIN",
content=b"the actual save data",
auth=ADMIN_AUTH,
)
@@ -938,17 +930,17 @@ class TestWebDAVCloudSyncPsp:
assert saves[0].file_name == "PSP-TEST12345DATA0.zip"
get_sfo = client.get(
- "/api/webdav-cloud-sync/saves/PPSSPP/PSP/SAVEDATA/TEST12345DATA0/PARAM.SFO",
+ "/api/sync/retroarch/saves/PPSSPP/PSP/SAVEDATA/TEST12345DATA0/PARAM.SFO",
auth=ADMIN_AUTH,
)
assert get_sfo.status_code == status.HTTP_200_OK
assert (
get_sfo.content
- == b"not real sfo bytes, resolved via WEBDAV_CLOUD_SYNC_PSP_SERIAL_MAP instead"
+ == b"not real sfo bytes, resolved via SYNC_RETROARCH_PSP_SERIAL_MAP instead"
)
get_data = client.get(
- "/api/webdav-cloud-sync/saves/PPSSPP/PSP/SAVEDATA/TEST12345DATA0/SAVE.BIN",
+ "/api/sync/retroarch/saves/PPSSPP/PSP/SAVEDATA/TEST12345DATA0/SAVE.BIN",
auth=ADMIN_AUTH,
)
assert get_data.status_code == status.HTTP_200_OK
@@ -958,17 +950,17 @@ class TestWebDAVCloudSyncPsp:
self, client, admin_user: User
):
client.put(
- "/api/webdav-cloud-sync/saves/PPSSPP/PSP/SAVEDATA/TEST12345DATA0/PARAM.SFO",
+ "/api/sync/retroarch/saves/PPSSPP/PSP/SAVEDATA/TEST12345DATA0/PARAM.SFO",
content=b"sfo",
auth=ADMIN_AUTH,
)
client.put(
- "/api/webdav-cloud-sync/saves/PPSSPP/PSP/SAVEDATA/TEST12345DATA0/SAVE.BIN",
+ "/api/sync/retroarch/saves/PPSSPP/PSP/SAVEDATA/TEST12345DATA0/SAVE.BIN",
content=b"data",
auth=ADMIN_AUTH,
)
- response = client.get("/api/webdav-cloud-sync/manifest.server", auth=ADMIN_AUTH)
+ response = client.get("/api/sync/retroarch/manifest.server", auth=ADMIN_AUTH)
assert response.status_code == status.HTTP_200_OK
paths = {entry["path"] for entry in response.json()}
@@ -1002,7 +994,7 @@ class TestWebDAVCloudSyncPsp:
)
response = client.put(
- "/api/webdav-cloud-sync/saves/PPSSPP/PSP/SAVEDATA/TEST12345DATA0/SAVE.BIN",
+ "/api/sync/retroarch/saves/PPSSPP/PSP/SAVEDATA/TEST12345DATA0/SAVE.BIN",
content=b"data",
auth=ADMIN_AUTH,
)
@@ -1012,7 +1004,7 @@ class TestWebDAVCloudSyncPsp:
assert [save.file_name for save in saves] == [tagged_name]
get_data = client.get(
- "/api/webdav-cloud-sync/saves/PPSSPP/PSP/SAVEDATA/TEST12345DATA0/SAVE.BIN",
+ "/api/sync/retroarch/saves/PPSSPP/PSP/SAVEDATA/TEST12345DATA0/SAVE.BIN",
auth=ADMIN_AUTH,
)
assert get_data.content == b"data"
@@ -1021,7 +1013,7 @@ class TestWebDAVCloudSyncPsp:
self, client, admin_user: User, rom: Rom
):
client.put(
- "/api/webdav-cloud-sync/saves/PPSSPP/PSP/SAVEDATA/TEST12345DATA0/SAVE.BIN",
+ "/api/sync/retroarch/saves/PPSSPP/PSP/SAVEDATA/TEST12345DATA0/SAVE.BIN",
content=b"synced",
auth=ADMIN_AUTH,
)
@@ -1048,13 +1040,13 @@ class TestWebDAVCloudSyncPsp:
)
get_data = client.get(
- "/api/webdav-cloud-sync/saves/PPSSPP/PSP/SAVEDATA/TEST12345DATA0/SAVE.BIN",
+ "/api/sync/retroarch/saves/PPSSPP/PSP/SAVEDATA/TEST12345DATA0/SAVE.BIN",
auth=ADMIN_AUTH,
)
assert get_data.content == b"synced"
client.delete(
- "/api/webdav-cloud-sync/saves/PPSSPP/PSP/SAVEDATA/TEST12345DATA0/SAVE.BIN",
+ "/api/sync/retroarch/saves/PPSSPP/PSP/SAVEDATA/TEST12345DATA0/SAVE.BIN",
auth=ADMIN_AUTH,
)
saves = db_save_handler.get_saves(user_id=admin_user.id, rom_ids=[rom.id])
@@ -1064,12 +1056,12 @@ class TestWebDAVCloudSyncPsp:
self, client, admin_user: User
):
client.put(
- "/api/webdav-cloud-sync/saves/PSP/SAVEDATA/TEST12345DATA0/SAVE.BIN",
+ "/api/sync/retroarch/saves/PSP/SAVEDATA/TEST12345DATA0/SAVE.BIN",
content=b"data",
auth=ADMIN_AUTH,
)
- response = client.get("/api/webdav-cloud-sync/manifest.server", auth=ADMIN_AUTH)
+ response = client.get("/api/sync/retroarch/manifest.server", auth=ADMIN_AUTH)
assert [entry["path"] for entry in response.json()] == [
"saves/PSP/SAVEDATA/TEST12345DATA0/SAVE.BIN"
@@ -1078,10 +1070,10 @@ class TestWebDAVCloudSyncPsp:
def test_unresolved_folder_is_buffered_and_conflicts(
self, client, admin_user: User, monkeypatch: pytest.MonkeyPatch
):
- monkeypatch.setattr(psp, "WEBDAV_CLOUD_SYNC_PSP_SERIAL_MAP", {})
+ monkeypatch.setattr(psp, "SYNC_RETROARCH_PSP_SERIAL_MAP", {})
response = client.put(
- "/api/webdav-cloud-sync/saves/PPSSPP/PSP/SAVEDATA/UNKNOWN99999DATA0/SAVE.BIN",
+ "/api/sync/retroarch/saves/PPSSPP/PSP/SAVEDATA/UNKNOWN99999DATA0/SAVE.BIN",
content=b"orphaned save data",
auth=ADMIN_AUTH,
)
@@ -1092,32 +1084,32 @@ class TestWebDAVCloudSyncPsp:
self, client, admin_user: User, rom: Rom
):
client.put(
- "/api/webdav-cloud-sync/saves/PPSSPP/PSP/SAVEDATA/TEST12345DATA0/PARAM.SFO",
+ "/api/sync/retroarch/saves/PPSSPP/PSP/SAVEDATA/TEST12345DATA0/PARAM.SFO",
content=b"sfo",
auth=ADMIN_AUTH,
)
client.put(
- "/api/webdav-cloud-sync/saves/PPSSPP/PSP/SAVEDATA/TEST12345DATA0/SAVE.BIN",
+ "/api/sync/retroarch/saves/PPSSPP/PSP/SAVEDATA/TEST12345DATA0/SAVE.BIN",
content=b"data",
auth=ADMIN_AUTH,
)
response = client.request(
"DELETE",
- "/api/webdav-cloud-sync/saves/PPSSPP/PSP/SAVEDATA/TEST12345DATA0/SAVE.BIN",
+ "/api/sync/retroarch/saves/PPSSPP/PSP/SAVEDATA/TEST12345DATA0/SAVE.BIN",
auth=ADMIN_AUTH,
)
assert response.status_code == status.HTTP_204_NO_CONTENT
get_sfo = client.get(
- "/api/webdav-cloud-sync/saves/PPSSPP/PSP/SAVEDATA/TEST12345DATA0/PARAM.SFO",
+ "/api/sync/retroarch/saves/PPSSPP/PSP/SAVEDATA/TEST12345DATA0/PARAM.SFO",
auth=ADMIN_AUTH,
)
assert get_sfo.status_code == status.HTTP_200_OK
assert get_sfo.content == b"sfo"
get_data = client.get(
- "/api/webdav-cloud-sync/saves/PPSSPP/PSP/SAVEDATA/TEST12345DATA0/SAVE.BIN",
+ "/api/sync/retroarch/saves/PPSSPP/PSP/SAVEDATA/TEST12345DATA0/SAVE.BIN",
auth=ADMIN_AUTH,
)
assert get_data.status_code == status.HTTP_404_NOT_FOUND
@@ -1127,7 +1119,7 @@ class TestWebDAVCloudSyncPsp:
):
for name in ("PARAM.SFO", "SAVE.BIN"):
client.put(
- f"/api/webdav-cloud-sync/saves/PPSSPP/PSP/SAVEDATA/TEST12345DATA0/{name}",
+ f"/api/sync/retroarch/saves/PPSSPP/PSP/SAVEDATA/TEST12345DATA0/{name}",
content=b"data",
auth=ADMIN_AUTH,
)
@@ -1135,7 +1127,7 @@ class TestWebDAVCloudSyncPsp:
for name in ("PARAM.SFO", "SAVE.BIN"):
response = client.request(
"DELETE",
- f"/api/webdav-cloud-sync/saves/PPSSPP/PSP/SAVEDATA/TEST12345DATA0/{name}",
+ f"/api/sync/retroarch/saves/PPSSPP/PSP/SAVEDATA/TEST12345DATA0/{name}",
auth=ADMIN_AUTH,
)
assert response.status_code == status.HTTP_204_NO_CONTENT
@@ -1143,22 +1135,22 @@ class TestWebDAVCloudSyncPsp:
assert db_save_handler.get_saves(user_id=admin_user.id, rom_ids=[rom.id]) == []
get_response = client.get(
- "/api/webdav-cloud-sync/saves/PPSSPP/PSP/SAVEDATA/TEST12345DATA0/PARAM.SFO",
+ "/api/sync/retroarch/saves/PPSSPP/PSP/SAVEDATA/TEST12345DATA0/PARAM.SFO",
auth=ADMIN_AUTH,
)
assert get_response.status_code == status.HTTP_404_NOT_FOUND
-class TestWebDAVCloudSyncMkcol:
+class TestRetroArchSyncMkcol:
def test_mkcol_succeeds_without_creating_anything(self, client, admin_user: User):
response = client.request(
- "MKCOL", "/api/webdav-cloud-sync/saves/Snes9x", auth=ADMIN_AUTH
+ "MKCOL", "/api/sync/retroarch/saves/Snes9x", auth=ADMIN_AUTH
)
assert response.status_code == status.HTTP_201_CREATED
-class TestWebDAVCloudSyncBlobPathParsing:
+class TestRetroArchSyncBlobPathParsing:
@pytest.mark.parametrize(
("path", "expected"),
[
@@ -1172,7 +1164,7 @@ class TestWebDAVCloudSyncBlobPathParsing:
],
)
def test_parses_blob_paths(self, path, expected):
- assert sync_handler.parse_webdav_cloud_sync_blob_path(path) == expected
+ assert sync_handler.parse_retroarch_sync_blob_path(path) == expected
@pytest.mark.parametrize(
"path",
@@ -1184,31 +1176,31 @@ class TestWebDAVCloudSyncBlobPathParsing:
],
)
def test_rejects_non_blob_paths(self, path):
- assert sync_handler.parse_webdav_cloud_sync_blob_path(path) is None
+ assert sync_handler.parse_retroarch_sync_blob_path(path) is None
-class TestWebDAVCloudSyncBlobs:
+class TestRetroArchSyncBlobs:
def test_creates_and_downloads_config_blob(self, client, admin_user: User):
put_response = client.put(
- "/api/webdav-cloud-sync/config/retroarch.cfg",
+ "/api/sync/retroarch/config/retroarch.cfg",
content=b"data",
auth=ADMIN_AUTH,
)
assert put_response.status_code == status.HTTP_201_CREATED
get_response = client.get(
- "/api/webdav-cloud-sync/config/retroarch.cfg", auth=ADMIN_AUTH
+ "/api/sync/retroarch/config/retroarch.cfg", auth=ADMIN_AUTH
)
assert get_response.status_code == status.HTTP_200_OK
assert get_response.content == b"data"
def test_overwrites_existing_blob_in_place(self, client, admin_user: User):
client.put(
- "/api/webdav-cloud-sync/system/bios.bin", content=b"data", auth=ADMIN_AUTH
+ "/api/sync/retroarch/system/bios.bin", content=b"data", auth=ADMIN_AUTH
)
response = client.put(
- "/api/webdav-cloud-sync/system/bios.bin",
+ "/api/sync/retroarch/system/bios.bin",
content=b"newdata",
auth=ADMIN_AUTH,
)
@@ -1216,13 +1208,13 @@ class TestWebDAVCloudSyncBlobs:
assert response.status_code == status.HTTP_204_NO_CONTENT
get_response = client.get(
- "/api/webdav-cloud-sync/system/bios.bin", auth=ADMIN_AUTH
+ "/api/sync/retroarch/system/bios.bin", auth=ADMIN_AUTH
)
assert get_response.content == b"newdata"
def test_accepts_nested_thumbnail_paths(self, client, admin_user: User):
response = client.put(
- "/api/webdav-cloud-sync/thumbnails/Nintendo - Game Boy/Named_Boxarts/Game.png",
+ "/api/sync/retroarch/thumbnails/Nintendo - Game Boy/Named_Boxarts/Game.png",
content=b"pngdata",
auth=ADMIN_AUTH,
)
@@ -1230,43 +1222,43 @@ class TestWebDAVCloudSyncBlobs:
assert response.status_code == status.HTTP_201_CREATED
def test_missing_blob_is_not_found(self, client, admin_user: User):
- response = client.get("/api/webdav-cloud-sync/config/nope.cfg", auth=ADMIN_AUTH)
+ response = client.get("/api/sync/retroarch/config/nope.cfg", auth=ADMIN_AUTH)
assert response.status_code == status.HTTP_404_NOT_FOUND
assert response.content == b""
def test_delete_removes_the_blob(self, client, admin_user: User):
client.put(
- "/api/webdav-cloud-sync/config/retroarch.cfg",
+ "/api/sync/retroarch/config/retroarch.cfg",
content=b"data",
auth=ADMIN_AUTH,
)
response = client.request(
- "DELETE", "/api/webdav-cloud-sync/config/retroarch.cfg", auth=ADMIN_AUTH
+ "DELETE", "/api/sync/retroarch/config/retroarch.cfg", auth=ADMIN_AUTH
)
assert response.status_code == status.HTTP_204_NO_CONTENT
get_response = client.get(
- "/api/webdav-cloud-sync/config/retroarch.cfg", auth=ADMIN_AUTH
+ "/api/sync/retroarch/config/retroarch.cfg", auth=ADMIN_AUTH
)
assert get_response.status_code == status.HTTP_404_NOT_FOUND
def test_delete_of_unknown_blob_is_not_found(self, client, admin_user: User):
response = client.request(
- "DELETE", "/api/webdav-cloud-sync/config/nope.cfg", auth=ADMIN_AUTH
+ "DELETE", "/api/sync/retroarch/config/nope.cfg", auth=ADMIN_AUTH
)
assert response.status_code == status.HTTP_404_NOT_FOUND
def test_manifest_includes_blobs_alongside_assets(self, client, admin_user: User):
client.put(
- "/api/webdav-cloud-sync/config/retroarch.cfg",
+ "/api/sync/retroarch/config/retroarch.cfg",
content=b"data",
auth=ADMIN_AUTH,
)
- response = client.get("/api/webdav-cloud-sync/manifest.server", auth=ADMIN_AUTH)
+ response = client.get("/api/sync/retroarch/manifest.server", auth=ADMIN_AUTH)
assert response.status_code == status.HTTP_200_OK
assert response.json() == [
@@ -1277,50 +1269,46 @@ class TestWebDAVCloudSyncBlobs:
]
-class TestWebDAVCloudSyncBrowsing:
+class TestRetroArchSyncBrowsing:
"""Read-only WebDAV browsing (PROPFIND, LOCK, the `roms/` redirect) for generic clients."""
def test_lock_succeeds(self, client, admin_user: User):
- response = client.request(
- "LOCK", "/api/webdav-cloud-sync/roms/", auth=ADMIN_AUTH
- )
+ response = client.request("LOCK", "/api/sync/retroarch/roms/", auth=ADMIN_AUTH)
assert response.status_code == status.HTTP_200_OK
assert response.headers["lock-token"].startswith("/api/webdav-cloud-sync/roms/" in body
- assert "/api/webdav-cloud-sync/saves/" in body
- assert "/api/webdav-cloud-sync/states/" in body
+ assert "/api/sync/retroarch/roms/" in body
+ assert "/api/sync/retroarch/saves/" in body
+ assert "/api/sync/retroarch/states/" in body
def test_propfind_roms_lists_platforms_with_roms(
self, client, admin_user: User, rom: Rom
):
response = client.request(
- "PROPFIND", "/api/webdav-cloud-sync/roms/", auth=ADMIN_AUTH
+ "PROPFIND", "/api/sync/retroarch/roms/", auth=ADMIN_AUTH
)
assert response.status_code == 207
assert (
- f"/api/webdav-cloud-sync/roms/{rom.platform.fs_slug}/"
+ f"/api/sync/retroarch/roms/{rom.platform.fs_slug}/"
in response.text
)
@@ -1329,19 +1317,19 @@ class TestWebDAVCloudSyncBrowsing:
):
response = client.request(
"PROPFIND",
- f"/api/webdav-cloud-sync/roms/{rom.platform.fs_slug}/",
+ f"/api/sync/retroarch/roms/{rom.platform.fs_slug}/",
auth=ADMIN_AUTH,
)
assert response.status_code == 207
assert (
- f"/api/webdav-cloud-sync/roms/{rom.platform.fs_slug}/{rom.fs_name}"
+ f"/api/sync/retroarch/roms/{rom.platform.fs_slug}/{rom.fs_name}"
in response.text
)
def test_propfind_unknown_platform_is_not_found(self, client, admin_user: User):
response = client.request(
- "PROPFIND", "/api/webdav-cloud-sync/roms/nope/", auth=ADMIN_AUTH
+ "PROPFIND", "/api/sync/retroarch/roms/nope/", auth=ADMIN_AUTH
)
assert response.status_code == status.HTTP_404_NOT_FOUND
@@ -1350,7 +1338,7 @@ class TestWebDAVCloudSyncBrowsing:
self, client, admin_user: User, rom: Rom
):
response = client.get(
- f"/api/webdav-cloud-sync/roms/{rom.platform.fs_slug}/{rom.fs_name}",
+ f"/api/sync/retroarch/roms/{rom.platform.fs_slug}/{rom.fs_name}",
auth=ADMIN_AUTH,
follow_redirects=False,
)
@@ -1364,14 +1352,14 @@ class TestWebDAVCloudSyncBrowsing:
self, client, admin_user: User, rom: Rom
):
response = client.get(
- f"/api/webdav-cloud-sync/roms/{rom.platform.fs_slug}/nope.zip",
+ f"/api/sync/retroarch/roms/{rom.platform.fs_slug}/nope.zip",
auth=ADMIN_AUTH,
)
assert response.status_code == status.HTTP_404_NOT_FOUND
@mock.patch(
- "handler.webdav_cloud_sync.sync_handler.asset_md5",
+ "handler.sync.retroarch.sync_handler.asset_md5",
new_callable=mock.AsyncMock,
return_value="d41d8cd98f00b204e9800998ecf8427e",
)
@@ -1379,14 +1367,14 @@ class TestWebDAVCloudSyncBrowsing:
self, _asset_md5: mock.AsyncMock, client, admin_user: User, synced_save: Save
):
response = client.request(
- "PROPFIND", "/api/webdav-cloud-sync/saves/", auth=ADMIN_AUTH
+ "PROPFIND", "/api/sync/retroarch/saves/", auth=ADMIN_AUTH
)
assert response.status_code == 207
- assert "/api/webdav-cloud-sync/saves/Snes9x/" in response.text
+ assert "/api/sync/retroarch/saves/Snes9x/" in response.text
@mock.patch(
- "handler.webdav_cloud_sync.sync_handler.asset_md5",
+ "handler.sync.retroarch.sync_handler.asset_md5",
new_callable=mock.AsyncMock,
return_value="d41d8cd98f00b204e9800998ecf8427e",
)
@@ -1394,11 +1382,11 @@ class TestWebDAVCloudSyncBrowsing:
self, _asset_md5: mock.AsyncMock, client, admin_user: User, synced_save: Save
):
response = client.request(
- "PROPFIND", "/api/webdav-cloud-sync/saves/Snes9x/", auth=ADMIN_AUTH
+ "PROPFIND", "/api/sync/retroarch/saves/Snes9x/", auth=ADMIN_AUTH
)
assert response.status_code == 207
assert (
- "/api/webdav-cloud-sync/saves/Snes9x/test_rom.srm"
+ "/api/sync/retroarch/saves/Snes9x/test_rom.srm"
in response.text
)
diff --git a/backend/tests/handler/webdav_cloud_sync/__init__.py b/backend/tests/handler/sync/retroarch/__init__.py
similarity index 100%
rename from backend/tests/handler/webdav_cloud_sync/__init__.py
rename to backend/tests/handler/sync/retroarch/__init__.py
diff --git a/backend/tests/handler/webdav_cloud_sync/test_psp.py b/backend/tests/handler/sync/retroarch/test_psp.py
similarity index 99%
rename from backend/tests/handler/webdav_cloud_sync/test_psp.py
rename to backend/tests/handler/sync/retroarch/test_psp.py
index 8baac47be..8b57761ca 100644
--- a/backend/tests/handler/webdav_cloud_sync/test_psp.py
+++ b/backend/tests/handler/sync/retroarch/test_psp.py
@@ -3,7 +3,7 @@ import zipfile
import pytest
-from handler.webdav_cloud_sync.psp import (
+from handler.sync.retroarch.psp import (
_BUNDLE_MAX_MEMBERS,
PspFilePath,
_bundle_folder,
diff --git a/docs/BACKEND_ARCHITECTURE.md b/docs/BACKEND_ARCHITECTURE.md
index f00afe878..4ff5ba8e5 100644
--- a/docs/BACKEND_ARCHITECTURE.md
+++ b/docs/BACKEND_ARCHITECTURE.md
@@ -193,7 +193,9 @@ backend/
│ ├── search.py # Cross-provider metadata search
│ ├── states.py # Save state management
│ ├── stats.py # Library statistics
-│ ├── sync.py # Device sync sessions (push/pull, SSH)
+│ ├── sync/ # Device sync
+│ │ ├── __init__.py # Sync sessions (push/pull, SSH)
+│ │ └── retroarch.py # RetroArch Cloud Sync WebDAV surface
│ ├── tasks.py # Task monitoring & triggering
│ ├── roms/ # ROM-specific endpoints
│ │ ├── __init__.py # ROM CRUD, download, bulk ops
@@ -938,12 +940,12 @@ Facet endpoints (`/artists`, `/albums`, `/genres`, `/years`) return `{value, cou
| PUT | `/{id}` | ASSETS_WRITE | Update state |
| POST | `/delete` | ASSETS_WRITE | Bulk delete |
-### 6.9b RetroArch Cloud Sync (`/api/webdav-cloud-sync`)
+### 6.9b RetroArch Cloud Sync (`/api/sync/retroarch`)
A minimal WebDAV surface for RetroArch's Cloud Sync driver, which diffs a JSON
manifest of `{path, hash}` entries instead of listing collections. PROPFIND,
LOCK and UNLOCK exist only for read-only browsing from generic WebDAV clients,
-and listing `roms/` also needs ROMS_READ. Point RetroArch's WebDAV URL at `https:///api/webdav-cloud-sync/`
+and listing `roms/` also needs ROMS_READ. Point RetroArch's WebDAV URL at `https:///api/sync/retroarch/`
(trailing slash required), enable save/state sync only, and authenticate with a
RomM username and password over HTTP Basic.
@@ -963,7 +965,7 @@ RomM username and password over HTTP Basic.
(`Super Mario World.srm` → the ROM whose `fs_name_no_ext` is `Super Mario
World`), so a name shared across platforms resolves ambiguously. The optional
`core` segment is RetroArch's own directory casing (e.g. `Snes9x`), translated
-through `webdav_cloud_sync.emulator_names.to_romm_emulator`/`to_retroarch_dir_name` to
+through `sync.retroarch.emulator_names.to_romm_emulator`/`to_retroarch_dir_name` to
and from the asset's `emulator` field, which namespaces storage exactly as it
does for uploads through `/api/saves`. Storing RetroArch's raw casing instead
would make the save invisible to RomM's own web player, which matches saves
@@ -977,7 +979,7 @@ client mishandles large ones.
RetroArch's other three Cloud Sync categories (Sync Configuration/Thumbnails/
System Files) have no ROM to attach to, so they're stored as opaque per-user
-blobs under `WEBDAV_CLOUD_SYNC_BLOB_BASE_PATH` (`FSWebDAVCloudSyncBlobHandler`) instead of
+blobs under `SYNC_RETROARCH_BLOB_BASE_PATH` (`FSRetroArchSyncBlobHandler`) instead of
going through the asset/ROM matching above, namespaced by user so two
RetroArch installs syncing to the same RomM instance under different accounts
never see each other's files. Unlike asset hashes, blob hashes are always real
@@ -1340,7 +1342,7 @@ Tracks per-user playtime events ingested from clients (web player, console mode,
### 8.7 Device Sync Sessions
-Coordinates save/state synchronization between devices using three sync modes (`API`, `FILE_TRANSFER`, `PUSH_PULL`). `SyncSession` tracks the lifecycle of a push/pull operation (including optional SSH-based file transfer; see `SYNC_SSH_*` env vars). Endpoints live in `endpoints/sync.py`; state is stored in the `sync_sessions` table.
+Coordinates save/state synchronization between devices using three sync modes (`API`, `FILE_TRANSFER`, `PUSH_PULL`). `SyncSession` tracks the lifecycle of a push/pull operation (including optional SSH-based file transfer; see `SYNC_SSH_*` env vars). Endpoints live in `endpoints/sync/__init__.py`; state is stored in the `sync_sessions` table.
### 8.8 Socket Handler (`handler/socket_handler.py`)