From fcc0b6ca975d86eb50eb729a1b439969b52fd7a0 Mon Sep 17 00:00:00 2001 From: Zurdi <34356590+zurdi15@users.noreply.github.com> Date: Fri, 31 Mar 2023 16:39:51 +0200 Subject: [PATCH 1/4] Update utils.js --- frontend/src/utils/utils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/utils/utils.js b/frontend/src/utils/utils.js index 8def2cab4..c0a30840b 100644 --- a/frontend/src/utils/utils.js +++ b/frontend/src/utils/utils.js @@ -4,11 +4,11 @@ import { saveAs } from 'file-saver' export function downloadRom(rom) { console.log("Downloading "+rom.file_name) - axios.get('/assets/library/'+rom.p_slug+'/roms/'+rom.file_name, { responseType: 'blob' }).then(response => { + axios.get('/assets/'+rom.file_path+'/'+rom.file_name, { responseType: 'blob' }).then(response => { saveAs(new Blob([response.data], { type: 'application/file' }), rom.file_name) }).catch((error) => {console.log(error)}) } export function downloadSave(rom) { console.log("Downloading "+rom.file_name+" save file") -} \ No newline at end of file +} From 8d3501cbf16b90379b39482823951fb658f9b963 Mon Sep 17 00:00:00 2001 From: Zurdi <34356590+zurdi15@users.noreply.github.com> Date: Fri, 31 Mar 2023 17:38:29 +0200 Subject: [PATCH 2/4] fix download url --- frontend/src/utils/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/utils/utils.js b/frontend/src/utils/utils.js index c0a30840b..34c9a6ba7 100644 --- a/frontend/src/utils/utils.js +++ b/frontend/src/utils/utils.js @@ -4,7 +4,7 @@ import { saveAs } from 'file-saver' export function downloadRom(rom) { console.log("Downloading "+rom.file_name) - axios.get('/assets/'+rom.file_path+'/'+rom.file_name, { responseType: 'blob' }).then(response => { + axios.get(rom.file_path+'/'+rom.file_name, { responseType: 'blob' }).then(response => { saveAs(new Blob([response.data], { type: 'application/file' }), rom.file_name) }).catch((error) => {console.log(error)}) } From 9e3d091162e4cb5b6a5c181da290d6ff87db4917 Mon Sep 17 00:00:00 2001 From: zurdi zurdo Date: Mon, 3 Apr 2023 12:32:19 +0200 Subject: [PATCH 3/4] download game fixed --- backend/src/config/__init__.py | 6 ++---- backend/src/handler/db_handler.py | 1 - backend/src/utils/fs.py | 2 +- frontend/.env | 1 + frontend/package-lock.json | 8 ++++---- frontend/package.json | 2 +- frontend/src/components/Navigation.vue | 7 ++++++- frontend/src/utils/utils.js | 2 +- 8 files changed, 16 insertions(+), 13 deletions(-) create mode 100644 frontend/.env diff --git a/backend/src/config/__init__.py b/backend/src/config/__init__.py index 44f94a14b..e26fe9bd8 100644 --- a/backend/src/config/__init__.py +++ b/backend/src/config/__init__.py @@ -1,17 +1,15 @@ import os -import pathlib import yaml from yaml.loader import SafeLoader - # Uvicorn DEV_PORT: int = 5000 DEV_HOST: str = "0.0.0.0" # PATHS -LIBRARY_BASE_PATH: str = f"{pathlib.Path(__file__).parent.parent.parent.parent.resolve()}/library" +LIBRARY_BASE_PATH: str = "/library" HIGH_PRIO_STRUCTURE_PATH: str = f"{LIBRARY_BASE_PATH}/roms" -ROMM_USER_CONFIG_PATH: str = f"{pathlib.Path(__file__).parent.parent.parent.parent.resolve()}/romm/config.yml" +ROMM_USER_CONFIG_PATH: str = f"/romm/config.yml" # ROMM RESERVED FOLDERS RESERVED_FOLDERS: list = ['resources', 'database'] diff --git a/backend/src/handler/db_handler.py b/backend/src/handler/db_handler.py index b8f1f8e52..01f211936 100644 --- a/backend/src/handler/db_handler.py +++ b/backend/src/handler/db_handler.py @@ -1,5 +1,4 @@ import functools -import json from fastapi import HTTPException from sqlalchemy import select diff --git a/backend/src/utils/fs.py b/backend/src/utils/fs.py index a50351e10..16a56441e 100644 --- a/backend/src/utils/fs.py +++ b/backend/src/utils/fs.py @@ -114,7 +114,7 @@ def get_roms(p_slug: str, full_scan: bool, only_amount: bool = False) -> list[di file_extension: str = rom.split('.')[-1] if '.' in rom else "" reg, rev, other_tags = parse_tags(rom) roms.append({'file_name': rom, 'file_path': roms_path, 'file_size': file_size, 'file_extension': file_extension, - 'region': reg, 'revision': rev, 'tags': other_tags}) + 'region': reg, 'revision': rev, 'tags': other_tags}) log.info(f"Roms found for {p_slug}: {roms}") if only_amount: return 0 return roms diff --git a/frontend/.env b/frontend/.env new file mode 100644 index 000000000..5f9286bec --- /dev/null +++ b/frontend/.env @@ -0,0 +1 @@ +VITE_ROMM_VERSION='1.6.1' \ No newline at end of file diff --git a/frontend/package-lock.json b/frontend/package-lock.json index ad25dda16..58572f303 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -1,12 +1,12 @@ { - "name": "vuetify-project", - "version": "0.0.0", + "name": "romm", + "version": "1.6.1", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "vuetify-project", - "version": "0.0.0", + "name": "romm", + "version": "1.2.2", "dependencies": { "@mdi/font": "7.0.96", "axios": "^1.3.4", diff --git a/frontend/package.json b/frontend/package.json index d376bc6c8..09840bc24 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -1,6 +1,6 @@ { "name": "romm", - "version": "1.2.2", + "version": "1.6.1", "private": true, "scripts": { "dev": "vite --host", diff --git a/frontend/src/components/Navigation.vue b/frontend/src/components/Navigation.vue index 0bf5ceffa..457a8d4d0 100644 --- a/frontend/src/components/Navigation.vue +++ b/frontend/src/components/Navigation.vue @@ -20,6 +20,7 @@ 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') @@ -122,7 +123,11 @@ getPlatforms() diff --git a/frontend/src/utils/utils.js b/frontend/src/utils/utils.js index 34c9a6ba7..3f7c128de 100644 --- a/frontend/src/utils/utils.js +++ b/frontend/src/utils/utils.js @@ -4,7 +4,7 @@ import { saveAs } from 'file-saver' export function downloadRom(rom) { console.log("Downloading "+rom.file_name) - axios.get(rom.file_path+'/'+rom.file_name, { responseType: 'blob' }).then(response => { + axios.get('/assets'+rom.file_path+'/'+rom.file_name, { responseType: 'blob' }).then(response => { saveAs(new Blob([response.data], { type: 'application/file' }), rom.file_name) }).catch((error) => {console.log(error)}) } From 1b7a419120a56b1b1a342f8d0a0cfbfaf7de32b0 Mon Sep 17 00:00:00 2001 From: zurdi zurdo Date: Mon, 3 Apr 2023 16:40:07 +0200 Subject: [PATCH 4/4] snackbar added to gathering and download rom --- frontend/src/components/RomDetails.vue | 16 +++------------- frontend/src/components/RomsGallery.vue | 13 ++----------- frontend/src/utils/utils.js | 14 +++++++++++--- 3 files changed, 16 insertions(+), 27 deletions(-) diff --git a/frontend/src/components/RomDetails.vue b/frontend/src/components/RomDetails.vue index 68e128b59..30b081470 100644 --- a/frontend/src/components/RomDetails.vue +++ b/frontend/src/components/RomDetails.vue @@ -1,6 +1,6 @@ @@ -92,8 +83,8 @@ onMounted(() => { if(localStorage.getItem('currentPlatform')){ getRoms(JSON.pars - - + + diff --git a/frontend/src/utils/utils.js b/frontend/src/utils/utils.js index 3f7c128de..7a87db786 100644 --- a/frontend/src/utils/utils.js +++ b/frontend/src/utils/utils.js @@ -2,13 +2,21 @@ import axios from 'axios' import { saveAs } from 'file-saver' -export function downloadRom(rom) { +export function downloadRom(rom, emitter) { console.log("Downloading "+rom.file_name) + emitter.emit('snackbarScan', {'msg': "Gathering "+rom.file_name+"...", 'icon': 'mdi-download', 'color': 'green'}) + emitter.emit('downloadingRom', true) axios.get('/assets'+rom.file_path+'/'+rom.file_name, { responseType: 'blob' }).then(response => { + emitter.emit('downloadingRom', false, rom.file_name) + emitter.emit('snackbarScan', {'msg': "Downloading "+rom.file_name, 'icon': 'mdi-download', 'color': 'green'}) saveAs(new Blob([response.data], { type: 'application/file' }), rom.file_name) - }).catch((error) => {console.log(error)}) + }).catch((error) => { + emitter.emit('downloadingRom', false) + console.log(error) + emitter.emit('snackbarScan', {'msg': "Couldn't download "+rom.file_name+". Something went wrong...", 'icon': 'mdi-close-circle', 'color': 'red'}) + }) } -export function downloadSave(rom) { +export function downloadSave(rom, emitter) { console.log("Downloading "+rom.file_name+" save file") }