mirror of
https://github.com/rommapp/romm.git
synced 2026-11-30 10:32:57 +01:00
@@ -1,3 +1,11 @@
|
||||
# v1.6.4 (_12-04-2023_)
|
||||
|
||||
## Added
|
||||
- Now RomM allows to fix missmatched games by searching by IGDB id manually
|
||||
- WonderSwan and WonderSwan Color support added
|
||||
|
||||
<br>
|
||||
|
||||
# v1.6.3 (_12-04-2023_)
|
||||
|
||||
## Added
|
||||
|
||||
124
README.md
124
README.md
@@ -125,67 +125,69 @@ This will change over the time, adding games metadata for more platforms. Make s
|
||||
|
||||
| slug | name | games metadata |
|
||||
|---------------|-------------------------------------| :----: |
|
||||
| 3ds | Nintendo 3DS | ✅ |
|
||||
| amiga | Amiga | ✅ |
|
||||
| arcade | Arcade | ✅ |
|
||||
| atari | atari | ❌ |
|
||||
| coleco | coleco | ❌ |
|
||||
| c64 | Commodore C64/128/MAX | ✅ |
|
||||
| cpc | cpc | ❌ |
|
||||
| cps1 | cps1 | ❌ |
|
||||
| cps2 | cps2 | ❌ |
|
||||
| cps3 | cps3 | ❌ |
|
||||
| daphne | daphne | ❌ |
|
||||
| dc | Dreamcast | ✅ |
|
||||
| dos | DOS | ✅ |
|
||||
| fairchild | fairchild | ❌ |
|
||||
| fba2012 | fba2012 | ❌ |
|
||||
| fbneo | fbneo | ❌ |
|
||||
| fds | Family Computer Disk System | ✅ |
|
||||
| gb | Game Boy | ✅ |
|
||||
| gba | Game Boy Advance | ✅ |
|
||||
| gbc | Game Boy Color | ✅ |
|
||||
| gg | gg | ❌ |
|
||||
| gw | gw | ❌ |
|
||||
| intellivision | Intellivision | ✅ |
|
||||
| jaguar | Atari Jaguar | ✅ |
|
||||
| lynx | Atari Lynx | ✅ |
|
||||
| md | md | ❌ |
|
||||
| megaduck | megaduck | ❌ |
|
||||
| ms | ms | ❌ |
|
||||
| msx | MSX | ✅ |
|
||||
| n64 | Nintendo 64 | ✅ |
|
||||
| nds | Nintendo DS | ✅ |
|
||||
| neocd | neocd | ❌ |
|
||||
| neogeo | neogeo | ❌ |
|
||||
| nes | Nintendo Entertainment System | ✅ |
|
||||
| ngc | Nintendo GameCube | ✅ |
|
||||
| ngp | ngp | ❌ |
|
||||
| odyssey | odyssey | ❌ |
|
||||
| pce | pce | ❌ |
|
||||
| pcecd | pcecd | ❌ |
|
||||
| pico | pico | ❌ |
|
||||
| poke | poke | ❌ |
|
||||
| ps | PlayStation | ✅ |
|
||||
| ps2 | PlayStation 2 | ✅ |
|
||||
| ps3 | PlayStation 3 | ✅ |
|
||||
| ps4 | ps4 | ❌ |
|
||||
| psp | PlayStation Portable | ✅ |
|
||||
| psvita | PlayStation Vita | ✅ |
|
||||
| scummvm | scummvm | ❌ |
|
||||
| segacd | Sega CD | ✅ |
|
||||
| segasgone | segasgone | ❌ |
|
||||
| sgb | sgb | ❌ |
|
||||
| sgfx | sgfx | ❌ |
|
||||
| snes | Super Nintendo Entertainment System | ✅ |
|
||||
| supervision | supervision | ❌ |
|
||||
| switch | Nintendo Switch | ✅ |
|
||||
| wii | Wii | ✅ |
|
||||
| win | PC (Microsoft Windows) | ✅ |
|
||||
| wiiu | Wii U | ✅ |
|
||||
| xbox | Xbox | ✅ |
|
||||
| xbox360 | Xbox 360 | ✅ |
|
||||
| xboxone | Xbox One | ✅ |
|
||||
| 3ds | Nintendo 3DS | ✅ |
|
||||
| amiga | Amiga | ✅ |
|
||||
| arcade | Arcade | ✅ |
|
||||
| atari | atari | ❌ |
|
||||
| coleco | coleco | ❌ |
|
||||
| c64 | Commodore C64/128/MAX | ✅ |
|
||||
| cpc | cpc | ❌ |
|
||||
| cps1 | cps1 | ❌ |
|
||||
| cps2 | cps2 | ❌ |
|
||||
| cps3 | cps3 | ❌ |
|
||||
| daphne | daphne | ❌ |
|
||||
| dc | Dreamcast | ✅ |
|
||||
| dos | DOS | ✅ |
|
||||
| fairchild | fairchild | ❌ |
|
||||
| fba2012 | fba2012 | ❌ |
|
||||
| fbneo | fbneo | ❌ |
|
||||
| fds | Family Computer Disk System | ✅ |
|
||||
| gb | Game Boy | ✅ |
|
||||
| gba | Game Boy Advance | ✅ |
|
||||
| gbc | Game Boy Color | ✅ |
|
||||
| gg | gg | ❌ |
|
||||
| gw | gw | ❌ |
|
||||
| intellivision | Intellivision | ✅ |
|
||||
| jaguar | Atari Jaguar | ✅ |
|
||||
| lynx | Atari Lynx | ✅ |
|
||||
| md | md | ❌ |
|
||||
| megaduck | megaduck | ❌ |
|
||||
| ms | ms | ❌ |
|
||||
| msx | MSX | ✅ |
|
||||
| n64 | Nintendo 64 | ✅ |
|
||||
| nds | Nintendo DS | ✅ |
|
||||
| neocd | neocd | ❌ |
|
||||
| neogeo | neogeo | ❌ |
|
||||
| nes | Nintendo Entertainment System | ✅ |
|
||||
| ngc | Nintendo GameCube | ✅ |
|
||||
| ngp | ngp | ❌ |
|
||||
| odyssey | odyssey | ❌ |
|
||||
| pce | pce | ❌ |
|
||||
| pcecd | pcecd | ❌ |
|
||||
| pico | pico | ❌ |
|
||||
| poke | poke | ❌ |
|
||||
| ps | PlayStation | ✅ |
|
||||
| ps2 | PlayStation 2 | ✅ |
|
||||
| ps3 | PlayStation 3 | ✅ |
|
||||
| ps4 | ps4 | ❌ |
|
||||
| psp | PlayStation Portable | ✅ |
|
||||
| psvita | PlayStation Vita | ✅ |
|
||||
| scummvm | scummvm | ❌ |
|
||||
| segacd | Sega CD | ✅ |
|
||||
| segasgone | segasgone | ❌ |
|
||||
| sgb | sgb | ❌ |
|
||||
| sgfx | sgfx | ❌ |
|
||||
| snes | Super Nintendo Entertainment System | ✅ |
|
||||
| supervision | supervision | ❌ |
|
||||
| switch | Nintendo Switch | ✅ |
|
||||
| wii | Wii | ✅ |
|
||||
| win | PC (Microsoft Windows) | ✅ |
|
||||
| wiiu | Wii U | ✅ |
|
||||
| wonderswan | WonderSwan | ✅ |
|
||||
| wonderswan-color| WonderSwan Color | ✅ |
|
||||
| xbox | Xbox | ✅ |
|
||||
| xbox360 | Xbox 360 | ✅ |
|
||||
| xboxone | Xbox One | ✅ |
|
||||
|
||||
## 📑 Tags support
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ class IGDBHandler():
|
||||
for rom in matched_roms:
|
||||
try:
|
||||
res_details: dict = requests.post("https://api.igdb.com/v4/covers/", headers=self.headers,
|
||||
data=f"fields url; where game={rom['id']};").json()[0]
|
||||
data=f"fields url; where game={rom['id']};").json()[0]
|
||||
rom['url_cover'] = f"https:{res_details['url']}".replace('t_thumb', f't_cover_big')
|
||||
except IndexError:
|
||||
rom['url_cover'] = DEFAULT_URL_COVER_L
|
||||
@@ -132,6 +132,21 @@ class IGDBHandler():
|
||||
else:
|
||||
log.warning(f"{p_slug} is not supported!")
|
||||
return matched_roms
|
||||
|
||||
def get_matched_roms_by_id(self, igdb_id: str) -> list:
|
||||
matched_roms: list[dict] = []
|
||||
matched_roms: list = requests.post("https://api.igdb.com/v4/games/", headers=self.headers,
|
||||
data=f"fields name, id, slug, summary; where id={igdb_id};").json()
|
||||
for rom in matched_roms:
|
||||
try:
|
||||
res_details: dict = requests.post("https://api.igdb.com/v4/covers/", headers=self.headers,
|
||||
data=f"fields url; where game={rom['id']};").json()[0]
|
||||
rom['url_cover'] = f"https:{res_details['url']}".replace('t_thumb', f't_cover_big')
|
||||
except IndexError:
|
||||
rom['url_cover'] = DEFAULT_URL_COVER_L
|
||||
rom['r_igdb_id'] = rom.pop('id')
|
||||
rom['r_slug'] = rom.pop('slug')
|
||||
return matched_roms
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -21,14 +21,14 @@ def startup() -> None:
|
||||
|
||||
|
||||
@app.get("/scan")
|
||||
def scan(platforms_to_scan: str, full_scan: bool=False) -> dict:
|
||||
def scan(platforms: str, full_scan: bool=False) -> dict:
|
||||
"""Scan platforms and roms and write them in database."""
|
||||
|
||||
log.info(emoji.emojize(":magnifying_glass_tilted_right: Scanning "))
|
||||
fs.store_default_resources()
|
||||
fs_platforms: list[str] = fs.get_platforms()
|
||||
platforms: list[str] = json.loads(platforms_to_scan) if len(json.loads(platforms_to_scan)) > 0 else fs_platforms
|
||||
log.info(f"Platforms detected: {', '.join(platforms)}")
|
||||
platforms: list[str] = json.loads(platforms) if len(json.loads(platforms)) > 0 else fs_platforms
|
||||
log.info(f"Platforms to be scanned: {', '.join(platforms)}")
|
||||
for p_slug in platforms:
|
||||
log.info(emoji.emojize(f":video_game: {p_slug} {COLORS['reset']}"))
|
||||
platform: Platform = fastapi.scan_platform(p_slug)
|
||||
@@ -112,13 +112,17 @@ def remove_rom(p_slug: str, file_name: str, filesystem: bool=False) -> dict:
|
||||
|
||||
|
||||
@app.put("/search/roms/igdb")
|
||||
async def search_rom_igdb(req: Request) -> dict:
|
||||
async def search_rom_igdb(req: Request, igdb_id: str=None) -> dict:
|
||||
"""Get all the roms matched from igdb."""
|
||||
|
||||
data: dict = await req.json()
|
||||
log.info(emoji.emojize(":magnifying_glass_tilted_right: IGDB Searching"))
|
||||
log.info(emoji.emojize(f":video_game: {data['rom']['p_slug']}: {COLORS['orange']}{data['rom']['file_name']}{COLORS['reset']}"))
|
||||
matched_roms = igdbh.get_matched_roms(data['rom']['file_name'], data['rom']['p_igdb_id'], data['rom']['p_slug'])
|
||||
if igdb_id:
|
||||
log.info(f"Searching by id: {igdb_id}")
|
||||
matched_roms = igdbh.get_matched_roms_by_id(igdb_id)
|
||||
else:
|
||||
log.info(emoji.emojize(f":video_game: {data['rom']['p_slug']}: {COLORS['orange']}{data['rom']['file_name']}{COLORS['reset']}"))
|
||||
matched_roms = igdbh.get_matched_roms(data['rom']['file_name'], data['rom']['p_igdb_id'], data['rom']['p_slug'])
|
||||
log.info("Results:")
|
||||
[log.info(f"\t - {COLORS['blue']}{rom['name']}{COLORS['reset']}") for rom in matched_roms]
|
||||
return {'data': matched_roms}
|
||||
|
||||
@@ -1 +1 @@
|
||||
VITE_ROMM_VERSION=1.6.3
|
||||
VITE_ROMM_VERSION=1.6.4
|
||||
BIN
frontend/assets/platforms/wonderswan-color.ico
Normal file
BIN
frontend/assets/platforms/wonderswan-color.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 264 KiB |
BIN
frontend/assets/platforms/wonderswan.ico
Normal file
BIN
frontend/assets/platforms/wonderswan.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 264 KiB |
4
frontend/package-lock.json
generated
4
frontend/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "romm",
|
||||
"version": "1.6.3",
|
||||
"version": "1.6.4",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "romm",
|
||||
"version": "1.6.3",
|
||||
"version": "1.6.4",
|
||||
"dependencies": {
|
||||
"@mdi/font": "7.0.96",
|
||||
"axios": "^1.3.4",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "romm",
|
||||
"version": "1.6.3",
|
||||
"version": "1.6.4",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "vite --host",
|
||||
|
||||
@@ -1,47 +1,36 @@
|
||||
<script setup>
|
||||
import { ref, inject } from "vue"
|
||||
import { useTheme } from "vuetify"
|
||||
import Navigation from '@/components/Navigation.vue'
|
||||
import AppBar from '@/components/AppBar/Base.vue'
|
||||
import PlatformsDrawer from '@/components/PlatformsDrawer/Base.vue'
|
||||
import SettingsDrawer from '@/components/SettingsDrawer/Base.vue'
|
||||
import Notification from '@/components/Notification.vue'
|
||||
|
||||
// Props
|
||||
useTheme().global.name.value = localStorage.getItem('theme') || 'dark'
|
||||
const refreshPlatforms = ref(false)
|
||||
const refreshRoms = ref(false)
|
||||
const snackbarShow = ref(false)
|
||||
const snackbarStatus = ref({})
|
||||
const refresh = ref(false)
|
||||
|
||||
// Event listeners bus
|
||||
const emitter = inject('emitter')
|
||||
emitter.on('refresh', () => {
|
||||
refreshPlatforms.value = !refreshPlatforms.value
|
||||
refreshRoms.value = !refreshRoms.value
|
||||
})
|
||||
emitter.on('refreshRoms', () => { refreshRoms.value = !refreshRoms.value })
|
||||
emitter.on('snackbarScan', (snackbar) => {
|
||||
snackbarShow.value = true
|
||||
snackbarStatus.value = snackbar
|
||||
})
|
||||
emitter.on('refresh', () => { refresh.value = !refresh.value })
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-app>
|
||||
|
||||
<navigation :key="refreshPlatforms"/>
|
||||
|
||||
<v-snackbar v-model="snackbarShow" :timeout="4000" location="top" class="mt-4">
|
||||
<v-icon :icon="snackbarStatus.icon" :color="snackbarStatus.color" class="ml-2 mr-2"/>
|
||||
{{ snackbarStatus.msg }}
|
||||
<template v-slot:actions>
|
||||
<v-btn @click="snackbarShow=false" variant="text"><v-icon icon="mdi-close"/></v-btn>
|
||||
</template>
|
||||
</v-snackbar>
|
||||
|
||||
|
||||
<settings-drawer />
|
||||
|
||||
<app-bar/>
|
||||
|
||||
<platforms-drawer :key="refresh"/>
|
||||
|
||||
<v-main>
|
||||
<v-container fluid>
|
||||
<router-view :key="refreshRoms"/>
|
||||
<router-view :key="refresh"/>
|
||||
</v-container>
|
||||
</v-main>
|
||||
|
||||
<notification/>
|
||||
|
||||
</v-app>
|
||||
</template>
|
||||
|
||||
42
frontend/src/components/AppBar/Base.vue
Normal file
42
frontend/src/components/AppBar/Base.vue
Normal file
@@ -0,0 +1,42 @@
|
||||
<script setup>
|
||||
import { ref, inject } from "vue"
|
||||
import RomMIcon from '@/components/AppBar/RomMIcon.vue'
|
||||
import PlatformsBtn from '@/components/AppBar/PlatformsBtn.vue'
|
||||
import SearchBar from '@/components/AppBar/SearchBar.vue'
|
||||
import SettingsBtn from '@/components/AppBar/SettingsBtn.vue'
|
||||
import UploadBtn from '@/components/AppBar/UploadBtn.vue'
|
||||
|
||||
// Props
|
||||
const scanning = ref(false)
|
||||
|
||||
// Event listeners bus
|
||||
const emitter = inject('emitter')
|
||||
emitter.on('scanning', (s) => { scanning.value = s })
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
<v-app-bar class="elevation-3">
|
||||
|
||||
<v-progress-linear
|
||||
:active="scanning"
|
||||
:indeterminate="true"
|
||||
absolute/>
|
||||
|
||||
<rom-m-icon/>
|
||||
|
||||
<platforms-btn/>
|
||||
|
||||
<v-spacer class="hidden-xs-and-down"/>
|
||||
|
||||
<upload-btn/>
|
||||
|
||||
<search-bar/>
|
||||
|
||||
<template v-slot:append>
|
||||
<settings-btn/>
|
||||
</template>
|
||||
|
||||
</v-app-bar>
|
||||
|
||||
</template>
|
||||
22
frontend/src/components/AppBar/PlatformsBtn.vue
Normal file
22
frontend/src/components/AppBar/PlatformsBtn.vue
Normal file
@@ -0,0 +1,22 @@
|
||||
<script setup>
|
||||
import { ref, inject } from "vue"
|
||||
|
||||
// Props
|
||||
const selectedPlatform = ref('')
|
||||
|
||||
// Event listeners bus
|
||||
const emitter = inject('emitter')
|
||||
emitter.on('selectedPlatform', (p) => { selectedPlatform.value = p })
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-btn
|
||||
@click="emitter.emit('togglePlatforms')"
|
||||
class="ma-4 hidden-lg-and-up"
|
||||
rounded="0"
|
||||
icon>
|
||||
<v-avatar rounded="0">
|
||||
<v-img :src="'/assets/platforms/'+selectedPlatform.slug+'.ico'"/>
|
||||
</v-avatar>
|
||||
</v-btn>
|
||||
</template>
|
||||
11
frontend/src/components/AppBar/RomMIcon.vue
Normal file
11
frontend/src/components/AppBar/RomMIcon.vue
Normal file
@@ -0,0 +1,11 @@
|
||||
<template>
|
||||
<v-avatar
|
||||
class="ml-4 mr-2 hidden-md-and-down"
|
||||
:rounded="0">
|
||||
<v-img src="/assets/romm.ico"/>
|
||||
</v-avatar>
|
||||
<v-list-item-title
|
||||
class="text-h6 font-weight-black ma-2 hidden-md-and-down">
|
||||
RomM
|
||||
</v-list-item-title>
|
||||
</template>
|
||||
23
frontend/src/components/AppBar/SearchBar.vue
Normal file
23
frontend/src/components/AppBar/SearchBar.vue
Normal file
@@ -0,0 +1,23 @@
|
||||
<script setup>
|
||||
import { ref, inject } from "vue"
|
||||
|
||||
// Props
|
||||
const filter = ref('')
|
||||
|
||||
// Event listeners bus
|
||||
const emitter = inject('emitter')
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-text-field
|
||||
@click:clear="emitter.emit('filter', '')"
|
||||
@keyup="emitter.emit('filter', filter)"
|
||||
v-model="filter"
|
||||
label="search"
|
||||
prepend-inner-icon="mdi-magnify"
|
||||
class="ml-2 mr-2 shrink"
|
||||
variant="outlined"
|
||||
density="compact"
|
||||
hide-details
|
||||
clearable/>
|
||||
</template>
|
||||
16
frontend/src/components/AppBar/SettingsBtn.vue
Normal file
16
frontend/src/components/AppBar/SettingsBtn.vue
Normal file
@@ -0,0 +1,16 @@
|
||||
<script setup>
|
||||
import { inject } from "vue"
|
||||
|
||||
// Event listeners bus
|
||||
const emitter = inject('emitter')
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-app-bar-nav-icon
|
||||
title="settings"
|
||||
@click="emitter.emit('toggleSettings')"
|
||||
class="ml-2"
|
||||
rounded="0">
|
||||
<v-icon>mdi-cog</v-icon>
|
||||
</v-app-bar-nav-icon>
|
||||
</template>
|
||||
19
frontend/src/components/AppBar/UploadBtn.vue
Normal file
19
frontend/src/components/AppBar/UploadBtn.vue
Normal file
@@ -0,0 +1,19 @@
|
||||
<script setup>
|
||||
import { inject } from "vue"
|
||||
|
||||
// Event listeners bus
|
||||
const emitter = inject('emitter')
|
||||
|
||||
// Functions
|
||||
function uploadRom() {console.log("uploading rom")}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-app-bar-nav-icon
|
||||
@click="uploadRom()"
|
||||
class="ma-2"
|
||||
rounded="0"
|
||||
disabled>
|
||||
<v-icon>mdi-upload</v-icon>
|
||||
</v-app-bar-nav-icon>
|
||||
</template>
|
||||
37
frontend/src/components/GameCard/ActionBar.vue
Normal file
37
frontend/src/components/GameCard/ActionBar.vue
Normal file
@@ -0,0 +1,37 @@
|
||||
<script setup>
|
||||
import { ref, inject } from 'vue'
|
||||
import { downloadRom, downloadSave } from '@/utils/utils.js'
|
||||
|
||||
// Props
|
||||
const props = defineProps(['rom'])
|
||||
const saveFiles = ref(false)
|
||||
|
||||
// Event listeners bus
|
||||
const emitter = inject('emitter')
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-card-text>
|
||||
<v-row>
|
||||
<v-col class="pa-0">
|
||||
<v-btn
|
||||
@click="downloadRom(rom, emitter)"
|
||||
icon="mdi-download"
|
||||
size="small"
|
||||
variant="text"/>
|
||||
<v-btn
|
||||
@click="downloadSave(rom, emitter)"
|
||||
icon="mdi-content-save-all"
|
||||
size="small"
|
||||
variant="text"
|
||||
:disabled="!saveFiles"/>
|
||||
</v-col>
|
||||
<v-btn
|
||||
@click=""
|
||||
icon="mdi-dots-vertical"
|
||||
size="small"
|
||||
variant="text"
|
||||
:disabled="!saveFiles"/>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
</template>
|
||||
42
frontend/src/components/GameCard/Base.vue
Normal file
42
frontend/src/components/GameCard/Base.vue
Normal file
@@ -0,0 +1,42 @@
|
||||
<script setup>
|
||||
import ActionBar from '@/components/GameCard/ActionBar.vue'
|
||||
import Cover from '@/components/GameCard/Cover.vue'
|
||||
|
||||
// Props
|
||||
const props = defineProps(['rom'])
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-hover v-slot="{isHovering, props}">
|
||||
<v-card
|
||||
v-bind="props"
|
||||
:class="{'on-hover': isHovering}"
|
||||
:elevation="isHovering ? 20 : 3">
|
||||
<v-hover v-slot="{isHovering, props}" open-delay="800">
|
||||
<cover :rom="rom" :isHovering="isHovering" :hoverProps="props"/>
|
||||
<action-bar :rom="rom"/>
|
||||
</v-hover>
|
||||
</v-card>
|
||||
</v-hover>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.v-card .rom-title{
|
||||
transition: opacity .4s ease-in-out;
|
||||
}
|
||||
.rom-title.on-hover {
|
||||
opacity: 1;
|
||||
}
|
||||
.rom-title:not(.on-hover) {
|
||||
opacity: 0.85;
|
||||
}
|
||||
.v-card.on-hover {
|
||||
opacity: 1;
|
||||
}
|
||||
.v-card:not(.on-hover) {
|
||||
opacity: 0.85;
|
||||
}
|
||||
.cover{
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
56
frontend/src/components/GameCard/Cover.vue
Normal file
56
frontend/src/components/GameCard/Cover.vue
Normal file
@@ -0,0 +1,56 @@
|
||||
<script setup>
|
||||
import { inject } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
|
||||
// Props
|
||||
const props = defineProps(['rom', 'isHovering', 'hoverProps'])
|
||||
const forceImgReload = Date.now()
|
||||
const router = useRouter()
|
||||
|
||||
// Event listeners bus
|
||||
const emitter = inject('emitter')
|
||||
|
||||
// Functions
|
||||
async function selectRom(rom) {
|
||||
localStorage.setItem('currentRom', JSON.stringify(rom))
|
||||
await router.push(import.meta.env.BASE_URL+'details')
|
||||
emitter.emit('currentRom', rom)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-img
|
||||
@click="selectRom(rom)"
|
||||
v-bind="hoverProps"
|
||||
:src="'/assets'+rom.path_cover_l+'?reload='+forceImgReload"
|
||||
:lazy-src="'/assets'+rom.path_cover_s+'?reload='+forceImgReload"
|
||||
class="cover"
|
||||
cover>
|
||||
<template v-slot:placeholder>
|
||||
<div class="d-flex align-center justify-center fill-height">
|
||||
<v-progress-circular indeterminate/>
|
||||
</div>
|
||||
</template>
|
||||
<v-expand-transition>
|
||||
<div
|
||||
v-if="isHovering || !rom.has_cover"
|
||||
class="rom-title d-flex transition-fast-in-fast-out bg-secondary text-caption-1">
|
||||
<v-list-item>{{ rom.file_name }}</v-list-item>
|
||||
</div>
|
||||
</v-expand-transition>
|
||||
<div>
|
||||
<v-chip
|
||||
v-show="rom.region"
|
||||
class="ml-1 mr-1 bg-primary"
|
||||
size="x-small">
|
||||
{{ rom.region }}
|
||||
</v-chip>
|
||||
<v-chip
|
||||
v-show="rom.revision"
|
||||
class="mr-1 bg-primary"
|
||||
size="x-small">
|
||||
{{ rom.revision }}
|
||||
</v-chip>
|
||||
</div>
|
||||
</v-img>
|
||||
</template>
|
||||
@@ -1,198 +0,0 @@
|
||||
<script setup>
|
||||
import axios from "axios"
|
||||
import { ref, inject, toRaw } from "vue"
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useTheme, useDisplay } from "vuetify"
|
||||
|
||||
// Props
|
||||
const platforms = ref([])
|
||||
const currentPlatform = ref(JSON.parse(localStorage.getItem('currentPlatform')) || "")
|
||||
const platformsToScan = ref([])
|
||||
const scanning = ref(false)
|
||||
const fullScan = ref(false)
|
||||
const gettingRomsFlag = ref(false)
|
||||
const filter = ref('')
|
||||
const drawer = ref(null)
|
||||
const settings = ref(null)
|
||||
const rail = (localStorage.getItem('rail') == 'true') ? ref(true) : ref(false)
|
||||
const theme = useTheme()
|
||||
const darkMode = (localStorage.getItem('theme') == 'light') ? ref(false) : ref(true)
|
||||
const router = useRouter()
|
||||
const { mobile } = useDisplay()
|
||||
const ROMM_VERSION = import.meta.env.VITE_ROMM_VERSION
|
||||
|
||||
// Event listeners bus
|
||||
const emitter = inject('emitter')
|
||||
emitter.on('gettingRoms', (flag) => { gettingRomsFlag.value = flag })
|
||||
|
||||
// Functions
|
||||
async function scan() {
|
||||
// Complete scan or by platform
|
||||
console.log("scanning...")
|
||||
scanning.value = true
|
||||
const platforms = []
|
||||
toRaw(platformsToScan)._rawValue.forEach(p => {platforms.push(toRaw(p.slug))})
|
||||
console.log(platforms)
|
||||
|
||||
await axios.get('/api/scan?platforms_to_scan='+JSON.stringify(platforms)+'&full_scan='+fullScan.value).then((response) => {
|
||||
console.log("scan completed")
|
||||
console.log(response.data)
|
||||
emitter.emit('snackbarScan', {'msg': 'Scan completed successfully!', 'icon': 'mdi-check-bold', 'color': 'green'})
|
||||
}).catch((error) => {
|
||||
console.log(error)
|
||||
emitter.emit('snackbarScan', {'msg': "Couldn't complete scan. Something went wrong...", 'icon': 'mdi-close-circle', 'color': 'red'})
|
||||
})
|
||||
scanning.value = false
|
||||
emitter.emit('refresh')
|
||||
}
|
||||
|
||||
async function getPlatforms() {
|
||||
// Get the list of the platforms for the navigation drawer
|
||||
console.log("Getting platforms...")
|
||||
axios.get('/api/platforms').then((response) => {
|
||||
console.log("Platforms loaded!")
|
||||
console.log(response.data.data)
|
||||
platforms.value = response.data.data
|
||||
}).catch((error) => {console.log(error)})
|
||||
}
|
||||
|
||||
async function selectPlatform(platform){
|
||||
// Select the current platform
|
||||
if(mobile.value){drawer.value = false}
|
||||
await router.push(import.meta.env.BASE_URL)
|
||||
localStorage.setItem('currentPlatform', JSON.stringify(platform))
|
||||
emitter.emit('currentPlatform', platform)
|
||||
currentPlatform.value = platform
|
||||
}
|
||||
|
||||
function uploadRom() {
|
||||
console.log("uploading rom")
|
||||
}
|
||||
|
||||
function setFilter(filter) {
|
||||
// Sets the roms filter
|
||||
emitter.emit('romsFilter', filter)
|
||||
}
|
||||
|
||||
function toggleRail(){
|
||||
// Toggle collapsed/expand platform navigation drawer
|
||||
rail.value = !rail.value
|
||||
localStorage.setItem('rail', rail.value)
|
||||
}
|
||||
|
||||
function toggleTheme() {
|
||||
// Toggle dark/light theme
|
||||
theme.global.name.value = darkMode.value ? "dark" : "light"
|
||||
darkMode.value ? localStorage.setItem('theme', 'dark') : localStorage.setItem('theme', 'light')
|
||||
}
|
||||
|
||||
getPlatforms()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
<!-- Settings drawer -->
|
||||
<v-navigation-drawer v-model="settings" location="right" width="270" temporary floating>
|
||||
<!-- Settings drawer - title -->
|
||||
<v-list-item class="text-h5 d-flex align-center justify-center font-weight-bold bg-primary pt-4 pb-4 pl-7">
|
||||
Settings
|
||||
<v-btn title="close settings" @click="settings = !settings" class="ml-1" icon="mdi-close-box" rounded="0" variant="plain"/>
|
||||
</v-list-item>
|
||||
<v-divider class="border-opacity-100" :thickness="2"/>
|
||||
<v-list>
|
||||
<!-- Settings drawer - scan button -->
|
||||
<v-select label="Platforms" item-title="name" v-model="platformsToScan" :items="platforms" class="pl-5 pr-5 mt-2 mb-1" density="comfortable" variant="outlined" multiple return-object clearable hide-details chips/>
|
||||
<v-list-item class="pa-0">
|
||||
<v-row class="align-center">
|
||||
<v-col class="d-flex justify-center">
|
||||
<v-btn title="scan" @click="scan()" :disabled="scanning" prepend-icon="mdi-magnify-scan" class="ml-7" color="secondary" rounded="0" inset>
|
||||
<p v-if="!scanning">Scan</p>
|
||||
<v-progress-circular v-show="scanning" class="ml-2" :width="2" :size="20" indeterminate/>
|
||||
</v-btn>
|
||||
</v-col>
|
||||
<v-col class="mr-4">
|
||||
<v-checkbox v-model="fullScan" label="Full scan" hide-details="true"/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
<!-- Settings drawer - theme toggle -->
|
||||
<template v-slot:append>
|
||||
<v-divider class="border-opacity-25"/>
|
||||
<v-list-item class="d-flex align-center justify-center">
|
||||
<v-switch @change="toggleTheme()" v-model="darkMode" class="pr-2 pl-2" hide-details="false" prepend-icon="mdi-theme-light-dark" inset/>
|
||||
</v-list-item>
|
||||
<v-divider class="border-opacity-25"/>
|
||||
<v-list-item class="d-flex justify-center alignt-center text-body-2">
|
||||
<p>RomM v{{ ROMM_VERSION }}</p>
|
||||
</v-list-item>
|
||||
</template>
|
||||
</v-navigation-drawer>
|
||||
|
||||
<!-- App bar -->
|
||||
<v-app-bar class="elevation-3">
|
||||
<!-- Scan progress bar -->
|
||||
<v-progress-linear :active="scanning" :indeterminate="true" absolute/>
|
||||
|
||||
<!-- Desktop -->
|
||||
<!-- RomM avatar -->
|
||||
<v-avatar class="ml-4 mr-2 hidden-md-and-down" :rounded="0"><v-img src="/assets/romm.ico"></v-img></v-avatar>
|
||||
<!-- RomM title -->
|
||||
<v-list-item-title class="text-h6 font-weight-black ma-2 hidden-md-and-down">RomM</v-list-item-title>
|
||||
|
||||
<!-- Mobile -->
|
||||
<!-- Platforms drawer toggle -->
|
||||
<!-- <v-app-bar-nav-icon @click="drawer = !drawer" class="ma-2 hidden-lg-and-up" rounded="0"/> -->
|
||||
<!-- Platform icon -->
|
||||
<v-btn @click="drawer = !drawer" class="ma-4 hidden-lg-and-up" rounded="0" icon>
|
||||
<v-avatar rounded="0">
|
||||
<v-img :src="'/assets/platforms/'+currentPlatform.slug+'.ico'"/>
|
||||
</v-avatar>
|
||||
</v-btn>
|
||||
|
||||
<v-spacer class="hidden-xs-and-down"></v-spacer>
|
||||
|
||||
<!-- Upload -->
|
||||
<v-app-bar-nav-icon @click="uploadRom()" class="ma-2" rounded="0" disabled><v-icon>mdi-upload</v-icon></v-app-bar-nav-icon>
|
||||
<!-- Search bar -->
|
||||
<v-text-field @click:clear="setFilter('')" @keyup="setFilter(filter)" v-model="filter" label="search" class="ml-2 mr-2 shrink" style="max-width:450px" prepend-inner-icon="mdi-magnify" variant="outlined" density="compact" hide-details clearable/>
|
||||
<template v-slot:append>
|
||||
<!-- Settings -->
|
||||
<v-app-bar-nav-icon title="settings" @click="settings = !settings" class="ml-2" rounded="0"><v-icon>mdi-cog</v-icon></v-app-bar-nav-icon>
|
||||
</template>
|
||||
|
||||
</v-app-bar>
|
||||
|
||||
<!-- Platforms drawer -->
|
||||
<v-navigation-drawer v-model="drawer" :rail="rail" width="300" rail-width="72">
|
||||
<v-list>
|
||||
<!-- Platforms drawer - Platforms list -->
|
||||
<v-list-item v-for="platform in platforms"
|
||||
:value="platform.slug"
|
||||
:key="platform"
|
||||
@:click="selectPlatform(platform)" class="pt-4 pb-4">
|
||||
<v-list class="text-subtitle-2">{{ rail ? '' : platform.name }}</v-list>
|
||||
<template v-slot:prepend>
|
||||
<v-avatar :rounded="0"><v-img :src="'/assets/platforms/'+platform.slug+'.ico'"></v-img></v-avatar>
|
||||
</template>
|
||||
<template v-slot:append>
|
||||
<v-chip class="ml-4" size="small">{{ platform.n_roms }}</v-chip>
|
||||
</template>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
<!-- Platforms drawer - Platforms list - rail toggle -->
|
||||
<template v-slot:append>
|
||||
<v-btn title="toggle rail platforms drawer" @click="toggleRail()" rounded="0" block>
|
||||
<v-icon v-if="rail">mdi-arrow-collapse-right</v-icon>
|
||||
<v-icon v-if="!rail">mdi-arrow-collapse-left</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
</v-navigation-drawer>
|
||||
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.v-navigation-drawer--rail:not(.v-navigation-drawer--is-hovering) .v-list .v-avatar {
|
||||
--v-avatar-height: 40px;
|
||||
}
|
||||
</style>
|
||||
24
frontend/src/components/Notification.vue
Normal file
24
frontend/src/components/Notification.vue
Normal file
@@ -0,0 +1,24 @@
|
||||
<script setup>
|
||||
import { ref, inject } from "vue"
|
||||
|
||||
// Props
|
||||
const snackbarShow = ref(false)
|
||||
const snackbarStatus = ref({})
|
||||
|
||||
// Event listeners bus
|
||||
const emitter = inject('emitter')
|
||||
emitter.on('snackbarScan', (snackbar) => {
|
||||
snackbarShow.value = true
|
||||
snackbarStatus.value = snackbar
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-snackbar v-model="snackbarShow" :timeout="4000" location="top" class="mt-4">
|
||||
<v-icon :icon="snackbarStatus.icon" :color="snackbarStatus.color" class="ml-2 mr-2"/>
|
||||
{{ snackbarStatus.msg }}
|
||||
<template v-slot:actions>
|
||||
<v-btn @click="snackbarShow=false" variant="text"><v-icon icon="mdi-close"/></v-btn>
|
||||
</template>
|
||||
</v-snackbar>
|
||||
</template>
|
||||
44
frontend/src/components/PlatformsDrawer/Base.vue
Normal file
44
frontend/src/components/PlatformsDrawer/Base.vue
Normal file
@@ -0,0 +1,44 @@
|
||||
<script setup>
|
||||
import axios from "axios"
|
||||
import { ref, inject } from "vue"
|
||||
import RailBtn from '@/components/PlatformsDrawer/RailBtn.vue'
|
||||
import Platform from '@/components/PlatformsDrawer/Platform.vue'
|
||||
|
||||
// Props
|
||||
const selectedPlatform = ref(JSON.parse(localStorage.getItem('selectedPlatform')) || "")
|
||||
const platforms = ref([])
|
||||
const platformsDrawer = ref(null)
|
||||
const rail = (localStorage.getItem('rail') == 'true') ? ref(true) : ref(false)
|
||||
|
||||
// Event listeners bus
|
||||
const emitter = inject('emitter')
|
||||
emitter.on('togglePlatforms', () => { platformsDrawer.value = !platformsDrawer.value })
|
||||
emitter.on('togglePlatformsRail', () => { rail.value = !rail.value; localStorage.setItem('rail', rail.value)})
|
||||
|
||||
// Functions
|
||||
async function getPlatforms() {
|
||||
axios.get('/api/platforms').then((response) => {
|
||||
platforms.value = response.data.data
|
||||
emitter.emit('platforms', platforms.value)
|
||||
}).catch((error) => {console.log(error)})
|
||||
}
|
||||
|
||||
getPlatforms()
|
||||
emitter.emit('selectedPlatform', selectedPlatform.value)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
<v-navigation-drawer v-model="platformsDrawer" :rail="rail" width="300" rail-width="72">
|
||||
|
||||
<v-list>
|
||||
<platform v-for="platform in platforms" :platform="platform" :rail="rail"/>
|
||||
</v-list>
|
||||
|
||||
<template v-slot:append>
|
||||
<rail-btn :rail="rail"/>
|
||||
</template>
|
||||
|
||||
</v-navigation-drawer>
|
||||
|
||||
</template>
|
||||
42
frontend/src/components/PlatformsDrawer/Platform.vue
Normal file
42
frontend/src/components/PlatformsDrawer/Platform.vue
Normal file
@@ -0,0 +1,42 @@
|
||||
<script setup>
|
||||
import { inject } from "vue"
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useDisplay } from "vuetify"
|
||||
|
||||
// Props
|
||||
const props = defineProps(['platform', 'rail'])
|
||||
const { mobile } = useDisplay()
|
||||
const router = useRouter()
|
||||
|
||||
// Event listeners bus
|
||||
const emitter = inject('emitter')
|
||||
|
||||
// Functions
|
||||
async function selectPlatform(platform){
|
||||
if(mobile.value){emitter.emit('togglePlatforms')}
|
||||
await router.push(import.meta.env.BASE_URL)
|
||||
localStorage.setItem('selectedPlatform', JSON.stringify(platform))
|
||||
emitter.emit('selectedPlatform', platform)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-list-item
|
||||
:value="platform.slug"
|
||||
:key="platform"
|
||||
@:click="selectPlatform(platform)" class="pt-4 pb-4">
|
||||
<p class="text-subtitle-2 text-truncate">{{ rail ? '' : platform.name }}</p>
|
||||
<template v-slot:prepend>
|
||||
<v-avatar :rounded="0"><v-img :src="'/assets/platforms/'+platform.slug+'.ico'"></v-img></v-avatar>
|
||||
</template>
|
||||
<template v-slot:append>
|
||||
<v-chip class="ml-4" size="small">{{ platform.n_roms }}</v-chip>
|
||||
</template>
|
||||
</v-list-item>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.v-navigation-drawer--rail:not(.v-navigation-drawer--is-hovering) .v-list .v-avatar {
|
||||
--v-avatar-height: 40px;
|
||||
}
|
||||
</style>
|
||||
19
frontend/src/components/PlatformsDrawer/RailBtn.vue
Normal file
19
frontend/src/components/PlatformsDrawer/RailBtn.vue
Normal file
@@ -0,0 +1,19 @@
|
||||
<script setup>
|
||||
import { inject } from "vue"
|
||||
|
||||
// Props
|
||||
const props = defineProps(['rail'])
|
||||
|
||||
// Event listeners bus
|
||||
const emitter = inject('emitter')
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-btn
|
||||
@click="emitter.emit('togglePlatformsRail')"
|
||||
rounded="0"
|
||||
block>
|
||||
<v-icon v-if="rail">mdi-arrow-collapse-right</v-icon>
|
||||
<v-icon v-if="!rail">mdi-arrow-collapse-left</v-icon>
|
||||
</v-btn>
|
||||
</template>
|
||||
@@ -1,127 +0,0 @@
|
||||
<script setup>
|
||||
import axios from 'axios'
|
||||
import { ref, inject, onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { downloadRom, downloadSave } from '@/utils/utils.js'
|
||||
|
||||
// Props
|
||||
const roms = ref([])
|
||||
const gettingRoms = ref(false)
|
||||
const noRoms = ref(false)
|
||||
const romsFiltered = ref([])
|
||||
const currentFilter = ref('')
|
||||
const router = useRouter()
|
||||
const forceImgReload = Date.now()
|
||||
const saveFiles = ref(false)
|
||||
|
||||
// Event listeners bus
|
||||
const emitter = inject('emitter')
|
||||
emitter.on('currentPlatform', (platform) => { getRoms(platform.slug) })
|
||||
emitter.on('romsFilter', (filter) => { setFilter(filter) })
|
||||
|
||||
// Functions
|
||||
async function getRoms(platform) {
|
||||
noRoms.value = false
|
||||
console.log("Getting roms...")
|
||||
emitter.emit('gettingRoms', true)
|
||||
gettingRoms.value = true
|
||||
await axios.get('/api/platforms/'+platform+'/roms').then((response) => {
|
||||
console.log("Roms loaded!")
|
||||
console.log(response.data.data)
|
||||
roms.value = response.data.data
|
||||
setFilter(currentFilter.value)
|
||||
}).catch((error) => {console.log(error)})
|
||||
emitter.emit('gettingRoms', false)
|
||||
gettingRoms.value = false
|
||||
if(roms.value.length==0){noRoms.value = true}
|
||||
}
|
||||
|
||||
async function selectRom(rom) {
|
||||
console.log("Selected rom "+rom.name)
|
||||
localStorage.setItem('currentRom', JSON.stringify(rom))
|
||||
await router.push(import.meta.env.BASE_URL+'details')
|
||||
emitter.emit('currentRom', rom)
|
||||
}
|
||||
|
||||
function normalizeString(s) {
|
||||
return s.toLowerCase().normalize('NFD').replace(/[\u0300-\u036f]/g,"")
|
||||
}
|
||||
|
||||
function setFilter(filter) {
|
||||
currentFilter.value = normalizeString(filter)
|
||||
romsFiltered.value = roms.value.filter(rom => {
|
||||
return normalizeString(rom.file_name).includes(currentFilter.value)
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => { if(localStorage.getItem('currentPlatform')){ getRoms(JSON.parse(localStorage.getItem('currentPlatform')).slug) } })
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
<v-row>
|
||||
<v-col v-for="rom in romsFiltered" cols="6" xs="6" sm="3" md="3" lg="2">
|
||||
<v-hover v-slot="{isHovering, props}">
|
||||
<v-card v-bind="props" :class="{'on-hover': isHovering}" :elevation="isHovering ? 20 : 3">
|
||||
<v-hover v-slot="{ isHovering, props }" open-delay="800">
|
||||
<v-img @click="selectRom(rom)" v-bind="props" :src="'/assets'+rom.path_cover_l+'?reload='+forceImgReload" :lazy-src="'/assets'+rom.path_cover_s+'?reload='+forceImgReload" class="cover" cover>
|
||||
<template v-slot:placeholder>
|
||||
<div class="d-flex align-center justify-center fill-height">
|
||||
<v-progress-circular indeterminate/>
|
||||
</div>
|
||||
</template>
|
||||
<v-expand-transition>
|
||||
<div v-if="isHovering || !rom.has_cover" class="rom-title d-flex transition-fast-in-fast-out bg-secondary text-caption-1">
|
||||
<v-list-item>{{ rom.file_name }}</v-list-item>
|
||||
</div>
|
||||
</v-expand-transition>
|
||||
<div>
|
||||
<v-chip v-show="rom.region" class="ml-1 mr-1 bg-primary" size="x-small">{{ rom.region }}</v-chip>
|
||||
<v-chip v-show="rom.revision" class="mr-1 bg-primary" size="x-small">{{ rom.revision }}</v-chip>
|
||||
</div>
|
||||
</v-img>
|
||||
<v-card-text>
|
||||
<v-row>
|
||||
<v-col class="pa-0">
|
||||
<v-btn @click="downloadRom(rom, emitter)" icon="mdi-download" size="small" variant="text"/>
|
||||
<v-btn @click="downloadSave(rom, emitter)" icon="mdi-content-save-all" size="small" variant="text" :disabled="!saveFiles"/>
|
||||
</v-col>
|
||||
<v-btn @click="" icon="mdi-dots-vertical" size="small" variant="text" :disabled="!saveFiles"/>
|
||||
</v-row>
|
||||
</v-card-text>
|
||||
</v-hover>
|
||||
</v-card>
|
||||
</v-hover>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<v-row v-if="noRoms" class="d-flex justify-center align-center mt-16">
|
||||
<div class="text-h6">Feels cold here... <v-icon>mdi-emoticon-sad</v-icon></div>
|
||||
</v-row>
|
||||
|
||||
<v-dialog v-model="gettingRoms" scroll-strategy="none" width="auto" :scrim="false" persistent>
|
||||
<v-progress-circular :width="3" :size="70" indeterminate/>
|
||||
</v-dialog>
|
||||
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.v-card .rom-title{
|
||||
transition: opacity .4s ease-in-out;
|
||||
}
|
||||
.rom-title.on-hover {
|
||||
opacity: 1;
|
||||
}
|
||||
.rom-title:not(.on-hover) {
|
||||
opacity: 0.85;
|
||||
}
|
||||
.v-card.on-hover {
|
||||
opacity: 1;
|
||||
}
|
||||
.v-card:not(.on-hover) {
|
||||
opacity: 0.85;
|
||||
}
|
||||
.cover{
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
39
frontend/src/components/SettingsDrawer/Base.vue
Normal file
39
frontend/src/components/SettingsDrawer/Base.vue
Normal file
@@ -0,0 +1,39 @@
|
||||
<script setup>
|
||||
import { ref, inject } from "vue"
|
||||
import SettingsHeader from '@/components/SettingsDrawer/Header.vue'
|
||||
import Scan from '@/components/SettingsDrawer/Scan.vue'
|
||||
import ThemeToggle from '@/components/SettingsDrawer/ThemeToggle.vue'
|
||||
import VersionLabel from '@/components/SettingsDrawer/VersionLabel.vue'
|
||||
|
||||
// Props
|
||||
const settingsDrawer = ref(false)
|
||||
|
||||
// Event listeners bus
|
||||
const emitter = inject('emitter')
|
||||
emitter.on('toggleSettings', () => { settingsDrawer.value = !settingsDrawer.value })
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
<v-navigation-drawer
|
||||
v-model="settingsDrawer"
|
||||
location="right"
|
||||
width="270"
|
||||
temporary
|
||||
floating>
|
||||
|
||||
<settings-header/>
|
||||
|
||||
<v-divider class="border-opacity-100" :thickness="2"/>
|
||||
|
||||
<scan/>
|
||||
|
||||
<template v-slot:append>
|
||||
<v-divider class="border-opacity-25"/>
|
||||
<theme-toggle/>
|
||||
<v-divider class="border-opacity-25"/>
|
||||
<version-label/>
|
||||
</template>
|
||||
|
||||
</v-navigation-drawer>
|
||||
</template>
|
||||
20
frontend/src/components/SettingsDrawer/Header.vue
Normal file
20
frontend/src/components/SettingsDrawer/Header.vue
Normal file
@@ -0,0 +1,20 @@
|
||||
<script setup>
|
||||
import { inject } from "vue"
|
||||
|
||||
// Event listeners bus
|
||||
const emitter = inject('emitter')
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-list-item
|
||||
class="text-h5 d-flex align-center justify-center font-weight-bold bg-primary pt-4 pb-4 pl-7">
|
||||
Settings
|
||||
<v-btn
|
||||
title="close settings"
|
||||
@click="emitter.emit('toggleSettings')"
|
||||
class="ml-1"
|
||||
icon="mdi-close-box"
|
||||
rounded="0"
|
||||
variant="plain"/>
|
||||
</v-list-item>
|
||||
</template>
|
||||
80
frontend/src/components/SettingsDrawer/Scan.vue
Normal file
80
frontend/src/components/SettingsDrawer/Scan.vue
Normal file
@@ -0,0 +1,80 @@
|
||||
<script setup>
|
||||
import axios from "axios"
|
||||
import { ref, inject, toRaw } from "vue"
|
||||
|
||||
// Props
|
||||
const platforms = ref([])
|
||||
const platformsToScan = ref([])
|
||||
const scanning = ref(false)
|
||||
const fullScan = ref(false)
|
||||
|
||||
// Event listeners bus
|
||||
const emitter = inject('emitter')
|
||||
emitter.on('platforms', (p) => { platforms.value = p })
|
||||
|
||||
// Functions
|
||||
async function scan() {
|
||||
scanning.value = true
|
||||
emitter.emit('scanning', true)
|
||||
const platforms = []
|
||||
toRaw(platformsToScan)._rawValue.forEach(p => {platforms.push(toRaw(p.slug))})
|
||||
await axios.get('/api/scan?platforms='+JSON.stringify(platforms)+'&full_scan='+fullScan.value).then((response) => {
|
||||
emitter.emit('snackbarScan', {'msg': 'Scan completed successfully!', 'icon': 'mdi-check-bold', 'color': 'green'})
|
||||
}).catch((error) => {
|
||||
console.log(error)
|
||||
emitter.emit('snackbarScan', {'msg': "Couldn't complete scan. Something went wrong...", 'icon': 'mdi-close-circle', 'color': 'red'})
|
||||
})
|
||||
scanning.value = false
|
||||
emitter.emit('scanning', false)
|
||||
emitter.emit('refresh')
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-list>
|
||||
<v-select
|
||||
label="Platforms"
|
||||
item-title="name"
|
||||
v-model="platformsToScan"
|
||||
:items="platforms"
|
||||
class="pl-5 pr-5 mt-2 mb-1"
|
||||
density="comfortable"
|
||||
variant="outlined"
|
||||
multiple
|
||||
return-object
|
||||
clearable
|
||||
hide-details
|
||||
chips/>
|
||||
|
||||
<v-list-item class="pa-0">
|
||||
<v-row class="align-center">
|
||||
<v-col class="d-flex justify-center">
|
||||
<v-btn
|
||||
title="scan"
|
||||
@click="scan()"
|
||||
:disabled="scanning"
|
||||
prepend-icon="mdi-magnify-scan"
|
||||
class="ml-7"
|
||||
color="secondary"
|
||||
rounded="0"
|
||||
inset>
|
||||
<p v-if="!scanning">Scan</p>
|
||||
<v-progress-circular
|
||||
v-show="scanning"
|
||||
class="ml-2"
|
||||
:width="2"
|
||||
:size="20"
|
||||
indeterminate/>
|
||||
</v-btn>
|
||||
</v-col>
|
||||
<v-col class="mr-4">
|
||||
<v-checkbox
|
||||
v-model="fullScan"
|
||||
label="Full scan"
|
||||
hide-details/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-list-item>
|
||||
|
||||
</v-list>
|
||||
</template>
|
||||
26
frontend/src/components/SettingsDrawer/ThemeToggle.vue
Normal file
26
frontend/src/components/SettingsDrawer/ThemeToggle.vue
Normal file
@@ -0,0 +1,26 @@
|
||||
<script setup>
|
||||
import { ref } from "vue"
|
||||
import { useTheme } from "vuetify"
|
||||
|
||||
// Props
|
||||
const theme = useTheme()
|
||||
const darkMode = (localStorage.getItem('theme') == 'light') ? ref(false) : ref(true)
|
||||
|
||||
// Functions
|
||||
function toggleTheme() {
|
||||
theme.global.name.value = darkMode.value ? "dark" : "light"
|
||||
darkMode.value ? localStorage.setItem('theme', 'dark') : localStorage.setItem('theme', 'light')
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-list-item class="d-flex align-center justify-center">
|
||||
<v-switch
|
||||
@change="toggleTheme()"
|
||||
v-model="darkMode"
|
||||
class="pr-2 pl-2"
|
||||
prepend-icon="mdi-theme-light-dark"
|
||||
hide-details
|
||||
inset/>
|
||||
</v-list-item>
|
||||
</template>
|
||||
9
frontend/src/components/SettingsDrawer/VersionLabel.vue
Normal file
9
frontend/src/components/SettingsDrawer/VersionLabel.vue
Normal file
@@ -0,0 +1,9 @@
|
||||
<script setup>
|
||||
const ROMM_VERSION = import.meta.env.VITE_ROMM_VERSION
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<v-list-item class="d-flex justify-center alignt-center text-body-2">
|
||||
<p>RomM v{{ ROMM_VERSION }}</p>
|
||||
</v-list-item>
|
||||
</template>
|
||||
@@ -4,11 +4,11 @@ import { createRouter, createWebHistory } from 'vue-router'
|
||||
const routes = [
|
||||
{
|
||||
path: '/',
|
||||
component: () => import('@/components/RomsGallery.vue')
|
||||
component: () => import('@/views/Gallery.vue')
|
||||
},
|
||||
{
|
||||
path: '/details',
|
||||
component: () => import('@/components/RomDetails.vue')
|
||||
component: () => import('@/views/Details.vue')
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
@@ -4,28 +4,22 @@ import { saveAs } from 'file-saver'
|
||||
|
||||
|
||||
export async function downloadRom(rom, emitter, filesToDownload=[]) {
|
||||
console.log("Downloading "+rom.file_name)
|
||||
emitter.emit('snackbarScan', {'msg': "Downloading "+rom.file_name+"...", 'icon': 'mdi-download', 'color': 'green'})
|
||||
if(rom.multi){
|
||||
const zip = new JSZip()
|
||||
var zipFilename = rom.file_name+".zip"
|
||||
var files = []
|
||||
toRaw(filesToDownload).forEach(f => {files.push(toRaw(f))})
|
||||
var zipFilename = rom.file_name+".zip"
|
||||
const zip = new JSZip()
|
||||
var count = 0
|
||||
if (files.length == 0){ files = rom.files }
|
||||
var count = 0
|
||||
files.forEach(async function (file_part) {
|
||||
var file_full_path = "/assets"+rom.file_path+"/"+rom.file_name+"/"+file_part
|
||||
console.log("downloading part: "+file_full_path)
|
||||
var file = await fetch(file_full_path)
|
||||
var fileBlob = await file.blob()
|
||||
var f = zip.folder(rom.file_name);
|
||||
f.file(file_part, fileBlob, { binary: true });
|
||||
count ++
|
||||
if (count == files.length) {
|
||||
zip.generateAsync({ type: 'blob' }).then(function (content) {
|
||||
saveAs(content, zipFilename);
|
||||
});
|
||||
}
|
||||
if (count == files.length) { zip.generateAsync({ type: 'blob' }).then(function (content) { saveAs(content, zipFilename); }); }
|
||||
})
|
||||
}
|
||||
else{
|
||||
@@ -36,6 +30,6 @@ export async function downloadRom(rom, emitter, filesToDownload=[]) {
|
||||
}
|
||||
}
|
||||
|
||||
export async function downloadSave(rom, emitter) {
|
||||
console.log("Downloading "+rom.file_name+" save file")
|
||||
}
|
||||
export async function downloadSave(rom, emitter) { console.log("Downloading "+rom.file_name+" save file") }
|
||||
|
||||
export function normalizeString(s) { return s.toLowerCase().normalize('NFD').replace(/[\u0300-\u036f]/g,"") }
|
||||
@@ -8,6 +8,7 @@ import { downloadRom, downloadSave } from '@/utils/utils.js'
|
||||
const rom = ref(JSON.parse(localStorage.getItem('currentRom')) || '')
|
||||
const saveFiles = ref(false)
|
||||
const searching = ref(false)
|
||||
const igdb_id = ref('')
|
||||
const matchedRoms = ref([])
|
||||
const updating = ref(false)
|
||||
const editedRomName = ref(rom.value.file_name)
|
||||
@@ -27,11 +28,9 @@ emitter.on('currentRom', (currentRom) => { rom.value = currentRom })
|
||||
async function searchRomIGDB() {
|
||||
searching.value = true
|
||||
dialogSearchRom.value = true
|
||||
console.log("searching for rom... "+rom.value.file_name)
|
||||
await axios.put('/api/search/roms/igdb', {
|
||||
await axios.put('/api/search/roms/igdb?igdb_id='+igdb_id.value, {
|
||||
rom: rom.value
|
||||
}).then((response) => {
|
||||
console.log(response.data.data)
|
||||
matchedRoms.value = response.data.data
|
||||
}).catch((error) => {console.log(error)})
|
||||
searching.value = false
|
||||
@@ -48,12 +47,10 @@ async function updateRom(updatedRom=Object.assign({},rom.value), newName=rom.val
|
||||
else{
|
||||
updatedRom.file_name = newName
|
||||
}
|
||||
console.log(rom.value)
|
||||
await axios.patch('/api/platforms/'+rom.value.p_slug+'/roms', {
|
||||
rom: rom.value,
|
||||
updatedRom: updatedRom
|
||||
}).then((response) => {
|
||||
console.log('updated rom: '+JSON.stringify(rom.value))
|
||||
localStorage.setItem('currentRom', JSON.stringify(response.data.data))
|
||||
emitter.emit('snackbarScan', {'msg': rom.value.file_name+" updated successfully!", 'icon': 'mdi-check-bold', 'color': 'green'})
|
||||
rom.value = response.data.data
|
||||
@@ -66,10 +63,8 @@ async function updateRom(updatedRom=Object.assign({},rom.value), newName=rom.val
|
||||
}
|
||||
|
||||
async function deleteRom() {
|
||||
console.log('deleting rom '+ rom.value.file_name)
|
||||
await axios.delete('/api/platforms/'+rom.value.p_slug+'/roms/'+rom.value.file_name+'?filesystem='+deleteFromFs.value)
|
||||
.then((response) => {
|
||||
console.log(response)
|
||||
emitter.emit('snackbarScan', {'msg': rom.value.file_name+" deleted successfully!", 'icon': 'mdi-check-bold', 'color': 'green'})
|
||||
router.push(import.meta.env.BASE_URL)
|
||||
}).catch((error) => {
|
||||
@@ -100,7 +95,14 @@ async function deleteRom() {
|
||||
<v-container>
|
||||
<v-row>
|
||||
<v-col class="pa-1">
|
||||
<v-btn @click="downloadRom(rom, emitter, filesToDownload)" rounded="0" block><v-icon icon="mdi-download" size="large"/></v-btn>
|
||||
<v-btn
|
||||
@click="downloadRom(rom, emitter, filesToDownload)"
|
||||
rounded="0"
|
||||
block>
|
||||
<v-icon
|
||||
icon="mdi-download"
|
||||
size="large"/>
|
||||
</v-btn>
|
||||
</v-col>
|
||||
<v-col class="pa-1">
|
||||
<v-btn @click="downloadSave(rom, emitter)" rounded="0" block :disabled="!saveFiles"><v-icon icon="mdi-content-save-all" size="large"/></v-btn>
|
||||
@@ -142,13 +144,10 @@ async function deleteRom() {
|
||||
</td></tr>
|
||||
<tr><td>Platform</td><td>{{ rom.p_slug }}</td></tr>
|
||||
<tr><td>Size</td><td>{{ rom.file_size }} MB</td></tr>
|
||||
<!-- <tr><td>Path</td><td>{{ rom.file_path }}</td></tr> -->
|
||||
<tr><td>IGDB id</td><td><a :href="'https://www.igdb.com/games/'+rom.r_slug">{{ rom.r_igdb_id }}</a></td></tr>
|
||||
<tr v-show="rom.region"><td>Region</td><td>{{ rom.region }}</td></tr>
|
||||
<tr v-show="rom.revision"><td>Revision</td><td>{{ rom.revision }}</td></tr>
|
||||
<tr v-show="rom.tags.length>0"><td>Tags</td><td><v-chip-group><v-chip v-for="tag in rom.tags" label>{{ tag }}</v-chip></v-chip-group></td></tr>
|
||||
<!-- <tr><td>Slug</td><td>{{ rom.r_slug }}</td></tr> -->
|
||||
<!-- <tr><td>Cover</td><td>{{ rom.path_cover_l }}</td></tr> -->
|
||||
<tr><td>Summary</td><td class="pt-3">{{ rom.summary }}</td></tr>
|
||||
</tbody>
|
||||
</v-table>
|
||||
@@ -157,14 +156,30 @@ async function deleteRom() {
|
||||
|
||||
<v-dialog v-model="dialogSearchRom" scroll-strategy="none" width="auto" :scrim="false">
|
||||
<v-card max-width="600">
|
||||
|
||||
<v-toolbar v-show="searching">
|
||||
<v-toolbar-title>Searching...</v-toolbar-title>
|
||||
<v-btn icon @click="dialogSearchRom=false" class="ml-1" rounded="0"><v-icon>mdi-close</v-icon></v-btn>
|
||||
</v-toolbar>
|
||||
|
||||
<v-toolbar v-show="!searching">
|
||||
<v-toolbar-title>Results found</v-toolbar-title>
|
||||
<v-btn icon @click="dialogSearchRom=false" class="ml-1" rounded="0"><v-icon>mdi-close</v-icon></v-btn>
|
||||
</v-toolbar>
|
||||
|
||||
<v-text-field
|
||||
@keyup.enter="searchRomIGDB()"
|
||||
@click:clear="igdb_id=''"
|
||||
v-show="!searching"
|
||||
v-model="igdb_id"
|
||||
label="search by id"
|
||||
prepend-inner-icon="mdi-search-web"
|
||||
class="ml-5 mt-5 mr-5 mb-5 shrink"
|
||||
variant="outlined"
|
||||
density="compact"
|
||||
hide-details
|
||||
clearable/>
|
||||
|
||||
<v-card-text rounded="0" class="pa-3 scroll">
|
||||
<div class="d-flex justify-center">
|
||||
<v-progress-circular v-show="searching" :width="2" :size="40" class="pa-3 ma-3" indeterminate/>
|
||||
63
frontend/src/views/Gallery.vue
Normal file
63
frontend/src/views/Gallery.vue
Normal file
@@ -0,0 +1,63 @@
|
||||
<script setup>
|
||||
import axios from 'axios'
|
||||
import { ref, inject, onMounted } from 'vue'
|
||||
import { normalizeString } from '@/utils/utils.js'
|
||||
import GameCard from '@/components/GameCard/Base.vue'
|
||||
|
||||
// Props
|
||||
const roms = ref([])
|
||||
const gettingRoms = ref(false)
|
||||
const noRoms = ref(false)
|
||||
const romsFiltered = ref([])
|
||||
const currentFilter = ref('')
|
||||
|
||||
// Event listeners bus
|
||||
const emitter = inject('emitter')
|
||||
emitter.on('selectedPlatform', (platform) => { getRoms(platform.slug) })
|
||||
emitter.on('filter', (filter) => { setFilter(filter) })
|
||||
|
||||
// Functions
|
||||
async function getRoms(platform) {
|
||||
noRoms.value = false
|
||||
emitter.emit('gettingRoms', true)
|
||||
gettingRoms.value = true
|
||||
await axios.get('/api/platforms/'+platform+'/roms').then((response) => {
|
||||
roms.value = response.data.data
|
||||
setFilter(currentFilter.value)
|
||||
}).catch((error) => {console.log(error)})
|
||||
emitter.emit('gettingRoms', false)
|
||||
gettingRoms.value = false
|
||||
if(roms.value.length==0){noRoms.value = true}
|
||||
}
|
||||
|
||||
function setFilter(filter) {
|
||||
currentFilter.value = normalizeString(filter)
|
||||
romsFiltered.value = roms.value.filter(rom => {
|
||||
return normalizeString(rom.file_name).includes(currentFilter.value)
|
||||
})
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
if(localStorage.getItem('selectedPlatform')){
|
||||
getRoms(JSON.parse(localStorage.getItem('selectedPlatform')).slug)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
||||
<v-row>
|
||||
<v-col v-for="rom in romsFiltered" cols="6" xs="6" sm="3" md="3" lg="2">
|
||||
<game-card :rom="rom"/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
|
||||
<v-row v-if="noRoms" class="d-flex justify-center align-center mt-16">
|
||||
<div class="text-h6">Feels cold here... <v-icon>mdi-emoticon-sad</v-icon></div>
|
||||
</v-row>
|
||||
|
||||
<v-dialog v-model="gettingRoms" scroll-strategy="none" width="auto" :scrim="false" persistent>
|
||||
<v-progress-circular :width="3" :size="70" indeterminate/>
|
||||
</v-dialog>
|
||||
|
||||
</template>
|
||||
Reference in New Issue
Block a user