Merge branch 'master' into docs/update_changelog_v2.2.0

This commit is contained in:
Zurdi
2023-12-29 18:11:39 +01:00
committed by GitHub
95 changed files with 558 additions and 146 deletions

View File

@@ -8,6 +8,7 @@ load_dotenv()
# UVICORN
DEV_PORT: Final = int(os.environ.get("VITE_BACKEND_DEV_PORT", "5000"))
DEV_HOST: Final = "0.0.0.0"
ROMM_HOST: Final = os.environ.get("ROMM_HOST", DEV_HOST)
# PATHS
ROMM_BASE_PATH: Final = os.environ.get("ROMM_BASE_PATH", "/romm")

View File

@@ -21,6 +21,7 @@ from logger.logger import log
class ConfigLoader:
# 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()
@@ -76,6 +77,7 @@ class ConfigLoader:
self.config["PLATFORMS_BINDING"] = pydash.get(
self.config, "system.platforms", {}
)
log.info(f"Config loaded successfully from {self.config_path}")
config = ConfigLoader().config

View File

@@ -4,9 +4,64 @@ from typing import Optional
from handler import dbh
from utils.oauth import protected_route
from config import ROMM_HOST
router = APIRouter()
WEBRCADE_SUPPORTED_PLATFORM_SLUGS = [
"3do",
"arcade",
"atari2600",
"atari5200",
"atari7800",
"lynx",
"wonderswan",
"wonderswan-color",
"colecovision",
"turbografx16--1",
"turbografx-16-slash-pc-engine-cd",
"supergrafx",
"pc-fx",
"nes",
"n64",
"snes",
"gb",
"gba",
"gbc",
"virtualboy",
"sg1000",
"sms",
"genesis-slash-megadrive",
"segacd",
"gamegear",
"neo-geo-cd",
"neogeoaes",
"neogeomvs",
"neo-geo-pocket",
"neo-geo-pocket-color",
"ps",
]
WEBRCADE_SLUG_TO_TYPE_MAP = {
"atari2600": "2600",
"atari5200": "5200",
"atari7800": "7800",
"lynx": "lnx",
"turbografx16--1": "pce",
"turbografx-16-slash-pc-engine-cd": "pce",
"supergrafx": "sgx",
"pc-fx": "pcfx",
"virtualboy": "vb",
"genesis-slash-megadrive": "genesis",
"gamegear": "gg",
"neogeoaes": "neogeo",
"neogeomvs": "neogeo",
"neo-geo-cd": "neogeocd",
"neo-geo-pocket": "ngp",
"neo-geo-pocket-color": "ngc",
"ps": "psx",
}
class PlatformSchema(BaseModel):
slug: str
@@ -25,3 +80,40 @@ class PlatformSchema(BaseModel):
def platforms(request: Request) -> list[PlatformSchema]:
"""Returns platforms data"""
return dbh.get_platforms()
@protected_route(router.get, "/platforms/webrcade/feed", [])
def platforms_webrcade_feed(request: Request):
"""Returns platforms data"""
platforms = dbh.get_platforms()
with dbh.session.begin() as session:
return {
"title": "RomM Feed",
"longTitle": "Custom RomM Feed",
"description": "Custom feed from your RomM library",
"thumbnail": "https://raw.githubusercontent.com/zurdi15/romm/f2dd425d87ad8e21bf47f8258ae5dcf90f56fbc2/frontend/assets/isotipo.svg",
"background": "https://raw.githubusercontent.com/zurdi15/romm/release/.github/screenshots/gallery.png",
"categories": [
{
"title": p.name,
"longTitle": f"{p.name} Games",
"background": f"{ROMM_HOST}/assets/webrcade/feed/{p.slug.lower()}-background.png",
"thumbnail": f"{ROMM_HOST}/assets/webrcade/feed/{p.slug.lower()}-thumb.png",
"description": "",
"items": [
{
"title": rom.name,
"description": rom.summary,
"type": WEBRCADE_SLUG_TO_TYPE_MAP.get(p.slug, p.slug),
"thumbnail": f"{ROMM_HOST}/assets/romm/resources/{rom.path_cover_s}",
"background": f"{ROMM_HOST}/assets/romm/resources/{rom.path_cover_l}",
"props": {"rom": f"{ROMM_HOST}{rom.download_path}"},
}
for rom in session.scalars(dbh.get_roms(p.slug)).all()
],
}
for p in platforms
if p.slug in WEBRCADE_SUPPORTED_PLATFORM_SLUGS
],
}

