mirror of
https://github.com/rommapp/romm.git
synced 2026-11-30 18:42:34 +01:00
Merge branch 'emulatorjs' into emulatorjs-ui
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -48,6 +48,7 @@ romm_mock
|
||||
# testing
|
||||
backend/romm_test/resources
|
||||
backend/romm_test/logs
|
||||
backend/romm_test/config
|
||||
.pytest_cache
|
||||
|
||||
# service worker
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
mkdir -p romm_mock/library/roms/switch
|
||||
touch romm_mock/library/roms/switch/metroid.xci
|
||||
mkdir -p romm_mock/resources
|
||||
mkdir -p romm_mock/config
|
||||
touch romm_mock/config.yml
|
||||
```
|
||||
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import Final
|
||||
from urllib.parse import quote_plus
|
||||
|
||||
import pydash
|
||||
import yaml
|
||||
from exceptions.config_exceptions import (
|
||||
ConfigNotWritableException,
|
||||
ConfigNotReadableException,
|
||||
)
|
||||
from config import (
|
||||
DB_HOST,
|
||||
DB_NAME,
|
||||
@@ -19,10 +16,15 @@ from config import (
|
||||
ROMM_BASE_PATH,
|
||||
ROMM_DB_DRIVER,
|
||||
)
|
||||
from exceptions.config_exceptions import (
|
||||
ConfigNotReadableException,
|
||||
ConfigNotWritableException,
|
||||
)
|
||||
from logger.logger import log
|
||||
from yaml.loader import SafeLoader
|
||||
|
||||
ROMM_USER_CONFIG_PATH: Final = f"{ROMM_BASE_PATH}/config.yml"
|
||||
ROMM_USER_CONFIG_PATH: Final = f"{ROMM_BASE_PATH}/config"
|
||||
ROMM_USER_CONFIG_FILE: Final = f"{ROMM_USER_CONFIG_PATH}/config.yml"
|
||||
SQLITE_DB_BASE_PATH: Final = f"{ROMM_BASE_PATH}/database"
|
||||
|
||||
|
||||
@@ -34,6 +36,7 @@ class Config:
|
||||
EXCLUDED_MULTI_PARTS_EXT: list[str]
|
||||
EXCLUDED_MULTI_PARTS_FILES: list[str]
|
||||
PLATFORMS_BINDING: dict[str, str]
|
||||
PLATFORMS_VERSIONS: dict[str, str]
|
||||
ROMS_FOLDER_NAME: str
|
||||
SAVES_FOLDER_NAME: str
|
||||
STATES_FOLDER_NAME: str
|
||||
@@ -61,13 +64,13 @@ class ConfigManager:
|
||||
return cls._self
|
||||
|
||||
# Tests require custom config path
|
||||
def __init__(self, config_path: str = ROMM_USER_CONFIG_PATH):
|
||||
self.config_path = config_path
|
||||
if os.path.isdir(config_path):
|
||||
log.critical(
|
||||
f"Your config file {config_path} is a directory, not a file. Docker creates folders by default for binded files that doesn't exists in advance in the host system."
|
||||
)
|
||||
raise FileNotFoundError()
|
||||
def __init__(self, config_file: str = ROMM_USER_CONFIG_FILE):
|
||||
self.config_file = config_file
|
||||
# If config file doesn't exists, create an empty one
|
||||
if not os.path.exists(config_file):
|
||||
Path(ROMM_USER_CONFIG_PATH).mkdir(parents=True, exist_ok=True)
|
||||
with open(config_file, "w") as file:
|
||||
file.write("")
|
||||
try:
|
||||
self.read_config()
|
||||
except ConfigNotReadableException as e:
|
||||
@@ -96,7 +99,9 @@ class ConfigManager:
|
||||
|
||||
# DEPRECATED
|
||||
if ROMM_DB_DRIVER == "sqlite":
|
||||
log.critical("Sqlite is not supported anymore, change to MariaDB is needed.")
|
||||
log.critical(
|
||||
"Sqlite is not supported anymore, change to MariaDB is needed."
|
||||
)
|
||||
sys.exit(6)
|
||||
# DEPRECATED
|
||||
|
||||
@@ -124,6 +129,7 @@ class ConfigManager:
|
||||
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", {}),
|
||||
ROMS_FOLDER_NAME=pydash.get(
|
||||
self._raw_config, "filesystem.roms_folder", "roms"
|
||||
),
|
||||
@@ -185,6 +191,17 @@ class ConfigManager:
|
||||
)
|
||||
sys.exit(3)
|
||||
|
||||
if not isinstance(self.config.PLATFORMS_VERSIONS, dict):
|
||||
log.critical("Invalid config.yml: system.versions must be a dictionary")
|
||||
sys.exit(3)
|
||||
else:
|
||||
for fs_slug, slug in self.config.PLATFORMS_VERSIONS.items():
|
||||
if slug is None:
|
||||
log.critical(
|
||||
f"Invalid config.yml: system.versions.{fs_slug} must be a string"
|
||||
)
|
||||
sys.exit(3)
|
||||
|
||||
if not isinstance(self.config.ROMS_FOLDER_NAME, str):
|
||||
log.critical("Invalid config.yml: filesystem.roms_folder must be a string")
|
||||
sys.exit(3)
|
||||
@@ -231,7 +248,7 @@ class ConfigManager:
|
||||
|
||||
def read_config(self) -> None:
|
||||
try:
|
||||
with open(self.config_path) as config_file:
|
||||
with open(self.config_file) as config_file:
|
||||
self._raw_config = yaml.load(config_file, Loader=SafeLoader) or {}
|
||||
except FileNotFoundError:
|
||||
self._raw_config = {}
|
||||
@@ -243,7 +260,7 @@ class ConfigManager:
|
||||
|
||||
def update_config(self) -> None:
|
||||
try:
|
||||
with open(self.config_path, "w") as config_file:
|
||||
with open(self.config_file, "w") as config_file:
|
||||
yaml.dump(self._raw_config, config_file)
|
||||
except FileNotFoundError:
|
||||
self._raw_config = {}
|
||||
@@ -254,6 +271,14 @@ class ConfigManager:
|
||||
self._parse_config()
|
||||
|
||||
def add_binding(self, fs_slug: str, slug: str) -> None:
|
||||
try:
|
||||
_ = self._raw_config["system"]
|
||||
except KeyError:
|
||||
self._raw_config = {"system": {"platforms": {}}}
|
||||
try:
|
||||
_ = self._raw_config["system"]["platforms"]
|
||||
except KeyError:
|
||||
self._raw_config["system"]["platforms"] = {}
|
||||
self._raw_config["system"]["platforms"][fs_slug] = slug
|
||||
self.update_config()
|
||||
|
||||
@@ -264,6 +289,25 @@ class ConfigManager:
|
||||
pass
|
||||
self.update_config()
|
||||
|
||||
def add_version(self, fs_slug: str, slug: str) -> None:
|
||||
try:
|
||||
_ = self._raw_config["system"]
|
||||
except KeyError:
|
||||
self._raw_config = {"system": {"versions": {}}}
|
||||
try:
|
||||
_ = self._raw_config["system"]["versions"]
|
||||
except KeyError:
|
||||
self._raw_config["system"]["versions"] = {}
|
||||
self._raw_config["system"]["versions"][fs_slug] = slug
|
||||
self.update_config()
|
||||
|
||||
def remove_version(self, fs_slug: str) -> None:
|
||||
try:
|
||||
del self._raw_config["system"]["versions"][fs_slug]
|
||||
except KeyError:
|
||||
pass
|
||||
self.update_config()
|
||||
|
||||
# def _get_exclude_path(self, exclude):
|
||||
# exclude_base = self._raw_config["exclude"]
|
||||
# exclusions = {
|
||||
|
||||
0
backend/config/empty_config.yml
Normal file
0
backend/config/empty_config.yml
Normal file
@@ -23,6 +23,8 @@ exclude:
|
||||
system:
|
||||
platforms:
|
||||
gc: 'ngc'
|
||||
versions:
|
||||
naomi: 'arcade'
|
||||
|
||||
filesystem:
|
||||
roms_folder: 'ROMS'
|
||||
0
backend/config/tests/fixtures/config/empty_config.yml
vendored
Normal file
0
backend/config/tests/fixtures/config/empty_config.yml
vendored
Normal file
@@ -6,7 +6,7 @@ from config.config_manager import ConfigManager
|
||||
|
||||
def test_config_loader():
|
||||
loader = ConfigManager(
|
||||
os.path.join(Path(__file__).resolve().parent, "fixtures", "config.yml")
|
||||
os.path.join(Path(__file__).resolve().parent, "fixtures", "config/config.yml")
|
||||
)
|
||||
|
||||
assert loader.config.EXCLUDED_PLATFORMS == ["romm"]
|
||||
@@ -16,6 +16,7 @@ def test_config_loader():
|
||||
assert loader.config.EXCLUDED_MULTI_PARTS_EXT == ["txt"]
|
||||
assert loader.config.EXCLUDED_MULTI_PARTS_FILES == ["data.xml"]
|
||||
assert loader.config.PLATFORMS_BINDING == {"gc": "ngc"}
|
||||
assert loader.config.PLATFORMS_VERSIONS == {"naomi": "arcade"}
|
||||
assert loader.config.ROMS_FOLDER_NAME == "ROMS"
|
||||
assert loader.config.SAVES_FOLDER_NAME == "SAVES"
|
||||
assert loader.config.STATES_FOLDER_NAME == "STATES"
|
||||
@@ -23,7 +24,7 @@ def test_config_loader():
|
||||
|
||||
|
||||
def test_empty_config_loader():
|
||||
loader = ConfigManager("")
|
||||
loader = ConfigManager("config/empty_config.yml")
|
||||
|
||||
assert loader.config.EXCLUDED_PLATFORMS == []
|
||||
assert loader.config.EXCLUDED_SINGLE_EXT == []
|
||||
@@ -32,6 +33,7 @@ def test_empty_config_loader():
|
||||
assert loader.config.EXCLUDED_MULTI_PARTS_EXT == []
|
||||
assert loader.config.EXCLUDED_MULTI_PARTS_FILES == []
|
||||
assert loader.config.PLATFORMS_BINDING == {}
|
||||
assert loader.config.PLATFORMS_VERSIONS == {}
|
||||
assert loader.config.ROMS_FOLDER_NAME == "roms"
|
||||
assert loader.config.SAVES_FOLDER_NAME == "saves"
|
||||
assert loader.config.STATES_FOLDER_NAME == "states"
|
||||
|
||||
@@ -67,6 +67,42 @@ async def delete_platform_binding(request: Request, fs_slug: str) -> MessageResp
|
||||
return {"msg": f"{fs_slug} bind removed successfully!"}
|
||||
|
||||
|
||||
@protected_route(router.post, "/config/system/versions", ["platforms.write"])
|
||||
async def add_platform_version(request: Request) -> MessageResponse:
|
||||
"""Add platform version to the configuration"""
|
||||
|
||||
data = await request.json()
|
||||
fs_slug = data["fs_slug"]
|
||||
slug = data["slug"]
|
||||
|
||||
try:
|
||||
cm.add_version(fs_slug, slug)
|
||||
except ConfigNotWritableException as e:
|
||||
log.critical(e.message)
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=e.message
|
||||
)
|
||||
|
||||
return {"msg": f"Added {fs_slug} as version of: {slug} successfully!"}
|
||||
|
||||
|
||||
@protected_route(
|
||||
router.delete, "/config/system/versions/{fs_slug}", ["platforms.write"]
|
||||
)
|
||||
async def delete_platform_version(request: Request, fs_slug: str) -> MessageResponse:
|
||||
"""Delete platform version from the configuration"""
|
||||
|
||||
try:
|
||||
cm.remove_version(fs_slug)
|
||||
except ConfigNotWritableException as e:
|
||||
log.critical(e.message)
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=e.message
|
||||
)
|
||||
|
||||
return {"msg": f"{fs_slug} version removed successfully!"}
|
||||
|
||||
|
||||
# @protected_route(router.post, "/config/exclude", ["platforms.write"])
|
||||
# async def add_exclusion(request: Request) -> MessageResponse:
|
||||
# """Add platform binding to the configuration"""
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel
|
||||
@@ -13,6 +14,8 @@ class BaseAsset(BaseModel):
|
||||
file_size_bytes: int
|
||||
full_path: str
|
||||
download_path: str
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
@@ -9,6 +9,7 @@ class ConfigResponse(TypedDict):
|
||||
EXCLUDED_MULTI_PARTS_EXT: list[str]
|
||||
EXCLUDED_MULTI_PARTS_FILES: list[str]
|
||||
PLATFORMS_BINDING: dict[str, str]
|
||||
PLATFORMS_VERSIONS: dict[str, str]
|
||||
ROMS_FOLDER_NAME: str
|
||||
SAVES_FOLDER_NAME: str
|
||||
STATES_FOLDER_NAME: str
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from handler.igdb_handler import IGDBRomType
|
||||
from handler.igdb_handler import IGDBRom
|
||||
from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class RomSearchResponse(TypedDict):
|
||||
msg: str
|
||||
roms: list[IGDBRomType]
|
||||
roms: list[IGDBRom]
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
from config.config_manager import config_manager as cm
|
||||
from decorators.auth import protected_route
|
||||
from endpoints.responses import MessageResponse
|
||||
from endpoints.responses.assets import UploadedSavesResponse
|
||||
from endpoints.responses.assets import UploadedSavesResponse, SaveSchema
|
||||
from fastapi import APIRouter, File, HTTPException, Request, UploadFile, status
|
||||
from handler import db_save_handler, fs_asset_handler, db_rom_handler
|
||||
from handler.scan_handler import scan_save
|
||||
from logger.logger import log
|
||||
from config import LIBRARY_BASE_PATH
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@@ -42,6 +43,7 @@ def add_saves(
|
||||
scanned_save.rom_id = rom.id
|
||||
db_save_handler.add_save(scanned_save)
|
||||
|
||||
rom = db_rom_handler.get_roms(rom_id)
|
||||
return {"uploaded": len(saves), "saves": rom.saves}
|
||||
|
||||
|
||||
@@ -55,9 +57,25 @@ def add_saves(
|
||||
# pass
|
||||
|
||||
|
||||
# @protected_route(router.put, "/saves/{id}", ["assets.write"])
|
||||
# def update_save(request: Request, id: int) -> MessageResponse:
|
||||
# pass
|
||||
@protected_route(router.put, "/saves/{id}", ["assets.write"])
|
||||
async def update_save(request: Request, id: int) -> SaveSchema:
|
||||
data = await request.form()
|
||||
|
||||
db_save = db_save_handler.get_save(id)
|
||||
if not db_save:
|
||||
error = f"Save with ID {id} not found"
|
||||
log.error(error)
|
||||
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail=error)
|
||||
|
||||
if "file" in data:
|
||||
file: UploadFile = data["file"]
|
||||
fs_asset_handler._write_file(
|
||||
file=file, path=f"{LIBRARY_BASE_PATH}/{db_save.file_path}"
|
||||
)
|
||||
db_save_handler.update_save(db_save.id, {"file_size_bytes": file.size})
|
||||
|
||||
db_save = db_save_handler.get_save(id)
|
||||
return db_save
|
||||
|
||||
|
||||
@protected_route(router.post, "/saves/delete", ["assets.write"])
|
||||
@@ -84,7 +102,9 @@ async def delete_saves(request: Request) -> MessageResponse:
|
||||
log.info(f"Deleting {save.file_name} from filesystem")
|
||||
|
||||
try:
|
||||
fs_asset_handler.remove_file(file_name=save.file_name, file_path=save.file_path)
|
||||
fs_asset_handler.remove_file(
|
||||
file_name=save.file_name, file_path=save.file_path
|
||||
)
|
||||
except FileNotFoundError:
|
||||
error = f"Save file {save.file_name} not found for platform {save.rom.platform_slug}"
|
||||
log.error(error)
|
||||
|
||||
@@ -74,6 +74,7 @@ async def update_state(request: Request, id: int) -> StateSchema:
|
||||
)
|
||||
db_state_handler.update_state(db_state.id, {"file_size_bytes": file.size})
|
||||
|
||||
db_state = db_state_handler.get_state(id)
|
||||
return db_state
|
||||
|
||||
|
||||
|
||||
@@ -43,12 +43,12 @@ SWITCH_PRODUCT_ID_FILE: Final = os.path.join(
|
||||
MAME_XML_FILE: Final = os.path.join(os.path.dirname(__file__), "fixtures", "mame.xml")
|
||||
|
||||
|
||||
class IGDBPlatformType(TypedDict):
|
||||
class IGDBPlatform(TypedDict):
|
||||
igdb_id: int
|
||||
name: str
|
||||
|
||||
|
||||
class IGDBRomType(TypedDict):
|
||||
class IGDBRom(TypedDict):
|
||||
igdb_id: int
|
||||
slug: str
|
||||
name: str
|
||||
@@ -60,6 +60,7 @@ class IGDBRomType(TypedDict):
|
||||
class IGDBHandler:
|
||||
def __init__(self) -> None:
|
||||
self.platform_url = "https://api.igdb.com/v4/platforms/"
|
||||
self.platform_version_url = "https://api.igdb.com/v4/platform_versions/"
|
||||
self.games_url = "https://api.igdb.com/v4/games/"
|
||||
self.covers_url = "https://api.igdb.com/v4/covers/"
|
||||
self.screenshots_url = "https://api.igdb.com/v4/screenshots/"
|
||||
@@ -263,23 +264,36 @@ class IGDBHandler:
|
||||
return search_term
|
||||
|
||||
@check_twitch_token
|
||||
def get_platform(self, slug: str) -> IGDBPlatformType:
|
||||
def get_platform(self, slug: str) -> IGDBPlatform:
|
||||
platforms = self._request(
|
||||
self.platform_url,
|
||||
data=f'fields id, name; where slug="{slug.lower()}";',
|
||||
)
|
||||
|
||||
platform = pydash.get(platforms, "[0]", None)
|
||||
if not platform:
|
||||
return IGDBPlatformType(igdb_id=None, name=slug.replace("-", " ").title())
|
||||
|
||||
return IGDBPlatformType(
|
||||
# Check if platform is a version if not found
|
||||
if not platform:
|
||||
platform_versions = self._request(
|
||||
self.platform_version_url,
|
||||
data=f'fields id, name; where slug="{slug.lower()}";',
|
||||
)
|
||||
version = pydash.get(platform_versions, "[0]", None)
|
||||
if not version:
|
||||
return IGDBPlatform(igdb_id=None, name=slug.replace("-", " ").title())
|
||||
|
||||
return IGDBPlatform(
|
||||
igdb_id=version["id"],
|
||||
name=version["name"],
|
||||
)
|
||||
|
||||
return IGDBPlatform(
|
||||
igdb_id=platform["id"],
|
||||
name=platform["name"],
|
||||
)
|
||||
|
||||
@check_twitch_token
|
||||
async def get_rom(self, file_name: str, platform_idgb_id: int) -> IGDBRomType:
|
||||
async def get_rom(self, file_name: str, platform_idgb_id: int) -> IGDBRom:
|
||||
from handler import fs_rom_handler
|
||||
|
||||
search_term = fs_rom_handler.get_file_name_with_no_tags(file_name)
|
||||
@@ -314,7 +328,7 @@ class IGDBHandler:
|
||||
)
|
||||
|
||||
igdb_id = res.get("id", None)
|
||||
rom = IGDBRomType(
|
||||
rom = IGDBRom(
|
||||
igdb_id=igdb_id,
|
||||
slug=res.get("slug", ""),
|
||||
name=res.get("name", search_term),
|
||||
@@ -330,7 +344,7 @@ class IGDBHandler:
|
||||
return rom
|
||||
|
||||
@check_twitch_token
|
||||
def get_rom_by_id(self, igdb_id: int) -> IGDBRomType:
|
||||
def get_rom_by_id(self, igdb_id: int) -> IGDBRom:
|
||||
roms = self._request(
|
||||
self.games_url,
|
||||
f"fields slug, name, summary; where id={igdb_id};",
|
||||
@@ -347,7 +361,7 @@ class IGDBHandler:
|
||||
}
|
||||
|
||||
@check_twitch_token
|
||||
def get_matched_roms_by_id(self, igdb_id: int) -> list[IGDBRomType]:
|
||||
def get_matched_roms_by_id(self, igdb_id: int) -> list[IGDBRom]:
|
||||
matched_rom = self.get_rom_by_id(igdb_id)
|
||||
matched_rom.update(
|
||||
url_cover=matched_rom["url_cover"].replace("t_thumb", "t_cover_big"),
|
||||
@@ -357,7 +371,7 @@ class IGDBHandler:
|
||||
@check_twitch_token
|
||||
def get_matched_roms_by_name(
|
||||
self, search_term: str, platform_idgb_id: int
|
||||
) -> list[IGDBRomType]:
|
||||
) -> list[IGDBRom]:
|
||||
if not platform_idgb_id:
|
||||
return []
|
||||
|
||||
@@ -371,7 +385,7 @@ class IGDBHandler:
|
||||
)
|
||||
|
||||
return [
|
||||
IGDBRomType(
|
||||
IGDBRom(
|
||||
igdb_id=rom["id"],
|
||||
slug=rom["slug"],
|
||||
name=rom["name"],
|
||||
|
||||
@@ -1,17 +1,38 @@
|
||||
import os
|
||||
from typing import Any
|
||||
import emoji
|
||||
|
||||
import emoji
|
||||
from config.config_manager import config_manager as cm
|
||||
from handler import fs_asset_handler, igdb_handler, fs_resource_handler, fs_rom_handler, db_platform_handler
|
||||
from handler import (
|
||||
db_platform_handler,
|
||||
fs_asset_handler,
|
||||
fs_resource_handler,
|
||||
fs_rom_handler,
|
||||
igdb_handler,
|
||||
)
|
||||
from logger.logger import log
|
||||
from models.assets import Save, Screenshot, State
|
||||
from models.platform import Platform
|
||||
from models.rom import Rom
|
||||
from models.assets import Save, Screenshot, State
|
||||
|
||||
SWAPPED_PLATFORM_BINDINGS = dict(
|
||||
(v, k) for k, v in cm.config.PLATFORMS_BINDING.items()
|
||||
)
|
||||
SWAPPED_PLATFORM_BINDINGS = dict((v, k) for k, v in cm.config.PLATFORMS_BINDING.items())
|
||||
|
||||
|
||||
def _get_main_platform_igdb_id(platform: Platform):
|
||||
if platform.fs_slug in cm.config.PLATFORMS_VERSIONS.keys():
|
||||
main_platform_slug = cm.config.PLATFORMS_VERSIONS[platform.fs_slug]
|
||||
main_platform = db_platform_handler.get_platform_by_slug(main_platform_slug)
|
||||
if main_platform:
|
||||
main_platform_igdb_id = main_platform.igdb_id
|
||||
else:
|
||||
main_platform_igdb_id = igdb_handler.get_platform(main_platform_slug)[
|
||||
"igdb_id"
|
||||
]
|
||||
if not main_platform_igdb_id:
|
||||
main_platform_igdb_id = platform.igdb_id
|
||||
else:
|
||||
main_platform_igdb_id = platform.igdb_id
|
||||
return main_platform_igdb_id
|
||||
|
||||
|
||||
def scan_platform(fs_slug: str, fs_platforms) -> Platform:
|
||||
@@ -51,7 +72,9 @@ def scan_platform(fs_slug: str, fs_platforms) -> Platform:
|
||||
if platform["igdb_id"]:
|
||||
log.info(emoji.emojize(f" Identified as {platform['name']} :video_game:"))
|
||||
else:
|
||||
log.warning(emoji.emojize(f" {platform_attrs['slug']} not found in IGDB :cross_mark:"))
|
||||
log.warning(
|
||||
emoji.emojize(f" {platform_attrs['slug']} not found in IGDB :cross_mark:")
|
||||
)
|
||||
|
||||
platform_attrs.update(platform)
|
||||
|
||||
@@ -85,8 +108,12 @@ async def scan_rom(
|
||||
"platform_id": platform.id,
|
||||
"file_path": roms_path,
|
||||
"file_name": rom_attrs["file_name"],
|
||||
"file_name_no_tags": fs_rom_handler.get_file_name_with_no_tags(rom_attrs["file_name"]),
|
||||
"file_extension": fs_rom_handler.parse_file_extension(rom_attrs["file_name"]),
|
||||
"file_name_no_tags": fs_rom_handler.get_file_name_with_no_tags(
|
||||
rom_attrs["file_name"]
|
||||
),
|
||||
"file_extension": fs_rom_handler.parse_file_extension(
|
||||
rom_attrs["file_name"]
|
||||
),
|
||||
"file_size_bytes": file_size,
|
||||
"multi": rom_attrs["multi"],
|
||||
"regions": regs,
|
||||
@@ -96,11 +123,13 @@ async def scan_rom(
|
||||
}
|
||||
)
|
||||
|
||||
main_platform_igdb_id = _get_main_platform_igdb_id(platform)
|
||||
|
||||
# Search in IGDB
|
||||
igdb_handler_rom = (
|
||||
igdb_handler.get_rom_by_id(int(r_igbd_id_search))
|
||||
if r_igbd_id_search
|
||||
else await igdb_handler.get_rom(rom_attrs["file_name"], platform.igdb_id)
|
||||
else await igdb_handler.get_rom(rom_attrs["file_name"], main_platform_igdb_id)
|
||||
)
|
||||
|
||||
rom_attrs.update(igdb_handler_rom)
|
||||
@@ -108,11 +137,15 @@ async def scan_rom(
|
||||
# Return early if not found in IGDB
|
||||
if not igdb_handler_rom["igdb_id"]:
|
||||
log.warning(
|
||||
emoji.emojize(f"\t {r_igbd_id_search or rom_attrs['file_name']} not found in IGDB :cross_mark:")
|
||||
emoji.emojize(
|
||||
f"\t {r_igbd_id_search or rom_attrs['file_name']} not found in IGDB :cross_mark:"
|
||||
)
|
||||
)
|
||||
return Rom(**rom_attrs)
|
||||
|
||||
log.info(emoji.emojize(f"\t Identified as {igdb_handler_rom['name']} :alien_monster:"))
|
||||
log.info(
|
||||
emoji.emojize(f"\t Identified as {igdb_handler_rom['name']} :alien_monster:")
|
||||
)
|
||||
|
||||
# Update properties from IGDB
|
||||
rom_attrs.update(
|
||||
@@ -180,6 +213,4 @@ def scan_screenshot(file_name: str, platform_slug: Platform = None) -> Screensho
|
||||
if platform_slug:
|
||||
return Screenshot(**_scan_asset(file_name, screenshots_path))
|
||||
|
||||
return Screenshot(
|
||||
**_scan_asset(file_name, cm.config.SCREENSHOTS_FOLDER_NAME)
|
||||
)
|
||||
return Screenshot(**_scan_asset(file_name, cm.config.SCREENSHOTS_FOLDER_NAME))
|
||||
|
||||
326
backend/handler/tests/cassettes/test_get_platform.yaml
generated
326
backend/handler/tests/cassettes/test_get_platform.yaml
generated
@@ -7,7 +7,114 @@ interactions:
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
Authorization:
|
||||
- Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
- Bearer test_token
|
||||
Client-ID:
|
||||
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
- '34'
|
||||
User-Agent:
|
||||
- python-requests/2.31.0
|
||||
method: POST
|
||||
uri: https://api.igdb.com/v4/platforms/
|
||||
response:
|
||||
body:
|
||||
string: "{\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/FrvfwQg\"\n}\n"
|
||||
headers:
|
||||
CF-Cache-Status:
|
||||
- DYNAMIC
|
||||
CF-RAY:
|
||||
- 847f78ab4a7a5aa7-VIE
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
- '437'
|
||||
Content-Type:
|
||||
- application/json
|
||||
Date:
|
||||
- Fri, 19 Jan 2024 13:37:16 GMT
|
||||
Server:
|
||||
- cloudflare
|
||||
Set-Cookie:
|
||||
- __cf_bm=ZVbN2keB5NG5FaeoRyKaEvTQBmMdm6YLBvSWV5NgLKQ-1705671436-1-Aag20MSVQtClvha5FrIikBY1ZlgjwbLC9Gww0y/AREeyexQsUS7ppX9MgAzkE1IuM9uki15DGzUjl0+uJQYwXkE=;
|
||||
path=/; expires=Fri, 19-Jan-24 14:07:16 GMT; domain=.igdb.com; HttpOnly; Secure;
|
||||
SameSite=None
|
||||
Strict-Transport-Security:
|
||||
- max-age=31536000; includeSubDomains; preload
|
||||
Via:
|
||||
- 1.1 ba761cfda8bfa6cbda2b6c433d6201f6.cloudfront.net (CloudFront)
|
||||
X-Amz-Cf-Id:
|
||||
- XecUo2xyRCkspvzhpxmMVNSXlvTjAnDL7NiycL747Ev0-SMhNnAUJA==
|
||||
X-Amz-Cf-Pop:
|
||||
- VIE50-C2
|
||||
X-Cache:
|
||||
- Error from cloudfront
|
||||
X-Content-Type-Options:
|
||||
- nosniff
|
||||
alt-svc:
|
||||
- h3=":443"; ma=86400
|
||||
x-amz-apigw-id:
|
||||
- Rygp8FT2PHcEUiw=
|
||||
x-amzn-ErrorType:
|
||||
- AccessDeniedException
|
||||
x-amzn-RequestId:
|
||||
- 95bd8829-ef4f-4432-bd7d-9ccaf436f56a
|
||||
status:
|
||||
code: 401
|
||||
message: Unauthorized
|
||||
- request:
|
||||
body: null
|
||||
headers:
|
||||
Accept:
|
||||
- '*/*'
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
- '0'
|
||||
User-Agent:
|
||||
- python-requests/2.31.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":"88ukw5q2sqlhctxykq8s8t97iql9yo","expires_in":5080333,"token_type":"bearer"}
|
||||
|
||||
'
|
||||
headers:
|
||||
Access-Control-Allow-Origin:
|
||||
- '*'
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
- '93'
|
||||
Content-Type:
|
||||
- application/json
|
||||
Date:
|
||||
- Fri, 19 Jan 2024 13:37:17 GMT
|
||||
Server:
|
||||
- nginx
|
||||
X-Ctxlog-Logid:
|
||||
- 1-65aa7b0d-4fe3b6b5219e294d30e2f68a
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
- request:
|
||||
body: fields id, name; where slug="n64";
|
||||
headers:
|
||||
Accept:
|
||||
- application/json
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
Authorization:
|
||||
- Bearer test_token
|
||||
Client-ID:
|
||||
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
Connection:
|
||||
@@ -25,7 +132,7 @@ interactions:
|
||||
CF-Cache-Status:
|
||||
- DYNAMIC
|
||||
CF-RAY:
|
||||
- 7f126a00ff5536ff-YYZ
|
||||
- 847f78b57cc05ad1-VIE
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Encoding:
|
||||
@@ -33,23 +140,23 @@ interactions:
|
||||
Content-Type:
|
||||
- application/json
|
||||
Date:
|
||||
- Thu, 03 Aug 2023 23:41:55 GMT
|
||||
- Fri, 19 Jan 2024 13:37:18 GMT
|
||||
Server:
|
||||
- cloudflare
|
||||
Set-Cookie:
|
||||
- __cf_bm=YSU1kOOYgk2sBN2rEWxDlKrslGRW1UpK8RnA6l.zKh4-1691106115-0-AaN052HbCUAYRaiWZZWlUTi/7cT0S9NbwQ7OwjzwmE/heOVqTfhFSJlTsFv6KbnQWd7RDcWEQI1EyCpeYesnUG4=;
|
||||
path=/; expires=Fri, 04-Aug-23 00:11:55 GMT; domain=.igdb.com; HttpOnly; Secure;
|
||||
- __cf_bm=FUiEglz.RknY_2kFXKZpmx2WDCOZK3knWG44mWNZju0-1705671438-1-Aaizw6VrbK0SXWkYd2ivuE6KDp9ZHMMKSevd2n0+A4vebUcoB0Sk0zML1IaS33GzxKun+KPo+5Vq0IXAG2z/7f8=;
|
||||
path=/; expires=Fri, 19-Jan-24 14:07:18 GMT; domain=.igdb.com; HttpOnly; Secure;
|
||||
SameSite=None
|
||||
Strict-Transport-Security:
|
||||
- max-age=31536000; includeSubDomains; preload
|
||||
Transfer-Encoding:
|
||||
- chunked
|
||||
Via:
|
||||
- 1.1 9b4f2014232c90b3056e1fb1e00215fc.cloudfront.net (CloudFront)
|
||||
- 1.1 a5feee427fe9cff4e87dc473d3d3e300.cloudfront.net (CloudFront)
|
||||
X-Amz-Cf-Id:
|
||||
- xhnv8ARLgZZoWZOYNyOKw2R9eORp9S7ZCmmvwShks2vAttJzZ_5eLA==
|
||||
- UxH9BKAeSFcfhHV3VfJu_4LeorACi_x0NrDp2ACA5SDfnWqYSEvZEA==
|
||||
X-Amz-Cf-Pop:
|
||||
- YUL62-C2
|
||||
- VIE50-C2
|
||||
X-Cache:
|
||||
- Miss from cloudfront
|
||||
X-Content-Type-Options:
|
||||
@@ -59,13 +166,13 @@ interactions:
|
||||
alt-svc:
|
||||
- h3=":443"; ma=86400
|
||||
x-amz-apigw-id:
|
||||
- JG4yfEnzPHcF9xQ=
|
||||
- RygqPEL5PHcESbg=
|
||||
x-amzn-Remapped-Content-Length:
|
||||
- '50'
|
||||
x-amzn-Remapped-Date:
|
||||
- Thu, 03 Aug 2023 23:41:54 GMT
|
||||
- Fri, 19 Jan 2024 13:37:18 GMT
|
||||
x-amzn-RequestId:
|
||||
- 86e7521f-07de-4725-93ae-5945991b2f80
|
||||
- 81a7c41d-ba91-4740-b50f-01750f498682
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
@@ -77,7 +184,114 @@ interactions:
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
Authorization:
|
||||
- Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
- Bearer test_token
|
||||
Client-ID:
|
||||
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
- '39'
|
||||
User-Agent:
|
||||
- python-requests/2.31.0
|
||||
method: POST
|
||||
uri: https://api.igdb.com/v4/platforms/
|
||||
response:
|
||||
body:
|
||||
string: "{\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/FrvfwQg\"\n}\n"
|
||||
headers:
|
||||
CF-Cache-Status:
|
||||
- DYNAMIC
|
||||
CF-RAY:
|
||||
- 847f78baabe25acf-VIE
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
- '437'
|
||||
Content-Type:
|
||||
- application/json
|
||||
Date:
|
||||
- Fri, 19 Jan 2024 13:37:18 GMT
|
||||
Server:
|
||||
- cloudflare
|
||||
Set-Cookie:
|
||||
- __cf_bm=YzByNhOv.HvkvnHbwnntOLv56C7mh5R4WUmK061VZm0-1705671438-1-Ac+kZrgAttx0RTFabeaWmCVW53EoQxrWKNk0K+i63+ub/zdYYNyXdJcLN3LYN1jwVDiGbsmdZ1V8Ngn7NO+PAgg=;
|
||||
path=/; expires=Fri, 19-Jan-24 14:07:18 GMT; domain=.igdb.com; HttpOnly; Secure;
|
||||
SameSite=None
|
||||
Strict-Transport-Security:
|
||||
- max-age=31536000; includeSubDomains; preload
|
||||
Via:
|
||||
- 1.1 659e81bfffb15e4b314a9b12d4db8946.cloudfront.net (CloudFront)
|
||||
X-Amz-Cf-Id:
|
||||
- rypdWtoibbAHhuaeJiMf2lEVNZJa3cVDhUfzudW6JJTg2rEEAx4HFw==
|
||||
X-Amz-Cf-Pop:
|
||||
- VIE50-C2
|
||||
X-Cache:
|
||||
- Error from cloudfront
|
||||
X-Content-Type-Options:
|
||||
- nosniff
|
||||
alt-svc:
|
||||
- h3=":443"; ma=86400
|
||||
x-amz-apigw-id:
|
||||
- RygqVFdIvHcEn1Q=
|
||||
x-amzn-ErrorType:
|
||||
- AccessDeniedException
|
||||
x-amzn-RequestId:
|
||||
- cfd88163-e5bb-4107-9244-711fb1aa034c
|
||||
status:
|
||||
code: 401
|
||||
message: Unauthorized
|
||||
- request:
|
||||
body: null
|
||||
headers:
|
||||
Accept:
|
||||
- '*/*'
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
- '0'
|
||||
User-Agent:
|
||||
- python-requests/2.31.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":"l3btktkckysdzd6zlb314x4x32yna8","expires_in":5407872,"token_type":"bearer"}
|
||||
|
||||
'
|
||||
headers:
|
||||
Access-Control-Allow-Origin:
|
||||
- '*'
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
- '93'
|
||||
Content-Type:
|
||||
- application/json
|
||||
Date:
|
||||
- Fri, 19 Jan 2024 13:37:20 GMT
|
||||
Server:
|
||||
- nginx
|
||||
X-Ctxlog-Logid:
|
||||
- 1-65aa7b10-745ccbbb55318a497e4c24ab
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
- request:
|
||||
body: fields id, name; where slug="not-real";
|
||||
headers:
|
||||
Accept:
|
||||
- application/json
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
Authorization:
|
||||
- Bearer l3btktkckysdzd6zlb314x4x32yna8
|
||||
Client-ID:
|
||||
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
Connection:
|
||||
@@ -95,7 +309,7 @@ interactions:
|
||||
CF-Cache-Status:
|
||||
- DYNAMIC
|
||||
CF-RAY:
|
||||
- 7f126a033dfe36d6-YYZ
|
||||
- 847f78c9286b5abb-VIE
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
@@ -103,21 +317,21 @@ interactions:
|
||||
Content-Type:
|
||||
- application/json
|
||||
Date:
|
||||
- Thu, 03 Aug 2023 23:41:55 GMT
|
||||
- Fri, 19 Jan 2024 13:37:21 GMT
|
||||
Server:
|
||||
- cloudflare
|
||||
Set-Cookie:
|
||||
- __cf_bm=C15lGKF9M7qAs3MgWG1Rdg1BBgoNTkXUtiHaTYm2.No-1691106115-0-AcXlYwi9KvmsVhZSGfPc+8QFPyJ8l75AmoGU1uIc08UsxgCqA0ebf/joGzEFDgKANOycFOVnm4SD0FBPe79QJIA=;
|
||||
path=/; expires=Fri, 04-Aug-23 00:11:55 GMT; domain=.igdb.com; HttpOnly; Secure;
|
||||
- __cf_bm=xJLCTNTRq9k6whzqynMFRRJli_Gjt1faJWfx.Ae1gvI-1705671441-1-AWU/X5sIGRg6L6Iw62fVfPdsA5uzMFgdLIUsuWqRC1AzNlqv4cVjhimnBRYwzVHWziwMXa+Hex+8SShophh698I=;
|
||||
path=/; expires=Fri, 19-Jan-24 14:07:21 GMT; domain=.igdb.com; HttpOnly; Secure;
|
||||
SameSite=None
|
||||
Strict-Transport-Security:
|
||||
- max-age=31536000; includeSubDomains; preload
|
||||
Via:
|
||||
- 1.1 b17b94cbc6db5cb82e8f8d6e55e1e85a.cloudfront.net (CloudFront)
|
||||
- 1.1 8ce530783de74227d43f4646291541dc.cloudfront.net (CloudFront)
|
||||
X-Amz-Cf-Id:
|
||||
- lssR6fbnPthIZ3KymDK4XGpoy79m63sp3YG3feOCNlerg3MlqgSjMw==
|
||||
- _V6x0Awmk0Xy12bWXipk8jF0Ce36ltBLkCfY7oGA3aojB5qIOV5QBw==
|
||||
X-Amz-Cf-Pop:
|
||||
- YTO50-P1
|
||||
- VIE50-C2
|
||||
X-Cache:
|
||||
- Miss from cloudfront
|
||||
X-Content-Type-Options:
|
||||
@@ -127,13 +341,81 @@ interactions:
|
||||
alt-svc:
|
||||
- h3=":443"; ma=86400
|
||||
x-amz-apigw-id:
|
||||
- JG4yiHcZPHcFydQ=
|
||||
- RygqsH6rvHcEIlg=
|
||||
x-amzn-Remapped-Content-Length:
|
||||
- '2'
|
||||
x-amzn-Remapped-Date:
|
||||
- Thu, 03 Aug 2023 23:41:55 GMT
|
||||
- Fri, 19 Jan 2024 13:37:21 GMT
|
||||
x-amzn-RequestId:
|
||||
- c4d171c7-91fb-4587-a7d4-2417fab3f265
|
||||
- c458910c-6008-4a3f-87f5-f4158bedd84b
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
- request:
|
||||
body: fields id, name; where slug="not-real";
|
||||
headers:
|
||||
Accept:
|
||||
- application/json
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
Authorization:
|
||||
- Bearer l3btktkckysdzd6zlb314x4x32yna8
|
||||
Client-ID:
|
||||
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
- '39'
|
||||
User-Agent:
|
||||
- python-requests/2.31.0
|
||||
method: POST
|
||||
uri: https://api.igdb.com/v4/platform_versions/
|
||||
response:
|
||||
body:
|
||||
string: '[]'
|
||||
headers:
|
||||
CF-Cache-Status:
|
||||
- DYNAMIC
|
||||
CF-RAY:
|
||||
- 847f78ccaac55a9e-VIE
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
- '2'
|
||||
Content-Type:
|
||||
- application/json
|
||||
Date:
|
||||
- Fri, 19 Jan 2024 13:37:21 GMT
|
||||
Server:
|
||||
- cloudflare
|
||||
Set-Cookie:
|
||||
- __cf_bm=G0tXKWtqGd.9I..1t5lxG6DQ1nTRcGJbXdPYV6oGr3I-1705671441-1-AZ82dbWtoyJTcgJKrAWOZ4rKukiH6JfCsSdKicQvdo4WT+lxkNOCtbpeVo8nYRPNtVEvURBUsFEzESxIDfR0d+s=;
|
||||
path=/; expires=Fri, 19-Jan-24 14:07:21 GMT; domain=.igdb.com; HttpOnly; Secure;
|
||||
SameSite=None
|
||||
Strict-Transport-Security:
|
||||
- max-age=31536000; includeSubDomains; preload
|
||||
Via:
|
||||
- 1.1 95c9d51ed7176777d7ac8ca8cb233696.cloudfront.net (CloudFront)
|
||||
X-Amz-Cf-Id:
|
||||
- PLKO6r61VkL3kdn0oN0HnPKcMksqzV6itTEOJtaZ21tEZPsw_AxOqA==
|
||||
X-Amz-Cf-Pop:
|
||||
- VIE50-C2
|
||||
X-Cache:
|
||||
- Miss from cloudfront
|
||||
X-Content-Type-Options:
|
||||
- nosniff
|
||||
X-Count:
|
||||
- '0'
|
||||
alt-svc:
|
||||
- h3=":443"; ma=86400
|
||||
x-amz-apigw-id:
|
||||
- RygqxF-JvHcEhbQ=
|
||||
x-amzn-Remapped-Content-Length:
|
||||
- '2'
|
||||
x-amzn-Remapped-Date:
|
||||
- Fri, 19 Jan 2024 13:37:21 GMT
|
||||
x-amzn-RequestId:
|
||||
- 9702c7c2-606e-4e08-82af-70e7841e46b6
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
|
||||
@@ -31,7 +31,7 @@ interactions:
|
||||
CF-Cache-Status:
|
||||
- DYNAMIC
|
||||
CF-RAY:
|
||||
- 840e1def59b553ef-YYZ
|
||||
- 847f78d01d945a68-VIE
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
@@ -39,21 +39,21 @@ interactions:
|
||||
Content-Type:
|
||||
- application/json
|
||||
Date:
|
||||
- Fri, 05 Jan 2024 19:27:09 GMT
|
||||
- Fri, 19 Jan 2024 13:37:22 GMT
|
||||
Server:
|
||||
- cloudflare
|
||||
Set-Cookie:
|
||||
- __cf_bm=UaS11VA2fB8atCFOx97aBLqoxkRUnsy_5rrNYIL3YoU-1704482829-1-AdzDyNg7l51RyROpA43PUQnVRrzVRtMP8CRdttBmqJFmha5lAkwAgZnY4Ph2NBm43oQ71fP5Tz8xSl3SeV4jfT4=;
|
||||
path=/; expires=Fri, 05-Jan-24 19:57:09 GMT; domain=.igdb.com; HttpOnly; Secure;
|
||||
- __cf_bm=_kOPxK15YR4iSYKsjblu8SJOiLI70wgQ7FOjvG27hXg-1705671442-1-ATULcbeLOsS/i3DKSecQWlBxz2qoIs0gw2ebsjEKw9Qmdq7dPp9HPCySt3FZZ8vM9LwXzxP93ox0QrXt++SJjow=;
|
||||
path=/; expires=Fri, 19-Jan-24 14:07:22 GMT; domain=.igdb.com; HttpOnly; Secure;
|
||||
SameSite=None
|
||||
Strict-Transport-Security:
|
||||
- max-age=31536000; includeSubDomains; preload
|
||||
Via:
|
||||
- 1.1 f7da5d3db9ee44e1812f138a4bdfd564.cloudfront.net (CloudFront)
|
||||
- 1.1 530e9f4b5e6084726110986459f0c18c.cloudfront.net (CloudFront)
|
||||
X-Amz-Cf-Id:
|
||||
- cY3sSQbEy2b71uGVJZ8qt0KgtzDfyrJqc8WVhXjxCfPiztfGVWglGg==
|
||||
- pLEOGpTtK4jBKry42XQ0jEFNtFMclP5_qTaPiyYCe9AtvesKjCKsxA==
|
||||
X-Amz-Cf-Pop:
|
||||
- YUL62-C2
|
||||
- VIE50-C2
|
||||
X-Cache:
|
||||
- Error from cloudfront
|
||||
X-Content-Type-Options:
|
||||
@@ -61,11 +61,11 @@ interactions:
|
||||
alt-svc:
|
||||
- h3=":443"; ma=86400
|
||||
x-amz-apigw-id:
|
||||
- RFKyDFjYPHcEgLw=
|
||||
- Rygq3HrsPHcEaRA=
|
||||
x-amzn-ErrorType:
|
||||
- AccessDeniedException
|
||||
x-amzn-RequestId:
|
||||
- 4db631d7-10ca-4505-99b0-000e64fab321
|
||||
- 572a740f-87ce-45c6-9096-fb30c9a03540
|
||||
status:
|
||||
code: 401
|
||||
message: Unauthorized
|
||||
@@ -86,7 +86,7 @@ interactions:
|
||||
uri: https://id.twitch.tv/oauth2/token?client_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&client_secret=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&grant_type=client_credentials
|
||||
response:
|
||||
body:
|
||||
string: '{"access_token":"ycmxc7vv0hesse6mjvg9hium4iku9s","expires_in":4762653,"token_type":"bearer"}
|
||||
string: '{"access_token":"3oeeqb3l2oufuidp79c708gr8xwseh","expires_in":4828909,"token_type":"bearer"}
|
||||
|
||||
'
|
||||
headers:
|
||||
@@ -99,11 +99,11 @@ interactions:
|
||||
Content-Type:
|
||||
- application/json
|
||||
Date:
|
||||
- Fri, 05 Jan 2024 19:27:09 GMT
|
||||
- Fri, 19 Jan 2024 13:37:23 GMT
|
||||
Server:
|
||||
- nginx
|
||||
X-Ctxlog-Logid:
|
||||
- 1-6598580d-72814aa35ddb1dba5cc27010
|
||||
- 1-65aa7b13-233b8db24633d23a3759fe1a
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
@@ -116,7 +116,7 @@ interactions:
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
Authorization:
|
||||
- Bearer ycmxc7vv0hesse6mjvg9hium4iku9s
|
||||
- Bearer 3oeeqb3l2oufuidp79c708gr8xwseh
|
||||
Client-ID:
|
||||
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
Connection:
|
||||
@@ -134,7 +134,7 @@ interactions:
|
||||
CF-Cache-Status:
|
||||
- DYNAMIC
|
||||
CF-RAY:
|
||||
- 840e1df61ff9a1e4-YYZ
|
||||
- 847f78da1a425a71-VIE
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
@@ -142,21 +142,21 @@ interactions:
|
||||
Content-Type:
|
||||
- application/json
|
||||
Date:
|
||||
- Fri, 05 Jan 2024 19:27:10 GMT
|
||||
- Fri, 19 Jan 2024 13:37:23 GMT
|
||||
Server:
|
||||
- cloudflare
|
||||
Set-Cookie:
|
||||
- __cf_bm=cBz3M1IzatwlfWTrENffjuZWUox3KdMY_ruN2OU8nT0-1704482830-1-AfBxgPXgQ/M/YsHGDYtUnb3VK8BHBhrI5of44hGUBp+KE03mKP2SH/Ui+s/O3vbcAmwr5cQdKCi7wvrP3MPpkL0=;
|
||||
path=/; expires=Fri, 05-Jan-24 19:57:10 GMT; domain=.igdb.com; HttpOnly; Secure;
|
||||
- __cf_bm=Lffs3gVHrcwjJ6hL6ckCIs8r6IEDWRKiDUjFBzPpAi8-1705671443-1-AbmAvDmsKM6FBdoFkxdaqZNV1FWdU4vpfpXwmHnEtQTRj36l9XYcgEX31cUIILCy1pzmZmoau5TITEZC8zly1sM=;
|
||||
path=/; expires=Fri, 19-Jan-24 14:07:23 GMT; domain=.igdb.com; HttpOnly; Secure;
|
||||
SameSite=None
|
||||
Strict-Transport-Security:
|
||||
- max-age=31536000; includeSubDomains; preload
|
||||
Via:
|
||||
- 1.1 5fa5e473f638d77357bb0fccef4ca526.cloudfront.net (CloudFront)
|
||||
- 1.1 a5feee427fe9cff4e87dc473d3d3e300.cloudfront.net (CloudFront)
|
||||
X-Amz-Cf-Id:
|
||||
- mNE9nHzWA6zBTPOM0rq4pQC4IyRVgWBPIx7HGN6u8T8nv7cZLq5ZPg==
|
||||
- vtfHJv1IXrt9dg17XtXAmCuFDqNmKO4bPK36DAcLWTpH6eXpFSSkOQ==
|
||||
X-Amz-Cf-Pop:
|
||||
- YUL62-C2
|
||||
- VIE50-C2
|
||||
X-Cache:
|
||||
- Miss from cloudfront
|
||||
X-Content-Type-Options:
|
||||
@@ -166,13 +166,13 @@ interactions:
|
||||
alt-svc:
|
||||
- h3=":443"; ma=86400
|
||||
x-amz-apigw-id:
|
||||
- RFKyNFyyvHcEKyA=
|
||||
- RygrHHLzPHcETeg=
|
||||
x-amzn-Remapped-Content-Length:
|
||||
- '2'
|
||||
x-amzn-Remapped-Date:
|
||||
- Fri, 05 Jan 2024 19:27:10 GMT
|
||||
- Fri, 19 Jan 2024 13:37:23 GMT
|
||||
x-amzn-RequestId:
|
||||
- ea9517b3-ad01-416d-99dd-7a9a73868337
|
||||
- ba00326d-56b5-4cdb-b381-890914f1f05d
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
@@ -186,7 +186,7 @@ interactions:
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
Authorization:
|
||||
- Bearer ycmxc7vv0hesse6mjvg9hium4iku9s
|
||||
- Bearer 3oeeqb3l2oufuidp79c708gr8xwseh
|
||||
Client-ID:
|
||||
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
Connection:
|
||||
@@ -204,7 +204,7 @@ interactions:
|
||||
CF-Cache-Status:
|
||||
- DYNAMIC
|
||||
CF-RAY:
|
||||
- 840e1df959f8a21d-YYZ
|
||||
- 847f78dd1db35a44-VIE
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
@@ -212,21 +212,21 @@ interactions:
|
||||
Content-Type:
|
||||
- application/json
|
||||
Date:
|
||||
- Fri, 05 Jan 2024 19:27:10 GMT
|
||||
- Fri, 19 Jan 2024 13:37:24 GMT
|
||||
Server:
|
||||
- cloudflare
|
||||
Set-Cookie:
|
||||
- __cf_bm=QiozKIK2Ap6T3BMS1.zFk9IfLGmrgDQV4tCC4mR5aVA-1704482830-1-AXm8pPyNZPolOcXxd2oXAtP/fZ+y+rwS2hHZL1ntRcWSpXMEmy3diGuqtZ61HzvH41ztaO0YBXA289em+GBAAV4=;
|
||||
path=/; expires=Fri, 05-Jan-24 19:57:10 GMT; domain=.igdb.com; HttpOnly; Secure;
|
||||
- __cf_bm=iQnfUHnJ5Ufwghyc7Mm8sOgaOSZXRSYGaWZr4jTRHSQ-1705671444-1-AQbNaTR4aNsOi4yogVUgsiwupAoF0THdvbLswX0npqkvUTeXK2C1z7Oyd1fm+0wIg9cCA5ChNoZyUPn/CKOJ/0g=;
|
||||
path=/; expires=Fri, 19-Jan-24 14:07:24 GMT; domain=.igdb.com; HttpOnly; Secure;
|
||||
SameSite=None
|
||||
Strict-Transport-Security:
|
||||
- max-age=31536000; includeSubDomains; preload
|
||||
Via:
|
||||
- 1.1 22068bada9db7a55ac57b9824fe6f9b4.cloudfront.net (CloudFront)
|
||||
- 1.1 95c9d51ed7176777d7ac8ca8cb233696.cloudfront.net (CloudFront)
|
||||
X-Amz-Cf-Id:
|
||||
- vLFpUC9iRNUiBqE1P5BNBSEmzpZpYdY92TXSUGZ8tH-Zpc7AO13Kww==
|
||||
- uCtbRR46oep4gC4Vadv3RRw6Q2XNTXk3dYWketup8W-TqncGpBZ-pA==
|
||||
X-Amz-Cf-Pop:
|
||||
- YUL62-C2
|
||||
- VIE50-C2
|
||||
X-Cache:
|
||||
- Miss from cloudfront
|
||||
X-Content-Type-Options:
|
||||
@@ -236,13 +236,13 @@ interactions:
|
||||
alt-svc:
|
||||
- h3=":443"; ma=86400
|
||||
x-amz-apigw-id:
|
||||
- RFKyTG7HPHcEpug=
|
||||
- RygrPE0yPHcEcZQ=
|
||||
x-amzn-Remapped-Content-Length:
|
||||
- '2'
|
||||
x-amzn-Remapped-Date:
|
||||
- Fri, 05 Jan 2024 19:27:10 GMT
|
||||
- Fri, 19 Jan 2024 13:37:24 GMT
|
||||
x-amzn-RequestId:
|
||||
- de9b5cba-2134-42cb-b13a-d0886acde238
|
||||
- dd57905d-8c5f-4c16-967b-0430b37bbdb6
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
@@ -255,7 +255,7 @@ interactions:
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
Authorization:
|
||||
- Bearer ycmxc7vv0hesse6mjvg9hium4iku9s
|
||||
- Bearer 3oeeqb3l2oufuidp79c708gr8xwseh
|
||||
Client-ID:
|
||||
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
Connection:
|
||||
@@ -273,7 +273,7 @@ interactions:
|
||||
CF-Cache-Status:
|
||||
- DYNAMIC
|
||||
CF-RAY:
|
||||
- 840e1dfc9aa236c3-YYZ
|
||||
- 847f78e21ea86c86-ZAG
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
@@ -281,21 +281,21 @@ interactions:
|
||||
Content-Type:
|
||||
- application/json
|
||||
Date:
|
||||
- Fri, 05 Jan 2024 19:27:11 GMT
|
||||
- Fri, 19 Jan 2024 13:37:25 GMT
|
||||
Server:
|
||||
- cloudflare
|
||||
Set-Cookie:
|
||||
- __cf_bm=NmMjWGx_xEiiM1uaWbgA84EAXUBTNmuTz9ZbInymZ00-1704482831-1-AXNxQ3/n3pxXz7JDMQBCqUGP1kl/TA0WSkLvOGP9Casw5j1J9WLw6zbPg/CqUntFGmZlIZrnJ1xFi1aJSlm1Ps8=;
|
||||
path=/; expires=Fri, 05-Jan-24 19:57:11 GMT; domain=.igdb.com; HttpOnly; Secure;
|
||||
- __cf_bm=_16d8qit0KtY.bR8s7LswAB3jHn0M184DpZdm1hHWT4-1705671445-1-AQDCn8JjNm55+Uk8KPbFj2OG7QyU3PN/Hf5mIlIFVmUEGrODJxqNFVDTM6xw4XccrUp4YN8vTIEx3E3sZVludNo=;
|
||||
path=/; expires=Fri, 19-Jan-24 14:07:25 GMT; domain=.igdb.com; HttpOnly; Secure;
|
||||
SameSite=None
|
||||
Strict-Transport-Security:
|
||||
- max-age=31536000; includeSubDomains; preload
|
||||
Via:
|
||||
- 1.1 8422f3871db2552d4ad0cc9f31e22c2e.cloudfront.net (CloudFront)
|
||||
- 1.1 a5feee427fe9cff4e87dc473d3d3e300.cloudfront.net (CloudFront)
|
||||
X-Amz-Cf-Id:
|
||||
- nNG-gTaYCZ5rpsGaE9w0Q6W7n0Zcgas_ijV_07HttzgZRJvFgewDyA==
|
||||
- WNetlDy__DbtmH_i_bvOd0dLp0H6HN1fcv3YU3gGHaLU3-sD7XcJYw==
|
||||
X-Amz-Cf-Pop:
|
||||
- YUL62-C2
|
||||
- VIE50-C2
|
||||
X-Cache:
|
||||
- Miss from cloudfront
|
||||
X-Content-Type-Options:
|
||||
@@ -305,13 +305,13 @@ interactions:
|
||||
alt-svc:
|
||||
- h3=":443"; ma=86400
|
||||
x-amz-apigw-id:
|
||||
- RFKyZFsMvHcEs2A=
|
||||
- RygrUE0VPHcERRQ=
|
||||
x-amzn-Remapped-Content-Length:
|
||||
- '2'
|
||||
x-amzn-Remapped-Date:
|
||||
- Fri, 05 Jan 2024 19:27:11 GMT
|
||||
- Fri, 19 Jan 2024 13:37:25 GMT
|
||||
x-amzn-RequestId:
|
||||
- bda8994c-74ff-40b9-946b-5c291feba36c
|
||||
- 9a70e744-3429-4b96-985a-92744d5be3cf
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
@@ -348,7 +348,7 @@ interactions:
|
||||
CF-Cache-Status:
|
||||
- DYNAMIC
|
||||
CF-RAY:
|
||||
- 840e1dffcff87119-YYZ
|
||||
- 847f78e54989c208-ZAG
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
@@ -356,21 +356,21 @@ interactions:
|
||||
Content-Type:
|
||||
- application/json
|
||||
Date:
|
||||
- Fri, 05 Jan 2024 19:27:11 GMT
|
||||
- Fri, 19 Jan 2024 13:37:25 GMT
|
||||
Server:
|
||||
- cloudflare
|
||||
Set-Cookie:
|
||||
- __cf_bm=08u9u5ApvfMie_jqiDNmXs9WL4bHaapgSVqf2xT_mLg-1704482831-1-AfJfmqIEV831rLFDaZg0D4C4D31H8oSfMR9ecWO7NIQo8pbw6LzbVBjWBZq6ryV3t/yGLxXtDjKMLnWifUaN4Bo=;
|
||||
path=/; expires=Fri, 05-Jan-24 19:57:11 GMT; domain=.igdb.com; HttpOnly; Secure;
|
||||
- __cf_bm=FtIGhsjzYIIsehRUwdXgO1EsNvVm9BV4Jga_ZE4zqCM-1705671445-1-AehcRuRferKqtUCpChjQegd40BjDxduRFP4jXFWhUXW6OuH5/ApuWVj3+c6dawoyNNAFY35q46Eq0GIW8daV7KU=;
|
||||
path=/; expires=Fri, 19-Jan-24 14:07:25 GMT; domain=.igdb.com; HttpOnly; Secure;
|
||||
SameSite=None
|
||||
Strict-Transport-Security:
|
||||
- max-age=31536000; includeSubDomains; preload
|
||||
Via:
|
||||
- 1.1 144825e0e5f4523d1f7ce8c9b62cd908.cloudfront.net (CloudFront)
|
||||
- 1.1 4e3b2e1fa2acb7612ea516b89c06af70.cloudfront.net (CloudFront)
|
||||
X-Amz-Cf-Id:
|
||||
- oeRw1015Xc3mSJUL7mrLuCKk9m_myM3RDMip_0iodK7uFY32s66BwA==
|
||||
- omwvkATR8iV09kN8O3NTlC0I1-CdoeaXzdyDNzgx0RgwM5pFcGjv1A==
|
||||
X-Amz-Cf-Pop:
|
||||
- YUL62-C2
|
||||
- VIE50-C2
|
||||
X-Cache:
|
||||
- Error from cloudfront
|
||||
X-Content-Type-Options:
|
||||
@@ -378,11 +378,11 @@ interactions:
|
||||
alt-svc:
|
||||
- h3=":443"; ma=86400
|
||||
x-amz-apigw-id:
|
||||
- RFKyeGWhvHcEPug=
|
||||
- RygrZFygvHcEO0A=
|
||||
x-amzn-ErrorType:
|
||||
- AccessDeniedException
|
||||
x-amzn-RequestId:
|
||||
- e8572348-415f-48ea-b3fa-15643a26b6f4
|
||||
- bdad4265-3048-46fb-b293-a5da8889d32d
|
||||
status:
|
||||
code: 401
|
||||
message: Unauthorized
|
||||
@@ -403,7 +403,7 @@ interactions:
|
||||
uri: https://id.twitch.tv/oauth2/token?client_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&client_secret=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&grant_type=client_credentials
|
||||
response:
|
||||
body:
|
||||
string: '{"access_token":"9vv70shduosepkqte323j2sk7e5l16","expires_in":5478750,"token_type":"bearer"}
|
||||
string: '{"access_token":"wey0sj7h4jksp02joebheczbjkxw0y","expires_in":5202483,"token_type":"bearer"}
|
||||
|
||||
'
|
||||
headers:
|
||||
@@ -416,11 +416,11 @@ interactions:
|
||||
Content-Type:
|
||||
- application/json
|
||||
Date:
|
||||
- Fri, 05 Jan 2024 19:27:12 GMT
|
||||
- Fri, 19 Jan 2024 13:37:26 GMT
|
||||
Server:
|
||||
- nginx
|
||||
X-Ctxlog-Logid:
|
||||
- 1-65985810-32ff685c334e1d562685f667
|
||||
- 1-65aa7b16-4159a84625a1bec276e5fc0f
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
@@ -434,7 +434,7 @@ interactions:
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
Authorization:
|
||||
- Bearer 9vv70shduosepkqte323j2sk7e5l16
|
||||
- Bearer wey0sj7h4jksp02joebheczbjkxw0y
|
||||
Client-ID:
|
||||
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
Connection:
|
||||
@@ -530,7 +530,7 @@ interactions:
|
||||
CF-Cache-Status:
|
||||
- DYNAMIC
|
||||
CF-RAY:
|
||||
- 840e1e062e8839f9-YYZ
|
||||
- 847f78efcac45a4a-VIE
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Encoding:
|
||||
@@ -540,21 +540,21 @@ interactions:
|
||||
Content-Type:
|
||||
- application/json
|
||||
Date:
|
||||
- Fri, 05 Jan 2024 19:27:12 GMT
|
||||
- Fri, 19 Jan 2024 13:37:27 GMT
|
||||
Server:
|
||||
- cloudflare
|
||||
Set-Cookie:
|
||||
- __cf_bm=SBQ0hfeNWLeVDi9u25Ycqjy0_y_lVOlQ6RUoOXpoUvE-1704482832-1-AX8irnnXyf/2o19KeyDM46YduN9meO/Qdwu0d/tDbrrtqL6M1ExPQqPN4J9DMGR9e6Gh2JtAV0DZTn8wlCe5B5E=;
|
||||
path=/; expires=Fri, 05-Jan-24 19:57:12 GMT; domain=.igdb.com; HttpOnly; Secure;
|
||||
- __cf_bm=8b3MbRlUf_cXtQrYJZGHA3rMoQ7VDbYZ1wS4NEK5.UQ-1705671447-1-AesmmpdP/BC2aBdD44z+9isv4H0hK8t+yU75PyJuCQdNvuheaDZBqD3IG4NUMh/yECYi4HHawzZSWJAMhYyO0rM=;
|
||||
path=/; expires=Fri, 19-Jan-24 14:07:27 GMT; domain=.igdb.com; HttpOnly; Secure;
|
||||
SameSite=None
|
||||
Strict-Transport-Security:
|
||||
- max-age=31536000; includeSubDomains; preload
|
||||
Via:
|
||||
- 1.1 f7da5d3db9ee44e1812f138a4bdfd564.cloudfront.net (CloudFront)
|
||||
- 1.1 a4035907ac3c3ba8d1fd116b6b6b9a4c.cloudfront.net (CloudFront)
|
||||
X-Amz-Cf-Id:
|
||||
- 4QRv9SqNlv9c1l6rJlzTPHUwAvsoje8ZHFOL381FA2S-mPfChjzv7Q==
|
||||
- WatxWH8uFhodIzj0McFJCYImtw9ehM7P8G2vz_qaWGi4q7WsT2E_Sw==
|
||||
X-Amz-Cf-Pop:
|
||||
- YUL62-C2
|
||||
- VIE50-C2
|
||||
X-Cache:
|
||||
- Miss from cloudfront
|
||||
X-Content-Type-Options:
|
||||
@@ -564,13 +564,13 @@ interactions:
|
||||
alt-svc:
|
||||
- h3=":443"; ma=86400
|
||||
x-amz-apigw-id:
|
||||
- RFKyoFdtPHcENCA=
|
||||
- RygrqF3rvHcEnpg=
|
||||
x-amzn-Remapped-Content-Length:
|
||||
- '2424'
|
||||
x-amzn-Remapped-Date:
|
||||
- Fri, 05 Jan 2024 19:27:12 GMT
|
||||
- Fri, 19 Jan 2024 13:37:27 GMT
|
||||
x-amzn-RequestId:
|
||||
- 1725c117-1e0b-4617-aaa3-e28514f91fc5
|
||||
- a17b1636-e8a9-40be-9c91-35379f66eb7d
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
@@ -582,7 +582,7 @@ interactions:
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
Authorization:
|
||||
- Bearer 9vv70shduosepkqte323j2sk7e5l16
|
||||
- Bearer wey0sj7h4jksp02joebheczbjkxw0y
|
||||
Client-ID:
|
||||
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
Connection:
|
||||
@@ -601,7 +601,7 @@ interactions:
|
||||
CF-Cache-Status:
|
||||
- DYNAMIC
|
||||
CF-RAY:
|
||||
- 840e1e0928333701-YYZ
|
||||
- 847f78f37ee25a50-VIE
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Encoding:
|
||||
@@ -609,23 +609,23 @@ interactions:
|
||||
Content-Type:
|
||||
- application/json
|
||||
Date:
|
||||
- Fri, 05 Jan 2024 19:27:13 GMT
|
||||
- Fri, 19 Jan 2024 13:37:28 GMT
|
||||
Server:
|
||||
- cloudflare
|
||||
Set-Cookie:
|
||||
- __cf_bm=bI2hirE91RIdKvLGAuGYFmNDWo.7x186AGjRyaxu1w8-1704482833-1-AWDx/4zSK3tfOUw0nN7HIEAoOYngfUQlpngXXAjSghmK9lSyrCfAnhgaYSN4H+rWVNQxOZ31tuZLwOOisbiz/Zo=;
|
||||
path=/; expires=Fri, 05-Jan-24 19:57:13 GMT; domain=.igdb.com; HttpOnly; Secure;
|
||||
- __cf_bm=5ecjpD04TCwTlrH57YWF1w7277xy8jZryDcULP1MKs0-1705671448-1-AXAzh8GGgViKgB9gSNhdbACQOIN8C26nd5Kj4dDz6Wd7K0QFiNLM5RDm35qvOqqvaGe5l/3sQG/xBsbRC4oJI9w=;
|
||||
path=/; expires=Fri, 19-Jan-24 14:07:28 GMT; domain=.igdb.com; HttpOnly; Secure;
|
||||
SameSite=None
|
||||
Strict-Transport-Security:
|
||||
- max-age=31536000; includeSubDomains; preload
|
||||
Transfer-Encoding:
|
||||
- chunked
|
||||
Via:
|
||||
- 1.1 0df778cadb5eaa000de4f1d7838b16e0.cloudfront.net (CloudFront)
|
||||
- 1.1 4de71b0a42267b098ed30fff0d8a660a.cloudfront.net (CloudFront)
|
||||
X-Amz-Cf-Id:
|
||||
- pJHvaV9ghiHsZMTQ_IcKG9EX2fXmnbLHRZQdBFPHA31DrhiJTcMAcQ==
|
||||
- 3qugWTzNrbWm_0zVSD9uGE6qR4JHusZt0cj8a1-SWATPF1bQ-3ekZg==
|
||||
X-Amz-Cf-Pop:
|
||||
- YUL62-C2
|
||||
- VIE50-C2
|
||||
X-Cache:
|
||||
- Miss from cloudfront
|
||||
X-Content-Type-Options:
|
||||
@@ -635,13 +635,13 @@ interactions:
|
||||
alt-svc:
|
||||
- h3=":443"; ma=86400
|
||||
x-amz-apigw-id:
|
||||
- RFKysFlZvHcEQfQ=
|
||||
- RygryG99vHcEVjQ=
|
||||
x-amzn-Remapped-Content-Length:
|
||||
- '97'
|
||||
x-amzn-Remapped-Date:
|
||||
- Fri, 05 Jan 2024 19:27:13 GMT
|
||||
- Fri, 19 Jan 2024 13:37:28 GMT
|
||||
x-amzn-RequestId:
|
||||
- 391acfec-991b-4b11-8ec1-bc5ccc558a7c
|
||||
- 680e91f5-50da-49f2-bade-44b9247fbd98
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
@@ -653,7 +653,7 @@ interactions:
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
Authorization:
|
||||
- Bearer 9vv70shduosepkqte323j2sk7e5l16
|
||||
- Bearer wey0sj7h4jksp02joebheczbjkxw0y
|
||||
Client-ID:
|
||||
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
Connection:
|
||||
@@ -676,7 +676,7 @@ interactions:
|
||||
CF-Cache-Status:
|
||||
- DYNAMIC
|
||||
CF-RAY:
|
||||
- 840e1e0c8e45a1da-YYZ
|
||||
- 847f78f92ae85ae8-VIE
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Encoding:
|
||||
@@ -684,23 +684,23 @@ interactions:
|
||||
Content-Type:
|
||||
- application/json
|
||||
Date:
|
||||
- Fri, 05 Jan 2024 19:27:13 GMT
|
||||
- Fri, 19 Jan 2024 13:37:29 GMT
|
||||
Server:
|
||||
- cloudflare
|
||||
Set-Cookie:
|
||||
- __cf_bm=_Lbr4oQE0LaNfBP5BiCrLEOHj.IXNE2El_O5u8FK.o4-1704482833-1-AQ5NVKvfJ9qNvAwufTD+7oNVvnlkcCbO0Qv+OIrYoYM4xPER/87JcGOd65ILQVduWMI7dX259NTaJe/oCgeTzZs=;
|
||||
path=/; expires=Fri, 05-Jan-24 19:57:13 GMT; domain=.igdb.com; HttpOnly; Secure;
|
||||
- __cf_bm=6X3Z2yBQwumpynWlLt9ocPpOYpl73BjMc.UcYpK6ffk-1705671449-1-AZ+1O4hCGxZIItvpLiUJh8VKfzTLfx00xBiQsSE9Q9GWHgdP2a7LITTX+dG0uiz070PKLR5UAz4iVYq3wX5Vywk=;
|
||||
path=/; expires=Fri, 19-Jan-24 14:07:29 GMT; domain=.igdb.com; HttpOnly; Secure;
|
||||
SameSite=None
|
||||
Strict-Transport-Security:
|
||||
- max-age=31536000; includeSubDomains; preload
|
||||
Transfer-Encoding:
|
||||
- chunked
|
||||
Via:
|
||||
- 1.1 f7da5d3db9ee44e1812f138a4bdfd564.cloudfront.net (CloudFront)
|
||||
- 1.1 95c9d51ed7176777d7ac8ca8cb233696.cloudfront.net (CloudFront)
|
||||
X-Amz-Cf-Id:
|
||||
- L9J0t_WDbn0jZmgEBmKE7fN3m-ZQAHr2GpcHcZznMRsnJ1Su2BRQQA==
|
||||
- y5xqVB4FhS0ZW1-OLBhrZ0wKfs_ze1YrMYd_o06UP4RvduEfkdA-lg==
|
||||
X-Amz-Cf-Pop:
|
||||
- YUL62-C2
|
||||
- VIE50-C2
|
||||
X-Cache:
|
||||
- Miss from cloudfront
|
||||
X-Content-Type-Options:
|
||||
@@ -710,13 +710,13 @@ interactions:
|
||||
alt-svc:
|
||||
- h3=":443"; ma=86400
|
||||
x-amz-apigw-id:
|
||||
- RFKyyGQhPHcEpHQ=
|
||||
- Rygr8H8jvHcES2w=
|
||||
x-amzn-Remapped-Content-Length:
|
||||
- '477'
|
||||
x-amzn-Remapped-Date:
|
||||
- Fri, 05 Jan 2024 19:27:13 GMT
|
||||
- Fri, 19 Jan 2024 13:37:29 GMT
|
||||
x-amzn-RequestId:
|
||||
- c3bcc7b4-bdfc-4c69-8a60-c8b5e6a7478b
|
||||
- 605655b7-bab7-4f34-934e-3197221fb3f2
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
|
||||
324
backend/utils/tests/cassettes/test_scan_platform.yaml
generated
324
backend/utils/tests/cassettes/test_scan_platform.yaml
generated
@@ -18,6 +18,113 @@ interactions:
|
||||
- python-requests/2.31.0
|
||||
method: POST
|
||||
uri: https://api.igdb.com/v4/platforms/
|
||||
response:
|
||||
body:
|
||||
string: "{\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/FrvfwQg\"\n}\n"
|
||||
headers:
|
||||
CF-Cache-Status:
|
||||
- DYNAMIC
|
||||
CF-RAY:
|
||||
- 847f7923eb415a68-VIE
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
- '437'
|
||||
Content-Type:
|
||||
- application/json
|
||||
Date:
|
||||
- Fri, 19 Jan 2024 13:37:35 GMT
|
||||
Server:
|
||||
- cloudflare
|
||||
Set-Cookie:
|
||||
- __cf_bm=LuRKnzhlumMElLmukIXuVmMgCcXtW0XDpsH53Zw6xsg-1705671455-1-AX0/uq4rO9sT5PELhyDuZygY76dEEdTTCjMrqdCaT1H61LqJiH4K6nY4WvDX0wgUJe9+YFtwG9wuZ83ioARrOVs=;
|
||||
path=/; expires=Fri, 19-Jan-24 14:07:35 GMT; domain=.igdb.com; HttpOnly; Secure;
|
||||
SameSite=None
|
||||
Strict-Transport-Security:
|
||||
- max-age=31536000; includeSubDomains; preload
|
||||
Via:
|
||||
- 1.1 a4035907ac3c3ba8d1fd116b6b6b9a4c.cloudfront.net (CloudFront)
|
||||
X-Amz-Cf-Id:
|
||||
- 1dq0DchR7bTMsHlc95R5clqE77jn2I5GP4gH8PfgSf2m3Tjs0l-eKg==
|
||||
X-Amz-Cf-Pop:
|
||||
- VIE50-C2
|
||||
X-Cache:
|
||||
- Error from cloudfront
|
||||
X-Content-Type-Options:
|
||||
- nosniff
|
||||
alt-svc:
|
||||
- h3=":443"; ma=86400
|
||||
x-amz-apigw-id:
|
||||
- Rygs9G6QPHcEp6Q=
|
||||
x-amzn-ErrorType:
|
||||
- AccessDeniedException
|
||||
x-amzn-RequestId:
|
||||
- f5db871a-286b-4678-90a1-f76e1b1f9589
|
||||
status:
|
||||
code: 401
|
||||
message: Unauthorized
|
||||
- request:
|
||||
body: null
|
||||
headers:
|
||||
Accept:
|
||||
- '*/*'
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
- '0'
|
||||
User-Agent:
|
||||
- python-requests/2.31.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":"f2e6dg9iq7t3ewie86rcphdb7xmrr4","expires_in":5446613,"token_type":"bearer"}
|
||||
|
||||
'
|
||||
headers:
|
||||
Access-Control-Allow-Origin:
|
||||
- '*'
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
- '93'
|
||||
Content-Type:
|
||||
- application/json
|
||||
Date:
|
||||
- Fri, 19 Jan 2024 13:37:36 GMT
|
||||
Server:
|
||||
- nginx
|
||||
X-Ctxlog-Logid:
|
||||
- 1-65aa7b20-59ebf75d0a230ec439f79578
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
- request:
|
||||
body: fields id, name; where slug="n64";
|
||||
headers:
|
||||
Accept:
|
||||
- application/json
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
Authorization:
|
||||
- Bearer f2e6dg9iq7t3ewie86rcphdb7xmrr4
|
||||
Client-ID:
|
||||
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
- '34'
|
||||
User-Agent:
|
||||
- python-requests/2.31.0
|
||||
method: POST
|
||||
uri: https://api.igdb.com/v4/platforms/
|
||||
response:
|
||||
body:
|
||||
string: "[\n {\n \"id\": 4,\n \"name\": \"Nintendo 64\"\n }\n]"
|
||||
@@ -25,7 +132,7 @@ interactions:
|
||||
CF-Cache-Status:
|
||||
- DYNAMIC
|
||||
CF-RAY:
|
||||
- 7eff5636a99d36a1-YYZ
|
||||
- 847f792da9eb5a68-VIE
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Encoding:
|
||||
@@ -33,23 +140,23 @@ interactions:
|
||||
Content-Type:
|
||||
- application/json
|
||||
Date:
|
||||
- Tue, 01 Aug 2023 16:07:54 GMT
|
||||
- Fri, 19 Jan 2024 13:37:37 GMT
|
||||
Server:
|
||||
- cloudflare
|
||||
Set-Cookie:
|
||||
- __cf_bm=M6jV8IDBXuhn5koc54NIo92mpS_07Vq_YCS_Er_x8Ho-1690906074-0-Aatz9H75G6sex1NR59WNaayPhbzHq5bsGY69J802KkuOxTJIRVagK7kMa09OIayfKnTNr4nci8tkf4PwZtAPBCQ=;
|
||||
path=/; expires=Tue, 01-Aug-23 16:37:54 GMT; domain=.igdb.com; HttpOnly; Secure;
|
||||
- __cf_bm=UeR9THzl1BMESRswlbiF8O8HVtWbphaaVN.u1NJwYaU-1705671457-1-ARbJ6pvkJw05JjLlnzVW0agt1kIneTfVdFlNtN3wfXtsa6k2ebGmJNAjpyqHMLabokene6qJ1JvPWfhGB8Al/N8=;
|
||||
path=/; expires=Fri, 19-Jan-24 14:07:37 GMT; domain=.igdb.com; HttpOnly; Secure;
|
||||
SameSite=None
|
||||
Strict-Transport-Security:
|
||||
- max-age=31536000; includeSubDomains; preload
|
||||
Transfer-Encoding:
|
||||
- chunked
|
||||
Via:
|
||||
- 1.1 77f3bc2c9964f50671e7151896d06648.cloudfront.net (CloudFront)
|
||||
- 1.1 ba761cfda8bfa6cbda2b6c433d6201f6.cloudfront.net (CloudFront)
|
||||
X-Amz-Cf-Id:
|
||||
- Q_HAeLD8jS46IJCOE7dnaNhMJy844TeELDlDwNXScyuwNEiQIqIUgw==
|
||||
- MfgSRHijVQz7kKWEBEKwOWuUABiiDDo9zTBwaIavMBXPh0McT6UfWg==
|
||||
X-Amz-Cf-Pop:
|
||||
- YUL62-C2
|
||||
- VIE50-C2
|
||||
X-Cache:
|
||||
- Miss from cloudfront
|
||||
X-Content-Type-Options:
|
||||
@@ -59,13 +166,13 @@ interactions:
|
||||
alt-svc:
|
||||
- h3=":443"; ma=86400
|
||||
x-amz-apigw-id:
|
||||
- I_QaOHVMPHcFiCQ=
|
||||
- RygtQH5QvHcEOWg=
|
||||
x-amzn-Remapped-Content-Length:
|
||||
- '50'
|
||||
x-amzn-Remapped-Date:
|
||||
- Tue, 01 Aug 2023 16:07:54 GMT
|
||||
- Fri, 19 Jan 2024 13:37:37 GMT
|
||||
x-amzn-RequestId:
|
||||
- a5224844-883a-4a2b-9e5a-a1278adeaec3
|
||||
- e160c12d-050e-4ace-a78c-4119da0f995a
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
@@ -77,7 +184,114 @@ interactions:
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
Authorization:
|
||||
- Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
- Bearer test_token
|
||||
Client-ID:
|
||||
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
- '31'
|
||||
User-Agent:
|
||||
- python-requests/2.31.0
|
||||
method: POST
|
||||
uri: https://api.igdb.com/v4/platforms/
|
||||
response:
|
||||
body:
|
||||
string: "{\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/FrvfwQg\"\n}\n"
|
||||
headers:
|
||||
CF-Cache-Status:
|
||||
- DYNAMIC
|
||||
CF-RAY:
|
||||
- 847f7932eed55ab5-VIE
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
- '437'
|
||||
Content-Type:
|
||||
- application/json
|
||||
Date:
|
||||
- Fri, 19 Jan 2024 13:37:38 GMT
|
||||
Server:
|
||||
- cloudflare
|
||||
Set-Cookie:
|
||||
- __cf_bm=5DrFN8rmd3MUbDV8GdtLxaEwZW.J9jcO_D97UUZd6qs-1705671458-1-ATJi7TaAzGqvZOtYHVUylDYcAagmfdS406NJfPFLaoTW/WKsVdMFQQKx+WQcX2D+PLlIQfgajycXBqqCWCcsy60=;
|
||||
path=/; expires=Fri, 19-Jan-24 14:07:38 GMT; domain=.igdb.com; HttpOnly; Secure;
|
||||
SameSite=None
|
||||
Strict-Transport-Security:
|
||||
- max-age=31536000; includeSubDomains; preload
|
||||
Via:
|
||||
- 1.1 95c9d51ed7176777d7ac8ca8cb233696.cloudfront.net (CloudFront)
|
||||
X-Amz-Cf-Id:
|
||||
- 5l8kbnmcqoAaf0ZoxM790IfzpLld4nSsqvLJSBw4My5JZwvdZiDACg==
|
||||
X-Amz-Cf-Pop:
|
||||
- VIE50-C2
|
||||
X-Cache:
|
||||
- Error from cloudfront
|
||||
X-Content-Type-Options:
|
||||
- nosniff
|
||||
alt-svc:
|
||||
- h3=":443"; ma=86400
|
||||
x-amz-apigw-id:
|
||||
- RygtYGmVPHcEGcQ=
|
||||
x-amzn-ErrorType:
|
||||
- AccessDeniedException
|
||||
x-amzn-RequestId:
|
||||
- 45e46f02-4827-4250-a7af-6d78bcb39c8a
|
||||
status:
|
||||
code: 401
|
||||
message: Unauthorized
|
||||
- request:
|
||||
body: null
|
||||
headers:
|
||||
Accept:
|
||||
- '*/*'
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
- '0'
|
||||
User-Agent:
|
||||
- python-requests/2.31.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":"dgnj5jacdcprwqcumxksdhz971u99l","expires_in":4848708,"token_type":"bearer"}
|
||||
|
||||
'
|
||||
headers:
|
||||
Access-Control-Allow-Origin:
|
||||
- '*'
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
- '93'
|
||||
Content-Type:
|
||||
- application/json
|
||||
Date:
|
||||
- Fri, 19 Jan 2024 13:37:39 GMT
|
||||
Server:
|
||||
- nginx
|
||||
X-Ctxlog-Logid:
|
||||
- 1-65aa7b23-7c0c3f6b134dd92804e3f668
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
- request:
|
||||
body: fields id, name; where slug="";
|
||||
headers:
|
||||
Accept:
|
||||
- application/json
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
Authorization:
|
||||
- Bearer dgnj5jacdcprwqcumxksdhz971u99l
|
||||
Client-ID:
|
||||
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
Connection:
|
||||
@@ -95,7 +309,7 @@ interactions:
|
||||
CF-Cache-Status:
|
||||
- DYNAMIC
|
||||
CF-RAY:
|
||||
- 7eff5637ea8e53ef-YYZ
|
||||
- 847f793f1963248a-ZAG
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
@@ -103,21 +317,21 @@ interactions:
|
||||
Content-Type:
|
||||
- application/json
|
||||
Date:
|
||||
- Tue, 01 Aug 2023 16:07:55 GMT
|
||||
- Fri, 19 Jan 2024 13:37:40 GMT
|
||||
Server:
|
||||
- cloudflare
|
||||
Set-Cookie:
|
||||
- __cf_bm=gE4jVTITKRcjnyoGHaSakiXPFmrb2UPnGvjjliZc0NU-1690906075-0-AZJKx7NGH6ws1e8nUErmNIBGvc1tW4ATwpOgnX3lwXHds7EMTL3plHx8pdSpnvFINrX66SVa+Z1GmnGGfOc8HJ0=;
|
||||
path=/; expires=Tue, 01-Aug-23 16:37:55 GMT; domain=.igdb.com; HttpOnly; Secure;
|
||||
- __cf_bm=gnQoBfHXjnj1a_AqfUftviJ4YKJZPPaxvcpSorQwE6c-1705671460-1-ATX7U3THaIbbG/0WMjoSH0Txd3rapaVpAq8SEbuCNyMhLLwnBSMKHherISYXpVKn6hb4eUmZ1LZRZAPI5kbmaoA=;
|
||||
path=/; expires=Fri, 19-Jan-24 14:07:40 GMT; domain=.igdb.com; HttpOnly; Secure;
|
||||
SameSite=None
|
||||
Strict-Transport-Security:
|
||||
- max-age=31536000; includeSubDomains; preload
|
||||
Via:
|
||||
- 1.1 d7e35fb15b3339fbd8a9457f22308ea0.cloudfront.net (CloudFront)
|
||||
- 1.1 de5338eac881cf5d87f2d811c3b7417c.cloudfront.net (CloudFront)
|
||||
X-Amz-Cf-Id:
|
||||
- sSYuZMZMfaWt75JeV6cdJzVc5cGFHQ3LmMu7xU1USOVDSQdjM-z44w==
|
||||
- B0LrRDTakDPE14xovQLLMpdJ5WguGkZcc203pPEdUNM-SCGZk4fxHw==
|
||||
X-Amz-Cf-Pop:
|
||||
- YTO50-P1
|
||||
- VIE50-C2
|
||||
X-Cache:
|
||||
- Miss from cloudfront
|
||||
X-Content-Type-Options:
|
||||
@@ -127,13 +341,81 @@ interactions:
|
||||
alt-svc:
|
||||
- h3=":443"; ma=86400
|
||||
x-amz-apigw-id:
|
||||
- I_QaQEcrvHcF0Ig=
|
||||
- RygtpE1GPHcELaQ=
|
||||
x-amzn-Remapped-Content-Length:
|
||||
- '2'
|
||||
x-amzn-Remapped-Date:
|
||||
- Tue, 01 Aug 2023 16:07:54 GMT
|
||||
- Fri, 19 Jan 2024 13:37:40 GMT
|
||||
x-amzn-RequestId:
|
||||
- ad21ab8d-30f2-4d81-b3bf-1a241b6379a2
|
||||
- 5a7437cf-1dc1-4ff4-8d2b-4b6e73599c8c
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
- request:
|
||||
body: fields id, name; where slug="";
|
||||
headers:
|
||||
Accept:
|
||||
- application/json
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
Authorization:
|
||||
- Bearer dgnj5jacdcprwqcumxksdhz971u99l
|
||||
Client-ID:
|
||||
- xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
- '31'
|
||||
User-Agent:
|
||||
- python-requests/2.31.0
|
||||
method: POST
|
||||
uri: https://api.igdb.com/v4/platform_versions/
|
||||
response:
|
||||
body:
|
||||
string: '[]'
|
||||
headers:
|
||||
CF-Cache-Status:
|
||||
- DYNAMIC
|
||||
CF-RAY:
|
||||
- 847f7942ec945abd-VIE
|
||||
Connection:
|
||||
- keep-alive
|
||||
Content-Length:
|
||||
- '2'
|
||||
Content-Type:
|
||||
- application/json
|
||||
Date:
|
||||
- Fri, 19 Jan 2024 13:37:40 GMT
|
||||
Server:
|
||||
- cloudflare
|
||||
Set-Cookie:
|
||||
- __cf_bm=.GvAgzuLBUILPOAU4qzTnt9ru4GlltXhurSbrvmoEwU-1705671460-1-Af5jCakYhp8BPH3bSIxKWa6hqLNlBHgZ0rPiA7yI55SXBfnwuouu2eg2n1iPydZoKnsoSzVNJyHoB165b5A30K4=;
|
||||
path=/; expires=Fri, 19-Jan-24 14:07:40 GMT; domain=.igdb.com; HttpOnly; Secure;
|
||||
SameSite=None
|
||||
Strict-Transport-Security:
|
||||
- max-age=31536000; includeSubDomains; preload
|
||||
Via:
|
||||
- 1.1 659e81bfffb15e4b314a9b12d4db8946.cloudfront.net (CloudFront)
|
||||
X-Amz-Cf-Id:
|
||||
- -U2SQuL1999EN_LGz7wkPV29-blNIdlv5CszU5qxq6Dr4JOMB4HZbQ==
|
||||
X-Amz-Cf-Pop:
|
||||
- VIE50-C2
|
||||
X-Cache:
|
||||
- Miss from cloudfront
|
||||
X-Content-Type-Options:
|
||||
- nosniff
|
||||
X-Count:
|
||||
- '0'
|
||||
alt-svc:
|
||||
- h3=":443"; ma=86400
|
||||
x-amz-apigw-id:
|
||||
- RygtvFBBPHcEJBQ=
|
||||
x-amzn-Remapped-Content-Length:
|
||||
- '2'
|
||||
x-amzn-Remapped-Date:
|
||||
- Fri, 19 Jan 2024 13:37:40 GMT
|
||||
x-amzn-RequestId:
|
||||
- ce901324-4bde-4c6d-adbf-195a8363ece2
|
||||
status:
|
||||
code: 200
|
||||
message: OK
|
||||
|
||||
@@ -41,7 +41,7 @@ services:
|
||||
volumes:
|
||||
- "/path/to/library:/romm/library"
|
||||
- "/path/to/resources:/romm/resources" # [Optional] Path where roms metadata (covers) are stored
|
||||
- "/path/to/config.yml:/romm/config.yml" # [Optional] Path where config is stored
|
||||
- "/path/to/config:/romm/config" # [Optional] Path where config is stored
|
||||
- "/path/to/database:/romm/database" # [Optional] Only needed if ROMM_DB_DRIVER=sqlite or not set
|
||||
- "/path/to/logs:/romm/logs" # [Optional] Path where logs are stored
|
||||
ports:
|
||||
|
||||
4
frontend/package-lock.json
generated
4
frontend/package-lock.json
generated
@@ -12,7 +12,7 @@
|
||||
"axios": "^1.6.0",
|
||||
"core-js": "^3.8.3",
|
||||
"cronstrue": "^2.31.0",
|
||||
"emulatorjs": "github:GAntoine/emulatorjs",
|
||||
"emulatorjs": "github:GAntoine/emulatorjs#main",
|
||||
"file-saver": "^2.0.5",
|
||||
"js-cookie": "^3.0.5",
|
||||
"jszip": "^3.10.1",
|
||||
@@ -3191,7 +3191,7 @@
|
||||
},
|
||||
"node_modules/emulatorjs": {
|
||||
"version": "4.0.6",
|
||||
"resolved": "git+ssh://git@github.com/GAntoine/emulatorjs.git#8015836f1dbed7d75b7ab77bf94669e58a77bee0",
|
||||
"resolved": "git+ssh://git@github.com/GAntoine/emulatorjs.git#8dfbfb0f32e94c77d49492fa34d27723a29d175e",
|
||||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"http-server": "^14.1.1"
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
"axios": "^1.6.0",
|
||||
"core-js": "^3.8.3",
|
||||
"cronstrue": "^2.31.0",
|
||||
"emulatorjs": "github:GAntoine/emulatorjs",
|
||||
"emulatorjs": "github:GAntoine/emulatorjs#main",
|
||||
"file-saver": "^2.0.5",
|
||||
"js-cookie": "^3.0.5",
|
||||
"jszip": "^3.10.1",
|
||||
|
||||
2
frontend/src/__generated__/index.ts
generated
2
frontend/src/__generated__/index.ts
generated
@@ -15,7 +15,7 @@ export type { CursorPage_RomSchema_ } from './models/CursorPage_RomSchema_';
|
||||
export type { EnhancedRomSchema } from './models/EnhancedRomSchema';
|
||||
export type { HeartbeatResponse } from './models/HeartbeatResponse';
|
||||
export type { HTTPValidationError } from './models/HTTPValidationError';
|
||||
export type { IGDBRomType } from './models/IGDBRomType';
|
||||
export type { IGDBRom } from './models/IGDBRom';
|
||||
export type { MessageResponse } from './models/MessageResponse';
|
||||
export type { PlatformSchema } from './models/PlatformSchema';
|
||||
export type { Role } from './models/Role';
|
||||
|
||||
@@ -11,6 +11,7 @@ export type ConfigResponse = {
|
||||
EXCLUDED_MULTI_PARTS_EXT: Array<string>;
|
||||
EXCLUDED_MULTI_PARTS_FILES: Array<string>;
|
||||
PLATFORMS_BINDING: Record<string, string>;
|
||||
PLATFORMS_VERSIONS: Record<string, string>;
|
||||
ROMS_FOLDER_NAME: string;
|
||||
SAVES_FOLDER_NAME: string;
|
||||
STATES_FOLDER_NAME: string;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
|
||||
export type IGDBRomType = {
|
||||
export type IGDBRom = {
|
||||
igdb_id: number;
|
||||
slug: string;
|
||||
name: string;
|
||||
@@ -3,10 +3,10 @@
|
||||
/* tslint:disable */
|
||||
/* eslint-disable */
|
||||
|
||||
import type { IGDBRomType } from './IGDBRomType';
|
||||
import type { IGDBRom } from './IGDBRom';
|
||||
|
||||
export type RomSearchResponse = {
|
||||
msg: string;
|
||||
roms: Array<IGDBRomType>;
|
||||
roms: Array<IGDBRom>;
|
||||
};
|
||||
|
||||
|
||||
2
frontend/src/__generated__/models/SaveSchema.ts
generated
2
frontend/src/__generated__/models/SaveSchema.ts
generated
@@ -12,6 +12,8 @@ export type SaveSchema = {
|
||||
file_size_bytes: number;
|
||||
full_path: string;
|
||||
download_path: string;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
rom_id: number;
|
||||
emulator: (string | null);
|
||||
};
|
||||
|
||||
@@ -12,6 +12,8 @@ export type ScreenshotSchema = {
|
||||
file_size_bytes: number;
|
||||
full_path: string;
|
||||
download_path: string;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
rom_id: number;
|
||||
};
|
||||
|
||||
|
||||
2
frontend/src/__generated__/models/StateSchema.ts
generated
2
frontend/src/__generated__/models/StateSchema.ts
generated
@@ -12,6 +12,8 @@ export type StateSchema = {
|
||||
file_size_bytes: number;
|
||||
full_path: string;
|
||||
download_path: string;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
rom_id: number;
|
||||
emulator: (string | null);
|
||||
};
|
||||
|
||||
@@ -1,144 +1,54 @@
|
||||
<script setup lang="ts">
|
||||
import type { SaveSchema, StateSchema } from "@/__generated__";
|
||||
import romApi from "@/services/api/rom";
|
||||
import stateApi from "@/services/api/state";
|
||||
import type { Rom } from "@/stores/roms";
|
||||
import { formatBytes } from "@/utils";
|
||||
import { onMounted, ref } from "vue";
|
||||
import { useRoute } from "vue-router";
|
||||
import Player from "@/views/Play/Player.vue";
|
||||
import { onMounted } from "vue";
|
||||
import { ref } from "vue";
|
||||
import { useDisplay } from "vuetify";
|
||||
|
||||
defineProps<{ rom: Rom }>();
|
||||
const route = useRoute();
|
||||
const rom = ref<Rom | null>(null);
|
||||
const props = defineProps<{ rom: Rom }>();
|
||||
const saveRef = ref<SaveSchema | null>(null);
|
||||
const stateRef = ref<StateSchema | null>(null);
|
||||
const gameRunning = ref(false);
|
||||
const fullScreenOnPlay = ref(true);
|
||||
const gameRunning = ref(false);
|
||||
const { smAndDown, mdAndUp } = useDisplay();
|
||||
|
||||
const EXTENSION_REGEX = new RegExp("\.(([a-z]+\.)*)$");
|
||||
|
||||
const script = document.createElement("script");
|
||||
script.src = "/assets/emulatorjs/loader.js";
|
||||
script.async = true;
|
||||
window.EJS_player = "#game";
|
||||
window.EJS_pathtodata = "/assets/emulatorjs/";
|
||||
window.EJS_color = "#A453FF";
|
||||
window.EJS_alignStartButton = "center";
|
||||
window.EJS_startOnLoaded = true;
|
||||
window.EJS_fullscreenOnLoaded = true;
|
||||
window.EJS_defaultOptions = {
|
||||
"save-state-location": "browser",
|
||||
};
|
||||
|
||||
function buildStateName(rom: Rom): string {
|
||||
const states = rom.states.map((s) => s.file_name);
|
||||
const romName = rom.file_name.replace(EXTENSION_REGEX, "").trim();
|
||||
let stateName = `${romName}.state.auto`;
|
||||
if (!states.includes(stateName)) return stateName;
|
||||
|
||||
let i = 1;
|
||||
stateName = `${romName}.state1`;
|
||||
while (states.includes(stateName)) {
|
||||
i++;
|
||||
stateName = `${romName}.state${i}`;
|
||||
}
|
||||
|
||||
return stateName;
|
||||
}
|
||||
|
||||
window.EJS_onSaveState = function ({
|
||||
state,
|
||||
}: {
|
||||
screenshot: File;
|
||||
state: File;
|
||||
}) {
|
||||
if (window.EJS_emulator.saveInBrowserSupported()) {
|
||||
window.EJS_emulator.storage.states.put(
|
||||
window.EJS_emulator.getBaseFileName() + ".state",
|
||||
state
|
||||
);
|
||||
window.EJS_emulator.displayMessage(
|
||||
window.EJS_emulator.localization("SAVE SAVED TO BROWSER")
|
||||
);
|
||||
}
|
||||
if (stateRef.value) {
|
||||
stateApi
|
||||
.updateState({
|
||||
state: stateRef.value,
|
||||
file: new File([state], stateRef.value.file_name, {
|
||||
type: "application/octet-stream",
|
||||
}),
|
||||
})
|
||||
.then(({ data }) => {
|
||||
stateRef.value = data;
|
||||
});
|
||||
} else if (rom.value) {
|
||||
stateApi
|
||||
.uploadStates({
|
||||
rom: rom.value,
|
||||
states: [
|
||||
new File([state], buildStateName(rom.value), {
|
||||
type: "application/octet-stream",
|
||||
}),
|
||||
],
|
||||
})
|
||||
.then(({ data }) => {
|
||||
if (rom.value) rom.value.states = data.states;
|
||||
stateRef.value = data.states.pop();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
window.EJS_onGameStart = () => {};
|
||||
|
||||
onMounted(() => {
|
||||
romApi
|
||||
.getRom({ romId: parseInt(route.params.rom as string) })
|
||||
.then((response) => {
|
||||
rom.value = response.data;
|
||||
window.EJS_core = rom.value.platform_slug;
|
||||
window.EJS_gameID = rom.value.id;
|
||||
window.EJS_gameName = rom.value.name;
|
||||
window.EJS_backgroundImage = `/assets/romm/resources/${rom.value.path_cover_l}`;
|
||||
window.EJS_gameUrl = rom.value.download_path;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
});
|
||||
});
|
||||
|
||||
function toggleFullScreen() {
|
||||
window.EJS_fullscreenOnLoaded = !window.EJS_fullscreenOnLoaded;
|
||||
}
|
||||
|
||||
function onPlay() {
|
||||
gameRunning.value = true;
|
||||
window.EJS_loadStateURL = stateRef.value?.download_path ?? null;
|
||||
window.EJS_fullscreenOnLoaded = fullScreenOnPlay.value;
|
||||
document.body.appendChild(script);
|
||||
gameRunning.value = true;
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
const wrapper = document.getElementById("game-wrapper");
|
||||
if (wrapper) wrapper.style.backgroundImage = `url(${window.EJS_backgroundImage})`;
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-row no-gutters>
|
||||
<v-col v-if="rom && !gameRunning" class="12">
|
||||
<v-select
|
||||
<v-row v-if="rom" no-gutters>
|
||||
<v-col v-if="!gameRunning" class="mb-6">
|
||||
<!-- <v-select
|
||||
density="compact"
|
||||
class="my-1"
|
||||
class="my-2"
|
||||
hide-details
|
||||
variant="outlined"
|
||||
clearable
|
||||
disabled
|
||||
label="BIOS"
|
||||
:items="['gba-bios.zip']"
|
||||
/>
|
||||
/> -->
|
||||
<v-select
|
||||
density="compact"
|
||||
class="my-1"
|
||||
class="my-2"
|
||||
hide-details
|
||||
variant="outlined"
|
||||
clearable
|
||||
disabled
|
||||
label="Save"
|
||||
v-model="saveRef"
|
||||
:items="
|
||||
@@ -151,7 +61,7 @@ function onPlay() {
|
||||
/>
|
||||
<v-select
|
||||
density="compact"
|
||||
class="my-1"
|
||||
class="my-2"
|
||||
hide-details
|
||||
variant="outlined"
|
||||
clearable
|
||||
@@ -165,9 +75,9 @@ function onPlay() {
|
||||
}))
|
||||
"
|
||||
/>
|
||||
<v-select
|
||||
<!-- <v-select
|
||||
density="compact"
|
||||
class="my-1"
|
||||
class="my-2"
|
||||
hide-details
|
||||
variant="outlined"
|
||||
clearable
|
||||
@@ -177,11 +87,10 @@ function onPlay() {
|
||||
'Advance Wars Balance (AW1) by Kartal',
|
||||
'War Room Sturm (AW1) by Kartal',
|
||||
]"
|
||||
/>
|
||||
/> -->
|
||||
<v-switch
|
||||
hide-details
|
||||
v-model="fullScreenOnPlay"
|
||||
@update:model-value="toggleFullScreen"
|
||||
color="romm-accent-1"
|
||||
label="Full screen"
|
||||
/>
|
||||
@@ -209,31 +118,16 @@ function onPlay() {
|
||||
</v-col>
|
||||
|
||||
<v-col cols="12" rounded id="game-wrapper">
|
||||
<div id="game"></div>
|
||||
<player :rom="rom" :state="stateRef" :save="saveRef" />
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row> </v-row>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
div.ejs_game {
|
||||
background-color: #191d22;
|
||||
}
|
||||
#game-wrapper {
|
||||
aspect-ratio: 16 / 9;
|
||||
background-size: contain;
|
||||
background-position: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- Other config options: https://emulatorjs.org/docs/Options.html -->
|
||||
|
||||
<!-- config.biosUrl = window.EJS_biosUrl; -->
|
||||
<!-- config.VirtualGamepadSettings = window.EJS_VirtualGamepadSettings; -->
|
||||
<!-- config.buttonOpts = window.EJS_Buttons; -->
|
||||
<!-- config.volume = window.EJS_volume; -->
|
||||
<!-- config.defaultControllers = window.EJS_defaultControls; -->
|
||||
<!-- config.cheats = window.EJS_cheats; -->
|
||||
<!-- config.defaultOptions = window.EJS_defaultOptions; -->
|
||||
<!-- config.gamePatchUrl = window.EJS_gamePatchUrl; -->
|
||||
<!-- config.gameParentUrl = window.EJS_gameParentUrl; -->
|
||||
<!-- config.netplayUrl = window.EJS_netplayServer; -->
|
||||
<!-- config.threads = window.EJS_threads; -->
|
||||
|
||||
@@ -5,11 +5,11 @@ import type { Emitter } from "mitt";
|
||||
import type { Events } from "@/types/emitter";
|
||||
import { formatBytes } from "@/utils";
|
||||
import stateApi from "@/services/api/state";
|
||||
import storeRoms from "@/stores/roms";
|
||||
import storeRoms, { type Rom } from "@/stores/roms";
|
||||
|
||||
import type { StateSchema } from "@/__generated__";
|
||||
|
||||
const props = defineProps(["rom"]);
|
||||
const props = defineProps<{ rom: Rom }>();
|
||||
const statesToUpload = ref<File[]>([]);
|
||||
const selectedStates = ref<StateSchema[]>([]);
|
||||
const emitter = inject<Emitter<Events>>("emitter");
|
||||
|
||||
@@ -36,7 +36,7 @@ async function deleteAssets() {
|
||||
if (!assets.value) return;
|
||||
|
||||
const result =
|
||||
(await assetType.value) === "saves"
|
||||
assetType.value === "saves"
|
||||
? saveApi.deleteSaves({
|
||||
saves: assets.value,
|
||||
deleteFromFs: deleteFromFs.value,
|
||||
@@ -47,9 +47,12 @@ async function deleteAssets() {
|
||||
});
|
||||
|
||||
result
|
||||
.then(({ data }) => {
|
||||
if (romRef.value) {
|
||||
romRef.value[assetType.value] = data;
|
||||
.then(() => {
|
||||
if (romRef.value?.[assetType.value]) {
|
||||
const deletedAssetIds = assets.value.map((asset) => asset.id);
|
||||
romRef.value[assetType.value] = romRef.value[assetType.value].filter(
|
||||
(asset) => !deletedAssetIds.includes(asset.id)
|
||||
);
|
||||
romsStore.update(romRef.value);
|
||||
emitter?.emit("romUpdated", romRef.value);
|
||||
}
|
||||
@@ -63,9 +66,9 @@ async function deleteAssets() {
|
||||
color: "red",
|
||||
timeout: 4000,
|
||||
});
|
||||
}).finally(() => {
|
||||
closeDialog();
|
||||
});
|
||||
|
||||
closeDialog();
|
||||
}
|
||||
|
||||
function closeDialog() {
|
||||
|
||||
104
frontend/src/components/Dialog/Config/CreatePlatformVersion.vue
Normal file
104
frontend/src/components/Dialog/Config/CreatePlatformVersion.vue
Normal file
@@ -0,0 +1,104 @@
|
||||
<script setup lang="ts">
|
||||
import api_config from "@/services/api_config";
|
||||
import storeConfig from "@/stores/config";
|
||||
import type { Events } from "@/types/emitter";
|
||||
import type { Emitter } from "mitt";
|
||||
import { inject, ref } from "vue";
|
||||
|
||||
// Props
|
||||
const show = ref(false);
|
||||
const configStore = storeConfig();
|
||||
const emitter = inject<Emitter<Events>>("emitter");
|
||||
const fsSlugToCreate = ref();
|
||||
const slugToCreate = ref();
|
||||
emitter?.on("showCreatePlatformVersionDialog", ({ fsSlug = "", slug = "" }) => {
|
||||
fsSlugToCreate.value = fsSlug;
|
||||
slugToCreate.value = slug;
|
||||
show.value = true;
|
||||
});
|
||||
|
||||
// Functions
|
||||
function addVersionPlatform() {
|
||||
api_config
|
||||
.addPlatformVersionConfig({
|
||||
fsSlug: fsSlugToCreate.value,
|
||||
slug: slugToCreate.value,
|
||||
})
|
||||
.then(() => {
|
||||
configStore.addPlatformVersion(fsSlugToCreate.value, slugToCreate.value);
|
||||
})
|
||||
.catch(({ response, message }) => {
|
||||
emitter?.emit("snackbarShow", {
|
||||
msg: `${response?.data?.detail || response?.statusText || message}`,
|
||||
icon: "mdi-close-circle",
|
||||
color: "red",
|
||||
timeout: 4000,
|
||||
});
|
||||
});
|
||||
closeDialog();
|
||||
}
|
||||
|
||||
function closeDialog() {
|
||||
show.value = false;
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<v-dialog v-model="show" max-width="500px" :scrim="true">
|
||||
<v-card>
|
||||
<v-toolbar density="compact" class="bg-terciary">
|
||||
<v-row class="align-center" no-gutters>
|
||||
<v-col cols="10">
|
||||
<v-icon icon="mdi-gamepad-variant" class="ml-5" />
|
||||
<v-icon icon="mdi-approximately-equal" class="ml-1 text-romm-gray" />
|
||||
<v-icon icon="mdi-controller" class="ml-1 text-romm-accent-1" />
|
||||
</v-col>
|
||||
<v-col>
|
||||
<v-btn
|
||||
@click="closeDialog"
|
||||
class="bg-terciary"
|
||||
rounded="0"
|
||||
variant="text"
|
||||
icon="mdi-close"
|
||||
block
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-toolbar>
|
||||
<v-divider class="border-opacity-25" :thickness="1" />
|
||||
|
||||
<v-card-text>
|
||||
<v-row class="pa-2 align-center" no-gutters>
|
||||
<v-text-field
|
||||
@keyup.enter=""
|
||||
v-model="fsSlugToCreate"
|
||||
label="Platform version"
|
||||
variant="outlined"
|
||||
required
|
||||
hide-details
|
||||
/>
|
||||
<v-icon icon="mdi-menu-right" class="mx-2 text-romm-gray" />
|
||||
<v-text-field
|
||||
class="text-romm-accent-1"
|
||||
@keyup.enter=""
|
||||
v-model="slugToCreate"
|
||||
label="Main platform"
|
||||
color="romm-accent-1"
|
||||
base-color="romm-accent-1"
|
||||
variant="outlined"
|
||||
required
|
||||
hide-details
|
||||
/>
|
||||
</v-row>
|
||||
<v-row class="justify-center pa-2" no-gutters>
|
||||
<v-btn @click="closeDialog" class="bg-terciary">Cancel</v-btn>
|
||||
<v-btn
|
||||
@click="addVersionPlatform()"
|
||||
class="text-romm-green bg-terciary ml-5"
|
||||
>
|
||||
Confirm
|
||||
</v-btn>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
@@ -0,0 +1,97 @@
|
||||
<script setup lang="ts">
|
||||
import api_config from "@/services/api_config";
|
||||
import storeConfig from "@/stores/config";
|
||||
import type { Events } from "@/types/emitter";
|
||||
import type { Emitter } from "mitt";
|
||||
import { inject, ref } from "vue";
|
||||
|
||||
// Props
|
||||
const show = ref(false);
|
||||
const emitter = inject<Emitter<Events>>("emitter");
|
||||
const configStore = storeConfig();
|
||||
const fsSlugToDelete = ref();
|
||||
const slugToDelete = ref();
|
||||
emitter?.on("showDeletePlatformVersionDialog", ({ fsSlug, slug }) => {
|
||||
fsSlugToDelete.value = fsSlug;
|
||||
slugToDelete.value = slug;
|
||||
show.value = true;
|
||||
});
|
||||
|
||||
// Functions
|
||||
function removeVersionPlatform() {
|
||||
api_config
|
||||
.deletePlatformVersionConfig({ fsSlug: fsSlugToDelete.value })
|
||||
.then(() => {
|
||||
configStore.removePlatformVersion(fsSlugToDelete.value);
|
||||
})
|
||||
.catch(({ response, message }) => {
|
||||
emitter?.emit("snackbarShow", {
|
||||
msg: `${response?.data?.detail || response?.statusText || message}`,
|
||||
icon: "mdi-close-circle",
|
||||
color: "red",
|
||||
timeout: 4000,
|
||||
});
|
||||
});
|
||||
closeDialog();
|
||||
}
|
||||
|
||||
function closeDialog() {
|
||||
show.value = false;
|
||||
}
|
||||
</script>
|
||||
<template>
|
||||
<v-dialog
|
||||
v-model="show"
|
||||
width="auto"
|
||||
@click:outside="closeDialog"
|
||||
@keydown.esc="closeDialog"
|
||||
no-click-animation
|
||||
persistent
|
||||
:scrim="true"
|
||||
>
|
||||
<v-card>
|
||||
<v-toolbar density="compact" class="bg-terciary">
|
||||
<v-row class="align-center" no-gutters>
|
||||
<v-col cols="10">
|
||||
<v-icon icon="mdi-delete" class="ml-5 mr-2" />
|
||||
</v-col>
|
||||
<v-col>
|
||||
<v-btn
|
||||
@click="closeDialog"
|
||||
class="bg-terciary"
|
||||
rounded="0"
|
||||
variant="text"
|
||||
icon="mdi-close"
|
||||
block
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-toolbar>
|
||||
<v-divider class="border-opacity-25" :thickness="1" />
|
||||
|
||||
<v-card-text>
|
||||
<v-row class="justify-center pa-2" no-gutters>
|
||||
<span class="mr-1">Deleting platform version [</span>
|
||||
<span class="text-romm-accent-1 mr-1">{{
|
||||
fsSlugToDelete
|
||||
}}</span>
|
||||
<span>:</span>
|
||||
<span class="text-romm-accent-1 ml-1">{{
|
||||
slugToDelete
|
||||
}}</span
|
||||
><span class="ml-1">].</span>
|
||||
<span class="ml-1">Do you confirm?</span>
|
||||
</v-row>
|
||||
<v-row class="justify-center pa-2" no-gutters>
|
||||
<v-btn @click="closeDialog" class="bg-terciary">Cancel</v-btn>
|
||||
<v-btn
|
||||
@click="removeVersionPlatform()"
|
||||
class="text-romm-red bg-terciary ml-5"
|
||||
>
|
||||
Confirm
|
||||
</v-btn>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
</template>
|
||||
133
frontend/src/components/Settings/Config/PlatformVersionsCard.vue
Normal file
133
frontend/src/components/Settings/Config/PlatformVersionsCard.vue
Normal file
@@ -0,0 +1,133 @@
|
||||
<script setup lang="ts">
|
||||
import CreatePlatformVersionDialog from "@/components/Dialog/Config/CreatePlatformVersion.vue";
|
||||
import DeletePlatformVersionDialog from "@/components/Dialog/Config/DeletePlatformVersion.vue";
|
||||
import PlatformIcon from "@/components/Platform/PlatformIcon.vue";
|
||||
import storeAuth from "@/stores/auth";
|
||||
import storeConfig from "@/stores/config";
|
||||
import type { Events } from "@/types/emitter";
|
||||
import type { Emitter } from "mitt";
|
||||
import { inject, ref } from "vue";
|
||||
|
||||
// Props
|
||||
const emitter = inject<Emitter<Events>>("emitter");
|
||||
const configStore = storeConfig();
|
||||
const authStore = storeAuth();
|
||||
const platformsVersions = configStore.value.PLATFORMS_VERSIONS;
|
||||
const editable = ref(false);
|
||||
</script>
|
||||
<template>
|
||||
<v-card rounded="0">
|
||||
<v-toolbar class="bg-terciary" density="compact">
|
||||
<v-toolbar-title class="text-button">
|
||||
<v-icon class="mr-3">mdi-gamepad-variant</v-icon>
|
||||
Platforms Versions
|
||||
</v-toolbar-title>
|
||||
<v-btn
|
||||
v-if="authStore.scopes.includes('platforms.write')"
|
||||
class="ma-2"
|
||||
rounded="0"
|
||||
size="small"
|
||||
variant="text"
|
||||
@click="editable = !editable"
|
||||
icon="mdi-cog"
|
||||
>
|
||||
</v-btn>
|
||||
</v-toolbar>
|
||||
|
||||
<v-divider class="border-opacity-25" />
|
||||
|
||||
<v-card-text class="pa-1">
|
||||
<v-row no-gutters class="align-center">
|
||||
<v-col
|
||||
cols="6"
|
||||
sm="4"
|
||||
md="3"
|
||||
lg="2"
|
||||
xl="2"
|
||||
v-for="(slug, fsSlug) in platformsVersions"
|
||||
:key="slug"
|
||||
:title="slug"
|
||||
>
|
||||
<v-list-item class="bg-terciary ma-1 pa-1 text-truncate">
|
||||
<template v-slot:prepend>
|
||||
<v-avatar :rounded="0" size="40" class="mx-2">
|
||||
<platform-icon class="platform-icon" :key="slug" :slug="slug" />
|
||||
</v-avatar>
|
||||
</template>
|
||||
<v-list-item class="bg-primary pr-2 pl-2">
|
||||
<span>{{ fsSlug }}</span>
|
||||
<template v-slot:append>
|
||||
<v-slide-x-reverse-transition>
|
||||
<v-btn
|
||||
v-if="
|
||||
authStore.scopes.includes('platforms.write') && editable
|
||||
"
|
||||
rounded="0"
|
||||
variant="text"
|
||||
size="x-small"
|
||||
icon="mdi-pencil"
|
||||
@click="
|
||||
emitter?.emit('showCreatePlatformVersionDialog', {
|
||||
fsSlug,
|
||||
slug,
|
||||
})
|
||||
"
|
||||
class="ml-2"
|
||||
/>
|
||||
</v-slide-x-reverse-transition>
|
||||
<v-slide-x-reverse-transition>
|
||||
<v-btn
|
||||
v-if="
|
||||
authStore.scopes.includes('platforms.write') && editable
|
||||
"
|
||||
rounded="0"
|
||||
variant="text"
|
||||
size="x-small"
|
||||
icon="mdi-delete"
|
||||
@click="
|
||||
emitter?.emit('showDeletePlatformVersionDialog', {
|
||||
fsSlug,
|
||||
slug,
|
||||
})
|
||||
"
|
||||
class="text-romm-red"
|
||||
/>
|
||||
</v-slide-x-reverse-transition>
|
||||
</template>
|
||||
</v-list-item>
|
||||
</v-list-item>
|
||||
</v-col>
|
||||
<v-col cols="6" sm="4" md="3" lg="2" xl="2" class="px-1">
|
||||
<v-expand-transition>
|
||||
<v-btn
|
||||
v-if="authStore.scopes.includes('platforms.write') && editable"
|
||||
block
|
||||
rounded="0"
|
||||
size="large"
|
||||
prepend-icon="mdi-plus"
|
||||
variant="outlined"
|
||||
class="text-romm-accent-1"
|
||||
@click="
|
||||
emitter?.emit('showCreatePlatformVersionDialog', {
|
||||
fsSlug: '',
|
||||
slug: '',
|
||||
})
|
||||
"
|
||||
>
|
||||
Add
|
||||
</v-btn>
|
||||
</v-expand-transition>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
|
||||
<create-platform-version-dialog />
|
||||
<delete-platform-version-dialog />
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.platform-icon {
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
@@ -36,23 +36,6 @@ const routes = [
|
||||
path: "/settings/control-panel/",
|
||||
name: "controlPanel",
|
||||
component: () => import("@/views/Settings/ControlPanel/Base.vue"),
|
||||
// children: [
|
||||
// {
|
||||
// path: "/settings/control-panel/general",
|
||||
// name: "controlPanelGeneral",
|
||||
// component: () => import("@/views/Settings/ControlPanel/General/Base.vue"),
|
||||
// },
|
||||
// {
|
||||
// path: "/settings/control-panel/config",
|
||||
// name: "controlPanelConfig",
|
||||
// component: () => import("@/views/Settings/ControlPanel/Config/Base.vue"),
|
||||
// },
|
||||
// {
|
||||
// path: "/settings/control-panel/users",
|
||||
// name: "controlPanelUsers",
|
||||
// component: () => import("@/views/Settings/ControlPanel/Users/Base.vue"),
|
||||
// }
|
||||
// ]
|
||||
},
|
||||
{
|
||||
path: "/:pathMatch(.*)*",
|
||||
@@ -63,7 +46,7 @@ const routes = [
|
||||
},
|
||||
{
|
||||
path: "/play/:rom",
|
||||
component: () => import("@/components/Details/Emulation.vue"),
|
||||
component: () => import("@/views/Play/Base.vue"),
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
@@ -21,6 +21,24 @@ async function deletePlatformBindConfig({
|
||||
return api.delete(`/config/system/platforms/${fsSlug}`);
|
||||
}
|
||||
|
||||
async function addPlatformVersionConfig({
|
||||
fsSlug,
|
||||
slug,
|
||||
}: {
|
||||
fsSlug: string;
|
||||
slug: string;
|
||||
}): Promise<{ data: MessageResponse }> {
|
||||
return api.post("/config/system/versions", { fs_slug: fsSlug, slug: slug });
|
||||
}
|
||||
|
||||
async function deletePlatformVersionConfig({
|
||||
fsSlug,
|
||||
}: {
|
||||
fsSlug: string;
|
||||
}): Promise<{ data: MessageResponse }> {
|
||||
return api.delete(`/config/system/versions/${fsSlug}`);
|
||||
}
|
||||
|
||||
async function addExclusion({
|
||||
exclude,
|
||||
exclusion,
|
||||
@@ -37,5 +55,7 @@ async function addExclusion({
|
||||
export default {
|
||||
addPlatformBindConfig,
|
||||
deletePlatformBindConfig,
|
||||
addPlatformVersionConfig,
|
||||
deletePlatformVersionConfig,
|
||||
addExclusion,
|
||||
};
|
||||
|
||||
@@ -15,6 +15,19 @@ async function uploadSaves({ rom, saves }: { rom: Rom; saves: File[] }) {
|
||||
});
|
||||
}
|
||||
|
||||
async function updateSave({
|
||||
save,
|
||||
file,
|
||||
}: {
|
||||
save: SaveSchema;
|
||||
file: File;
|
||||
}): Promise<{ data: SaveSchema }> {
|
||||
var formData = new FormData();
|
||||
formData.append("file", file);
|
||||
|
||||
return api.put(`/saves/${save.id}`, formData);
|
||||
}
|
||||
|
||||
async function deleteSaves({
|
||||
saves,
|
||||
deleteFromFs,
|
||||
@@ -30,5 +43,6 @@ async function deleteSaves({
|
||||
|
||||
export default {
|
||||
deleteSaves,
|
||||
updateSave,
|
||||
uploadSaves,
|
||||
};
|
||||
|
||||
@@ -17,5 +17,11 @@ export default defineStore("config", {
|
||||
removePlatformBinding(fsSlug: string) {
|
||||
delete this.value.PLATFORMS_BINDING[fsSlug];
|
||||
},
|
||||
addPlatformVersion(fsSlug: string, slug: string) {
|
||||
this.value.PLATFORMS_VERSIONS[fsSlug] = slug;
|
||||
},
|
||||
removePlatformVersion(fsSlug: string) {
|
||||
delete this.value.PLATFORMS_VERSIONS[fsSlug];
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
8
frontend/src/types/emitter.d.ts
vendored
8
frontend/src/types/emitter.d.ts
vendored
@@ -30,6 +30,14 @@ export type Events = {
|
||||
fsSlug: string;
|
||||
slug: string;
|
||||
};
|
||||
showCreatePlatformVersionDialog: {
|
||||
fsSlug: string;
|
||||
slug: string;
|
||||
};
|
||||
showDeletePlatformVersionDialog: {
|
||||
fsSlug: string;
|
||||
slug: string;
|
||||
};
|
||||
showCreateExclusionDialog: { exclude: string };
|
||||
showCreateUserDialog: null;
|
||||
showEditUserDialog: UserItem;
|
||||
|
||||
20
frontend/src/types/main.d.ts
vendored
20
frontend/src/types/main.d.ts
vendored
@@ -3,23 +3,3 @@ declare module "*.vue" {
|
||||
const Component: ReturnType<typeof defineComponent>;
|
||||
export default Component;
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
EJS_player: string;
|
||||
EJS_pathtodata: string;
|
||||
EJS_color: string;
|
||||
EJS_defaultOptions: object;
|
||||
EJS_gameID: number;
|
||||
EJS_gameName: string;
|
||||
EJS_backgroundImage: string;
|
||||
EJS_gameUrl: string;
|
||||
EJS_loadStateURL: string;
|
||||
EJS_cheats: string;
|
||||
EJS_gamePatchUrl: string;
|
||||
EJS_netplayServer: string;
|
||||
EJS_onGameStart: () => void;
|
||||
EJS_onSaveState: (args: { screenshot: File, state: File}) => void;
|
||||
EJS_onLoadState: () => void;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,124 +1,51 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from "vue";
|
||||
import { useRoute } from "vue-router";
|
||||
import romApi from "@/services/api/rom";
|
||||
import stateApi from "@/services/api/state";
|
||||
import { onMounted, ref } from "vue";
|
||||
import type { Rom } from "@/stores/roms";
|
||||
import type { SaveSchema, StateSchema } from "@/__generated__";
|
||||
import { formatBytes } from "@/utils";
|
||||
import romApi from "@/services/api/rom";
|
||||
import { useRoute } from "vue-router";
|
||||
import Player from "@/views/Play/Player.vue";
|
||||
|
||||
const route = useRoute();
|
||||
const rom = ref<Rom | null>(null);
|
||||
const saveRef = ref<SaveSchema | null>(null);
|
||||
const stateRef = ref<StateSchema | null>(null);
|
||||
const gameRunning = ref(false);
|
||||
const gameWindow = ref(9);
|
||||
|
||||
const EXTENSION_REGEX = new RegExp("\.(([a-z]+\.)*)$");
|
||||
|
||||
const script = document.createElement("script");
|
||||
script.src = "/assets/emulatorjs/loader.js";
|
||||
script.async = true;
|
||||
window.EJS_player = "#game";
|
||||
window.EJS_pathtodata = "/assets/emulatorjs/";
|
||||
window.EJS_color = "#A453FF";
|
||||
window.EJS_alignStartButton = "center";
|
||||
window.EJS_startOnLoaded = true;
|
||||
window.EJS_fullscreenOnLoaded = true;
|
||||
window.EJS_defaultOptions = {
|
||||
"save-state-location": "browser",
|
||||
};
|
||||
|
||||
function buildStateName(rom: Rom): string {
|
||||
const states = rom.states.map((s) => s.file_name);
|
||||
const romName = rom.file_name.replace(EXTENSION_REGEX, "").trim();
|
||||
let stateName = `${romName}.state.auto`;
|
||||
if (!states.includes(stateName)) return stateName;
|
||||
|
||||
let i = 1;
|
||||
stateName = `${romName}.state1`;
|
||||
while (states.includes(stateName)) {
|
||||
i++;
|
||||
stateName = `${romName}.state${i}`;
|
||||
}
|
||||
|
||||
return stateName;
|
||||
}
|
||||
|
||||
window.EJS_onSaveState = function ({
|
||||
state,
|
||||
}: {
|
||||
screenshot: File;
|
||||
state: File;
|
||||
}) {
|
||||
if (window.EJS_emulator.saveInBrowserSupported()) {
|
||||
window.EJS_emulator.storage.states.put(
|
||||
window.EJS_emulator.getBaseFileName() + ".state",
|
||||
state
|
||||
);
|
||||
window.EJS_emulator.displayMessage(
|
||||
window.EJS_emulator.localization("SAVE SAVED TO BROWSER")
|
||||
);
|
||||
}
|
||||
if (stateRef.value) {
|
||||
stateApi
|
||||
.updateState({
|
||||
state: stateRef.value,
|
||||
file: new File([state], stateRef.value.file_name, {
|
||||
type: "application/octet-stream",
|
||||
}),
|
||||
})
|
||||
.then(({ data }) => {
|
||||
stateRef.value = data;
|
||||
});
|
||||
} else if (rom.value) {
|
||||
stateApi
|
||||
.uploadStates({
|
||||
rom: rom.value,
|
||||
states: [
|
||||
new File([state], buildStateName(rom.value), {
|
||||
type: "application/octet-stream",
|
||||
}),
|
||||
],
|
||||
})
|
||||
.then(({ data }) => {
|
||||
if (rom.value) rom.value.states = data.states;
|
||||
stateRef.value = data.states.pop();
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
window.EJS_onGameStart = () => {};
|
||||
|
||||
onMounted(() => {
|
||||
romApi
|
||||
.getRom({ romId: parseInt(route.params.rom as string) })
|
||||
.then((response) => {
|
||||
rom.value = response.data;
|
||||
window.EJS_core = rom.value.platform_slug;
|
||||
window.EJS_gameID = rom.value.id;
|
||||
window.EJS_gameName = rom.value.name;
|
||||
window.EJS_backgroundImage = `/assets/romm/resources/${rom.value.path_cover_l}`;
|
||||
window.EJS_gameUrl = rom.value.download_path;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log(error);
|
||||
}).finally(() => {
|
||||
const wrapper = document.getElementById("game-wrapper");
|
||||
if (wrapper) wrapper.style.backgroundImage = `url(${window.EJS_backgroundImage})`;
|
||||
});
|
||||
});
|
||||
|
||||
function onPlay() {
|
||||
gameWindow.value = 12;
|
||||
gameRunning.value = true;
|
||||
window.EJS_loadStateURL = stateRef.value?.download_path ?? null;
|
||||
document.body.appendChild(script);
|
||||
gameRunning.value = true;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-row no-gutters >
|
||||
<v-col v-if="rom && !gameRunning" cols="3" class="px-3">
|
||||
<v-img class="mx-auto mt-6 mb-5" width="250" src="/assets/powered_by_emulatorjs.png" />
|
||||
<v-select
|
||||
<v-row v-if="rom" no-gutters>
|
||||
<v-col v-if="!gameRunning" cols="3" class="px-3">
|
||||
<v-img
|
||||
class="mx-auto mt-6 mb-5"
|
||||
width="250"
|
||||
src="/assets/powered_by_emulatorjs.png"
|
||||
/>
|
||||
<!-- <v-select
|
||||
class="my-1"
|
||||
hide-details
|
||||
variant="outlined"
|
||||
@@ -126,13 +53,12 @@ function onPlay() {
|
||||
disabled
|
||||
label="BIOS"
|
||||
:items="['gba-bios.zip']"
|
||||
/>
|
||||
/> -->
|
||||
<v-select
|
||||
class="my-1"
|
||||
hide-details
|
||||
variant="outlined"
|
||||
clearable
|
||||
disabled
|
||||
label="Save"
|
||||
v-model="saveRef"
|
||||
:items="
|
||||
@@ -158,7 +84,7 @@ function onPlay() {
|
||||
}))
|
||||
"
|
||||
/>
|
||||
<v-select
|
||||
<!-- <v-select
|
||||
class="my-1"
|
||||
hide-details
|
||||
variant="outlined"
|
||||
@@ -169,7 +95,7 @@ function onPlay() {
|
||||
'Advance Wars Balance (AW1) by Kartal',
|
||||
'War Room Sturm (AW1) by Kartal',
|
||||
]"
|
||||
/>
|
||||
/> -->
|
||||
<v-btn
|
||||
class="mt-4"
|
||||
block
|
||||
@@ -182,32 +108,16 @@ function onPlay() {
|
||||
</v-btn>
|
||||
</v-col>
|
||||
|
||||
<v-col class="my-4 bg-primary" :cols="gameWindow" rounded id="game-wrapper">
|
||||
<v-img v-if="!gameRunning" :src="`/assets/romm/resources/${rom?.path_cover_l}`" />
|
||||
<div id="game"></div>
|
||||
<v-col class="my-4 bg-primary" rounded id="game-wrapper">
|
||||
<player :rom="rom" :state="stateRef" :save="saveRef" />
|
||||
</v-col>
|
||||
</v-row>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
div.ejs_game {
|
||||
background-color: #191d22;
|
||||
}
|
||||
#game-wrapper {
|
||||
aspect-ratio: 16 / 9;
|
||||
background-size: contain;
|
||||
background-position: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- Other config options: https://emulatorjs.org/docs/Options.html -->
|
||||
|
||||
<!-- config.biosUrl = window.EJS_biosUrl; -->
|
||||
<!-- config.VirtualGamepadSettings = window.EJS_VirtualGamepadSettings; -->
|
||||
<!-- config.buttonOpts = window.EJS_Buttons; -->
|
||||
<!-- config.volume = window.EJS_volume; -->
|
||||
<!-- config.defaultControllers = window.EJS_defaultControls; -->
|
||||
<!-- config.cheats = window.EJS_cheats; -->
|
||||
<!-- config.defaultOptions = window.EJS_defaultOptions; -->
|
||||
<!-- config.gamePatchUrl = window.EJS_gamePatchUrl; -->
|
||||
<!-- config.gameParentUrl = window.EJS_gameParentUrl; -->
|
||||
<!-- config.netplayUrl = window.EJS_netplayServer; -->
|
||||
<!-- config.threads = window.EJS_threads; -->
|
||||
|
||||
254
frontend/src/views/Play/Player.vue
Normal file
254
frontend/src/views/Play/Player.vue
Normal file
@@ -0,0 +1,254 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import stateApi from "@/services/api/state";
|
||||
import saveApi, { saveApi as api } from "@/services/api/save";
|
||||
import type { Rom } from "@/stores/roms";
|
||||
import type { SaveSchema, StateSchema } from "@/__generated__";
|
||||
|
||||
const props = defineProps<{
|
||||
rom: Rom;
|
||||
save: SaveSchema | null;
|
||||
state: StateSchema | null;
|
||||
}>();
|
||||
const saveRef = ref<SaveSchema | null>(props.save);
|
||||
const stateRef = ref<StateSchema | null>(props.state);
|
||||
|
||||
// Uses a different regex for jaavscript
|
||||
const EXTENSION_REGEX = new RegExp("\.(([a-z]+\.)*)$");
|
||||
|
||||
// Declare global variables for EmulatorJS
|
||||
declare global {
|
||||
interface Window {
|
||||
EJS_core: string;
|
||||
EJS_player: string;
|
||||
EJS_pathtodata: string;
|
||||
EJS_color: string;
|
||||
EJS_defaultOptions: object;
|
||||
EJS_gameID: number;
|
||||
EJS_gameName: string;
|
||||
EJS_backgroundImage: string;
|
||||
EJS_gameUrl: string;
|
||||
EJS_loadStateURL: string | null;
|
||||
EJS_cheats: string;
|
||||
EJS_gamePatchUrl: string;
|
||||
EJS_netplayServer: string;
|
||||
EJS_alignStartButton: string;
|
||||
EJS_startOnLoaded: boolean;
|
||||
EJS_fullscreenOnLoaded: boolean;
|
||||
EJS_emulator: any;
|
||||
EJS_onGameStart: () => void;
|
||||
EJS_onSaveState: (args: { screenshot: File; state: File }) => void;
|
||||
EJS_onLoadState: () => void;
|
||||
EJS_onSaveSave: (args: { screenshot: File; save: File }) => void;
|
||||
EJS_onLoadSave: () => void;
|
||||
}
|
||||
}
|
||||
|
||||
window.EJS_core = props.rom.platform_slug;
|
||||
window.EJS_gameID = props.rom.id;
|
||||
window.EJS_backgroundImage =
|
||||
props.rom.url_screenshots[0] ||
|
||||
`/assets/romm/resources/${props.rom.path_cover_l}`;
|
||||
window.EJS_gameUrl = props.rom.download_path;
|
||||
window.EJS_player = "#game";
|
||||
window.EJS_pathtodata = "/assets/emulatorjs/";
|
||||
window.EJS_color = "#A453FF";
|
||||
window.EJS_alignStartButton = "center";
|
||||
window.EJS_startOnLoaded = true;
|
||||
window.EJS_fullscreenOnLoaded = false;
|
||||
window.EJS_defaultOptions = { "save-state-location": "browser" };
|
||||
if (props.rom.name) window.EJS_gameName = props.rom.name;
|
||||
|
||||
function buildStateName(): string {
|
||||
const states = props.rom.states.map((s) => s.file_name);
|
||||
const romName = props.rom.file_name.replace(EXTENSION_REGEX, "").trim();
|
||||
let stateName = `${romName}.state.auto`;
|
||||
if (!states.includes(stateName)) return stateName;
|
||||
|
||||
let i = 1;
|
||||
stateName = `${romName}.state1`;
|
||||
while (states.includes(stateName)) {
|
||||
i++;
|
||||
stateName = `${romName}.state${i}`;
|
||||
}
|
||||
|
||||
return stateName;
|
||||
}
|
||||
|
||||
function buildSaveName(): string {
|
||||
const saves = props.rom.saves.map((s) => s.file_name);
|
||||
const romName = props.rom.file_name.replace(EXTENSION_REGEX, "").trim();
|
||||
let saveName = `${romName}.srm`;
|
||||
if (!saves.includes(saveName)) return saveName;
|
||||
|
||||
let i = 2;
|
||||
saveName = `${romName} (${i}).srm`;
|
||||
while (saves.includes(saveName)) {
|
||||
i++;
|
||||
saveName = `${romName} (${i}).srm`;
|
||||
}
|
||||
|
||||
return saveName;
|
||||
}
|
||||
|
||||
async function fetchState(): Promise<Uint8Array> {
|
||||
if (stateRef.value) {
|
||||
const { data } = await api.get(
|
||||
stateRef.value.download_path.replace("/api", ""),
|
||||
{ responseType: "arraybuffer" }
|
||||
);
|
||||
return new Uint8Array(data);
|
||||
} else if (window.EJS_emulator.saveInBrowserSupported()) {
|
||||
const data = await window.EJS_emulator.storage.states.get(
|
||||
window.EJS_emulator.getBaseFileName() + ".state"
|
||||
);
|
||||
return data;
|
||||
}
|
||||
return new Uint8Array();
|
||||
}
|
||||
|
||||
window.EJS_onLoadState = async function () {
|
||||
const stat = await fetchState();
|
||||
window.EJS_emulator.gameManager.loadState(stat);
|
||||
window.EJS_emulator.displayMessage("LOADED FROM ROMM");
|
||||
};
|
||||
|
||||
window.EJS_onSaveState = function ({
|
||||
state,
|
||||
}: {
|
||||
screenshot: File;
|
||||
state: File;
|
||||
}) {
|
||||
if (window.EJS_emulator.saveInBrowserSupported()) {
|
||||
window.EJS_emulator.storage.states.put(
|
||||
window.EJS_emulator.getBaseFileName() + ".state",
|
||||
state
|
||||
);
|
||||
window.EJS_emulator.displayMessage("SAVED TO ROMM");
|
||||
}
|
||||
if (stateRef.value) {
|
||||
stateApi
|
||||
.updateState({
|
||||
state: stateRef.value,
|
||||
file: new File([state], stateRef.value.file_name, {
|
||||
type: "application/octet-stream",
|
||||
}),
|
||||
})
|
||||
.then(({ data }) => {
|
||||
stateRef.value = data;
|
||||
});
|
||||
} else if (props.rom) {
|
||||
stateApi
|
||||
.uploadStates({
|
||||
rom: props.rom,
|
||||
states: [
|
||||
new File([state], buildStateName(), {
|
||||
type: "application/octet-stream",
|
||||
}),
|
||||
],
|
||||
})
|
||||
.then(({ data }) => {
|
||||
const allStates = data.states.sort(
|
||||
(a: StateSchema, b: StateSchema) => a.id - b.id
|
||||
);
|
||||
if (props.rom) props.rom.states = allStates;
|
||||
stateRef.value = allStates.pop() ?? null;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
async function fetchSave(): Promise<Uint8Array> {
|
||||
if (saveRef.value) {
|
||||
const { data } = await api.get(
|
||||
saveRef.value.download_path.replace("/api", ""),
|
||||
{ responseType: "arraybuffer" }
|
||||
);
|
||||
return new Uint8Array(data);
|
||||
}
|
||||
|
||||
const file = await window.EJS_emulator.selectFile();
|
||||
return new Uint8Array(await file.arrayBuffer());
|
||||
}
|
||||
|
||||
window.EJS_onLoadSave = async function () {
|
||||
const sav = await fetchSave();
|
||||
const FS = window.EJS_emulator.Module.FS;
|
||||
const path = window.EJS_emulator.gameManager.getSaveFilePath();
|
||||
const paths = path.split("/");
|
||||
let cp = "";
|
||||
for (let i = 0; i < paths.length - 1; i++) {
|
||||
if (paths[i] === "") continue;
|
||||
cp += "/" + paths[i];
|
||||
if (!FS.analyzePath(cp).exists) FS.mkdir(cp);
|
||||
}
|
||||
if (FS.analyzePath(path).exists) FS.unlink(path);
|
||||
FS.writeFile(path, sav);
|
||||
window.EJS_emulator.gameManager.loadSaveFiles();
|
||||
};
|
||||
|
||||
window.EJS_onSaveSave = function ({ save }: { screenshot: File; save: File }) {
|
||||
if (saveRef.value) {
|
||||
saveApi
|
||||
.updateSave({
|
||||
save: saveRef.value,
|
||||
file: new File([save], saveRef.value.file_name, {
|
||||
type: "application/octet-stream",
|
||||
}),
|
||||
})
|
||||
.then(({ data }) => {
|
||||
saveRef.value = data;
|
||||
});
|
||||
} else if (props.rom) {
|
||||
saveApi
|
||||
.uploadSaves({
|
||||
rom: props.rom,
|
||||
saves: [
|
||||
new File([save], buildSaveName(), {
|
||||
type: "application/octet-stream",
|
||||
}),
|
||||
],
|
||||
})
|
||||
.then(({ data }) => {
|
||||
const allSaves = data.saves.sort(
|
||||
(a: SaveSchema, b: SaveSchema) => a.id - b.id
|
||||
);
|
||||
if (props.rom) props.rom.saves = allSaves;
|
||||
saveRef.value = allSaves.pop() ?? null;
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
window.EJS_onGameStart = async () => {
|
||||
saveRef.value = props.save;
|
||||
stateRef.value = props.state;
|
||||
|
||||
setTimeout(() => {
|
||||
if (stateRef.value) window.EJS_onLoadState();
|
||||
if (saveRef.value) window.EJS_onLoadSave();
|
||||
}, 10);
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div id="game"></div>
|
||||
</template>
|
||||
|
||||
<style>
|
||||
div.ejs_game {
|
||||
background-color: #191d22;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- Other config options: https://emulatorjs.org/docs/Options.html -->
|
||||
|
||||
<!-- config.biosUrl = window.EJS_biosUrl; -->
|
||||
<!-- config.VirtualGamepadSettings = window.EJS_VirtualGamepadSettings; -->
|
||||
<!-- config.buttonOpts = window.EJS_Buttons; -->
|
||||
<!-- config.volume = window.EJS_volume; -->
|
||||
<!-- config.defaultControllers = window.EJS_defaultControls; -->
|
||||
<!-- config.cheats = window.EJS_cheats; -->
|
||||
<!-- config.defaultOptions = window.EJS_defaultOptions; -->
|
||||
<!-- config.gamePatchUrl = window.EJS_gamePatchUrl; -->
|
||||
<!-- config.gameParentUrl = window.EJS_gameParentUrl; -->
|
||||
<!-- config.netplayUrl = window.EJS_netplayServer; -->
|
||||
<!-- config.threads = window.EJS_threads; -->
|
||||
@@ -1,9 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import ExclusionsCard from "@/components/Settings/Config/ExclusionsCard.vue";
|
||||
import PlatformBinding from "@/components/Settings/Config/PlatformBindingCard.vue";
|
||||
import PlatformVersions from "@/components/Settings/Config/PlatformVersionsCard.vue";
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<platform-binding />
|
||||
<platform-versions />
|
||||
<exclusions-card class="mt-1" />
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user