download game fixed

This commit is contained in:
zurdi zurdo
2023-04-03 12:32:19 +02:00
parent 863684f46e
commit 1239c96b2f
8 changed files with 16 additions and 13 deletions

View File

@@ -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']

View File

@@ -1,5 +1,4 @@
import functools
import json
from fastapi import HTTPException
from sqlalchemy import select

View File

@@ -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

1
frontend/.env Normal file
View File

@@ -0,0 +1 @@
VITE_ROMM_VERSION='1.6.1'

View File

@@ -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",

View File

@@ -1,6 +1,6 @@
{
"name": "romm",
"version": "1.2.2",
"version": "1.6.1",
"private": true,
"scripts": {
"dev": "vite --host",

View File

@@ -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()
<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="true" prepend-icon="mdi-theme-light-dark" inset/>
<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>

View File

@@ -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)})
}