View File

@@ -9,32 +9,19 @@ client = TestClient(app)
def test_heartbeat():
response = client.get("/heartbeat")
assert response.status_code == 200
assert response.json() == {
"VERSION" : get_version(),
"ROMM_AUTH_ENABLED": True,
"WATCHER": {
"ENABLED": True,
"TITLE": "Rescan on filesystem change",
"MESSAGE": "Runs a scan when a change is detected in the library path, with a 5 minute delay",
},
"SCHEDULER": {
"RESCAN": {
"ENABLED": True,
"CRON": "0 3 * * *",
"TITLE": "Scheduled rescan",
"MESSAGE": "Rescans the entire library",
},
"SWITCH_TITLEDB": {
"ENABLED": True,
"CRON": "0 4 * * *",
"TITLE": "Scheduled Switch TitleDB update",
"MESSAGE": "Updates the Nintedo Switch TitleDB file",
},
"MAME_XML": {
"ENABLED": True,
"CRON": "0 5 * * *",
"TITLE": "Scheduled MAME XML update",
"MESSAGE": "Updates the MAME XML file",
},
},
}
heartbeat = response.json()
assert heartbeat.get('VERSION') == get_version()
assert heartbeat.get('ROMM_AUTH_ENABLED') == True
assert heartbeat.get('WATCHER').get('ENABLED') == True
assert heartbeat.get('WATCHER').get('TITLE') == "Rescan on filesystem change"
assert heartbeat.get('SCHEDULER').get('RESCAN').get('ENABLED') == True
assert heartbeat.get('SCHEDULER').get('RESCAN').get('CRON') == "0 3 * * *"
assert heartbeat.get('SCHEDULER').get('RESCAN').get('TITLE') == "Scheduled rescan"
assert heartbeat.get('SCHEDULER').get('SWITCH_TITLEDB').get('ENABLED') == True
assert heartbeat.get('SCHEDULER').get('SWITCH_TITLEDB').get('CRON') == "0 4 * * *"
assert heartbeat.get('SCHEDULER').get('SWITCH_TITLEDB').get('TITLE') == "Scheduled Switch TitleDB update"
assert heartbeat.get('SCHEDULER').get('MAME_XML').get('ENABLED') == True
assert heartbeat.get('SCHEDULER').get('MAME_XML').get('CRON') == "0 5 * * *"
assert heartbeat.get('SCHEDULER').get('MAME_XML').get('TITLE') == "Scheduled MAME XML update"
assert heartbeat.get('CONFIG').get('EXCLUDED_MULTI_FILES') == []
assert heartbeat.get('CONFIG').get('EXCLUDED_SINGLE_EXT') == []

View File

