diff --git a/.github/resources/romm_complete.png b/.github/resources/romm_complete.png new file mode 100644 index 000000000..b46e651d9 Binary files /dev/null and b/.github/resources/romm_complete.png differ diff --git a/README.md b/README.md index ad00101ad..242282e1b 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@
- romm logo + romm logo

A beautiful, powerful, self-hosted rom manager. diff --git a/backend/alembic/env.py b/backend/alembic/env.py index 2bf6bfbc6..8cd4677fe 100644 --- a/backend/alembic/env.py +++ b/backend/alembic/env.py @@ -8,7 +8,7 @@ from models.assets import Save, Screenshot, State # noqa from models.base import BaseModel from models.firmware import Firmware # noqa from models.platform import Platform # noqa -from models.rom import Rom # noqa +from models.rom import Rom, SiblingRom # noqa from models.user import User # noqa from sqlalchemy import create_engine @@ -33,6 +33,14 @@ target_metadata = BaseModel.metadata # ... etc. +# Ignore specific models when running migrations +def include_object(object, name, type_, reflected, compare_to): + if type_ == "table" and name in [SiblingRom.__tablename__]: # Virtual table + return False + + return True + + def run_migrations_offline() -> None: """Run migrations in 'offline' mode. @@ -53,6 +61,7 @@ def run_migrations_offline() -> None: literal_binds=True, dialect_opts={"paramstyle": "named"}, compare_type=True, + include_object=include_object, ) with context.begin_transaction(): @@ -75,6 +84,7 @@ def run_migrations_online() -> None: target_metadata=target_metadata, render_as_batch=True, compare_type=True, + include_object=include_object, ) with context.begin_transaction(): diff --git a/backend/alembic/versions/0026_romuser_status_fields.py b/backend/alembic/versions/0026_romuser_status_fields.py new file mode 100644 index 000000000..42c6ed481 --- /dev/null +++ b/backend/alembic/versions/0026_romuser_status_fields.py @@ -0,0 +1,84 @@ +"""empty message + +Revision ID: 0026_romuser_status_fields +Revises: 0025_roms_hashes +Create Date: 2024-08-29 15:52:56.031850 + +""" + +import sqlalchemy as sa +from alembic import op +from sqlalchemy.dialects import mysql + +# revision identifiers, used by Alembic. +revision = "0026_romuser_status_fields" +down_revision = "0025_roms_hashes" +branch_labels = None +depends_on = None + + +def upgrade() -> None: + with op.batch_alter_table("collections", schema=None) as batch_op: + batch_op.alter_column( + "path_cover_l", + existing_type=mysql.VARCHAR(length=1000), + type_=sa.Text(), + existing_nullable=True, + ) + batch_op.alter_column( + "path_cover_s", + existing_type=mysql.VARCHAR(length=1000), + type_=sa.Text(), + existing_nullable=True, + ) + + with op.batch_alter_table("rom_user", schema=None) as batch_op: + batch_op.add_column( + sa.Column("last_played", sa.DateTime(timezone=True), nullable=True) + ) + batch_op.add_column(sa.Column("backlogged", sa.Boolean(), nullable=False)) + batch_op.add_column(sa.Column("now_playing", sa.Boolean(), nullable=False)) + batch_op.add_column(sa.Column("hidden", sa.Boolean(), nullable=False)) + batch_op.add_column(sa.Column("rating", sa.Integer(), nullable=False)) + batch_op.add_column(sa.Column("difficulty", sa.Integer(), nullable=False)) + batch_op.add_column(sa.Column("completion", sa.Integer(), nullable=False)) + batch_op.add_column( + sa.Column( + "status", + sa.Enum( + "INCOMPLETE", + "FINISHED", + "COMPLETED_100", + "RETIRED", + "NEVER_PLAYING", + name="romuserstatus", + ), + nullable=True, + ) + ) + + +def downgrade() -> None: + with op.batch_alter_table("rom_user", schema=None) as batch_op: + batch_op.drop_column("status") + batch_op.drop_column("completion") + batch_op.drop_column("difficulty") + batch_op.drop_column("rating") + batch_op.drop_column("hidden") + batch_op.drop_column("now_playing") + batch_op.drop_column("backlogged") + batch_op.drop_column("last_played") + + with op.batch_alter_table("collections", schema=None) as batch_op: + batch_op.alter_column( + "path_cover_s", + existing_type=sa.Text(), + type_=mysql.VARCHAR(length=1000), + existing_nullable=True, + ) + batch_op.alter_column( + "path_cover_l", + existing_type=sa.Text(), + type_=mysql.VARCHAR(length=1000), + existing_nullable=True, + ) diff --git a/backend/endpoints/auth.py b/backend/endpoints/auth.py index f85a829b6..f273d9753 100644 --- a/backend/endpoints/auth.py +++ b/backend/endpoints/auth.py @@ -1,4 +1,4 @@ -from datetime import datetime, timedelta +from datetime import datetime, timedelta, timezone from typing import Annotated, Final from endpoints.forms.identity import OAuth2RequestForm @@ -161,9 +161,8 @@ def login( request.session.update({"iss": "romm:auth", "sub": user.username}) # Update last login and active times - db_user_handler.update_user( - user.id, {"last_login": datetime.now(), "last_active": datetime.now()} - ) + now = datetime.now(timezone.utc) + db_user_handler.update_user(user.id, {"last_login": now, "last_active": now}) return {"msg": "Successfully logged in"} diff --git a/backend/endpoints/platform.py b/backend/endpoints/platform.py index 6f5152c31..24133f6da 100644 --- a/backend/endpoints/platform.py +++ b/backend/endpoints/platform.py @@ -1,4 +1,4 @@ -from datetime import datetime +from datetime import datetime, timezone from decorators.auth import protected_route from endpoints.responses import MessageResponse @@ -69,6 +69,7 @@ def get_supported_platforms(request: Request) -> list[PlatformSchema]: db_platforms_map = {p.name: p.id for p in db_platforms} for platform in IGDB_PLATFORM_LIST: + now = datetime.now(timezone.utc) sup_plat = { "id": -1, "name": platform["name"], @@ -77,8 +78,8 @@ def get_supported_platforms(request: Request) -> list[PlatformSchema]: "logo_path": "", "roms": [], "rom_count": 0, - "created_at": datetime.now(), - "updated_at": datetime.now(), + "created_at": now, + "updated_at": now, } if platform["name"] in db_platforms_map: diff --git a/backend/endpoints/responses/rom.py b/backend/endpoints/responses/rom.py index e3ebce0db..62232ba69 100644 --- a/backend/endpoints/responses/rom.py +++ b/backend/endpoints/responses/rom.py @@ -1,7 +1,7 @@ from __future__ import annotations import re -from datetime import datetime +from datetime import datetime, timezone from typing import NotRequired, TypedDict, get_type_hints from endpoints.responses.assets import SaveSchema, ScreenshotSchema, StateSchema @@ -9,8 +9,8 @@ from endpoints.responses.collection import CollectionSchema from fastapi import Request from handler.metadata.igdb_handler import IGDBMetadata from handler.metadata.moby_handler import MobyMetadata -from models.rom import Rom, RomFile -from pydantic import BaseModel, Field, computed_field +from models.rom import Rom, RomFile, RomUserStatus +from pydantic import BaseModel, computed_field SORT_COMPARE_REGEX = re.compile(r"^([Tt]he|[Aa]|[Aa]nd)\s") @@ -26,6 +26,28 @@ RomMobyMetadata = TypedDict( # type: ignore[misc] ) +def rom_user_schema_factory() -> RomUserSchema: + now = datetime.now(timezone.utc) + return RomUserSchema( + id=-1, + user_id=-1, + rom_id=-1, + created_at=now, + updated_at=now, + note_raw_markdown="", + note_is_public=False, + is_main_sibling=False, + backlogged=False, + now_playing=False, + hidden=False, + rating=0, + difficulty=0, + completion=0, + status=None, + user__username="", + ) + + class RomUserSchema(BaseModel): id: int user_id: int @@ -35,18 +57,26 @@ class RomUserSchema(BaseModel): note_raw_markdown: str note_is_public: bool is_main_sibling: bool + backlogged: bool + now_playing: bool + hidden: bool + rating: int + difficulty: int + completion: int + status: RomUserStatus | None user__username: str class Config: from_attributes = True @classmethod - def for_user(cls, user_id: int, db_rom: Rom) -> RomUserSchema | None: + def for_user(cls, user_id: int, db_rom: Rom) -> RomUserSchema: for n in db_rom.rom_users: if n.user_id == user_id: return cls.model_validate(n) - return None + # Return a dummy RomUserSchema if the user + rom combination doesn't exist + return rom_user_schema_factory() @classmethod def notes_for_user(cls, user_id: int, db_rom: Rom) -> list[UserNotesSchema]: @@ -85,6 +115,7 @@ class RomSchema(BaseModel): # Metadata fields first_release_date: int | None + youtube_video_id: str | None alternative_names: list[str] genres: list[str] franchises: list[str] @@ -131,52 +162,52 @@ class RomSchema(BaseModel): class SimpleRomSchema(RomSchema): - sibling_roms: list[RomSchema] = Field(default_factory=list) - rom_user: RomUserSchema | None = Field(default=None) + sibling_roms: list[RomSchema] + rom_user: RomUserSchema @classmethod - def from_orm_with_request(cls, db_rom: Rom, request: Request) -> SimpleRomSchema: - rom = cls.model_validate(db_rom) + def from_orm_with_request( + cls, db_rom: Rom, request: Request + ) -> SimpleRomSchema | None: user_id = request.user.id - rom.rom_user = RomUserSchema.for_user(user_id, db_rom) + db_rom.rom_user = RomUserSchema.for_user(user_id, db_rom) - return rom + return cls.model_validate(db_rom) class DetailedRomSchema(RomSchema): merged_screenshots: list[str] - sibling_roms: list[RomSchema] = Field(default_factory=list) - rom_user: RomUserSchema | None = Field(default=None) - user_saves: list[SaveSchema] = Field(default_factory=list) - user_states: list[StateSchema] = Field(default_factory=list) - user_screenshots: list[ScreenshotSchema] = Field(default_factory=list) - user_notes: list[UserNotesSchema] = Field(default_factory=list) - user_collections: list[CollectionSchema] = Field(default_factory=list) + sibling_roms: list[RomSchema] + rom_user: RomUserSchema + user_saves: list[SaveSchema] + user_states: list[StateSchema] + user_screenshots: list[ScreenshotSchema] + user_notes: list[UserNotesSchema] + user_collections: list[CollectionSchema] @classmethod def from_orm_with_request(cls, db_rom: Rom, request: Request) -> DetailedRomSchema: - rom = cls.model_validate(db_rom) user_id = request.user.id - rom.rom_user = RomUserSchema.for_user(user_id, db_rom) - rom.user_notes = RomUserSchema.notes_for_user(user_id, db_rom) - rom.user_saves = [ + db_rom.rom_user = RomUserSchema.for_user(user_id, db_rom) + db_rom.user_notes = RomUserSchema.notes_for_user(user_id, db_rom) + db_rom.user_saves = [ SaveSchema.model_validate(s) for s in db_rom.saves if s.user_id == user_id ] - rom.user_states = [ + db_rom.user_states = [ StateSchema.model_validate(s) for s in db_rom.states if s.user_id == user_id ] - rom.user_screenshots = [ + db_rom.user_screenshots = [ ScreenshotSchema.model_validate(s) for s in db_rom.screenshots if s.user_id == user_id ] - rom.user_collections = CollectionSchema.for_user( + db_rom.user_collections = CollectionSchema.for_user( user_id, db_rom.get_collections() ) - return rom + return cls.model_validate(db_rom) class UserNotesSchema(TypedDict): diff --git a/backend/endpoints/rom.py b/backend/endpoints/rom.py index 9f646e2df..49c8c7f86 100644 --- a/backend/endpoints/rom.py +++ b/backend/endpoints/rom.py @@ -126,7 +126,8 @@ def get_roms( limit=limit, ) - return [SimpleRomSchema.from_orm_with_request(rom, request) for rom in roms] + roms = [SimpleRomSchema.from_orm_with_request(rom, request) for rom in roms] + return [rom for rom in roms if rom] @protected_route( @@ -539,12 +540,36 @@ async def update_rom_user(request: Request, id: int) -> RomUserSchema: id, request.user.id ) or db_rom_handler.add_rom_user(id, request.user.id) - cleaned_data = { - "note_raw_markdown": data.get( - "note_raw_markdown", db_rom_user.note_raw_markdown - ), - "note_is_public": data.get("note_is_public", db_rom_user.note_is_public), - "is_main_sibling": data.get("is_main_sibling", db_rom_user.is_main_sibling), - } + cleaned_data = {} + + if "note_raw_markdown" in data: + cleaned_data.update({"note_raw_markdown": data.get("note_raw_markdown")}) + + if "note_is_public" in data: + cleaned_data.update({"note_is_public": data.get("note_is_public")}) + + if "is_main_sibling" in data: + cleaned_data.update({"is_main_sibling": data.get("is_main_sibling")}) + + if "backlogged" in data: + cleaned_data.update({"backlogged": data.get("backlogged")}) + + if "now_playing" in data: + cleaned_data.update({"now_playing": data.get("now_playing")}) + + if "hidden" in data: + cleaned_data.update({"hidden": data.get("hidden")}) + + if "rating" in data: + cleaned_data.update({"rating": data.get("rating")}) + + if "difficulty" in data: + cleaned_data.update({"difficulty": data.get("difficulty")}) + + if "completion" in data: + cleaned_data.update({"completion": data.get("completion")}) + + if "status" in data: + cleaned_data.update({"status": data.get("status")}) return db_rom_handler.update_rom_user(db_rom_user.id, cleaned_data) diff --git a/backend/endpoints/saves.py b/backend/endpoints/saves.py index 271a26146..0a7893d3f 100644 --- a/backend/endpoints/saves.py +++ b/backend/endpoints/saves.py @@ -1,6 +1,9 @@ +from datetime import datetime, timezone + from decorators.auth import protected_route from endpoints.responses import MessageResponse from endpoints.responses.assets import SaveSchema, UploadedSavesResponse +from exceptions.endpoint_exceptions import RomNotFoundInDatabaseException from fastapi import File, HTTPException, Request, UploadFile, status from handler.database import db_rom_handler, db_save_handler, db_screenshot_handler from handler.filesystem import fs_asset_handler @@ -19,6 +22,9 @@ def add_saves( emulator: str | None = None, ) -> UploadedSavesResponse: rom = db_rom_handler.get_rom(rom_id) + if not rom: + raise RomNotFoundInDatabaseException(rom_id) + current_user = request.user log.info(f"Uploading saves to {rom.name}") @@ -57,7 +63,19 @@ def add_saves( scanned_save.emulator = emulator db_save_handler.add_save(scanned_save) + # Set the last played time for the current user + rom_user = db_rom_handler.get_rom_user(rom.id, current_user.id) + if not rom_user: + rom_user = db_rom_handler.add_rom_user(rom.id, current_user.id) + db_rom_handler.update_rom_user( + rom_user.id, {"last_played": datetime.now(timezone.utc)} + ) + + # Refetch the rom to get updated saves rom = db_rom_handler.get_rom(rom_id) + if not rom: + raise RomNotFoundInDatabaseException(rom_id) + return { "uploaded": len(saves), "saves": [s for s in rom.saves if s.user_id == current_user.id], @@ -94,6 +112,16 @@ async def update_save(request: Request, id: int) -> SaveSchema: fs_asset_handler.write_file(file=file, path=db_save.file_path) db_save_handler.update_save(db_save.id, {"file_size_bytes": file.size}) + # Set the last played time for the current user + current_user = request.user + rom_user = db_rom_handler.get_rom_user(db_save.rom_id, current_user.id) + if not rom_user: + rom_user = db_rom_handler.add_rom_user(db_save.rom_id, current_user.id) + db_rom_handler.update_rom_user( + rom_user.id, {"last_played": datetime.now(timezone.utc)} + ) + + # Refetch the save to get updated fields db_save = db_save_handler.get_save(id) return db_save diff --git a/backend/endpoints/states.py b/backend/endpoints/states.py index b4199ae22..462c236fc 100644 --- a/backend/endpoints/states.py +++ b/backend/endpoints/states.py @@ -1,6 +1,9 @@ +from datetime import datetime, timezone + from decorators.auth import protected_route from endpoints.responses import MessageResponse from endpoints.responses.assets import StateSchema, UploadedStatesResponse +from exceptions.endpoint_exceptions import RomNotFoundInDatabaseException from fastapi import File, HTTPException, Request, UploadFile, status from handler.database import db_rom_handler, db_screenshot_handler, db_state_handler from handler.filesystem import fs_asset_handler @@ -19,6 +22,9 @@ def add_states( emulator: str | None = None, ) -> UploadedStatesResponse: rom = db_rom_handler.get_rom(rom_id) + if not rom: + raise RomNotFoundInDatabaseException(rom_id) + current_user = request.user log.info(f"Uploading states to {rom.name}") @@ -57,6 +63,14 @@ def add_states( scanned_state.emulator = emulator db_state_handler.add_state(scanned_state) + # Set the last played time for the current user + rom_user = db_rom_handler.get_rom_user(rom.id, current_user.id) + if not rom_user: + rom_user = db_rom_handler.add_rom_user(rom.id, current_user.id) + db_rom_handler.update_rom_user( + rom_user.id, {"last_played": datetime.now(timezone.utc)} + ) + rom = db_rom_handler.get_rom(rom_id) return { "uploaded": len(states), @@ -94,6 +108,15 @@ async def update_state(request: Request, id: int) -> StateSchema: fs_asset_handler.write_file(file=file, path=db_state.file_path) db_state_handler.update_state(db_state.id, {"file_size_bytes": file.size}) + # Set the last played time for the current user + current_user = request.user + rom_user = db_rom_handler.get_rom_user(db_state.rom_id, current_user.id) + if not rom_user: + rom_user = db_rom_handler.add_rom_user(db_state.rom_id, current_user.id) + db_rom_handler.update_rom_user( + rom_user.id, {"last_played": datetime.now(timezone.utc)} + ) + db_state = db_state_handler.get_state(id) return db_state diff --git a/backend/endpoints/tests/test_rom.py b/backend/endpoints/tests/test_rom.py index 5792a24a2..b37d763f8 100644 --- a/backend/endpoints/tests/test_rom.py +++ b/backend/endpoints/tests/test_rom.py @@ -58,6 +58,7 @@ def test_update_rom(rename_file_mock, get_rom_by_id_mock, client, access_token, "dlcs": "[]", "companies": '[{"id": 203227, "company": {"id": 70, "name": "Nintendo"}}, {"id": 203307, "company": {"id": 766, "name": "Retro Studios"}}]', "first_release_date": 1675814400, + "youtube_video_id": "dQw4w9WgXcQ", "remasters": "[]", "remakes": "[]", "expanded_games": "[]", diff --git a/backend/handler/auth/base_handler.py b/backend/handler/auth/base_handler.py index 2a5fecfc9..836c8f88f 100644 --- a/backend/handler/auth/base_handler.py +++ b/backend/handler/auth/base_handler.py @@ -1,4 +1,4 @@ -from datetime import datetime, timedelta +from datetime import datetime, timedelta, timezone from typing import Final from config import ROMM_AUTH_SECRET_KEY @@ -106,9 +106,11 @@ class OAuthHandler: to_encode = data.copy() if expires_delta: - expire = datetime.utcnow() + expires_delta + expire = datetime.now(timezone.utc) + expires_delta else: - expire = datetime.utcnow() + timedelta(minutes=DEFAULT_OAUTH_TOKEN_EXPIRY) + expire = datetime.now(timezone.utc) + timedelta( + minutes=DEFAULT_OAUTH_TOKEN_EXPIRY + ) to_encode.update({"exp": expire}) diff --git a/backend/handler/database/roms_handler.py b/backend/handler/database/roms_handler.py index cb1661c87..7b0adbd57 100644 --- a/backend/handler/database/roms_handler.py +++ b/backend/handler/database/roms_handler.py @@ -226,7 +226,7 @@ class DBRomsHandler(DBBaseHandler): rom_user = self.get_rom_user_by_id(id) - if data["is_main_sibling"]: + if data.get("is_main_sibling", False): rom = self.get_rom(rom_user.rom_id) session.execute( diff --git a/backend/handler/metadata/igdb_handler.py b/backend/handler/metadata/igdb_handler.py index c500e5c4d..7cd5db801 100644 --- a/backend/handler/metadata/igdb_handler.py +++ b/backend/handler/metadata/igdb_handler.py @@ -62,6 +62,7 @@ class IGDBMetadata(TypedDict): total_rating: str aggregated_rating: str first_release_date: int | None + youtube_video_id: str | None genres: list[str] franchises: list[str] alternative_names: list[str] @@ -89,9 +90,12 @@ class IGDBRom(TypedDict): igdb_metadata: NotRequired[IGDBMetadata] -def extract_metadata_from_igdb_rom(rom: dict) -> IGDBMetadata: +def extract_metadata_from_igdb_rom( + rom: dict, video_id: str | None = None +) -> IGDBMetadata: return IGDBMetadata( { + "youtube_video_id": video_id, "total_rating": str(round(rom.get("total_rating", 0.0), 2)), "aggregated_rating": str(round(rom.get("aggregated_rating", 0.0), 2)), "first_release_date": rom.get("first_release_date", None), @@ -197,6 +201,7 @@ class IGDBBaseHandler(MetadataHandler): self.games_fields = GAMES_FIELDS self.search_endpoint = f"{self.BASE_URL}/search" self.search_fields = SEARCH_FIELDS + self.video_endpoint = f"{self.BASE_URL}/game_videos" self.pagination_limit = 200 self.twitch_auth = TwitchAuth() self.headers = { @@ -214,7 +219,6 @@ class IGDBBaseHandler(MetadataHandler): return wrapper - # trunk-ignore(ruff/ASYNC109): timeout is used for request async def _request(self, url: str, data: str, timeout: int = 120) -> list: httpx_client = ctx_httpx_client.get() try: @@ -436,6 +440,13 @@ class IGDBBaseHandler(MetadataHandler): if not rom: return fallback_rom + # Get the video ID for the game + video_ids = await self._request( + self.video_endpoint, + f'fields video_id; where game={rom["id"]};', + ) + video_id = pydash.get(video_ids, "[0].video_id", None) + return IGDBRom( igdb_id=rom["id"], slug=rom["slug"], @@ -450,7 +461,7 @@ class IGDBBaseHandler(MetadataHandler): ) for s in rom.get("screenshots", []) ], - igdb_metadata=extract_metadata_from_igdb_rom(rom), + igdb_metadata=extract_metadata_from_igdb_rom(rom, video_id), ) @check_twitch_token @@ -467,6 +478,13 @@ class IGDBBaseHandler(MetadataHandler): if not rom: return IGDBRom(igdb_id=None) + # Get the video ID for the game + video_ids = await self._request( + self.video_endpoint, + f'fields video_id; where game={rom["id"]};', + ) + video_id = pydash.get(video_ids, "[0].video_id", None) + return IGDBRom( igdb_id=rom["id"], slug=rom["slug"], @@ -481,7 +499,7 @@ class IGDBBaseHandler(MetadataHandler): ) for s in rom.get("screenshots", []) ], - igdb_metadata=extract_metadata_from_igdb_rom(rom), + igdb_metadata=extract_metadata_from_igdb_rom(rom, video_id), ) @check_twitch_token diff --git a/backend/handler/redis_handler.py b/backend/handler/redis_handler.py index a8319e7d0..4832a552f 100644 --- a/backend/handler/redis_handler.py +++ b/backend/handler/redis_handler.py @@ -46,7 +46,7 @@ def __get_sync_cache() -> Redis: return FakeRedis(version=7) - log.info(f"Connecting to redis in {sys.argv[0]}...") + log.info(f"Connecting to sync redis in {sys.argv[0]}...") # A separate client that auto-decodes responses is needed client = Redis( host=REDIS_HOST, @@ -56,7 +56,7 @@ def __get_sync_cache() -> Redis: db=REDIS_DB, decode_responses=True, ) - log.info(f"Redis connection established in {sys.argv[0]}!") + log.info(f"Redis sync connection established in {sys.argv[0]}!") return client @@ -67,7 +67,7 @@ def __get_async_cache() -> AsyncRedis: return FakeAsyncRedis(version=7) - log.info(f"Connecting to redis in {sys.argv[0]}...") + log.info(f"Connecting to async redis in {sys.argv[0]}...") # A separate client that auto-decodes responses is needed client = AsyncRedis( host=REDIS_HOST, @@ -77,7 +77,7 @@ def __get_async_cache() -> AsyncRedis: db=REDIS_DB, decode_responses=True, ) - log.info(f"Redis connection established in {sys.argv[0]}!") + log.info(f"Redis async connection established in {sys.argv[0]}!") return client diff --git a/backend/handler/scan_handler.py b/backend/handler/scan_handler.py index 13bc0937e..b6d43009b 100644 --- a/backend/handler/scan_handler.py +++ b/backend/handler/scan_handler.py @@ -17,6 +17,8 @@ from models.platform import Platform from models.rom import Rom from models.user import User +NON_HASHABLE_PLATFORMS = ["pc", "win", "mac", "linux"] + class ScanType(Enum): NEW_PLATFORMS = "new_platforms" @@ -232,8 +234,14 @@ async def scan_rom( # Calculating hashes is expensive, so we only do it if necessary if not rom or scan_type == ScanType.COMPLETE or scan_type == ScanType.HASHES: - rom_hashes = fs_rom_handler.get_rom_hashes(rom_attrs["file_name"], roms_path) - rom_attrs.update(**rom_hashes) + # Skip hashing games for platforms that don't have a hash database + if platform.slug in NON_HASHABLE_PLATFORMS: + rom_attrs.update({"crc_hash": "", "md5_hash": "", "sha1_hash": ""}) + else: + rom_hashes = fs_rom_handler.get_rom_hashes( + rom_attrs["file_name"], roms_path + ) + rom_attrs.update(**rom_hashes) # If no metadata scan is required if scan_type == ScanType.HASHES: diff --git a/backend/handler/tests/cassettes/test_fastapi/test_scan_platform.yaml b/backend/handler/tests/cassettes/test_fastapi/test_scan_platform.yaml index ed5f59bf0..88c27805c 100644 --- a/backend/handler/tests/cassettes/test_fastapi/test_scan_platform.yaml +++ b/backend/handler/tests/cassettes/test_fastapi/test_scan_platform.yaml @@ -2,20 +2,22 @@ interactions: - request: body: fields id,name; where slug="n64"; limit 200; headers: - Accept: + accept: - application/json - Accept-Encoding: - - gzip, deflate - Authorization: + accept-encoding: + - gzip, deflate, br + authorization: - Bearer test_token - Client-ID: + client-id: - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - Connection: + connection: - keep-alive - Content-Length: + content-length: - "44" - User-Agent: - - python-requests/2.32.3 + host: + - api.igdb.com + user-agent: + - python-httpx/0.27.0 method: POST uri: https://api.igdb.com/v4/platforms response: @@ -31,7 +33,7 @@ interactions: CF-Cache-Status: - DYNAMIC CF-RAY: - - 8954456aa9091cd4-BUD + - 8c0446041af7aaa4-YYZ Connection: - keep-alive Content-Length: @@ -39,12 +41,12 @@ interactions: Content-Type: - application/json Date: - - Mon, 17 Jun 2024 16:03:42 GMT + - Mon, 09 Sep 2024 04:00:49 GMT Server: - cloudflare Set-Cookie: - - __cf_bm=TvCGrl03utW_uL8ydwhyI2KREebWDuL9NcblPAZjIVc-1718640222-1.0.1.1-yM_GpZQqO_WEMOMA82bCwwcw3Ddz1tIG_zFCr5_nMOG2vFadF1EwBeSzvs98sEbRmyphK8DEyhtIt1Di1oom1A; - path=/; expires=Mon, 17-Jun-24 16:33:42 GMT; domain=.igdb.com; HttpOnly; Secure; + - __cf_bm=sjY4VydC64JVy6pLLWORdQkqzHqfYTnRj_1BVvezT2k-1725854449-1.0.1.1-DYMlZ3H_61d3oZPkzh6KHGWvadSErGTz6TuNMVdsJHi1yzTvuwmls_iMvj3h9OQh7ijf1lzdn_yrDncMlSRVCw; + path=/; expires=Mon, 09-Sep-24 04:30:49 GMT; domain=.igdb.com; HttpOnly; Secure; SameSite=None Strict-Transport-Security: - max-age=31536000; includeSubDomains; preload @@ -53,41 +55,43 @@ interactions: alt-svc: - h3=":443"; ma=86400 via: - - 1.1 5dbbe1c6db9a003131a63be8ded250a4.cloudfront.net (CloudFront) + - 1.1 a44cf9ed8a499212c53e0b8f57aa31f4.cloudfront.net (CloudFront) x-amz-apigw-id: - - ZhOuyGawPHcEmUQ= + - d0blxEVdPHcEiJg= x-amz-cf-id: - - yXBecbRzM674HMnCZIaYWsqUiSWlrtmBw8CPPIlBhScuigVg6P9xjg== + - LdihAJTohkx0uxEl9Ooa9XmczflSSEvLX6FDjmrnIozW2AM4E6_ZIQ== x-amz-cf-pop: - - FRA56-P8 + - YTO50-P1 x-amzn-errortype: - AccessDeniedException x-amzn-requestid: - - 3e53a3ee-5c90-491e-9672-c7a048bd596b + - 55e8e242-e61c-4060-9ccf-53dce6802560 x-cache: - Error from cloudfront status: code: 401 message: Unauthorized - request: - body: null + body: "" headers: - Accept: + accept: - "*/*" - Accept-Encoding: - - gzip, deflate - Connection: + accept-encoding: + - gzip, deflate, br + connection: - keep-alive - Content-Length: + content-length: - "0" - User-Agent: - - python-requests/2.32.3 + host: + - id.twitch.tv + user-agent: + - python-httpx/0.27.0 method: POST uri: https://id.twitch.tv/oauth2/token?client_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&client_secret=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&grant_type=client_credentials response: body: string: - '{"access_token":"emaxpf4c7rlbt30js8iif0el0nygp8","expires_in":5647699,"token_type":"bearer"} + '{"access_token":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","expires_in":5663717,"token_type":"bearer"} ' headers: @@ -100,53 +104,56 @@ interactions: Content-Type: - application/json Date: - - Mon, 17 Jun 2024 16:03:43 GMT + - Mon, 09 Sep 2024 04:00:50 GMT Server: - nginx X-Ctxlog-Logid: - - 1-66705e5f-11952900765a988e7c6e449b + - 1-66de72f1-7530704306b7aeaf271de9b0 status: code: 200 message: OK - request: body: fields id,name; where slug="n64"; limit 200; headers: - Accept: + accept: - application/json - Accept-Encoding: - - gzip, deflate - Authorization: - - Bearer emaxpf4c7rlbt30js8iif0el0nygp8 - Client-ID: + accept-encoding: + - gzip, deflate, br + authorization: + - Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + client-id: - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - Connection: + connection: - keep-alive - Content-Length: + content-length: - "44" - User-Agent: - - python-requests/2.32.3 + cookie: + - __cf_bm=sjY4VydC64JVy6pLLWORdQkqzHqfYTnRj_1BVvezT2k-1725854449-1.0.1.1-DYMlZ3H_61d3oZPkzh6KHGWvadSErGTz6TuNMVdsJHi1yzTvuwmls_iMvj3h9OQh7ijf1lzdn_yrDncMlSRVCw + host: + - api.igdb.com + user-agent: + - python-httpx/0.27.0 method: POST uri: https://api.igdb.com/v4/platforms response: body: - string: "[\n {\n \"id\": 4,\n \"name\": \"Nintendo 64\"\n }\n]" + string: !!binary | + IcQAACDwn7d+Jb39LJqgBKGYYCMITtFMUaRRNFANngFoDWViCO97KqOy/E4fhxRl8K0ZAw== headers: CF-Cache-Status: - DYNAMIC CF-RAY: - - 895445746e561cd8-BUD + - 8c044609dfd4aaa4-YYZ Connection: - keep-alive + Content-Encoding: + - br Content-Type: - application/json Date: - - Mon, 17 Jun 2024 16:03:44 GMT + - Mon, 09 Sep 2024 04:00:50 GMT Server: - cloudflare - Set-Cookie: - - __cf_bm=aTy_gWfTO4HWMKGVEyqkLYevxkHNwBf3NYbxA7cEV9k-1718640224-1.0.1.1-i4sqDvwxyTxgpX9IqeuQMc0D8InY3tHxTRxho221fuit1Vq0siMm7cXNEM2aMmblInMFmo8BYxqZ5zGZsXtMdQ; - path=/; expires=Mon, 17-Jun-24 16:33:44 GMT; domain=.igdb.com; HttpOnly; Secure; - SameSite=None Strict-Transport-Security: - max-age=31536000; includeSubDomains; preload Transfer-Encoding: @@ -156,43 +163,47 @@ interactions: alt-svc: - h3=":443"; ma=86400 via: - - 1.1 1e0f88a39289286be3e03ff93487da80.cloudfront.net (CloudFront) + - 1.1 20f9576431d2962bf870247ded502538.cloudfront.net (CloudFront) x-amz-apigw-id: - - ZhOvAEWYPHcEDOQ= + - d0bl6FZDvHcEIow= x-amz-cf-id: - - 4t1ulbfMmOP0s2nEgG6Yu1ftGtPiPaC9-sHNM8DHtumIZZFNJth-YA== + - s199US7PmuBSeMqMyENeM3JCZwzvSBxdSNB2f9wyLixAIrx8KCewMA== x-amz-cf-pop: - - FRA56-P8 + - YTO50-P1 x-amzn-remapped-content-length: - "50" x-amzn-remapped-date: - - Mon, 17 Jun 2024 16:03:43 GMT + - Mon, 09 Sep 2024 04:00:50 GMT x-amzn-requestid: - - cc9ed3b6-4195-4b6a-922c-d5d0c4227ad2 + - a544b73f-7c1c-4a6f-8099-3fac7e0c40f8 x-cache: - Miss from cloudfront x-count: - "1" + x-pool: + - slow status: code: 200 message: OK - request: body: fields id,name; where slug=""; limit 200; headers: - Accept: + accept: - application/json - Accept-Encoding: - - gzip, deflate - Authorization: + accept-encoding: + - gzip, deflate, br + authorization: - Bearer test_token - Client-ID: + client-id: - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - Connection: + connection: - keep-alive - Content-Length: + content-length: - "41" - User-Agent: - - python-requests/2.32.3 + host: + - api.igdb.com + user-agent: + - python-httpx/0.27.0 method: POST uri: https://api.igdb.com/v4/platforms response: @@ -208,7 +219,7 @@ interactions: CF-Cache-Status: - DYNAMIC CF-RAY: - - 895445784eff68b5-BUD + - 8c04460c5e77aaf4-YYZ Connection: - keep-alive Content-Length: @@ -216,12 +227,12 @@ interactions: Content-Type: - application/json Date: - - Mon, 17 Jun 2024 16:03:45 GMT + - Mon, 09 Sep 2024 04:00:50 GMT Server: - cloudflare Set-Cookie: - - __cf_bm=gUD7CGHbbRYNhfkH1sA.kS.0XmsBiw0TQXfRJrwuU84-1718640225-1.0.1.1-_OSqpovtQghNqxSoTeCrl4cAC7Tdz_OS2CdC0TFwyAxqwnzDnBTymRXbdaURYyuWXFV5WB2N0lVG4ALl8vuOgA; - path=/; expires=Mon, 17-Jun-24 16:33:45 GMT; domain=.igdb.com; HttpOnly; Secure; + - __cf_bm=Jat24qPjsOoVAfI1A37h2_49j.42qFUxjOdafz_lIOw-1725854450-1.0.1.1-SjDrIXIhTVSb28y.p3eyNCLUgBvBYspDnmFqZjfd1kL5gJfNteebA87hjxDiEOLMcRQJvqaxZvkve6zRc63TiQ; + path=/; expires=Mon, 09-Sep-24 04:30:50 GMT; domain=.igdb.com; HttpOnly; Secure; SameSite=None Strict-Transport-Security: - max-age=31536000; includeSubDomains; preload @@ -230,41 +241,43 @@ interactions: alt-svc: - h3=":443"; ma=86400 via: - - 1.1 b7c8b552077b93dc0acaa0b82d11fa62.cloudfront.net (CloudFront) + - 1.1 490c6f54e6cd81b80f07ff6be833267e.cloudfront.net (CloudFront) x-amz-apigw-id: - - ZhOvHGJ0vHcEplg= + - d0bl9HwcPHcEFug= x-amz-cf-id: - - fPRgpDjIs5s9lyV72fdkwgAO945qmzkiO4cAyzWvZJ9dONgbOq5MbA== + - iIeGPppNzBbXatePVMUfbeXPILwUgaz05mckVGYtkiRzCxFp2IfhJQ== x-amz-cf-pop: - - FRA56-P8 + - YTO50-P1 x-amzn-errortype: - AccessDeniedException x-amzn-requestid: - - 5710ca40-1b77-45d8-9283-554460deb589 + - 544a89f3-81e8-40c0-ac90-2b26b8c397db x-cache: - Error from cloudfront status: code: 401 message: Unauthorized - request: - body: null + body: "" headers: - Accept: + accept: - "*/*" - Accept-Encoding: - - gzip, deflate - Connection: + accept-encoding: + - gzip, deflate, br + connection: - keep-alive - Content-Length: + content-length: - "0" - User-Agent: - - python-requests/2.32.3 + host: + - id.twitch.tv + user-agent: + - python-httpx/0.27.0 method: POST uri: https://id.twitch.tv/oauth2/token?client_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&client_secret=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&grant_type=client_credentials response: body: string: - '{"access_token":"wuxsvs55uzd59noni1vq1w4gez1tok","expires_in":4961287,"token_type":"bearer"} + '{"access_token":"2gqi94oorguwsrvn55s325mxth1t30","expires_in":5390596,"token_type":"bearer"} ' headers: @@ -277,31 +290,35 @@ interactions: Content-Type: - application/json Date: - - Mon, 17 Jun 2024 16:03:46 GMT + - Mon, 09 Sep 2024 04:00:51 GMT Server: - nginx X-Ctxlog-Logid: - - 1-66705e61-11a882db1ddf5a8237265f6c + - 1-66de72f3-7c84f02a46fd560c2c982304 status: code: 200 message: OK - request: body: fields id,name; where slug=""; limit 200; headers: - Accept: + accept: - application/json - Accept-Encoding: - - gzip, deflate - Authorization: - - Bearer wuxsvs55uzd59noni1vq1w4gez1tok - Client-ID: + accept-encoding: + - gzip, deflate, br + authorization: + - Bearer 2gqi94oorguwsrvn55s325mxth1t30 + client-id: - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - Connection: + connection: - keep-alive - Content-Length: + content-length: - "41" - User-Agent: - - python-requests/2.32.3 + cookie: + - __cf_bm=Jat24qPjsOoVAfI1A37h2_49j.42qFUxjOdafz_lIOw-1725854450-1.0.1.1-SjDrIXIhTVSb28y.p3eyNCLUgBvBYspDnmFqZjfd1kL5gJfNteebA87hjxDiEOLMcRQJvqaxZvkve6zRc63TiQ + host: + - api.igdb.com + user-agent: + - python-httpx/0.27.0 method: POST uri: https://api.igdb.com/v4/platforms response: @@ -311,7 +328,7 @@ interactions: CF-Cache-Status: - DYNAMIC CF-RAY: - - 89544585e87ac1cd-BUD + - 8c044611b9d9aaf4-YYZ Connection: - keep-alive Content-Length: @@ -319,13 +336,9 @@ interactions: Content-Type: - application/json Date: - - Mon, 17 Jun 2024 16:03:46 GMT + - Mon, 09 Sep 2024 04:00:51 GMT Server: - cloudflare - Set-Cookie: - - __cf_bm=S4zvm8n8CODJny82N8B3HjbghVvZa0Q9bLy7VNAvMyY-1718640226-1.0.1.1-uhZ4jsj7Z.6_BbMm0tpbfxdhEOaRbFW3fRIuE1GVbmRNhocfmJ7CCC9mVAPId09S7wpABF2iB3dumAA5WIjrKg; - path=/; expires=Mon, 17-Jun-24 16:33:46 GMT; domain=.igdb.com; HttpOnly; Secure; - SameSite=None Strict-Transport-Security: - max-age=31536000; includeSubDomains; preload X-Content-Type-Options: @@ -333,43 +346,49 @@ interactions: alt-svc: - h3=":443"; ma=86400 via: - - 1.1 1e0f88a39289286be3e03ff93487da80.cloudfront.net (CloudFront) + - 1.1 490c6f54e6cd81b80f07ff6be833267e.cloudfront.net (CloudFront) x-amz-apigw-id: - - ZhOvaFXKPHcEZoQ= + - d0bmHH5yPHcEb1Q= x-amz-cf-id: - - kOZy7iLktTLH5LpuANbdlBMeEep_bKCLDhQPuj6TSs_rMTlLIrDXPw== + - OgxUiXjH-N9qICjt0piT6tRYtTm5h-gf55rDirrC5ZQ_93is5L8ScA== x-amz-cf-pop: - - FRA56-P8 + - YTO50-P1 x-amzn-remapped-content-length: - "2" x-amzn-remapped-date: - - Mon, 17 Jun 2024 16:03:46 GMT + - Mon, 09 Sep 2024 04:00:51 GMT x-amzn-requestid: - - e895522e-7ed5-48af-8f7e-80263c41c55e + - 68b59619-9f77-4d4c-81b2-969d547b53a1 x-cache: - Miss from cloudfront x-count: - "0" + x-pool: + - slow status: code: 200 message: OK - request: body: fields id,name; where slug=""; limit 200; headers: - Accept: + accept: - application/json - Accept-Encoding: - - gzip, deflate - Authorization: - - Bearer wuxsvs55uzd59noni1vq1w4gez1tok - Client-ID: + accept-encoding: + - gzip, deflate, br + authorization: + - Bearer 2gqi94oorguwsrvn55s325mxth1t30 + client-id: - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - Connection: + connection: - keep-alive - Content-Length: + content-length: - "41" - User-Agent: - - python-requests/2.32.3 + cookie: + - __cf_bm=Jat24qPjsOoVAfI1A37h2_49j.42qFUxjOdafz_lIOw-1725854450-1.0.1.1-SjDrIXIhTVSb28y.p3eyNCLUgBvBYspDnmFqZjfd1kL5gJfNteebA87hjxDiEOLMcRQJvqaxZvkve6zRc63TiQ + host: + - api.igdb.com + user-agent: + - python-httpx/0.27.0 method: POST uri: https://api.igdb.com/v4/platform_versions response: @@ -379,7 +398,7 @@ interactions: CF-Cache-Status: - DYNAMIC CF-RAY: - - 895445884fe66847-BUD + - 8c0446145c3aaaf4-YYZ Connection: - keep-alive Content-Length: @@ -387,13 +406,9 @@ interactions: Content-Type: - application/json Date: - - Mon, 17 Jun 2024 16:03:46 GMT + - Mon, 09 Sep 2024 04:00:52 GMT Server: - cloudflare - Set-Cookie: - - __cf_bm=EsMSXikvSpKrFPTBAB6_OBLnqkecPuhdU994JBnpSyQ-1718640226-1.0.1.1-SuDA1nw3BEJ3qc20ZSY.IqU8RM3KPapCYk.UmO3EJaDi1i34KSo5uMf3g.14pUm7WTMJNzMsJl0NLxRzgCdX.w; - path=/; expires=Mon, 17-Jun-24 16:33:46 GMT; domain=.igdb.com; HttpOnly; Secure; - SameSite=None Strict-Transport-Security: - max-age=31536000; includeSubDomains; preload X-Content-Type-Options: @@ -401,23 +416,25 @@ interactions: alt-svc: - h3=":443"; ma=86400 via: - - 1.1 1e0f88a39289286be3e03ff93487da80.cloudfront.net (CloudFront) + - 1.1 490c6f54e6cd81b80f07ff6be833267e.cloudfront.net (CloudFront) x-amz-apigw-id: - - ZhOvdGS4PHcEk9g= + - d0bmLFGePHcET9Q= x-amz-cf-id: - - 6iAscp4gUnYmobcPfyOuZQwMGZ0YUu8eahhnsGhTZGXq7h4GcVUNcQ== + - ZZYXxenlmY8Jo8YEVxUfLPZtoN_MynqsJE5vj2PweWkqx7I0mty8Xg== x-amz-cf-pop: - - FRA56-P8 + - YTO50-P1 x-amzn-remapped-content-length: - "2" x-amzn-remapped-date: - - Mon, 17 Jun 2024 16:03:46 GMT + - Mon, 09 Sep 2024 04:00:52 GMT x-amzn-requestid: - - fb152fd2-097c-4685-a6a2-89ca39583612 + - dfab708b-c79c-4bad-b649-1d56870fe813 x-cache: - Miss from cloudfront x-count: - "0" + x-pool: + - slow status: code: 200 message: OK diff --git a/backend/handler/tests/cassettes/test_fastapi/test_scan_rom.yaml b/backend/handler/tests/cassettes/test_fastapi/test_scan_rom.yaml index 4ca969dd0..1ed4e1320 100644 --- a/backend/handler/tests/cassettes/test_fastapi/test_scan_rom.yaml +++ b/backend/handler/tests/cassettes/test_fastapi/test_scan_rom.yaml @@ -4,20 +4,22 @@ interactions: search "Paper Mario"; fields id,name,slug,summary,total_rating,aggregated_rating,first_release_date,artworks.url,cover.url,screenshots.url,platforms.id,platforms.name,alternative_names.name,genres.name,franchise.name,franchises.name,collections.name,game_modes.name,involved_companies.company.name,expansions.id,expansions.slug,expansions.name,expansions.cover.url,expanded_games.id,expanded_games.slug,expanded_games.name,expanded_games.cover.url,dlcs.id,dlcs.name,dlcs.slug,dlcs.cover.url,remakes.id,remakes.slug,remakes.name,remakes.cover.url,remasters.id,remasters.slug,remasters.name,remasters.cover.url,ports.id,ports.slug,ports.name,ports.cover.url,similar_games.id,similar_games.slug,similar_games.name,similar_games.cover.url; where platforms=[4] & (category=0 | category=10); limit 200; headers: - Accept: + accept: - application/json - Accept-Encoding: - - gzip, deflate - Authorization: + accept-encoding: + - gzip, deflate, br + authorization: - Bearer test_token - Client-ID: + client-id: - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - Connection: + connection: - keep-alive - Content-Length: + content-length: - "796" - User-Agent: - - python-requests/2.32.0 + host: + - api.igdb.com + user-agent: + - python-httpx/0.27.0 method: POST uri: https://api.igdb.com/v4/games response: @@ -33,7 +35,7 @@ interactions: CF-Cache-Status: - DYNAMIC CF-RAY: - - 8a4509ef2f06ab0c-YYZ + - 8c0445b39b8dabd6-YYZ Connection: - keep-alive Content-Length: @@ -41,12 +43,12 @@ interactions: Content-Type: - application/json Date: - - Tue, 16 Jul 2024 21:20:53 GMT + - Mon, 09 Sep 2024 04:00:36 GMT Server: - cloudflare Set-Cookie: - - __cf_bm=K63xoXgTxGJm.n8D27NJG_ly4hN5z2J6yYDTzgLbD80-1721164853-1.0.1.1-p2nx3KwSJSjeNAWPDw0cRQAUg6YHgO_Y3Z0jYU6sB2Yr5fkj8Db6FRqWdlVSS5EN_6KieLIwqUxDUg4J45h50g; - path=/; expires=Tue, 16-Jul-24 21:50:53 GMT; domain=.igdb.com; HttpOnly; Secure; + - __cf_bm=ZTkzLY1Wz3Lq3KdkQQpVj0yhgTOXkbAP9lPgbSV.fTY-1725854436-1.0.1.1-.UtTECTjipcRDIa3.6ZWDiOQNj0q9mHlDSCB2265Xcox2wuSZ6hHVY_mke1BBtuYQIMilhWlObkmR7PM1tX6RQ; + path=/; expires=Mon, 09-Sep-24 04:30:36 GMT; domain=.igdb.com; HttpOnly; Secure; SameSite=None Strict-Transport-Security: - max-age=31536000; includeSubDomains; preload @@ -55,41 +57,43 @@ interactions: alt-svc: - h3=":443"; ma=86400 via: - - 1.1 1acedc07a77a02e11785c2290515f2e4.cloudfront.net (CloudFront) + - 1.1 1005873908b937da8d6e408eda0fb9e0.cloudfront.net (CloudFront) x-amz-apigw-id: - - bBiYcG8dvHcEJyg= + - d0bjwHzrPHcEtQg= x-amz-cf-id: - - 5BP2CkODtFEThqTb1WSzRtjpsi2tscDJRx4NmPXzCpmEQod5maIjnQ== + - Sf46nvswLwbFt_dJ5Ve5KvqLFp-odcsTS64D_cjG6rDGktuFotMRNw== x-amz-cf-pop: - - ORD51-C2 + - YTO50-P1 x-amzn-errortype: - AccessDeniedException x-amzn-requestid: - - b6b00df1-1438-4aa1-bda3-0cd0f7c23296 + - fe684a1e-715f-47ce-9b11-a000f167acbd x-cache: - Error from cloudfront status: code: 401 message: Unauthorized - request: - body: null + body: "" headers: - Accept: + accept: - "*/*" - Accept-Encoding: - - gzip, deflate - Connection: + accept-encoding: + - gzip, deflate, br + connection: - keep-alive - Content-Length: + content-length: - "0" - User-Agent: - - python-requests/2.32.0 + host: + - id.twitch.tv + user-agent: + - python-httpx/0.27.0 method: POST uri: https://id.twitch.tv/oauth2/token?client_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&client_secret=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&grant_type=client_credentials response: body: string: - '{"access_token":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","expires_in":5624809,"token_type":"bearer"} + '{"access_token":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","expires_in":4930334,"token_type":"bearer"} ' headers: @@ -102,11 +106,11 @@ interactions: Content-Type: - application/json Date: - - Tue, 16 Jul 2024 21:20:54 GMT + - Mon, 09 Sep 2024 04:00:37 GMT Server: - nginx X-Ctxlog-Logid: - - 1-6696e436-783213912ac0e5067f1e9592 + - 1-66de72e5-20e8932a7697667d209b366f status: code: 200 message: OK @@ -115,120 +119,73 @@ interactions: search "Paper Mario"; fields id,name,slug,summary,total_rating,aggregated_rating,first_release_date,artworks.url,cover.url,screenshots.url,platforms.id,platforms.name,alternative_names.name,genres.name,franchise.name,franchises.name,collections.name,game_modes.name,involved_companies.company.name,expansions.id,expansions.slug,expansions.name,expansions.cover.url,expanded_games.id,expanded_games.slug,expanded_games.name,expanded_games.cover.url,dlcs.id,dlcs.name,dlcs.slug,dlcs.cover.url,remakes.id,remakes.slug,remakes.name,remakes.cover.url,remasters.id,remasters.slug,remasters.name,remasters.cover.url,ports.id,ports.slug,ports.name,ports.cover.url,similar_games.id,similar_games.slug,similar_games.name,similar_games.cover.url; where platforms=[4] & (category=0 | category=10); limit 200; headers: - Accept: + accept: - application/json - Accept-Encoding: - - gzip, deflate - Authorization: + accept-encoding: + - gzip, deflate, br + authorization: - Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - Client-ID: + client-id: - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - Connection: + connection: - keep-alive - Content-Length: + content-length: - "796" - User-Agent: - - python-requests/2.32.0 + cookie: + - __cf_bm=ZTkzLY1Wz3Lq3KdkQQpVj0yhgTOXkbAP9lPgbSV.fTY-1725854436-1.0.1.1-.UtTECTjipcRDIa3.6ZWDiOQNj0q9mHlDSCB2265Xcox2wuSZ6hHVY_mke1BBtuYQIMilhWlObkmR7PM1tX6RQ + host: + - api.igdb.com + user-agent: + - python-httpx/0.27.0 method: POST uri: https://api.igdb.com/v4/games response: body: - string: - "[\n {\n \"id\": 3340,\n \"aggregated_rating\": 90.0,\n \"alternative_names\": - [\n {\n \"id\": 39105,\n \"name\": \"Zhi Pian Mario\"\n - \ },\n {\n \"id\": 51791,\n \"name\": \"\u30DE\u30EA\u30AA\u30B9\u30C8\u30FC\u30EA\u30FC\"\n - \ },\n {\n \"id\": 51792,\n \"name\": \"\u7EB8\u7247\u9A6C\u91CC\u5965\"\n - \ },\n {\n \"id\": 78718,\n \"name\": \"Mario Story\"\n - \ },\n {\n \"id\": 88088,\n \"name\": \"Super Mario - RPG 2\"\n },\n {\n \"id\": 119107,\n \"name\": \"\u7EB8\u7247\u9A6C\u529B\u6B27\"\n - \ },\n {\n \"id\": 137285,\n \"name\": \"\uD398\uC774\uD37C - \uB9C8\uB9AC\uC624\"\n }\n ],\n \"artworks\": [\n {\n \"id\": - 73649,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/ar1ktt.jpg\"\n - \ }\n ],\n \"cover\": {\n \"id\": 80830,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/co1qda.jpg\"\n - \ },\n \"first_release_date\": 965952000,\n \"franchises\": [\n {\n - \ \"id\": 845,\n \"name\": \"Mario\"\n }\n ],\n \"game_modes\": - [\n {\n \"id\": 1,\n \"name\": \"Single player\"\n }\n - \ ],\n \"genres\": [\n {\n \"id\": 12,\n \"name\": - \"Role-playing (RPG)\"\n },\n {\n \"id\": 16,\n \"name\": - \"Turn-based strategy (TBS)\"\n },\n {\n \"id\": 31,\n \"name\": - \"Adventure\"\n }\n ],\n \"involved_companies\": [\n {\n \"id\": - 148214,\n \"company\": {\n \"id\": 70,\n \"name\": - \"Nintendo\"\n }\n },\n {\n \"id\": 225578,\n \"company\": - {\n \"id\": 5163,\n \"name\": \"iQue\"\n }\n },\n - \ {\n \"id\": 225579,\n \"company\": {\n \"id\": - 812,\n \"name\": \"Gradiente\"\n }\n },\n {\n \"id\": - 264416,\n \"company\": {\n \"id\": 25077,\n \"name\": - \"Intelligent Systems\"\n }\n }\n ],\n \"name\": \"Paper - Mario\",\n \"platforms\": [\n {\n \"id\": 4,\n \"name\": - \"Nintendo 64\"\n },\n {\n \"id\": 5,\n \"name\": - \"Wii\"\n },\n {\n \"id\": 41,\n \"name\": \"Wii U\"\n - \ }\n ],\n \"screenshots\": [\n {\n \"id\": 24167,\n - \ \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/a5r3k2lf3lgvifrycqeg.jpg\"\n - \ },\n {\n \"id\": 24168,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/hdxgs9nruycvrzcgvseu.jpg\"\n - \ },\n {\n \"id\": 24169,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/ig9ainu9fershqdinox1.jpg\"\n - \ },\n {\n \"id\": 24170,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/jz66se3deczeta6hd4ys.jpg\"\n - \ },\n {\n \"id\": 24171,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/kjnf90jnud6njmwto3th.jpg\"\n - \ }\n ],\n \"similar_games\": [\n {\n \"id\": 358,\n - \ \"cover\": {\n \"id\": 312995,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/co6pib.jpg\"\n - \ },\n \"name\": \"Super Mario Bros.\",\n \"slug\": \"super-mario-bros\"\n - \ },\n {\n \"id\": 660,\n \"cover\": {\n \"id\": - 357155,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/co7nkz.jpg\"\n - \ },\n \"name\": \"Darkstone\",\n \"slug\": \"darkstone\"\n - \ },\n {\n \"id\": 1026,\n \"cover\": {\n \"id\": - 181427,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/co3vzn.jpg\"\n - \ },\n \"name\": \"The Legend of Zelda: A Link to the Past\",\n - \ \"slug\": \"the-legend-of-zelda-a-link-to-the-past\"\n },\n {\n - \ \"id\": 1035,\n \"cover\": {\n \"id\": 170804,\n \"url\": - \"//images.igdb.com/igdb/image/upload/t_thumb/co3nsk.jpg\"\n },\n \"name\": - \"The Legend of Zelda: The Minish Cap\",\n \"slug\": \"the-legend-of-zelda-the-minish-cap\"\n - \ },\n {\n \"id\": 1068,\n \"cover\": {\n \"id\": - 358989,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/co7ozx.jpg\"\n - \ },\n \"name\": \"Super Mario Bros. 3\",\n \"slug\": - \"super-mario-bros-3\"\n },\n {\n \"id\": 1280,\n \"cover\": - {\n \"id\": 311972,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/co6opw.jpg\"\n - \ },\n \"name\": \"Breath of Fire IV\",\n \"slug\": \"breath-of-fire-iv\"\n - \ },\n {\n \"id\": 2148,\n \"cover\": {\n \"id\": - 93043,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/co1zsj.jpg\"\n - \ },\n \"name\": \"Banjo-Kazooie\",\n \"slug\": \"banjo-kazooie\"\n - \ },\n {\n \"id\": 3349,\n \"cover\": {\n \"id\": - 100900,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/co25us.jpg\"\n - \ },\n \"name\": \"Paper Mario: The Thousand-Year Door\",\n \"slug\": - \"paper-mario-the-thousand-year-door\"\n },\n {\n \"id\": - 3351,\n \"cover\": {\n \"id\": 95596,\n \"url\": - \"//images.igdb.com/igdb/image/upload/t_thumb/co21rg.jpg\"\n },\n \"name\": - \"Mario \\u0026 Luigi: Superstar Saga\",\n \"slug\": \"mario-luigi-superstar-saga\"\n - \ },\n {\n \"id\": 22387,\n \"cover\": {\n \"id\": - 137538,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/co2y4i.jpg\"\n - \ },\n \"name\": \"Legrand Legacy\",\n \"slug\": \"legrand-legacy\"\n - \ }\n ],\n \"slug\": \"paper-mario\",\n \"summary\": \"Paper - Mario, a turn-based JRPG entry in the Mario franchise with a paper-based aesthetic - and platforming elements, sees the titular character working his way through - the Mushroom Kingdom\\u0027s diverse locales and biomes, meeting its inhabitants, - fighthing unruly enemies and recruiting an array of companions in order to - once again save Princess Peach from the clutches of the evil Koopa King Bowser.\",\n - \ \"total_rating\": 88.63753217601834,\n \"collections\": [\n {\n - \ \"id\": 240,\n \"name\": \"Super Mario\"\n },\n {\n - \ \"id\": 593,\n \"name\": \"Paper Mario\"\n }\n ]\n - \ }\n]" + string: !!binary | + H4sIAAAAAAAA/61YS28cRRC+51e09hSkHXvej9xiIqKQh0xsQCREq96Z3pnenenedPesM4u44EMC + As6REJwIEShHDoDyb6wQRUn+A9W7Xns3jHcmtiVb9nRX1VdfdVX14+4FhL6CX4Q6NOlcQo7jmt35 + N05TQVKsSNITWFGWwnRkbhxN54oIBhMT0mO4IBKm786mFhaXrEaW6XWPB7U8DHfuZBRtU8zQTSwo + 7xwKfN09wYxnBZFVY+Zg/5eD/T8OvoGfvw/2Hx3sP9ef+89bGbRrDL7856+X3z589fuzVw+/f/Hk + SaOdIAyssMbOjBbaUVxUjTbC0AzrbOyUYyLmAUK3t68iu9GSZUG4g3W0Xnz307/PnjYbcgI7rFu3 + tz8+fvPzn29/eI5eP330+rdnbx7/emRs9vfeIkmE2uNitC43Asd3oyWMUuQaYnOTFjglcoOmSX8j + 5sWm/mc+uFmOc46TTdVTWVn0N7GwRkptDMdpvRcxnxABRhfQhwE3Q8dcAJ8GNubW/QQfwx7GsTOg + QqqeIDnBkvQSqCBdOb4XebZpLspnIDCLMyrX1k3o1kV/tVhWmKYg0it4stZqXQntQH3nBI1zXEGo + 6m0TJtbbrSul2zwnhjYLAOgiJPAHzWnn19jZLQUz+hDQBEkF/YikFbq4u7XTbM6p43s5mRCmSkHq + uVI24fkEOh9kwBgzup63G9qWuwQyV6qWMu5YODC7y2MLf25RpghLjpZ14dAaXrbteUHYEtazfKcW + mH5SkvcFjVqChssZsYR5VeCEQvjfC9h33ZXEWAdse2YQ1EJfA9Q8p5DLCu1UUpFC1jixkgsL1W18 + 1Ig7h1OQ12rARbEuO9ya7FusNvLd5j2qRv9zShv13Lq0B0X0aX3Ky1gQwmTG1To2NizC8tZymm7t + CWdk5wMnTyd0IKr4PklXeveJKQDY4dmws+RBKiMmyiqeiGmcTiQpW2OfcZeiaYQpK6MBETK7n1DG + H1htsZe7xmmwh1Pfl8RJSDwlCvtZ4layNbZ1NuzRkA0ic8jKxGfDYk9xR2Un79WSFjTHopc2HSm9 + 1da3usMvyVl2FHkrveBUW70/pv1lr5didsJhbUtwudFZEpJ5qc/QHamFjEILGX0QalwE3zfbcfUC + yzsHrgEbTZu5XsFwsFOckTqOydFk425v2n4rdlZouXZwdnbOZMqa2e1mBN0gsE8kiA/QHZIn+BK6 + jG5QNkKKIwXT21iqOu4wZ+QzVYMPjKlWNbCRg6ahuKFnx1qzOTCO1y4wgRma7jkEhsnRKQOjB29S + RmWGPsTjtkHRY8VMy4hBqzkgfsua98IojM6hDvj0wSlqHjltqt5wmgnbYcvChytfYJ9Dk+PjvWbC + W4JglenV/4gKgq59Vke3PxPSaw3XIWLQSfNWA+foVmwjx3Sds5O1pnLYgixmQ25cx1POaW2n688E + RocCTSQdx43aFbVpRqZ5dpa2V8pmlktn23kx72a8lBiK9QuCBbrCuajjPsbHOa2LWS20KtAyEq3V + HBDParfqnhf55xAPS6TN8ZhX85elCZsTulHSlF5CszqXCsKxg1NcF455IHItbsiFtCG1dGPy204Y + tEsMJ/Cc8BwCUbm0ORDQ6QUsqO74OK7qSOdzCd3ctUT9oe7/+bK4QsmygO/qnSTsIozU8Y3/Y/3w + BVc2USHKZnvvfIGOHlHQHoWOhNEcYK6EiQRJRWOkCSyuavoZguSkAGuyiyQhcmZPUVXCsRPFGRY4 + VuCHfrfSwmAe7eEKpAQv02yOXkr44gW6DhIJL2aJEkiUUFg18CbnMc7BsgbuUw4n2S4qCNGPqIgq + CSQy3KcKz3wY0DRTmZ4q4WKSV0CUFPRQW5BYlHSmiBnCQoAn0HgPnyU407YQFwk4DKcSzmKCIN1g + TOIJnFAEhREp0TbBcQbhApe1/3FeqjgDCDClv8mE5ug652M8Y4S2+J4kYnF47SiucH78CByGG4EZ + hI4Z2nA58Gzn6Jktz0mstFdrb5Dm+k20+UYcOetb2DtJeEH/d+8/eNAf8OoWAAA= headers: CF-Cache-Status: - DYNAMIC CF-RAY: - - 8a4509f43a89abb8-YYZ + - 8c0445b8f82eabd6-YYZ Connection: - keep-alive + Content-Encoding: + - gzip Content-Length: - - "1528" + - "1529" Content-Type: - application/json Date: - - Tue, 16 Jul 2024 21:20:54 GMT + - Mon, 09 Sep 2024 04:00:37 GMT Server: - cloudflare - Set-Cookie: - - __cf_bm=PsncMQhPTWpR1oHjMpk15qRUP7WbtGRS.NGfZOY65l8-1721164854-1.0.1.1-cYy4SO3EJA2a4jqwmm1x1Zl3Z9o7Y8cIfRAv5mv0GnC8rjX2I1KEmbMp3aurQ3iwuGOS_LwNuMReKOD74TwXbA; - path=/; expires=Tue, 16-Jul-24 21:50:54 GMT; domain=.igdb.com; HttpOnly; Secure; - SameSite=None Strict-Transport-Security: - max-age=31536000; includeSubDomains; preload X-Content-Type-Options: @@ -236,89 +193,72 @@ interactions: alt-svc: - h3=":443"; ma=86400 via: - - 1.1 412b0215b557780a6efcc1651037dc90.cloudfront.net (CloudFront) + - 1.1 1005873908b937da8d6e408eda0fb9e0.cloudfront.net (CloudFront) x-amz-apigw-id: - - bBiYjGocvHcES9Q= + - d0bj4FrsPHcELQw= x-amz-cf-id: - - qNRcxGGRlOiahu_AQFHB6TMBbOASu2LA0t9PmPndvxSI4nkv96V3dA== + - nGKmz8x3MAZLbXpwAPNXo2hwQ7UwmchXiWql7aMqWaRVqrjVM60Lmw== x-amz-cf-pop: - YTO50-P1 x-amzn-remapped-content-length: - - "1528" + - "1529" x-amzn-remapped-date: - - Tue, 16 Jul 2024 21:20:54 GMT + - Mon, 09 Sep 2024 04:00:37 GMT x-amzn-requestid: - - 2659af3f-8bbb-4d7b-9e1c-dc972fc6367f + - 0c112999-f30d-4510-95a9-d61502c7b12b x-cache: - Miss from cloudfront x-count: - "1" + x-pool: + - slow status: code: 200 message: OK - request: - body: - fields game.id,name; where game.platforms=[4] & (name ~ *"Paper Mario"* - | alternative_name ~ *"Paper Mario"*); limit 200; + body: fields video_id; where game=3340; limit 200; headers: - Accept: + accept: - application/json - Accept-Encoding: - - gzip, deflate - Authorization: + accept-encoding: + - gzip, deflate, br + authorization: - Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - Client-ID: + client-id: - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - Connection: + connection: - keep-alive - Content-Length: - - "121" - User-Agent: - - python-requests/2.32.0 + content-length: + - "44" + cookie: + - __cf_bm=ZTkzLY1Wz3Lq3KdkQQpVj0yhgTOXkbAP9lPgbSV.fTY-1725854436-1.0.1.1-.UtTECTjipcRDIa3.6ZWDiOQNj0q9mHlDSCB2265Xcox2wuSZ6hHVY_mke1BBtuYQIMilhWlObkmR7PM1tX6RQ + host: + - api.igdb.com + user-agent: + - python-httpx/0.27.0 method: POST - uri: https://api.igdb.com/v4/search + uri: https://api.igdb.com/v4/game_videos response: body: - string: - "[\n {\n \"id\": 103536,\n \"game\": {\n \"id\": 3340\n - \ },\n \"name\": \"Paper Mario\"\n },\n {\n \"id\": 12331114,\n - \ \"game\": {\n \"id\": 155012\n },\n \"name\": \"Bowser\\u0027s - Dark Story\"\n },\n {\n \"id\": 12409264,\n \"game\": {\n \"id\": - 159325\n },\n \"name\": \"Paper Mario Multiplayer\"\n },\n {\n \"id\": - 12409477,\n \"game\": {\n \"id\": 159343\n },\n \"name\": \"Paper - Mario Black Pit\"\n },\n {\n \"id\": 12759145,\n \"game\": {\n \"id\": - 186399\n },\n \"name\": \"The Paper Mario Christmas Special\"\n },\n - \ {\n \"id\": 12845644,\n \"game\": {\n \"id\": 187873\n },\n - \ \"name\": \"Paper Mario Master Quest\"\n },\n {\n \"id\": 15877679,\n - \ \"game\": {\n \"id\": 240080\n },\n \"name\": \"Paper Mario - All Bosses in the Same Battle\"\n },\n {\n \"id\": 16126540,\n \"game\": - {\n \"id\": 245039\n },\n \"name\": \"Paper Mario Eggstraordinary - Egg Hunt\"\n },\n {\n \"id\": 16583338,\n \"game\": {\n \"id\": - 248349\n },\n \"name\": \"Paper Mario Master Quest + Jr\"\n },\n {\n - \ \"id\": 17792734,\n \"game\": {\n \"id\": 257636\n },\n \"name\": - \"Paper Mario TTYD64\"\n },\n {\n \"id\": 18361556,\n \"game\": {\n - \ \"id\": 266504\n },\n \"name\": \"Paper Mario Dark Star Edition\"\n - \ },\n {\n \"id\": 18454017,\n \"game\": {\n \"id\": 268692\n - \ },\n \"name\": \"Paper Mario Pro Mode\"\n },\n {\n \"id\": 20937038,\n - \ \"game\": {\n \"id\": 304045\n },\n \"name\": \"Paper Mario - Randomizer\"\n }\n]" + string: !!binary | + IYADACBmzOlj1F902yUFkmNFSE45EAgww1Qyz6wdMaDDxpggjRmd0a1LwJcAgNczjhFF6hraT3wN + m0dc8LfePrXxmvsyE/A3pskXFTtL6eCWDE6fp399gjRcyF+39VJ2aqcrAlNRKfadenSd3OqynzIB + f+obAw== headers: CF-Cache-Status: - DYNAMIC CF-RAY: - - 8a4509f668ce7119-YYZ + - 8c0445bb6a46abd6-YYZ Connection: - keep-alive + Content-Encoding: + - br Content-Type: - application/json Date: - - Tue, 16 Jul 2024 21:20:55 GMT + - Mon, 09 Sep 2024 04:00:38 GMT Server: - cloudflare - Set-Cookie: - - __cf_bm=KkAmqxhQPavV7fCKkDnuvzC9DyvenDp7tA7GNRkkVAc-1721164855-1.0.1.1-Ae5ASfcHkdEuszHbLuVn2rOsIOFO4lhkF0wJz_zkUMyHZGyjfMfbxc23IZI6vc_liGEP2Xgy2dI6I4xyduE1pA; - path=/; expires=Tue, 16-Jul-24 21:50:55 GMT; domain=.igdb.com; HttpOnly; Secure; - SameSite=None Strict-Transport-Security: - max-age=31536000; includeSubDomains; preload Transfer-Encoding: @@ -328,144 +268,78 @@ interactions: alt-svc: - h3=":443"; ma=86400 via: - - 1.1 19d1514f5f81da4dca6349d0f75a352c.cloudfront.net (CloudFront) + - 1.1 1005873908b937da8d6e408eda0fb9e0.cloudfront.net (CloudFront) x-amz-apigw-id: - - bBiYnGaWvHcEMVw= + - d0bj9F_nvHcEe3Q= x-amz-cf-id: - - qgoGtG02JXbCB4cXLi0sKJRw1f7uX6caTDqPIzUFUAiiaaTYr0DPmw== + - z0uGc71xLQMm1sTPsdIwmh7Uso2jjYjrTjIL7yqbvs9WQ5RYHTciIQ== x-amz-cf-pop: - - YUL62-C2 + - YTO50-P1 x-amzn-remapped-content-length: - - "1421" + - "225" x-amzn-remapped-date: - - Tue, 16 Jul 2024 21:20:54 GMT + - Mon, 09 Sep 2024 04:00:37 GMT x-amzn-requestid: - - b12a507c-48c8-4e57-8028-af00f0ec2ecf + - e7ec2d18-e037-4d50-8919-4f9d38c9abf6 x-cache: - Miss from cloudfront x-count: - - "13" + - "4" + x-pool: + - slow status: code: 200 message: OK - request: body: - fields id,name,slug,summary,total_rating,aggregated_rating,first_release_date,artworks.url,cover.url,screenshots.url,platforms.id,platforms.name,alternative_names.name,genres.name,franchise.name,franchises.name,collections.name,game_modes.name,involved_companies.company.name,expansions.id,expansions.slug,expansions.name,expansions.cover.url,expanded_games.id,expanded_games.slug,expanded_games.name,expanded_games.cover.url,dlcs.id,dlcs.name,dlcs.slug,dlcs.cover.url,remakes.id,remakes.slug,remakes.name,remakes.cover.url,remasters.id,remasters.slug,remasters.name,remasters.cover.url,ports.id,ports.slug,ports.name,ports.cover.url,similar_games.id,similar_games.slug,similar_games.name,similar_games.cover.url; - where id=3340; limit 200; + search "Paper Mario"; fields id,name,slug,summary,total_rating,aggregated_rating,first_release_date,artworks.url,cover.url,screenshots.url,platforms.id,platforms.name,alternative_names.name,genres.name,franchise.name,franchises.name,collections.name,game_modes.name,involved_companies.company.name,expansions.id,expansions.slug,expansions.name,expansions.cover.url,expanded_games.id,expanded_games.slug,expanded_games.name,expanded_games.cover.url,dlcs.id,dlcs.name,dlcs.slug,dlcs.cover.url,remakes.id,remakes.slug,remakes.name,remakes.cover.url,remasters.id,remasters.slug,remasters.name,remasters.cover.url,ports.id,ports.slug,ports.name,ports.cover.url,similar_games.id,similar_games.slug,similar_games.name,similar_games.cover.url; + where platforms=[4] & (category=0 | category=10); limit 200; headers: - Accept: + accept: - application/json - Accept-Encoding: - - gzip, deflate - Authorization: - - Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - Client-ID: + accept-encoding: + - gzip, deflate, br + authorization: + - Bearer test_token + client-id: - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - Connection: + connection: - keep-alive - Content-Length: - - "739" - User-Agent: - - python-requests/2.32.0 + content-length: + - "796" + host: + - api.igdb.com + user-agent: + - python-httpx/0.27.0 method: POST uri: https://api.igdb.com/v4/games response: body: string: - "[\n {\n \"id\": 3340,\n \"aggregated_rating\": 90.0,\n \"alternative_names\": - [\n {\n \"id\": 39105,\n \"name\": \"Zhi Pian Mario\"\n - \ },\n {\n \"id\": 51791,\n \"name\": \"\u30DE\u30EA\u30AA\u30B9\u30C8\u30FC\u30EA\u30FC\"\n - \ },\n {\n \"id\": 51792,\n \"name\": \"\u7EB8\u7247\u9A6C\u91CC\u5965\"\n - \ },\n {\n \"id\": 78718,\n \"name\": \"Mario Story\"\n - \ },\n {\n \"id\": 88088,\n \"name\": \"Super Mario - RPG 2\"\n },\n {\n \"id\": 119107,\n \"name\": \"\u7EB8\u7247\u9A6C\u529B\u6B27\"\n - \ },\n {\n \"id\": 137285,\n \"name\": \"\uD398\uC774\uD37C - \uB9C8\uB9AC\uC624\"\n }\n ],\n \"artworks\": [\n {\n \"id\": - 73649,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/ar1ktt.jpg\"\n - \ }\n ],\n \"cover\": {\n \"id\": 80830,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/co1qda.jpg\"\n - \ },\n \"first_release_date\": 965952000,\n \"franchises\": [\n {\n - \ \"id\": 845,\n \"name\": \"Mario\"\n }\n ],\n \"game_modes\": - [\n {\n \"id\": 1,\n \"name\": \"Single player\"\n }\n - \ ],\n \"genres\": [\n {\n \"id\": 12,\n \"name\": - \"Role-playing (RPG)\"\n },\n {\n \"id\": 16,\n \"name\": - \"Turn-based strategy (TBS)\"\n },\n {\n \"id\": 31,\n \"name\": - \"Adventure\"\n }\n ],\n \"involved_companies\": [\n {\n \"id\": - 148214,\n \"company\": {\n \"id\": 70,\n \"name\": - \"Nintendo\"\n }\n },\n {\n \"id\": 225578,\n \"company\": - {\n \"id\": 5163,\n \"name\": \"iQue\"\n }\n },\n - \ {\n \"id\": 225579,\n \"company\": {\n \"id\": - 812,\n \"name\": \"Gradiente\"\n }\n },\n {\n \"id\": - 264416,\n \"company\": {\n \"id\": 25077,\n \"name\": - \"Intelligent Systems\"\n }\n }\n ],\n \"name\": \"Paper - Mario\",\n \"platforms\": [\n {\n \"id\": 4,\n \"name\": - \"Nintendo 64\"\n },\n {\n \"id\": 5,\n \"name\": - \"Wii\"\n },\n {\n \"id\": 41,\n \"name\": \"Wii U\"\n - \ }\n ],\n \"screenshots\": [\n {\n \"id\": 24167,\n - \ \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/a5r3k2lf3lgvifrycqeg.jpg\"\n - \ },\n {\n \"id\": 24168,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/hdxgs9nruycvrzcgvseu.jpg\"\n - \ },\n {\n \"id\": 24169,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/ig9ainu9fershqdinox1.jpg\"\n - \ },\n {\n \"id\": 24170,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/jz66se3deczeta6hd4ys.jpg\"\n - \ },\n {\n \"id\": 24171,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/kjnf90jnud6njmwto3th.jpg\"\n - \ }\n ],\n \"similar_games\": [\n {\n \"id\": 358,\n - \ \"cover\": {\n \"id\": 312995,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/co6pib.jpg\"\n - \ },\n \"name\": \"Super Mario Bros.\",\n \"slug\": \"super-mario-bros\"\n - \ },\n {\n \"id\": 660,\n \"cover\": {\n \"id\": - 357155,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/co7nkz.jpg\"\n - \ },\n \"name\": \"Darkstone\",\n \"slug\": \"darkstone\"\n - \ },\n {\n \"id\": 1026,\n \"cover\": {\n \"id\": - 181427,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/co3vzn.jpg\"\n - \ },\n \"name\": \"The Legend of Zelda: A Link to the Past\",\n - \ \"slug\": \"the-legend-of-zelda-a-link-to-the-past\"\n },\n {\n - \ \"id\": 1035,\n \"cover\": {\n \"id\": 170804,\n \"url\": - \"//images.igdb.com/igdb/image/upload/t_thumb/co3nsk.jpg\"\n },\n \"name\": - \"The Legend of Zelda: The Minish Cap\",\n \"slug\": \"the-legend-of-zelda-the-minish-cap\"\n - \ },\n {\n \"id\": 1068,\n \"cover\": {\n \"id\": - 358989,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/co7ozx.jpg\"\n - \ },\n \"name\": \"Super Mario Bros. 3\",\n \"slug\": - \"super-mario-bros-3\"\n },\n {\n \"id\": 1280,\n \"cover\": - {\n \"id\": 311972,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/co6opw.jpg\"\n - \ },\n \"name\": \"Breath of Fire IV\",\n \"slug\": \"breath-of-fire-iv\"\n - \ },\n {\n \"id\": 2148,\n \"cover\": {\n \"id\": - 93043,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/co1zsj.jpg\"\n - \ },\n \"name\": \"Banjo-Kazooie\",\n \"slug\": \"banjo-kazooie\"\n - \ },\n {\n \"id\": 3349,\n \"cover\": {\n \"id\": - 100900,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/co25us.jpg\"\n - \ },\n \"name\": \"Paper Mario: The Thousand-Year Door\",\n \"slug\": - \"paper-mario-the-thousand-year-door\"\n },\n {\n \"id\": - 3351,\n \"cover\": {\n \"id\": 95596,\n \"url\": - \"//images.igdb.com/igdb/image/upload/t_thumb/co21rg.jpg\"\n },\n \"name\": - \"Mario \\u0026 Luigi: Superstar Saga\",\n \"slug\": \"mario-luigi-superstar-saga\"\n - \ },\n {\n \"id\": 22387,\n \"cover\": {\n \"id\": - 137538,\n \"url\": \"//images.igdb.com/igdb/image/upload/t_thumb/co2y4i.jpg\"\n - \ },\n \"name\": \"Legrand Legacy\",\n \"slug\": \"legrand-legacy\"\n - \ }\n ],\n \"slug\": \"paper-mario\",\n \"summary\": \"Paper - Mario, a turn-based JRPG entry in the Mario franchise with a paper-based aesthetic - and platforming elements, sees the titular character working his way through - the Mushroom Kingdom\\u0027s diverse locales and biomes, meeting its inhabitants, - fighthing unruly enemies and recruiting an array of companions in order to - once again save Princess Peach from the clutches of the evil Koopa King Bowser.\",\n - \ \"total_rating\": 88.63753217601834,\n \"collections\": [\n {\n - \ \"id\": 240,\n \"name\": \"Super Mario\"\n },\n {\n - \ \"id\": 593,\n \"name\": \"Paper Mario\"\n }\n ]\n - \ }\n]" + "{\n \"message\": \"Authorization Failure. Have you tried:\",\n \"Tip + 1\": \"Ensure you are sending Authorization and Client-ID as headers.\",\n + \ \"Tip 2\": \"Ensure Authorization value starts with 'Bearer ', including + the space\",\n \"Tip 3\": \"Ensure Authorization value ends with the App + Access Token you generated, NOT your Client Secret.\",\n \"Docs\": \"https://api-docs.igdb.com/#authentication\",\n + \ \"Discord\": \"https://discord.gg/igdb\"\n}\n" headers: CF-Cache-Status: - DYNAMIC CF-RAY: - - 8a4509fc9e8da246-YYZ + - 8c0446168f587117-YYZ Connection: - keep-alive Content-Length: - - "1528" + - "434" Content-Type: - application/json Date: - - Tue, 16 Jul 2024 21:20:56 GMT + - Mon, 09 Sep 2024 04:00:52 GMT Server: - cloudflare Set-Cookie: - - __cf_bm=5bPHYIegBMi1xJ02b0hjaxBDqtvwnry9PO980Xd7lNc-1721164856-1.0.1.1-cu9HyVrxbU2z.sX3r4j0oAGX.uCZMrSGh9G3DRsu7t2.CCaDCEZcRTqdbASeR2V9LLJseMkdn7TF7FBTjNY2DA; - path=/; expires=Tue, 16-Jul-24 21:50:56 GMT; domain=.igdb.com; HttpOnly; Secure; + - __cf_bm=Uc538fsRMgVlaNKx20H7.wBHC_4yQvf5msLYDdiWHWw-1725854452-1.0.1.1-7HfoY3TYKBR5atKo7l9f8nL_QkBZtJl1R6cFz5Ui8Gn.XVLC7ok6KRWdNH4Gp_CQAqu5nw9PklMWrdGGcjvFWg; + path=/; expires=Mon, 09-Sep-24 04:30:52 GMT; domain=.igdb.com; HttpOnly; Secure; SameSite=None Strict-Transport-Security: - max-age=31536000; includeSubDomains; preload @@ -474,23 +348,236 @@ interactions: alt-svc: - h3=":443"; ma=86400 via: - - 1.1 490c6f54e6cd81b80f07ff6be833267e.cloudfront.net (CloudFront) + - 1.1 f92b450b48c98e711c027c1986c59944.cloudfront.net (CloudFront) x-amz-apigw-id: - - bBiYxEaCPHcEErA= + - d0bmNH1xvHcEIUg= x-amz-cf-id: - - syxc_2spiC05CJNtd7tJxBxPfHKt0FzGAI0rbGnWlRK5_zFEK10LWA== + - 5FhkJO2W64H2MJHbkQ1er_vxxHQ-9jWO50WmaiIjjklL3_w0Tc4fMA== + x-amz-cf-pop: + - YTO50-P1 + x-amzn-errortype: + - AccessDeniedException + x-amzn-requestid: + - 17e5ffd1-9f99-43d2-abcb-d94bffc7911f + x-cache: + - Error from cloudfront + status: + code: 401 + message: Unauthorized + - request: + body: "" + headers: + accept: + - "*/*" + accept-encoding: + - gzip, deflate, br + connection: + - keep-alive + content-length: + - "0" + host: + - id.twitch.tv + user-agent: + - python-httpx/0.27.0 + method: POST + uri: https://id.twitch.tv/oauth2/token?client_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&client_secret=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&grant_type=client_credentials + response: + body: + string: + '{"access_token":"vyzx88dpfr0ve3kypohhawd40j0r5z","expires_in":5391063,"token_type":"bearer"} + + ' + headers: + Access-Control-Allow-Origin: + - "*" + Connection: + - keep-alive + Content-Length: + - "93" + Content-Type: + - application/json + Date: + - Mon, 09 Sep 2024 04:00:52 GMT + Server: + - nginx + X-Ctxlog-Logid: + - 1-66de72f4-66afdd221ca68b434444e2c7 + status: + code: 200 + message: OK + - request: + body: + search "Paper Mario"; fields id,name,slug,summary,total_rating,aggregated_rating,first_release_date,artworks.url,cover.url,screenshots.url,platforms.id,platforms.name,alternative_names.name,genres.name,franchise.name,franchises.name,collections.name,game_modes.name,involved_companies.company.name,expansions.id,expansions.slug,expansions.name,expansions.cover.url,expanded_games.id,expanded_games.slug,expanded_games.name,expanded_games.cover.url,dlcs.id,dlcs.name,dlcs.slug,dlcs.cover.url,remakes.id,remakes.slug,remakes.name,remakes.cover.url,remasters.id,remasters.slug,remasters.name,remasters.cover.url,ports.id,ports.slug,ports.name,ports.cover.url,similar_games.id,similar_games.slug,similar_games.name,similar_games.cover.url; + where platforms=[4] & (category=0 | category=10); limit 200; + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate, br + authorization: + - Bearer vyzx88dpfr0ve3kypohhawd40j0r5z + client-id: + - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + connection: + - keep-alive + content-length: + - "796" + cookie: + - __cf_bm=Uc538fsRMgVlaNKx20H7.wBHC_4yQvf5msLYDdiWHWw-1725854452-1.0.1.1-7HfoY3TYKBR5atKo7l9f8nL_QkBZtJl1R6cFz5Ui8Gn.XVLC7ok6KRWdNH4Gp_CQAqu5nw9PklMWrdGGcjvFWg + host: + - api.igdb.com + user-agent: + - python-httpx/0.27.0 + method: POST + uri: https://api.igdb.com/v4/games + response: + body: + string: !!binary | + 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 + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8c04461b49d77117-YYZ + Connection: + - keep-alive + Content-Encoding: + - gzip + Content-Length: + - "1529" + Content-Type: + - application/json + Date: + - Mon, 09 Sep 2024 04:00:53 GMT + Server: + - cloudflare + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + via: + - 1.1 f92b450b48c98e711c027c1986c59944.cloudfront.net (CloudFront) + x-amz-apigw-id: + - d0bmWEgfPHcEc-Q= + x-amz-cf-id: + - ayWP5EBTRdWEN9F1pKi1KLnEFGM2irHDLDchaXiBhhZShZX-fHbmkQ== x-amz-cf-pop: - YTO50-P1 x-amzn-remapped-content-length: - - "1528" + - "1529" x-amzn-remapped-date: - - Tue, 16 Jul 2024 21:20:55 GMT + - Mon, 09 Sep 2024 04:00:53 GMT x-amzn-requestid: - - 5674e595-eafc-4003-91be-0267d28f76c9 + - 0ee33393-4abc-4943-a2c1-50908af51e6d x-cache: - Miss from cloudfront x-count: - "1" + x-pool: + - slow + status: + code: 200 + message: OK + - request: + body: fields video_id; where game=3340; limit 200; + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate, br + authorization: + - Bearer vyzx88dpfr0ve3kypohhawd40j0r5z + client-id: + - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + connection: + - keep-alive + content-length: + - "44" + cookie: + - __cf_bm=Uc538fsRMgVlaNKx20H7.wBHC_4yQvf5msLYDdiWHWw-1725854452-1.0.1.1-7HfoY3TYKBR5atKo7l9f8nL_QkBZtJl1R6cFz5Ui8Gn.XVLC7ok6KRWdNH4Gp_CQAqu5nw9PklMWrdGGcjvFWg + host: + - api.igdb.com + user-agent: + - python-httpx/0.27.0 + method: POST + uri: https://api.igdb.com/v4/game_videos + response: + body: + string: !!binary | + IYADACBmzOlj1F902yUFkmNFSE45EAgww1Qyz6wdMaDDxpggjRmd0a1LwJcAgNczjhFF6hraT3wN + m0dc8LfePrXxmvsyE/A3pskXFTtL6eCWDE6fp399gjRcyF+39VJ2aqcrAlNRKfadenSd3OqynzIB + f+obAw== + headers: + CF-Cache-Status: + - DYNAMIC + CF-RAY: + - 8c04461dfb577117-YYZ + Connection: + - keep-alive + Content-Encoding: + - br + Content-Type: + - application/json + Date: + - Mon, 09 Sep 2024 04:00:53 GMT + Server: + - cloudflare + Strict-Transport-Security: + - max-age=31536000; includeSubDomains; preload + Transfer-Encoding: + - chunked + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + via: + - 1.1 f92b450b48c98e711c027c1986c59944.cloudfront.net (CloudFront) + x-amz-apigw-id: + - d0bmaG4PPHcERHQ= + x-amz-cf-id: + - 8Hq3T2WEPlUJISXm2DY86rlSr9tTqhbNJCxndioQu8jCDrJZQlJbEw== + x-amz-cf-pop: + - YTO50-P1 + x-amzn-remapped-content-length: + - "225" + x-amzn-remapped-date: + - Mon, 09 Sep 2024 04:00:53 GMT + x-amzn-requestid: + - 3c20676f-438f-4938-a2a9-6c45bd83542d + x-cache: + - Miss from cloudfront + x-count: + - "4" + x-pool: + - slow status: code: 200 message: OK diff --git a/backend/main.py b/backend/main.py index c810f870d..350976bd2 100644 --- a/backend/main.py +++ b/backend/main.py @@ -48,7 +48,13 @@ async def lifespan(app: FastAPI) -> AsyncGenerator[None, None]: yield -app = FastAPI(title="RomM API", version=get_version(), lifespan=lifespan) +app = FastAPI( + title="RomM API", + version=get_version(), + lifespan=lifespan, + docs_url="/api/docs", + redoc_url="/api/redoc", +) app.add_middleware( CORSMiddleware, diff --git a/backend/models/rom.py b/backend/models/rom.py index d176d21b2..e198fcb15 100644 --- a/backend/models/rom.py +++ b/backend/models/rom.py @@ -1,5 +1,7 @@ from __future__ import annotations +import enum +from datetime import datetime from functools import cached_property from typing import TYPE_CHECKING, Any, TypedDict @@ -8,6 +10,8 @@ from models.base import BaseModel from sqlalchemy import ( JSON, BigInteger, + DateTime, + Enum, ForeignKey, Integer, String, @@ -126,6 +130,10 @@ class Rom(BaseModel): return db_rom_handler.get_rom_collections(self) # Metadata fields + @property + def youtube_video_id(self) -> str: + return self.igdb_metadata.get("youtube_video_id", "") + @property def alternative_names(self) -> list[str]: return ( @@ -174,6 +182,14 @@ class Rom(BaseModel): return self.file_name +class RomUserStatus(enum.StrEnum): + INCOMPLETE = "incomplete" # Started but not finished + FINISHED = "finished" # Reached the end of the game + COMPLETED_100 = "completed_100" # Completed 100% + RETIRED = "retired" # Won't play again + NEVER_PLAYING = "never_playing" # Will never play + + class RomUser(BaseModel): __tablename__ = "rom_user" __table_args__ = ( @@ -186,6 +202,17 @@ class RomUser(BaseModel): note_is_public: Mapped[bool] = mapped_column(default=False) is_main_sibling: Mapped[bool] = mapped_column(default=False) + last_played: Mapped[datetime | None] = mapped_column(DateTime(timezone=True)) + + backlogged: Mapped[bool] = mapped_column(default=False) + now_playing: Mapped[bool] = mapped_column(default=False) + hidden: Mapped[bool] = mapped_column(default=False) + rating: Mapped[int] = mapped_column(default=0) + difficulty: Mapped[int] = mapped_column(default=0) + completion: Mapped[int] = mapped_column(default=0) + status: Mapped[RomUserStatus | None] = mapped_column( + Enum(RomUserStatus), default=None + ) rom_id: Mapped[int] = mapped_column(ForeignKey("roms.id", ondelete="CASCADE")) user_id: Mapped[int] = mapped_column(ForeignKey("users.id", ondelete="CASCADE")) diff --git a/backend/models/tests/rom_response_example.json b/backend/models/tests/rom_response_example.json index a4de8dec6..d52ed2f51 100644 --- a/backend/models/tests/rom_response_example.json +++ b/backend/models/tests/rom_response_example.json @@ -6,6 +6,7 @@ "total_rating": 75.10255180007994, "aggregated_rating": 80.0, "first_release_date": 1668729600, + "video_id": "dQw4w9WgXcQ", "alternative_names": [ { "id": 90678, diff --git a/backend/models/user.py b/backend/models/user.py index f880a37ae..635e19eaa 100644 --- a/backend/models/user.py +++ b/backend/models/user.py @@ -1,7 +1,7 @@ from __future__ import annotations import enum -from datetime import datetime +from datetime import datetime, timezone from typing import TYPE_CHECKING from models.base import BaseModel @@ -61,4 +61,6 @@ class User(BaseModel, SimpleUser): def set_last_active(self): from handler.database import db_user_handler - db_user_handler.update_user(self.id, {"last_active": datetime.now()}) + db_user_handler.update_user( + self.id, {"last_active": datetime.now(timezone.utc)} + ) diff --git a/frontend/index.html b/frontend/index.html index 37f2e441f..d8dad12e3 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -2,7 +2,13 @@ - + + + + + + + RomM diff --git a/frontend/public/android-chrome-192x192.png b/frontend/public/android-chrome-192x192.png new file mode 100644 index 000000000..ffdf9c46d Binary files /dev/null and b/frontend/public/android-chrome-192x192.png differ diff --git a/frontend/public/android-chrome-512x512.png b/frontend/public/android-chrome-512x512.png new file mode 100644 index 000000000..18c1c2b0d Binary files /dev/null and b/frontend/public/android-chrome-512x512.png differ diff --git a/frontend/public/apple-touch-icon.png b/frontend/public/apple-touch-icon.png new file mode 100644 index 000000000..2b0e79b97 Binary files /dev/null and b/frontend/public/apple-touch-icon.png differ diff --git a/frontend/public/browserconfig.xml b/frontend/public/browserconfig.xml new file mode 100644 index 000000000..3f3a1b9a9 --- /dev/null +++ b/frontend/public/browserconfig.xml @@ -0,0 +1,9 @@ + + + + + + #9205f2 + + + diff --git a/frontend/public/favicon-16x16.png b/frontend/public/favicon-16x16.png new file mode 100644 index 000000000..7461e13b9 Binary files /dev/null and b/frontend/public/favicon-16x16.png differ diff --git a/frontend/public/favicon-32x32.png b/frontend/public/favicon-32x32.png new file mode 100644 index 000000000..16cde649f Binary files /dev/null and b/frontend/public/favicon-32x32.png differ diff --git a/frontend/public/favicon.ico b/frontend/public/favicon.ico index 11f2fc46a..1d1600dac 100644 Binary files a/frontend/public/favicon.ico and b/frontend/public/favicon.ico differ diff --git a/frontend/public/mstile-150x150.png b/frontend/public/mstile-150x150.png new file mode 100644 index 000000000..1454745ee Binary files /dev/null and b/frontend/public/mstile-150x150.png differ diff --git a/frontend/public/safari-pinned-tab.svg b/frontend/public/safari-pinned-tab.svg new file mode 100644 index 000000000..965c5262a --- /dev/null +++ b/frontend/public/safari-pinned-tab.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/frontend/public/site.webmanifest b/frontend/public/site.webmanifest new file mode 100644 index 000000000..79387a13c --- /dev/null +++ b/frontend/public/site.webmanifest @@ -0,0 +1,19 @@ +{ + "name": "RomM", + "short_name": "RomM", + "icons": [ + { + "src": "/android-chrome-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "/android-chrome-512x512.png", + "sizes": "512x512", + "type": "image/png" + } + ], + "theme_color": "#2a0145", + "background_color": "#2a0145", + "display": "standalone" +} diff --git a/frontend/src/__generated__/index.ts b/frontend/src/__generated__/index.ts index ceda3dedb..b2cc3b96d 100644 --- a/frontend/src/__generated__/index.ts +++ b/frontend/src/__generated__/index.ts @@ -33,6 +33,7 @@ export type { RomIGDBMetadata } from './models/RomIGDBMetadata'; export type { RomMobyMetadata } from './models/RomMobyMetadata'; export type { RomSchema } from './models/RomSchema'; export type { RomUserSchema } from './models/RomUserSchema'; +export type { RomUserStatus } from './models/RomUserStatus'; export type { SaveSchema } from './models/SaveSchema'; export type { SchedulerDict } from './models/SchedulerDict'; export type { ScreenshotSchema } from './models/ScreenshotSchema'; diff --git a/frontend/src/__generated__/models/DetailedRomSchema.ts b/frontend/src/__generated__/models/DetailedRomSchema.ts index b23f6d6b8..c7517e44f 100644 --- a/frontend/src/__generated__/models/DetailedRomSchema.ts +++ b/frontend/src/__generated__/models/DetailedRomSchema.ts @@ -32,6 +32,7 @@ export type DetailedRomSchema = { slug: (string | null); summary: (string | null); first_release_date: (number | null); + youtube_video_id: (string | null); alternative_names: Array; genres: Array; franchises: Array; @@ -58,13 +59,13 @@ export type DetailedRomSchema = { created_at: string; updated_at: string; merged_screenshots: Array; - sibling_roms?: Array; - rom_user?: (RomUserSchema | null); - user_saves?: Array; - user_states?: Array; - user_screenshots?: Array; - user_notes?: Array; - user_collections?: Array; + sibling_roms: Array; + rom_user: RomUserSchema; + user_saves: Array; + user_states: Array; + user_screenshots: Array; + user_notes: Array; + user_collections: Array; readonly sort_comparator: string; }; diff --git a/frontend/src/__generated__/models/RomIGDBMetadata.ts b/frontend/src/__generated__/models/RomIGDBMetadata.ts index 0eee20bfa..c6f3eaa21 100644 --- a/frontend/src/__generated__/models/RomIGDBMetadata.ts +++ b/frontend/src/__generated__/models/RomIGDBMetadata.ts @@ -11,6 +11,7 @@ export type RomIGDBMetadata = { total_rating?: string; aggregated_rating?: string; first_release_date?: (number | null); + youtube_video_id?: (string | null); genres?: Array; franchises?: Array; alternative_names?: Array; diff --git a/frontend/src/__generated__/models/RomSchema.ts b/frontend/src/__generated__/models/RomSchema.ts index 17636ecb4..a29ed3217 100644 --- a/frontend/src/__generated__/models/RomSchema.ts +++ b/frontend/src/__generated__/models/RomSchema.ts @@ -25,6 +25,7 @@ export type RomSchema = { slug: (string | null); summary: (string | null); first_release_date: (number | null); + youtube_video_id: (string | null); alternative_names: Array; genres: Array; franchises: Array; diff --git a/frontend/src/__generated__/models/RomUserSchema.ts b/frontend/src/__generated__/models/RomUserSchema.ts index db0740842..bc226a6a2 100644 --- a/frontend/src/__generated__/models/RomUserSchema.ts +++ b/frontend/src/__generated__/models/RomUserSchema.ts @@ -3,6 +3,8 @@ /* tslint:disable */ /* eslint-disable */ +import type { RomUserStatus } from './RomUserStatus'; + export type RomUserSchema = { id: number; user_id: number; @@ -12,6 +14,13 @@ export type RomUserSchema = { note_raw_markdown: string; note_is_public: boolean; is_main_sibling: boolean; + backlogged: boolean; + now_playing: boolean; + hidden: boolean; + rating: number; + difficulty: number; + completion: number; + status: (RomUserStatus | null); user__username: string; }; diff --git a/frontend/src/__generated__/models/RomUserStatus.ts b/frontend/src/__generated__/models/RomUserStatus.ts new file mode 100644 index 000000000..d6f3a090b --- /dev/null +++ b/frontend/src/__generated__/models/RomUserStatus.ts @@ -0,0 +1,6 @@ +/* generated using openapi-typescript-codegen -- do no edit */ +/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export type RomUserStatus = 'incomplete' | 'finished' | 'completed_100' | 'retired' | 'never_playing'; diff --git a/frontend/src/__generated__/models/SimpleRomSchema.ts b/frontend/src/__generated__/models/SimpleRomSchema.ts index b776f6caa..43ecf715b 100644 --- a/frontend/src/__generated__/models/SimpleRomSchema.ts +++ b/frontend/src/__generated__/models/SimpleRomSchema.ts @@ -27,6 +27,7 @@ export type SimpleRomSchema = { slug: (string | null); summary: (string | null); first_release_date: (number | null); + youtube_video_id: (string | null); alternative_names: Array; genres: Array; franchises: Array; @@ -52,8 +53,8 @@ export type SimpleRomSchema = { full_path: string; created_at: string; updated_at: string; - sibling_roms?: Array; - rom_user?: (RomUserSchema | null); + sibling_roms: Array; + rom_user: RomUserSchema; readonly sort_comparator: string; }; diff --git a/frontend/src/components/Details/Info/FileInfo.vue b/frontend/src/components/Details/Info/FileInfo.vue index aa6153b1a..551154f5f 100644 --- a/frontend/src/components/Details/Info/FileInfo.vue +++ b/frontend/src/components/Details/Info/FileInfo.vue @@ -14,17 +14,7 @@ import { ref, watch } from "vue"; const props = defineProps<{ rom: DetailedRom; platform: Platform }>(); const downloadStore = storeDownload(); const auth = storeAuth(); -const romUser = ref( - props.rom.rom_user ?? { - id: null, - user_id: auth.user?.id, - rom_id: props.rom.id, - updated_at: new Date(), - note_raw_markdown: "", - note_is_public: false, - is_main_sibling: false, - }, -); +const romUser = ref(props.rom.rom_user); // Functions function collectionsWithoutFavourites(collections: Collection[]) { @@ -35,25 +25,13 @@ async function toggleMainSibling() { romUser.value.is_main_sibling = !romUser.value.is_main_sibling; romApi.updateUserRomProps({ romId: props.rom.id, - noteRawMarkdown: romUser.value.note_raw_markdown, - noteIsPublic: romUser.value.note_is_public, - isMainSibling: romUser.value.is_main_sibling, + data: romUser.value, }); } watch( () => props.rom, - async () => { - romUser.value = props.rom.rom_user ?? { - id: null, - user_id: auth.user?.id, - rom_id: props.rom.id, - updated_at: new Date(), - note_raw_markdown: "", - note_is_public: false, - is_main_sibling: false, - }; - }, + async () => (romUser.value = props.rom.rom_user), );