mirror of
https://github.com/rommapp/romm.git
synced 2026-11-30 10:32:57 +01:00
@@ -58,7 +58,7 @@ RUN npm install
|
||||
WORKDIR /app
|
||||
|
||||
# Install uv for the non-root user
|
||||
COPY --from=ghcr.io/astral-sh/uv:0.7.19 /uv /uvx /usr/local/bin/
|
||||
COPY --from=ghcr.io/astral-sh/uv:0.11.2 /uv /uvx /usr/local/bin/
|
||||
|
||||
# Install Python
|
||||
RUN uv python install 3.13
|
||||
|
||||
@@ -45,6 +45,7 @@ DEFAULT_EXCLUDED_FILES: Final = [
|
||||
".stfolder",
|
||||
"@SynoResource",
|
||||
"gamelist.xml",
|
||||
"metadata.pegasus.xml",
|
||||
]
|
||||
DEFAULT_EXCLUDED_DIRS: Final = [
|
||||
"@eaDir",
|
||||
@@ -224,39 +225,67 @@ class ConfigManager:
|
||||
self.config = Config(
|
||||
CONFIG_FILE_MOUNTED=self._config_file_mounted,
|
||||
CONFIG_FILE_WRITABLE=self._config_file_writable,
|
||||
EXCLUDED_PLATFORMS=pydash.get(
|
||||
self._raw_config, "exclude.platforms", DEFAULT_EXCLUDED_DIRS
|
||||
EXCLUDED_PLATFORMS=sorted(
|
||||
{
|
||||
*DEFAULT_EXCLUDED_DIRS,
|
||||
*pydash.get(self._raw_config, "exclude.platforms", []),
|
||||
}
|
||||
),
|
||||
EXCLUDED_SINGLE_EXT=[
|
||||
e.lower()
|
||||
for e in pydash.get(
|
||||
self._raw_config,
|
||||
"exclude.roms.single_file.extensions",
|
||||
DEFAULT_EXCLUDED_EXTENSIONS,
|
||||
)
|
||||
],
|
||||
EXCLUDED_SINGLE_FILES=pydash.get(
|
||||
self._raw_config,
|
||||
"exclude.roms.single_file.names",
|
||||
DEFAULT_EXCLUDED_FILES,
|
||||
EXCLUDED_SINGLE_EXT=sorted(
|
||||
{
|
||||
*(e.lower() for e in DEFAULT_EXCLUDED_EXTENSIONS),
|
||||
*(
|
||||
e.lower()
|
||||
for e in pydash.get(
|
||||
self._raw_config,
|
||||
"exclude.roms.single_file.extensions",
|
||||
[],
|
||||
)
|
||||
),
|
||||
}
|
||||
),
|
||||
EXCLUDED_MULTI_FILES=pydash.get(
|
||||
self._raw_config,
|
||||
"exclude.roms.multi_file.names",
|
||||
DEFAULT_EXCLUDED_DIRS,
|
||||
EXCLUDED_SINGLE_FILES=sorted(
|
||||
{
|
||||
*DEFAULT_EXCLUDED_FILES,
|
||||
*pydash.get(
|
||||
self._raw_config,
|
||||
"exclude.roms.single_file.names",
|
||||
[],
|
||||
),
|
||||
}
|
||||
),
|
||||
EXCLUDED_MULTI_PARTS_EXT=[
|
||||
e.lower()
|
||||
for e in pydash.get(
|
||||
self._raw_config,
|
||||
"exclude.roms.multi_file.parts.extensions",
|
||||
DEFAULT_EXCLUDED_EXTENSIONS,
|
||||
)
|
||||
],
|
||||
EXCLUDED_MULTI_PARTS_FILES=pydash.get(
|
||||
self._raw_config,
|
||||
"exclude.roms.multi_file.parts.names",
|
||||
DEFAULT_EXCLUDED_FILES,
|
||||
EXCLUDED_MULTI_FILES=sorted(
|
||||
{
|
||||
*DEFAULT_EXCLUDED_DIRS,
|
||||
*pydash.get(
|
||||
self._raw_config,
|
||||
"exclude.roms.multi_file.names",
|
||||
[],
|
||||
),
|
||||
}
|
||||
),
|
||||
EXCLUDED_MULTI_PARTS_EXT=sorted(
|
||||
{
|
||||
*(e.lower() for e in DEFAULT_EXCLUDED_EXTENSIONS),
|
||||
*(
|
||||
e.lower()
|
||||
for e in pydash.get(
|
||||
self._raw_config,
|
||||
"exclude.roms.multi_file.parts.extensions",
|
||||
[],
|
||||
)
|
||||
),
|
||||
}
|
||||
),
|
||||
EXCLUDED_MULTI_PARTS_FILES=sorted(
|
||||
{
|
||||
*DEFAULT_EXCLUDED_FILES,
|
||||
*pydash.get(
|
||||
self._raw_config,
|
||||
"exclude.roms.multi_file.parts.names",
|
||||
[],
|
||||
),
|
||||
}
|
||||
),
|
||||
PLATFORMS_BINDING=pydash.get(self._raw_config, "system.platforms", {}),
|
||||
PLATFORMS_VERSIONS=pydash.get(self._raw_config, "system.versions", {}),
|
||||
|
||||
@@ -413,7 +413,7 @@ async def _identify_rom(
|
||||
)
|
||||
|
||||
# Handle special media files from Screenscraper
|
||||
if _added_rom.ss_metadata:
|
||||
if _added_rom.ss_metadata and MetadataSource.SS in metadata_sources:
|
||||
preferred_media_types = get_preferred_media_types()
|
||||
for media_type in preferred_media_types:
|
||||
if _added_rom.ss_metadata.get(f"{media_type.value}_path"):
|
||||
@@ -423,7 +423,7 @@ async def _identify_rom(
|
||||
)
|
||||
|
||||
# Handle special media files from ES-DE gamelist.xml
|
||||
if _added_rom.gamelist_metadata:
|
||||
if _added_rom.gamelist_metadata and MetadataSource.GAMELIST in metadata_sources:
|
||||
preferred_media_types = get_preferred_media_types()
|
||||
for media_type in preferred_media_types:
|
||||
if _added_rom.gamelist_metadata.get(f"{media_type.value}_path"):
|
||||
@@ -433,7 +433,7 @@ async def _identify_rom(
|
||||
)
|
||||
|
||||
# Store normal and locked badges
|
||||
if _added_rom.ra_metadata:
|
||||
if _added_rom.ra_metadata and MetadataSource.RA in metadata_sources:
|
||||
for ach in _added_rom.ra_metadata.get("achievements", []):
|
||||
badge_url_lock = ach.get("badge_url_lock", None)
|
||||
badge_path_lock = ach.get("badge_path_lock", None)
|
||||
|
||||
@@ -20,6 +20,16 @@ from utils.validation import validate_url_for_http_request
|
||||
from .base_handler import CoverSize, FSHandler
|
||||
|
||||
|
||||
def _check_content_type(
|
||||
response: httpx.Response, allowed_prefixes: tuple[str, ...], label: str
|
||||
) -> bool:
|
||||
content_type = response.headers.get("content-type", "").lower()
|
||||
if not any(content_type.startswith(p) for p in allowed_prefixes):
|
||||
log.warning(f"Unexpected content type for {label}: {content_type}")
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
class FSResourcesHandler(FSHandler):
|
||||
def __init__(self) -> None:
|
||||
super().__init__(base_path=RESOURCES_BASE_PATH)
|
||||
@@ -75,11 +85,15 @@ class FSResourcesHandler(FSHandler):
|
||||
# Handle file:// URLs for gamelist.xml
|
||||
if url_cover.startswith("file://"):
|
||||
try:
|
||||
file_path = AnyioPath(url_cover[7:]) # Remove "file://" prefix
|
||||
if await file_path.exists():
|
||||
from handler.filesystem import fs_rom_handler
|
||||
|
||||
validated = fs_rom_handler.validate_path(
|
||||
url_cover[7:] # Remove "file://" prefix
|
||||
)
|
||||
if await AnyioPath(validated).exists():
|
||||
# Copy the file to the resources directory
|
||||
dest_path = f"{cover_file}/{size.value}.png"
|
||||
await self.copy_file(Path(str(file_path)), dest_path)
|
||||
await self.copy_file(validated, dest_path)
|
||||
|
||||
if ENABLE_SCHEDULED_CONVERT_IMAGES_TO_WEBP:
|
||||
self.image_converter.convert_to_webp(
|
||||
@@ -87,14 +101,13 @@ class FSResourcesHandler(FSHandler):
|
||||
force=True,
|
||||
)
|
||||
else:
|
||||
log.warning(f"Cover file not found: {file_path}")
|
||||
log.warning(f"Cover file not found: {str(validated)}")
|
||||
return None
|
||||
except Exception as exc:
|
||||
log.error(f"Unable to copy cover file {url_cover}: {str(exc)}")
|
||||
return None
|
||||
else:
|
||||
# Handle HTTP URLs
|
||||
# Validate URL to prevent SSRF attacks
|
||||
validate_url_for_http_request(url_cover, "url_cover")
|
||||
|
||||
httpx_client = ctx_httpx_client.get()
|
||||
@@ -103,6 +116,9 @@ class FSResourcesHandler(FSHandler):
|
||||
"GET", url_cover, timeout=120
|
||||
) as response:
|
||||
if response.status_code == status.HTTP_200_OK:
|
||||
if not _check_content_type(response, ("image/",), "cover"):
|
||||
return None
|
||||
|
||||
# Check if content is gzipped from response headers
|
||||
is_gzipped = (
|
||||
response.headers.get("content-encoding", "").lower()
|
||||
@@ -249,21 +265,22 @@ class FSResourcesHandler(FSHandler):
|
||||
# Handle file:// URLs for gamelist.xml
|
||||
if url_screenhot.startswith("file://"):
|
||||
try:
|
||||
file_path = AnyioPath(url_screenhot[7:]) # Remove "file://" prefix
|
||||
if await file_path.exists():
|
||||
from handler.filesystem import fs_rom_handler
|
||||
|
||||
validated = fs_rom_handler.validate_path(
|
||||
url_screenhot[7:] # Remove "file://" prefix
|
||||
)
|
||||
if await AnyioPath(validated).exists():
|
||||
# Copy the file to the resources directory
|
||||
await self.copy_file(
|
||||
Path(str(file_path)), f"{screenshot_path}/{idx}.jpg"
|
||||
)
|
||||
await self.copy_file(validated, f"{screenshot_path}/{idx}.jpg")
|
||||
else:
|
||||
log.warning(f"Screenshot file not found: {file_path}")
|
||||
log.warning(f"Screenshot file not found: {str(validated)}")
|
||||
return None
|
||||
except Exception as exc:
|
||||
log.error(f"Unable to copy screenshot file {url_screenhot}: {str(exc)}")
|
||||
return None
|
||||
else:
|
||||
# Handle HTTP URLs
|
||||
# Validate URL to prevent SSRF attacks
|
||||
validate_url_for_http_request(url_screenhot, "url_screenshot")
|
||||
|
||||
httpx_client = ctx_httpx_client.get()
|
||||
@@ -272,6 +289,9 @@ class FSResourcesHandler(FSHandler):
|
||||
"GET", url_screenhot, timeout=120
|
||||
) as response:
|
||||
if response.status_code == status.HTTP_200_OK:
|
||||
if not _check_content_type(response, ("image/",), "screenshot"):
|
||||
return None
|
||||
|
||||
# Check if content is gzipped from response headers
|
||||
is_gzipped = (
|
||||
response.headers.get("content-encoding", "").lower()
|
||||
@@ -365,21 +385,22 @@ class FSResourcesHandler(FSHandler):
|
||||
# Handle file:// URLs for gamelist.xml
|
||||
if url_manual.startswith("file://"):
|
||||
try:
|
||||
file_path = AnyioPath(url_manual[7:]) # Remove "file://" prefix
|
||||
if await file_path.exists():
|
||||
from handler.filesystem import fs_rom_handler
|
||||
|
||||
validated = fs_rom_handler.validate_path(
|
||||
url_manual[7:] # Remove "file://" prefix
|
||||
)
|
||||
if await AnyioPath(validated).exists():
|
||||
# Copy the file to the resources directory
|
||||
await self.copy_file(
|
||||
Path(str(file_path)), f"{manual_path}/{rom.id}.pdf"
|
||||
)
|
||||
await self.copy_file(validated, f"{manual_path}/{rom.id}.pdf")
|
||||
else:
|
||||
log.warning(f"Manual file not found: {file_path}")
|
||||
log.warning(f"Manual file not found: {str(validated)}")
|
||||
return None
|
||||
except Exception as exc:
|
||||
log.error(f"Unable to copy manual file {url_manual}: {str(exc)}")
|
||||
return None
|
||||
else:
|
||||
# Handle HTTP URL
|
||||
# Validate URL to prevent SSRF attacks
|
||||
validate_url_for_http_request(url_manual, "url_manual")
|
||||
|
||||
httpx_client = ctx_httpx_client.get()
|
||||
@@ -388,6 +409,11 @@ class FSResourcesHandler(FSHandler):
|
||||
"GET", url_manual, timeout=120
|
||||
) as response:
|
||||
if response.status_code == status.HTTP_200_OK:
|
||||
if not _check_content_type(
|
||||
response, ("application/pdf",), "manual"
|
||||
):
|
||||
return None
|
||||
|
||||
# Check if content is gzipped from response headers
|
||||
is_gzipped = (
|
||||
response.headers.get("content-encoding", "").lower()
|
||||
@@ -440,7 +466,6 @@ class FSResourcesHandler(FSHandler):
|
||||
|
||||
# Retroachievements
|
||||
async def store_ra_badge(self, url: str, path: str) -> None:
|
||||
# Validate URL to prevent SSRF attacks
|
||||
validate_url_for_http_request(url, "url_badge")
|
||||
|
||||
httpx_client = ctx_httpx_client.get()
|
||||
@@ -456,6 +481,9 @@ class FSResourcesHandler(FSHandler):
|
||||
try:
|
||||
async with httpx_client.stream("GET", url, timeout=120) as response:
|
||||
if response.status_code == status.HTTP_200_OK:
|
||||
if not _check_content_type(response, ("image/",), "badge"):
|
||||
return
|
||||
|
||||
async with await self.write_file_streamed(
|
||||
path=directory, filename=filename
|
||||
) as f:
|
||||
@@ -498,7 +526,12 @@ class FSResourcesHandler(FSHandler):
|
||||
# Handle file:// URLs for gamelist.xml
|
||||
if url_media.startswith("file://"):
|
||||
try:
|
||||
file_path = AnyioPath(url_media[7:]) # Remove "file://" prefix
|
||||
from handler.filesystem import fs_rom_handler
|
||||
|
||||
validated = fs_rom_handler.validate_path(
|
||||
url_media[7:] # Remove "file://" prefix
|
||||
)
|
||||
file_path = AnyioPath(validated)
|
||||
if await file_path.exists():
|
||||
await self.copy_file(Path(str(file_path)), dest_path)
|
||||
except Exception as exc:
|
||||
@@ -506,7 +539,6 @@ class FSResourcesHandler(FSHandler):
|
||||
return None
|
||||
else:
|
||||
# Handle HTTP URLs
|
||||
# Validate URL to prevent SSRF attacks
|
||||
validate_url_for_http_request(url_media, "url_media")
|
||||
|
||||
httpx_client = ctx_httpx_client.get()
|
||||
@@ -515,6 +547,13 @@ class FSResourcesHandler(FSHandler):
|
||||
"GET", url_media, timeout=120
|
||||
) as response:
|
||||
if response.status_code == status.HTTP_200_OK:
|
||||
if not _check_content_type(
|
||||
response,
|
||||
("image/", "video/", "application/pdf"),
|
||||
"media",
|
||||
):
|
||||
return None
|
||||
|
||||
async with await self.write_file_streamed(
|
||||
path=directory, filename=filename
|
||||
) as f:
|
||||
|
||||
@@ -745,6 +745,6 @@ class FSRomsHandler(FSHandler):
|
||||
if platform_slug == UPS.PICO and fs_name.lower().endswith(
|
||||
PICO8_CARTRIDGE_EXTENSION
|
||||
):
|
||||
rom_path = self.validate_path(f"{fs_path}/{fs_name}")
|
||||
return f"file://{rom_path}"
|
||||
self.validate_path(f"{fs_path}/{fs_name}")
|
||||
return f"file://{fs_path}/{fs_name}"
|
||||
return None
|
||||
|
||||
@@ -1 +1 @@
|
||||
https://howlongtobeat.com/api/finder
|
||||
https://howlongtobeat.com/api/find
|
||||
|
||||
@@ -99,10 +99,9 @@ XML_TAG_MAP: Final = {
|
||||
|
||||
def _make_file_uri(platform_dir: str, raw_text: str) -> str:
|
||||
cleaned_text = raw_text.replace("./", "")
|
||||
validated_path = fs_platform_handler.validate_path(
|
||||
os.path.join(platform_dir, cleaned_text)
|
||||
)
|
||||
return f"file://{str(validated_path)}"
|
||||
joined_path = Path(platform_dir, cleaned_text)
|
||||
fs_platform_handler.validate_path(str(joined_path))
|
||||
return f"file://{joined_path.as_posix()}"
|
||||
|
||||
|
||||
def extract_media_from_gamelist_rom(
|
||||
@@ -148,7 +147,9 @@ def extract_media_from_gamelist_rom(
|
||||
found_files = glob.glob(str(search_path))
|
||||
if found_files:
|
||||
# trunk-ignore(mypy/literal-required)
|
||||
gamelist_media[media_key] = f"file://{str(found_files[0])}"
|
||||
gamelist_media[media_key] = (
|
||||
f"file://{str(Path(found_files[0]).relative_to(fs_platform_handler.base_path))}"
|
||||
)
|
||||
|
||||
return gamelist_media
|
||||
|
||||
|
||||
@@ -178,9 +178,11 @@ class HLTBHandler(MetadataHandler):
|
||||
self.base_url = "https://howlongtobeat.com"
|
||||
self.user_endpoint = f"{self.base_url}/api/user"
|
||||
self.stats_endpoint = f"{self.base_url}/api/stats/games?platform=1&year=2000"
|
||||
self.search_url = f"{self.base_url}/api/search"
|
||||
self.search_url = f"{self.base_url}/api/find"
|
||||
self.search_init_url = f"{self.search_url}/init"
|
||||
self.security_token = None
|
||||
self.hp_key = None
|
||||
self.hp_val = None
|
||||
self.min_similarity_score: Final = 0.85
|
||||
|
||||
# HLTB rotates their search endpoint regularly
|
||||
@@ -226,7 +228,10 @@ class HLTBHandler(MetadataHandler):
|
||||
timeout=10,
|
||||
)
|
||||
response.raise_for_status()
|
||||
self.security_token = response.json().get("token", None)
|
||||
data = response.json()
|
||||
self.security_token = data.get("token", None)
|
||||
self.hp_key = data.get("hpKey", None)
|
||||
self.hp_val = data.get("hpVal", None)
|
||||
except Exception as e:
|
||||
log.warning("Unexpected error fetching HLTB security token: %s", e)
|
||||
|
||||
@@ -253,7 +258,7 @@ class HLTBHandler(MetadataHandler):
|
||||
:return: A dictionary with the json result.
|
||||
:raises HTTPException: If the request fails or the service is unavailable.
|
||||
"""
|
||||
if not self.security_token:
|
||||
if not self.security_token or not self.hp_key or not self.hp_val:
|
||||
return {}
|
||||
|
||||
httpx_client = ctx_httpx_client.get()
|
||||
@@ -262,9 +267,14 @@ class HLTBHandler(MetadataHandler):
|
||||
"Content-Type": "application/json",
|
||||
"Referer": "https://howlongtobeat.com",
|
||||
"User-Agent": f"RomM/{get_version()}",
|
||||
"X-Auth-Token": self.security_token,
|
||||
"x-auth-token": self.security_token,
|
||||
"x-hp-key": self.hp_key,
|
||||
"x-hp-val": self.hp_val,
|
||||
}
|
||||
|
||||
# Some HLTB endpoints require the key:val in the payload
|
||||
payload[self.hp_key] = self.hp_val
|
||||
|
||||
log.debug(
|
||||
"HowLongToBeat API request: URL=%s, Headers=%s, Payload=%s, Timeout=%s",
|
||||
url,
|
||||
|
||||
@@ -17,10 +17,10 @@ def sanitize_filename(stem: str) -> str:
|
||||
|
||||
def file_uri_for_local_path(path: Path) -> str | None:
|
||||
try:
|
||||
_ = path.resolve().relative_to(LAUNCHBOX_LOCAL_DIR.resolve())
|
||||
relative = path.resolve().relative_to(LAUNCHBOX_LOCAL_DIR.resolve())
|
||||
except ValueError:
|
||||
return None
|
||||
return f"file://{str(path)}"
|
||||
return f"file://{relative.as_posix()}"
|
||||
|
||||
|
||||
def coalesce(*values: object | None) -> str | None:
|
||||
|
||||
@@ -14,12 +14,35 @@ def test_config_loader():
|
||||
os.path.join(Path(__file__).resolve().parent, "fixtures", "config/config.yml")
|
||||
)
|
||||
|
||||
assert loader.config.EXCLUDED_PLATFORMS == ["romm"]
|
||||
assert loader.config.EXCLUDED_SINGLE_EXT == ["xml"]
|
||||
assert loader.config.EXCLUDED_SINGLE_FILES == ["info.txt"]
|
||||
assert loader.config.EXCLUDED_MULTI_FILES == ["my_multi_file_game", "DLC"]
|
||||
assert loader.config.EXCLUDED_MULTI_PARTS_EXT == ["txt"]
|
||||
assert loader.config.EXCLUDED_MULTI_PARTS_FILES == ["data.xml"]
|
||||
assert loader.config.EXCLUDED_PLATFORMS == sorted({*DEFAULT_EXCLUDED_DIRS, "romm"})
|
||||
assert loader.config.EXCLUDED_SINGLE_EXT == sorted(
|
||||
{
|
||||
*(e.lower() for e in DEFAULT_EXCLUDED_EXTENSIONS),
|
||||
"xml",
|
||||
}
|
||||
)
|
||||
assert loader.config.EXCLUDED_SINGLE_FILES == sorted(
|
||||
{*DEFAULT_EXCLUDED_FILES, "info.txt"}
|
||||
)
|
||||
assert loader.config.EXCLUDED_MULTI_FILES == sorted(
|
||||
{
|
||||
*DEFAULT_EXCLUDED_DIRS,
|
||||
"my_multi_file_game",
|
||||
"DLC",
|
||||
}
|
||||
)
|
||||
assert loader.config.EXCLUDED_MULTI_PARTS_EXT == sorted(
|
||||
{
|
||||
*(e.lower() for e in DEFAULT_EXCLUDED_EXTENSIONS),
|
||||
"txt",
|
||||
}
|
||||
)
|
||||
assert loader.config.EXCLUDED_MULTI_PARTS_FILES == sorted(
|
||||
{
|
||||
*DEFAULT_EXCLUDED_FILES,
|
||||
"data.xml",
|
||||
}
|
||||
)
|
||||
assert loader.config.PLATFORMS_BINDING == {"gc": "ngc"}
|
||||
assert loader.config.PLATFORMS_VERSIONS == {"naomi": "arcade"}
|
||||
assert loader.config.ROMS_FOLDER_NAME == "ROMS"
|
||||
@@ -63,16 +86,16 @@ def test_empty_config_loader():
|
||||
)
|
||||
)
|
||||
|
||||
assert loader.config.EXCLUDED_PLATFORMS == DEFAULT_EXCLUDED_DIRS
|
||||
assert loader.config.EXCLUDED_SINGLE_EXT == [
|
||||
e.lower() for e in DEFAULT_EXCLUDED_EXTENSIONS
|
||||
]
|
||||
assert loader.config.EXCLUDED_SINGLE_FILES == DEFAULT_EXCLUDED_FILES
|
||||
assert loader.config.EXCLUDED_MULTI_FILES == DEFAULT_EXCLUDED_DIRS
|
||||
assert loader.config.EXCLUDED_MULTI_PARTS_EXT == [
|
||||
e.lower() for e in DEFAULT_EXCLUDED_EXTENSIONS
|
||||
]
|
||||
assert loader.config.EXCLUDED_MULTI_PARTS_FILES == DEFAULT_EXCLUDED_FILES
|
||||
assert loader.config.EXCLUDED_PLATFORMS == sorted(DEFAULT_EXCLUDED_DIRS)
|
||||
assert loader.config.EXCLUDED_SINGLE_EXT == sorted(
|
||||
{e.lower() for e in DEFAULT_EXCLUDED_EXTENSIONS}
|
||||
)
|
||||
assert loader.config.EXCLUDED_SINGLE_FILES == sorted(DEFAULT_EXCLUDED_FILES)
|
||||
assert loader.config.EXCLUDED_MULTI_FILES == sorted(DEFAULT_EXCLUDED_DIRS)
|
||||
assert loader.config.EXCLUDED_MULTI_PARTS_EXT == sorted(
|
||||
{e.lower() for e in DEFAULT_EXCLUDED_EXTENSIONS}
|
||||
)
|
||||
assert loader.config.EXCLUDED_MULTI_PARTS_FILES == sorted(DEFAULT_EXCLUDED_FILES)
|
||||
assert loader.config.PLATFORMS_BINDING == {}
|
||||
assert loader.config.PLATFORMS_VERSIONS == {}
|
||||
assert loader.config.ROMS_FOLDER_NAME == "roms"
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
from pathlib import Path
|
||||
from unittest.mock import Mock
|
||||
|
||||
import pytest
|
||||
import socketio
|
||||
|
||||
from config import LIBRARY_BASE_PATH
|
||||
from endpoints.sockets.scan import ScanStats, _should_scan_rom
|
||||
from handler.filesystem.roms_handler import FSRomsHandler
|
||||
from handler.metadata.base_handler import UniversalPlatformSlug as UPS
|
||||
@@ -263,7 +261,7 @@ class TestGetPico8CoverUrl:
|
||||
fs_name="mygame.p8.png",
|
||||
fs_path="pico/roms",
|
||||
)
|
||||
expected = f"file://{Path(LIBRARY_BASE_PATH).resolve() / 'pico/roms' / 'mygame.p8.png'}"
|
||||
expected = "file://pico/roms/mygame.p8.png"
|
||||
assert url == expected
|
||||
|
||||
def test_returns_none_for_non_pico8_platform(self, handler: FSRomsHandler):
|
||||
|
||||
@@ -24,16 +24,16 @@ def test_config(client):
|
||||
assert response.status_code == status.HTTP_200_OK
|
||||
|
||||
config = response.json()
|
||||
assert config.get("EXCLUDED_PLATFORMS") == DEFAULT_EXCLUDED_DIRS
|
||||
assert config.get("EXCLUDED_SINGLE_EXT") == [
|
||||
assert config.get("EXCLUDED_PLATFORMS") == sorted(DEFAULT_EXCLUDED_DIRS)
|
||||
assert config.get("EXCLUDED_SINGLE_EXT") == sorted(
|
||||
e.lower() for e in DEFAULT_EXCLUDED_EXTENSIONS
|
||||
]
|
||||
assert config.get("EXCLUDED_SINGLE_FILES") == DEFAULT_EXCLUDED_FILES
|
||||
assert config.get("EXCLUDED_MULTI_FILES") == DEFAULT_EXCLUDED_DIRS
|
||||
assert config.get("EXCLUDED_MULTI_PARTS_EXT") == [
|
||||
)
|
||||
assert config.get("EXCLUDED_SINGLE_FILES") == sorted(DEFAULT_EXCLUDED_FILES)
|
||||
assert config.get("EXCLUDED_MULTI_FILES") == sorted(DEFAULT_EXCLUDED_DIRS)
|
||||
assert config.get("EXCLUDED_MULTI_PARTS_EXT") == sorted(
|
||||
e.lower() for e in DEFAULT_EXCLUDED_EXTENSIONS
|
||||
]
|
||||
assert config.get("EXCLUDED_MULTI_PARTS_FILES") == DEFAULT_EXCLUDED_FILES
|
||||
)
|
||||
assert config.get("EXCLUDED_MULTI_PARTS_FILES") == sorted(DEFAULT_EXCLUDED_FILES)
|
||||
assert config.get("PLATFORMS_BINDING") == {}
|
||||
assert not config.get("SKIP_HASH_CALCULATION")
|
||||
|
||||
|
||||
@@ -700,9 +700,7 @@ onBeforeUnmount(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
class="play-root fixed inset-0 bg-black text-white z-[70] overflow-hidden"
|
||||
>
|
||||
<div class="play-root fixed inset-0 bg-black text-white z-70 overflow-hidden">
|
||||
<div id="game" class="w-full h-full" />
|
||||
<div
|
||||
v-if="bezelSrc"
|
||||
@@ -741,7 +739,7 @@ onBeforeUnmount(() => {
|
||||
<div class="text-red-300 font-medium">
|
||||
{{ t("console.emulator-failed") }}
|
||||
</div>
|
||||
<div class="mt-1 text-[11px] max-w-xs leading-snug break-words">
|
||||
<div class="mt-1 text-[11px] max-w-xs leading-snug wrap-break-words">
|
||||
{{ loaderError }}
|
||||
</div>
|
||||
</template>
|
||||
@@ -771,7 +769,7 @@ onBeforeUnmount(() => {
|
||||
borderColor: 'var(--console-modal-border)',
|
||||
boxShadow: 'var(--console-modal-shadow)',
|
||||
}"
|
||||
class="relative w-full max-w-[560px] mx-auto rounded-2xl pa-10 md:p-9 flex flex-col gap-6 focus:outline-none border"
|
||||
class="relative w-full max-w-140 mx-auto rounded-2xl pa-10 md:p-9 flex flex-col gap-6 focus:outline-none border"
|
||||
>
|
||||
<div class="flex items-center justify-between">
|
||||
<h2
|
||||
@@ -799,7 +797,7 @@ onBeforeUnmount(() => {
|
||||
? 'opacity-40 cursor-not-allowed'
|
||||
: '',
|
||||
focusedExitIndex === i
|
||||
? 'shadow-[0_0_0_2px_var(--console-modal-tile-selected-border),_0_0_18px_-4px_var(--console-modal-tile-selected-border)]'
|
||||
? 'shadow-[0_0_0_2px_var(--console-modal-tile-selected-border),0_0_18px_-4px_var(--console-modal-tile-selected-border)]'
|
||||
: '',
|
||||
]"
|
||||
:style="
|
||||
|
||||
Reference in New Issue
Block a user