@@ -13,7 +13,7 @@ from typing import Final
from typing_extensions import TypedDict
from config import IGDB_CLIENT_ID, IGDB_CLIENT_SECRET, DEFAULT_URL_COVER_L
from utils import get_file_name_with_no_tags as get_search_term
from utils import get_file_name_with_no_tags as get_search_term, normalize_search_term
from logger.logger import log
from utils.cache import cache
from tasks.update_switch_titledb import update_switch_titledb_task
@@ -162,6 +162,85 @@ class IGDBHandler:
if "url" in r.keys()
]
@staticmethod
def _ps2_opl_format(match: re.Match[str]) -> str:
serial_code = match.group(1)
with open(PS2_OPL_INDEX_FILE, "r") as index_json:
opl_index = json.loads(index_json.read())
index_entry = opl_index.get(serial_code, None)
if index_entry:
search_term = index_entry["Name"] # type: ignore
return search_term
@staticmethod
async def _switch_titledb_format(match: re.Match[str]) -> str:
title_id = match.group(1)
titledb_index = {}
try:
with open(SWITCH_TITLEDB_INDEX_FILE, "r") as index_json:
titledb_index = json.loads(index_json.read())
except FileNotFoundError:
log.warning("Fetching the Switch titleDB index file...")
await update_switch_titledb_task.run(force=True)
try:
with open(SWITCH_TITLEDB_INDEX_FILE, "r") as index_json:
titledb_index = json.loads(index_json.read())
except FileNotFoundError:
log.error("Could not fetch the Switch titleDB index file")
finally:
index_entry = titledb_index.get(title_id, None)
if index_entry:
search_term = index_entry["name"] # type: ignore
return search_term
@staticmethod
async def _switch_productid_format(match: re.Match[str]) -> str:
product_id = match.group(1)
product_id_index = {}
try:
with open(SWITCH_PRODUCT_ID_FILE, "r") as index_json:
product_id_index = json.loads(index_json.read())
except FileNotFoundError:
log.warning("Fetching the Switch titleDB index file...")
await update_switch_titledb_task.run(force=True)
try:
with open(SWITCH_PRODUCT_ID_FILE, "r") as index_json:
product_id_index = json.loads(index_json.read())
except FileNotFoundError:
log.error("Could not fetch the Switch titleDB index file")
finally:
index_entry = product_id_index.get(product_id, None)
if index_entry:
search_term = index_entry["name"] # type: ignore
return search_term
@staticmethod
async def _mame_format(search_term: str) -> str:
mame_index = {"menu": {"game": []}}
try:
with open(MAME_XML_FILE, "r") as index_xml:
mame_index = xmltodict.parse(index_xml.read())
except FileNotFoundError:
log.warning("Fetching the MAME XML file from HyperspinFE...")
await update_mame_xml_task.run(force=True)
try:
with open(MAME_XML_FILE, "r") as index_xml:
mame_index = xmltodict.parse(index_xml.read())
except FileNotFoundError:
log.error("Could not fetch the MAME XML file from HyperspinFE")
finally:
index_entry = [
game
for game in mame_index["menu"]["game"]
if game["@name"] == search_term
]
if index_entry:
# Run through get_search_term to remove tags
search_term = get_search_term(
index_entry[0].get("description", search_term)
)
return search_term
@check_twitch_token
def get_platform(self, slug: str) -> IGDBPlatformType:
platforms = self._request(
@@ -182,96 +261,26 @@ class IGDBHandler:
async def get_rom(self, file_name: str, platform_idgb_id: int) -> IGDBRomType:
search_term = get_search_term(file_name)
# Patch support for PS2 OPL flename format
# Support for PS2 OPL filename format
match = re.match(PS2_OPL_REGEX, file_name)
if platform_idgb_id == PS2_IGDB_ID and match:
serial_code = match.group(1)
self._ps2_opl_format(match)
with open(PS2_OPL_INDEX_FILE, "r") as index_json:
opl_index = json.loads(index_json.read())
index_entry = opl_index.get(serial_code, None)
if index_entry:
search_term = index_entry["Name"] # type: ignore
# Patch support for switch titleID filename format
# Support for switch titleID filename format
match = re.match(SWITCH_TITLEDB_REGEX, file_name)
if platform_idgb_id == SWITCH_IGDB_ID and match:
title_id = match.group(1)
titledb_index = {}
try:
with open(SWITCH_TITLEDB_INDEX_FILE, "r") as index_json:
titledb_index = json.loads(index_json.read())
except FileNotFoundError:
log.warning("Fetching the Switch titleDB index file...")
await update_switch_titledb_task.run(force=True)
try:
with open(SWITCH_TITLEDB_INDEX_FILE, "r") as index_json:
titledb_index = json.loads(index_json.read())
except FileNotFoundError:
log.error("Could not fetch the Switch titleDB index file")
finally:
index_entry = titledb_index.get(title_id, None)
if index_entry:
search_term = index_entry["name"] # type: ignore
self._switch_titledb_format(match)
# Support for switch productID filename format
match = re.search(SWITCH_PRODUCT_ID_REGEX, file_name)
if platform_idgb_id == SWITCH_IGDB_ID and match:
product_id = match.group(1)
product_id_index = {}
try:
with open(SWITCH_PRODUCT_ID_FILE, "r") as index_json:
product_id_index = json.loads(index_json.read())
except FileNotFoundError:
log.warning("Fetching the Switch titleDB index file...")
await update_switch_titledb_task.run(force=True)
try:
with open(SWITCH_PRODUCT_ID_FILE, "r") as index_json:
product_id_index = json.loads(index_json.read())
except FileNotFoundError:
log.error("Could not fetch the Switch titleDB index file")
finally:
index_entry = product_id_index.get(product_id, None)
if index_entry:
search_term = index_entry["name"] # type: ignore
self._switch_productid_format(match)
# Support for MAME arcade filename format
if platform_idgb_id in ARCADE_IGDB_IDS:
mame_index = {"menu": {"game": []}}
self._mame_format(search_term)
try:
with open(MAME_XML_FILE, "r") as index_xml:
mame_index = xmltodict.parse(index_xml.read())
except FileNotFoundError:
log.warning("Fetching the MAME XML file from HyperspinFE...")
await update_mame_xml_task.run(force=True)
try:
with open(MAME_XML_FILE, "r") as index_xml:
mame_index = xmltodict.parse(index_xml.read())
except FileNotFoundError:
log.error("Could not fetch the MAME XML file from HyperspinFE")
finally:
index_entry = [
game
for game in mame_index["menu"]["game"]
if game["@name"] == search_term
]
if index_entry:
# Run through get_search_term to remove tags
search_term = get_search_term(index_entry[0].get("description", search_term))
search_term = (
search_term.replace("\u2122", "") # Remove trademark symbol
.replace("\u00ae", "") # Remove registered symbol
.replace("\u00a9", "") # Remove copywrite symbol
.replace("\u2120", "") # Remove service mark symbol
.strip() # Remove leading and trailing spaces
)
search_term = normalize_search_term(search_term)
res = (
self._search_rom(uc(search_term), platform_idgb_id, MAIN_GAME_CATEGORY)

View File

@@ -31,6 +31,7 @@ from utils.auth import (
create_default_admin_user,
)
from utils import get_version
from config.config_loader import config
app = FastAPI(title="RomM API", version="0.1.0")
@@ -106,6 +107,7 @@ def heartbeat():
"MESSAGE": "Updates the MAME XML file",
},
},
"CONFIG": config
}

