diff --git a/backend/src/main.py b/backend/src/main.py index 3d21f3c3c..c329e9f83 100644 --- a/backend/src/main.py +++ b/backend/src/main.py @@ -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) diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 311fc8da4..c38c41017 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -1,47 +1,36 @@ diff --git a/frontend/src/components/AppBar/Base.vue b/frontend/src/components/AppBar/Base.vue new file mode 100644 index 000000000..e87997fdc --- /dev/null +++ b/frontend/src/components/AppBar/Base.vue @@ -0,0 +1,42 @@ + + + diff --git a/frontend/src/components/AppBar/PlatformsBtn.vue b/frontend/src/components/AppBar/PlatformsBtn.vue new file mode 100644 index 000000000..8b6bb73d4 --- /dev/null +++ b/frontend/src/components/AppBar/PlatformsBtn.vue @@ -0,0 +1,22 @@ + + + \ No newline at end of file diff --git a/frontend/src/components/AppBar/RomMIcon.vue b/frontend/src/components/AppBar/RomMIcon.vue new file mode 100644 index 000000000..2b7666968 --- /dev/null +++ b/frontend/src/components/AppBar/RomMIcon.vue @@ -0,0 +1,11 @@ + diff --git a/frontend/src/components/AppBar/SearchBar.vue b/frontend/src/components/AppBar/SearchBar.vue new file mode 100644 index 000000000..f16c45cc9 --- /dev/null +++ b/frontend/src/components/AppBar/SearchBar.vue @@ -0,0 +1,23 @@ + + + diff --git a/frontend/src/components/AppBar/SettingsBtn.vue b/frontend/src/components/AppBar/SettingsBtn.vue new file mode 100644 index 000000000..331d47d16 --- /dev/null +++ b/frontend/src/components/AppBar/SettingsBtn.vue @@ -0,0 +1,16 @@ + + + \ No newline at end of file diff --git a/frontend/src/components/AppBar/UploadBtn.vue b/frontend/src/components/AppBar/UploadBtn.vue new file mode 100644 index 000000000..750e80fbc --- /dev/null +++ b/frontend/src/components/AppBar/UploadBtn.vue @@ -0,0 +1,19 @@ + + + \ No newline at end of file diff --git a/frontend/src/components/GameCard/ActionBar.vue b/frontend/src/components/GameCard/ActionBar.vue new file mode 100644 index 000000000..0dbc206b6 --- /dev/null +++ b/frontend/src/components/GameCard/ActionBar.vue @@ -0,0 +1,37 @@ + + + \ No newline at end of file diff --git a/frontend/src/components/GameCard/Base.vue b/frontend/src/components/GameCard/Base.vue new file mode 100644 index 000000000..bcc21d449 --- /dev/null +++ b/frontend/src/components/GameCard/Base.vue @@ -0,0 +1,42 @@ + + + + + \ No newline at end of file diff --git a/frontend/src/components/GameCard/Cover.vue b/frontend/src/components/GameCard/Cover.vue new file mode 100644 index 000000000..f9d9e4595 --- /dev/null +++ b/frontend/src/components/GameCard/Cover.vue @@ -0,0 +1,56 @@ + + + \ No newline at end of file diff --git a/frontend/src/components/Navigation.vue b/frontend/src/components/Navigation.vue deleted file mode 100644 index 55abd72e7..000000000 --- a/frontend/src/components/Navigation.vue +++ /dev/null @@ -1,198 +0,0 @@ - - - - - \ No newline at end of file diff --git a/frontend/src/components/Notification.vue b/frontend/src/components/Notification.vue new file mode 100644 index 000000000..50d19b310 --- /dev/null +++ b/frontend/src/components/Notification.vue @@ -0,0 +1,24 @@ + + + \ No newline at end of file diff --git a/frontend/src/components/PlatformsDrawer/Base.vue b/frontend/src/components/PlatformsDrawer/Base.vue new file mode 100644 index 000000000..11411f4bb --- /dev/null +++ b/frontend/src/components/PlatformsDrawer/Base.vue @@ -0,0 +1,44 @@ + + + diff --git a/frontend/src/components/PlatformsDrawer/Platform.vue b/frontend/src/components/PlatformsDrawer/Platform.vue new file mode 100644 index 000000000..743a6d957 --- /dev/null +++ b/frontend/src/components/PlatformsDrawer/Platform.vue @@ -0,0 +1,42 @@ + + + + + \ No newline at end of file diff --git a/frontend/src/components/PlatformsDrawer/RailBtn.vue b/frontend/src/components/PlatformsDrawer/RailBtn.vue new file mode 100644 index 000000000..713844969 --- /dev/null +++ b/frontend/src/components/PlatformsDrawer/RailBtn.vue @@ -0,0 +1,19 @@ + + + \ No newline at end of file diff --git a/frontend/src/components/RomsGallery.vue b/frontend/src/components/RomsGallery.vue deleted file mode 100644 index 17e262700..000000000 --- a/frontend/src/components/RomsGallery.vue +++ /dev/null @@ -1,127 +0,0 @@ - - - - - \ No newline at end of file diff --git a/frontend/src/components/SettingsDrawer/Base.vue b/frontend/src/components/SettingsDrawer/Base.vue new file mode 100644 index 000000000..b7e114b01 --- /dev/null +++ b/frontend/src/components/SettingsDrawer/Base.vue @@ -0,0 +1,39 @@ + + + diff --git a/frontend/src/components/SettingsDrawer/Header.vue b/frontend/src/components/SettingsDrawer/Header.vue new file mode 100644 index 000000000..ba445efd5 --- /dev/null +++ b/frontend/src/components/SettingsDrawer/Header.vue @@ -0,0 +1,20 @@ + + + \ No newline at end of file diff --git a/frontend/src/components/SettingsDrawer/Scan.vue b/frontend/src/components/SettingsDrawer/Scan.vue new file mode 100644 index 000000000..f7f6bd849 --- /dev/null +++ b/frontend/src/components/SettingsDrawer/Scan.vue @@ -0,0 +1,80 @@ + + + \ No newline at end of file diff --git a/frontend/src/components/SettingsDrawer/ThemeToggle.vue b/frontend/src/components/SettingsDrawer/ThemeToggle.vue new file mode 100644 index 000000000..dbac4efe9 --- /dev/null +++ b/frontend/src/components/SettingsDrawer/ThemeToggle.vue @@ -0,0 +1,26 @@ + + + \ No newline at end of file diff --git a/frontend/src/components/SettingsDrawer/VersionLabel.vue b/frontend/src/components/SettingsDrawer/VersionLabel.vue new file mode 100644 index 000000000..34d6b1b1a --- /dev/null +++ b/frontend/src/components/SettingsDrawer/VersionLabel.vue @@ -0,0 +1,9 @@ + + + \ No newline at end of file diff --git a/frontend/src/router/index.js b/frontend/src/router/index.js index 0f255f8d3..fae2377e8 100644 --- a/frontend/src/router/index.js +++ b/frontend/src/router/index.js @@ -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') } ] diff --git a/frontend/src/utils/utils.js b/frontend/src/utils/utils.js index 81a2a0c51..1e3e89a1c 100644 --- a/frontend/src/utils/utils.js +++ b/frontend/src/utils/utils.js @@ -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,"") } \ No newline at end of file diff --git a/frontend/src/components/RomDetails.vue b/frontend/src/views/Details.vue similarity index 94% rename from frontend/src/components/RomDetails.vue rename to frontend/src/views/Details.vue index 3353d49a2..03d4a1360 100644 --- a/frontend/src/components/RomDetails.vue +++ b/frontend/src/views/Details.vue @@ -27,11 +27,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', { 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 +46,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 +62,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 +94,14 @@ async function deleteRom() { - + + + @@ -142,13 +143,10 @@ async function deleteRom() { Platform{{ rom.p_slug }} Size{{ rom.file_size }} MB - IGDB id{{ rom.r_igdb_id }} Region{{ rom.region }} Revision{{ rom.revision }} Tags{{ tag }} - - Summary{{ rom.summary }} diff --git a/frontend/src/views/Gallery.vue b/frontend/src/views/Gallery.vue new file mode 100644 index 000000000..fd66abbac --- /dev/null +++ b/frontend/src/views/Gallery.vue @@ -0,0 +1,63 @@ + + +