View File

@@ -114,6 +114,16 @@ def get_file_name_with_no_tags(file_name: str) -> str:
return re.sub(TAG_REGEX, "", file_name_no_extension).strip()
def normalize_search_term(search_term: str) -> str:
return (
search_term.replace("\u2122", "") # Remove trademark symbol
.replace("\u00ae", "") # Remove registered symbol
.replace("\u00a9", "") # Remove copywrite symbol
.replace("\u2120", "") # Remove service mark symbol
.strip() # Remove leading and trailing spaces
)
def get_file_extension(rom: dict) -> str:
return (
re.search(EXTENSION_REGEX, rom["file_name"]).group(1)

0
backend/worker.py Executable file → Normal file
View File

View File

@@ -11,6 +11,7 @@ ARG WEBSERVER_FOLDER=/var/www/html
COPY --from=front-build-stage /front/dist ${WEBSERVER_FOLDER}
COPY ./frontend/assets/default_avatar.png ${WEBSERVER_FOLDER}/assets/
COPY ./frontend/assets/platforms ${WEBSERVER_FOLDER}/assets/platforms
COPY ./frontend/assets/webrcade/feed ${WEBSERVER_FOLDER}/assets/webrcade/feed
RUN mkdir -p ${WEBSERVER_FOLDER}/assets/romm && \
ln -s /romm/library ${WEBSERVER_FOLDER}/assets/romm/library && \
ln -s /romm/resources ${WEBSERVER_FOLDER}/assets/romm/resources

View File

@@ -62,6 +62,9 @@ http {
location / {
try_files $uri $uri/ /index.html;
proxy_redirect off;
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods *;
add_header Access-Control-Allow-Headers *;
}
# OpenAPI for swagger and redoc

View File

@@ -1,5 +1,6 @@
ROMM_BASE_PATH=/path/to/romm_mock
VITE_BACKEND_DEV_PORT=5000
ROMM_HOST=localhost
# IGDB credentials
IGDB_CLIENT_ID=

View File

@@ -0,0 +1,8 @@
### Attribution Information for Libretro icons
The files found in this folder are sourced from the webRcade project, which is licensed under then Apache License 2.0
The original license can be found at https://github.com/webrcade/webrcade/blob/master/LICENSE
For more information about the Apache License 2.0, visit https://www.apache.org/licenses/LICENSE-2.0
The RomM Project
December 27th, 2023

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 185 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 594 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 836 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 363 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 584 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 380 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 955 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 914 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 950 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 96 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

View File

@@ -9,41 +9,41 @@ const { smAndUp } = useDisplay();
<template>
<v-row no-gutters>
<div
class="text-h5 text-white text-shadow font-weight-bold title"
class="text-h5 text-white text-shadow font-weight-bold title px-1"
:class="{ 'text-truncate': smAndUp }"
>
{{ rom.name }}
</div>
</v-row>
<v-row no-gutters class="align-center mt-2">
<v-row no-gutters class="align-center py-2">
<v-chip
class="font-italic text-white text-shadow title pa-3"
class="font-italic text-white text-shadow title px-3"
:to="`/platform/${rom.platform_slug}`"
>
{{ rom.platform_name || rom.platform_slug }}
<v-avatar :rounded="0" size="43" class="ml-2 pa-1">
<v-avatar :rounded="0" size="40" class="ml-2 pa-1">
<platform-icon :platform="rom.platform_slug"></platform-icon>
</v-avatar>
</v-chip>
<v-chip-group class="ml-2 pa-0 text-white text-shadow">
<v-chip
v-if="rom.regions.filter(i => i).length > 0"
:title="`Regions: ${rom.regions.join(', ')}`"
>
<span class="px-1" v-for="region in rom.regions"
>{{ regionToEmoji(region) }}</span
>
</v-chip>
<v-chip
v-if="rom.languages.filter(i => i).length > 0"
:title="`Languages: ${rom.languages.join(', ')}`"
>
<span class="px-1" v-for="language in rom.languages"
>{{ languageToEmoji(language) }}</span
>
</v-chip>
<v-chip v-show="rom.revision"> Rev {{ rom.revision }} </v-chip>
</v-chip-group>
<v-chip
class="text-white text-shadow title ml-2"
v-if="rom.regions.filter((i) => i).length > 0"
:title="`Regions: ${rom.regions.join(', ')}`"
>
<span class="px-1" v-for="region in rom.regions">{{
regionToEmoji(region)
}}</span>
</v-chip>
<v-chip
class="text-white text-shadow title ml-2"
v-if="rom.languages.filter((i) => i).length > 0"
:title="`Languages: ${rom.languages.join(', ')}`"
>
<span class="px-1" v-for="language in rom.languages">{{
languageToEmoji(language)
}}</span>
</v-chip>
<v-chip v-show="rom.revision"> Rev {{ rom.revision }} </v-chip>
</v-row>
</template>

View File

@@ -0,0 +1,47 @@
<script setup>
import { ref, inject } from "vue";
import api from "@/services/api";
const show = ref(false);
const emitter = inject("emitter");
emitter.on("showCreatePlatformBindingDialog", () => {
show.value = true;
});
</script>
<template>
<v-dialog v-model="show" max-width="500px" :scrim="false">
<v-card>
<v-toolbar density="compact" class="bg-terciary">
<v-row class="align-center" no-gutters>
<v-col cols="10">
<v-icon icon="mdi-controller" class="ml-5 mr-2" />
</v-col>
<v-col>
<v-btn
@click="show = false"
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>
<v-btn @click="show = false" class="bg-terciary">Cancel</v-btn>
<v-btn
:disabled="false"
class="text-romm-green bg-terciary ml-5"
@click="createBinding()"
>
Create
</v-btn>
</v-row>
</v-card-text>
</v-card>
</v-dialog>
</template>

View File

@@ -98,11 +98,11 @@ function onTouchEnd() {
<v-list-item>{{ rom.name || rom.file_name }}</v-list-item>
</div>
</v-expand-transition>
<v-chip-group class="ml-1 pt-0 text-shadow position-absolute flags">
<v-chip-group class="ml-2 pt-0 text-shadow position-absolute flags">
<v-chip
v-if="rom.regions.filter(i => i).length > 0"
:title="`Regions: ${rom.regions.join(', ')}`"
class="px-1 bg-chip"
class="bg-chip"
density="compact"
>
<span class="px-1" v-for="region in rom.regions">
@@ -112,7 +112,7 @@ function onTouchEnd() {
<v-chip
v-if="rom.languages.filter(i => i).length > 0"
:title="`Languages: ${rom.languages.join(', ')}`"
class="px-1 bg-chip"
class="bg-chip"
density="compact"
>
<span class="px-1" v-for="language in rom.languages">

View File

@@ -15,7 +15,7 @@ const props = defineProps(["platform", "rail"]);
<span v-if="!rail" class="text-body-2">{{ platform.name }}</span>
<template v-slot:prepend>
<v-avatar :rounded="0" size="40">
<platform-icon :platform="platform.slug"></platform-icon>
<platform-icon :platform="platform.slug" />
<div class="igdb-icon" v-if="!platform.igdb_id" title="Not found in IGDB">
⚠️
</div>

View File

@@ -0,0 +1,150 @@
<script setup>
import { ref, onBeforeMount, inject } from "vue";
import { api } from "@/services/api";
import storeHeartbeat from "@/stores/heartbeat";
// import CreateExclusionDialog from "@/components/Dialog/Platform/CreateExclusion.vue";
// Props
const emitter = inject("emitter");
const heartbeat = storeHeartbeat();
const excluded_platforms = heartbeat.data.CONFIG.EXCLUDED_PLATFORMS;
const excludad_single_roms_files = heartbeat.data.CONFIG.EXCLUDED_SINGLE_FILES;
const excludad_single_roms_ext = heartbeat.data.CONFIG.EXCLUDED_SINGLE_EXT;
const excludad_multi_roms_files = heartbeat.data.CONFIG.EXCLUDED_MULTI_FILES;
const excludad_multi_roms_parts_files =
heartbeat.data.CONFIG.EXCLUDED_MULTI_PARTS_FILES;
const excludad_multi_roms_parts_ext =
heartbeat.data.CONFIG.EXCLUDED_MULTI_PARTS_EXT;
</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-cancel</v-icon>
Excluded
</v-toolbar-title>
<v-btn
disabled
prepend-icon="mdi-plus"
variant="outlined"
class="text-romm-accent-1"
@click="emitter.emit('showCreateExclusionDialog')"
>
Add
</v-btn>
</v-toolbar>
<v-divider class="border-opacity-25" />
<v-card-text class="pa-1">
<v-row no-gutters class="bg-terciary mt-1 mb-2 px-3">
<v-toolbar-title class="pa-2 text-body-1">
<v-icon>mdi-controller-off</v-icon>
Platforms
</v-toolbar-title>
<v-divider class="border-opacity-25 mb-1" />
<v-row no-gutters class="mb-3">
<v-col class="pa-1">
<v-chip label class="mx-1" v-for="excluded in excluded_platforms">{{
excluded
}}</v-chip>
</v-col>
</v-row>
</v-row>
<v-row no-gutters class="bg-terciary mt-1 mb-2 px-3">
<v-toolbar-title class="pa-2 text-body-1">
<v-icon>mdi-file-document-remove-outline</v-icon>
Single Roms Files
</v-toolbar-title>
<v-divider class="border-opacity-25 mb-1" />
<v-row no-gutters class="mb-3">
<v-col class="pa-1">
<v-chip
label
class="mx-1"
v-for="excluded in excludad_single_roms_files"
>{{ excluded }}</v-chip
>
</v-col>
</v-row>
</v-row>
<v-row no-gutters class="bg-terciary mt-1 mb-2 px-3">
<v-toolbar-title class="pa-2 text-body-1">
<v-icon>mdi-file-document-remove-outline</v-icon>
Single Roms Extensions
</v-toolbar-title>
<v-divider class="border-opacity-25 mb-1" />
<v-row no-gutters class="mb-3">
<v-col class="pa-1">
<v-chip
label
class="mx-1"
v-for="excluded in excludad_single_roms_ext"
>{{ excluded }}</v-chip
>
</v-col>
</v-row>
</v-row>
<v-row no-gutters class="bg-terciary mt-1 mb-2 px-3">
<v-toolbar-title class="pa-2 text-body-1">
<v-icon>mdi-file-document-remove-outline</v-icon>
Multi Roms Files
</v-toolbar-title>
<v-divider class="border-opacity-25 mb-1" />
<v-row no-gutters class="mb-3">
<v-col class="pa-1">
<v-chip
label
class="mx-1"
v-for="excluded in excludad_multi_roms_files"
>{{ excluded }}</v-chip
>
</v-col>
</v-row>
</v-row>
<v-row no-gutters class="bg-terciary mt-1 mb-2 px-3">
<v-toolbar-title class="pa-2 text-body-1">
<v-icon>mdi-file-document-remove-outline</v-icon>
Multi Roms Parts Files
</v-toolbar-title>
<v-divider class="border-opacity-25 mb-1" />
<v-row no-gutters class="mb-3">
<v-col class="pa-1">
<v-chip
label
class="mx-1"
v-for="excluded in excludad_multi_roms_parts_files"
>{{ excluded }}</v-chip
>
</v-col>
</v-row>
</v-row>
<v-row no-gutters class="bg-terciary mt-1 mb-2 px-3">
<v-toolbar-title class="pa-2 text-body-1">
<v-icon>mdi-file-document-remove-outline</v-icon>
Multi Roms Parts Extensions
</v-toolbar-title>
<v-divider class="border-opacity-25 mb-1" />
<v-row no-gutters class="mb-3">
<v-col class="pa-1">
<v-chip
label
class="mx-1"
v-for="excluded in excludad_multi_roms_parts_ext"
>{{ excluded }}</v-chip
>
</v-col>
</v-row>
</v-row>
</v-card-text>
</v-card>
<!-- <create-exclusions-dialog /> -->
</template>
<style scoped></style>

View File

@@ -0,0 +1,58 @@
<script setup>
import { ref, onBeforeMount, inject } from "vue";
import { api } from "@/services/api";
import storeHeartbeat from "@/stores/heartbeat";
import PlatformIcon from "@/components/Platform/PlatformIcon.vue";
import CreatePlatformBindingDialog from "@/components/Dialog/Platform/CreatePlatformBinding.vue";
// Props
const emitter = inject("emitter");
const heartbeat = storeHeartbeat();
const platformsBinding = heartbeat.data.CONFIG.PLATFORMS_BINDING;
</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-controller</v-icon>
Platforms Bindings
</v-toolbar-title>
<v-btn
disabled
prepend-icon="mdi-plus"
variant="outlined"
class="text-romm-accent-1"
@click="emitter.emit('showCreatePlatformBindingDialog')"
>
Add
</v-btn>
</v-toolbar>
<v-divider class="border-opacity-25" />
<v-card-text class="pa-1">
<v-row no-gutters>
<v-col cols="6" sm="3" md="2" lg="2" v-for="(platform, fs_platform) in platformsBinding">
<v-card-text class="bg-terciary ma-1 py-1 pl-1 pr-3">
<v-row class="align-center" no-gutters>
<v-col cols="5" sm="4" md="5" lg="4">
<v-avatar class="mx-2" :rounded="0" size="40">
<platform-icon :platform="platform" />
</v-avatar>
</v-col>
<v-col cols="7" sm="8" md="7" lg="8">
<div class="bg-primary pa-2 text-caption text-truncate" :title="fs_platform">
<span clas="pa-1">{{ fs_platform }}</span>
</div>
</v-col>
</v-row>
</v-card-text>
</v-col>
</v-row>
</v-card-text>
</v-card>
<create-platform-binding-dialog />
</template>
<style scoped></style>

View File

@@ -1,6 +1,7 @@
<script setup>
import { ref, onBeforeMount, inject } from "vue";
import { api } from "@/services/api";
import storeRunningTasks from "@/stores/runningTasks";
import TaskWatcher from "@/components/Settings/General/TaskStatus/TaskWatcher.vue";
import TaskScheduler from "@/components/Settings/General/TaskStatus/TaskScheduler.vue";
import storeHeartbeat from "@/stores/heartbeat";
@@ -8,10 +9,13 @@ import storeHeartbeat from "@/stores/heartbeat";
// Props
const emitter = inject("emitter");
const heartbeat = storeHeartbeat();
const runningTasks = storeRunningTasks()
// Methods
const runAllTasks = async () => {
runningTasks.value = true;
const result = await api.post("/tasks/run");
runningTasks.value = false;
if (result.status !== 200) {
return emitter.emit("snackbarShow", {
msg: "Error running tasks",
@@ -34,9 +38,16 @@ const runAllTasks = async () => {
<v-icon class="mr-3">mdi-pulse</v-icon>
Task Status
</v-toolbar-title>
<v-toolbar-items>
<v-btn @click="runAllTasks"><v-icon class="mr-1">mdi-play</v-icon> Run all </v-btn>
</v-toolbar-items>
<v-btn
:disabled="runningTasks.value"
:loading="runningTasks.value"
prepend-icon="mdi-play"
variant="outlined"
class="text-romm-accent-1"
@click="runAllTasks"
>
Run All
</v-btn>
</v-toolbar>
<v-divider class="border-opacity-25" />

View File

@@ -0,0 +1,11 @@
import { defineStore } from "pinia";
export default defineStore("runningTasks", {
state: () => ({ value: false }),
actions: {
set(runningTasks) {
this.value = runningTasks;
},
},
});

View File

@@ -8,19 +8,19 @@ import dashboardPlatforms from "@/components/Dashboard/Platforms.vue";
</script>
<template>
<v-row class="pa-1" no-gutters>
<v-row class="mx-1 mt-1" no-gutters>
<v-col>
<dashboard-summary />
</v-col>
</v-row>
<v-row class="pa-1" no-gutters>
<v-row class="mx-1 mt-1" no-gutters>
<v-col>
<recently-added />
</v-col>
</v-row>
<v-row class="pa-1" no-gutters>
<v-row class="mx-1 mt-1" no-gutters>
<v-col>
<dashboard-platforms />
</v-col>

View File

@@ -22,7 +22,7 @@ const romsStore = storeRoms();
const { allRoms } = storeToRefs(romsStore);
const rom = ref(allRoms.value.find((rom) => rom.id == route.params.rom));
const tab = ref("details");
const { xs, sm, md, lgAndUp, name } = useDisplay();
const { xs, sm, md, lgAndUp } = useDisplay();
// Event listeners bus
const emitter = inject("emitter");
@@ -148,7 +148,7 @@ onBeforeMount(async () => {
.content,
.content-tablet-md {
margin-top: 82px;
margin-top: 86px;
margin-left: 100px;
}

View File

@@ -184,7 +184,7 @@ onBeforeRouteUpdate((to, _) => {
<template>
<gallery-app-bar />
<template v-if="filteredRoms.length > 0">
<v-row no-gutters v-scroll="onScroll">
<v-row class="pa-1" no-gutters v-scroll="onScroll">
<!-- Gallery cards view -->
<v-col
class="pa-1"

View File

@@ -49,7 +49,7 @@ onMounted(async () => {
<app-bar v-if="mdAndDown" />
<v-container class="pa-1" fluid>
<v-container class="pa-0" fluid>
<router-view />
</v-container>
</template>

View File

@@ -2,6 +2,7 @@
import { ref } from "vue";
import storeAuth from "@/stores/auth";
import Settings from "@/views/Settings/ControlPanel/General/Base.vue";
import Config from "@/views/Settings/ControlPanel/Config/Base.vue";
import Users from "@/views/Settings/ControlPanel/Users/Base.vue";
import storeHeartbeat from "@/stores/heartbeat";
@@ -15,6 +16,7 @@ const tab = ref("general");
<v-app-bar elevation="0" density="compact">
<v-tabs v-model="tab" slider-color="romm-accent-1" class="bg-primary">
<v-tab value="general" rounded="0">General</v-tab>
<v-tab value="config" rounded="0">Config</v-tab>
<v-tab
:disabled="!auth.scopes.includes('users.read')"
value="users"
@@ -35,6 +37,15 @@ const tab = ref("general");
</v-row>
</v-window-item>
<!-- Config tab -->
<v-window-item value="config">
<v-row class="pa-1">
<v-col>
<config />
</v-col>
</v-row>
</v-window-item>
<!-- Users tab -->
<v-window-item value="users">
<v-row class="pa-1">

View File

@@ -0,0 +1,8 @@
<script setup>
import PlatformBinding from "@/components/Settings/Config/PlatformBindingCard.vue";
import ExclusionsCard from "@/components/Settings/Config/ExclusionsCard.vue";
</script>
<template>
<platform-binding />
<exclusions-card class="mt-1" />
</template>

View File

@@ -4,5 +4,5 @@ import TaskStatus from "@/components/Settings/General/TaskStatus/TaskStatusCard.
</script>
<template>
<theme />
<task-status class="mt-2" />
<task-status class="mt-1" />
</template>

View File

@@ -87,7 +87,7 @@ onMounted(() => {
class="text-romm-accent-1"
@click="emitter.emit('showCreateUserDialog')"
>
Add user
Add
</v-btn>
</v-toolbar>