diff --git a/backend/alembic/versions/0033_rom_file_and_hashes.py b/backend/alembic/versions/0033_rom_file_and_hashes.py
index cb82ce262..936cda2a6 100644
--- a/backend/alembic/versions/0033_rom_file_and_hashes.py
+++ b/backend/alembic/versions/0033_rom_file_and_hashes.py
@@ -105,7 +105,9 @@ def upgrade() -> None:
CASE WHEN NOT r.multi THEN r.md5_hash ELSE NULL END AS md5_hash,
CASE WHEN NOT r.multi THEN r.sha1_hash ELSE NULL END AS sha1_hash
FROM roms r
- CROSS JOIN jsonb_array_elements(r.files) AS file_data;
+ CROSS JOIN jsonb_array_elements(r.files) AS file_data
+ WHERE file_data->>'filename' IS NOT NULL
+ AND file_data->>'filename' <> '';
"""
)
else:
@@ -124,7 +126,10 @@ def upgrade() -> None:
SELECT
r.id AS rom_id,
JSON_UNQUOTE(JSON_EXTRACT(file_data, '$.filename')) AS file_name,
- CASE WHEN r.multi = 0 THEN r.file_path ELSE CONCAT(TRIM(TRAILING '/' FROM r.file_path), '/', r.file_name) END AS file_path,
+ CASE
+ WHEN r.multi = 0 THEN r.file_path
+ ELSE CONCAT(TRIM(TRAILING '/' FROM r.file_path), '/', r.file_name)
+ END AS file_path,
JSON_UNQUOTE(JSON_EXTRACT(file_data, '$.size')) AS file_size_bytes,
JSON_UNQUOTE(JSON_EXTRACT(file_data, '$.last_modified')) AS last_modified,
CASE WHEN r.multi = 0 THEN r.crc_hash ELSE NULL END AS crc_hash,
@@ -135,7 +140,9 @@ def upgrade() -> None:
COLUMNS (
file_data JSON PATH '$'
)
- ) AS extracted_files;
+ ) AS extracted_files
+ WHERE JSON_UNQUOTE(JSON_EXTRACT(file_data, '$.filename')) IS NOT NULL
+ AND JSON_UNQUOTE(JSON_EXTRACT(file_data, '$.filename')) <> '';
"""
)
diff --git a/backend/config/config_manager.py b/backend/config/config_manager.py
index 1ba06d1f3..4e8fe3019 100644
--- a/backend/config/config_manager.py
+++ b/backend/config/config_manager.py
@@ -257,7 +257,10 @@ class ConfigManager:
},
},
},
- "filesystem": {"roms_folder": self.config.ROMS_FOLDER_NAME},
+ "filesystem": {
+ "roms_folder": self.config.ROMS_FOLDER_NAME,
+ "firmware_folder": self.config.FIRMWARE_FOLDER_NAME,
+ },
"system": {
"platforms": self.config.PLATFORMS_BINDING,
"versions": self.config.PLATFORMS_VERSIONS,
diff --git a/backend/handler/database/collections_handler.py b/backend/handler/database/collections_handler.py
index cfc83f6cd..1a40a1733 100644
--- a/backend/handler/database/collections_handler.py
+++ b/backend/handler/database/collections_handler.py
@@ -77,16 +77,20 @@ class DBCollectionsHandler(DBBaseHandler):
.execution_options(synchronize_session="evaluate")
)
- if rom_ids:
+ if rom_ids is not None:
# Delete all existing CollectionRom entries for this collection
session.execute(
delete(CollectionRom).where(CollectionRom.collection_id == id)
)
# Insert new CollectionRom entries for this collection
- session.execute(
- insert(CollectionRom),
- [{"collection_id": id, "rom_id": rom_id} for rom_id in set(rom_ids)],
- )
+ if rom_ids:
+ session.execute(
+ insert(CollectionRom),
+ [
+ {"collection_id": id, "rom_id": rom_id}
+ for rom_id in set(rom_ids)
+ ],
+ )
return session.query(Collection).filter_by(id=id).one()
diff --git a/backend/handler/metadata/igdb_handler.py b/backend/handler/metadata/igdb_handler.py
index d4112b084..8d9f9fafc 100644
--- a/backend/handler/metadata/igdb_handler.py
+++ b/backend/handler/metadata/igdb_handler.py
@@ -881,7 +881,6 @@ IGDB_PLATFORM_LIST = (
{"slug": "nuon", "name": "Nuon"},
{"slug": "ps", "name": "PlayStation"},
{"slug": "64dd", "name": "Nintendo 64DD"},
- {"slug": "64dd", "name": "Nintendo 64DD"},
{"slug": "neo-geo-pocket-color", "name": "Neo Geo Pocket Color"},
{"slug": "dvd-player", "name": "DVD Player"},
{"slug": "pocketstation", "name": "PocketStation"},
diff --git a/frontend/src/components/Details/Info/GameInfo.vue b/frontend/src/components/Details/Info/GameInfo.vue
index 796d64303..011e2bbfd 100644
--- a/frontend/src/components/Details/Info/GameInfo.vue
+++ b/frontend/src/components/Details/Info/GameInfo.vue
@@ -1,5 +1,6 @@
@@ -28,7 +25,6 @@ const { xs, smAndDown } = useDisplay();
-
diff --git a/frontend/src/components/Gallery/AppBar/Search/PlatformSelector.vue b/frontend/src/components/Gallery/AppBar/Search/PlatformSelector.vue
deleted file mode 100644
index 5415be3f0..000000000
--- a/frontend/src/components/Gallery/AppBar/Search/PlatformSelector.vue
+++ /dev/null
@@ -1,131 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/frontend/src/components/Gallery/AppBar/Search/SearchTextField.vue b/frontend/src/components/Gallery/AppBar/Search/SearchTextField.vue
index bd582e748..45cc62f87 100644
--- a/frontend/src/components/Gallery/AppBar/Search/SearchTextField.vue
+++ b/frontend/src/components/Gallery/AppBar/Search/SearchTextField.vue
@@ -2,14 +2,12 @@
import romApi from "@/services/api/rom";
import storeRoms from "@/stores/roms";
import storeGalleryFilter from "@/stores/galleryFilter";
-import storePlatforms from "@/stores/platforms";
import type { Events } from "@/types/emitter";
import type { Emitter } from "mitt";
import { inject, onMounted, watch } from "vue";
import { storeToRefs } from "pinia";
import { useDisplay } from "vuetify";
import { useRouter } from "vue-router";
-import type { Platform } from "@/stores/platforms";
import { useI18n } from "vue-i18n";
// Props
@@ -19,50 +17,9 @@ const router = useRouter();
const romsStore = storeRoms();
const { gettingRoms } = storeToRefs(romsStore);
const emitter = inject>("emitter");
-const platformsStore = storePlatforms();
-const { allPlatforms } = storeToRefs(platformsStore);
const galleryFilterStore = storeGalleryFilter();
const { searchText } = storeToRefs(galleryFilterStore);
-// Functions
-function setFilters() {
- galleryFilterStore.setFilterGenres([
- ...new Set(
- romsStore.filteredRoms
- .flatMap((rom) => rom.genres.map((genre) => genre))
- .sort(),
- ),
- ]);
- galleryFilterStore.setFilterFranchises([
- ...new Set(
- romsStore.filteredRoms
- .flatMap((rom) => rom.franchises.map((franchise) => franchise))
- .sort(),
- ),
- ]);
- galleryFilterStore.setFilterCompanies([
- ...new Set(
- romsStore.filteredRoms
- .flatMap((rom) => rom.companies.map((company) => company))
- .sort(),
- ),
- ]);
- galleryFilterStore.setFilterCollections([
- ...new Set(
- romsStore.filteredRoms
- .flatMap((rom) => rom.meta_collections.map((collection) => collection))
- .sort(),
- ),
- ]);
- galleryFilterStore.setFilterAgeRatings([
- ...new Set(
- romsStore.filteredRoms
- .flatMap((rom) => rom.age_ratings.map((ageRating) => ageRating))
- .sort(),
- ),
- ]);
-}
-
async function fetchRoms() {
if (searchText.value) {
// Auto hide android keyboard
@@ -90,18 +47,6 @@ async function fetchRoms() {
console.error(`Couldn't fetch roms: ${error}`);
} finally {
gettingRoms.value = false;
-
- galleryFilterStore.setFilterPlatforms([
- ...new Map(
- romsStore.filteredRoms.map((rom) => {
- const platform = allPlatforms.value.find(
- (p) => p.id === rom.platform_id,
- );
- return [rom.platform_name, platform];
- }),
- ).values(),
- ] as Platform[]);
- setFilters();
galleryFilterStore.activeFilterDrawer = false;
}
}
diff --git a/frontend/src/components/Gallery/AppBar/common/FilterDrawer/Base.vue b/frontend/src/components/Gallery/AppBar/common/FilterDrawer/Base.vue
index 6d374c3d3..e79eafee0 100644
--- a/frontend/src/components/Gallery/AppBar/common/FilterDrawer/Base.vue
+++ b/frontend/src/components/Gallery/AppBar/common/FilterDrawer/Base.vue
@@ -4,23 +4,30 @@ import FilterMatchedBtn from "@/components/Gallery/AppBar/common/FilterDrawer/Fi
import FilterFavouritesBtn from "@/components/Gallery/AppBar/common/FilterDrawer/FilterFavouritesBtn.vue";
import FilterDuplicatesBtn from "@/components/Gallery/AppBar/common/FilterDrawer/FilterDuplicatesBtn.vue";
import FilterTextField from "@/components/Gallery/AppBar/common/FilterTextField.vue";
-import PlatformSelector from "@/components/Gallery/AppBar/Search/PlatformSelector.vue";
import SearchTextField from "@/components/Gallery/AppBar/Search/SearchTextField.vue";
import SearchBtn from "@/components/Gallery/AppBar/Search/SearchBtn.vue";
import storeGalleryFilter from "@/stores/galleryFilter";
+import storeRoms from "@/stores/roms";
+import storePlatforms from "@/stores/platforms";
import type { Events } from "@/types/emitter";
import type { Emitter } from "mitt";
import { storeToRefs } from "pinia";
-import { inject, nextTick, ref } from "vue";
+import { inject, nextTick, onMounted, ref, watch } from "vue";
import { useDisplay } from "vuetify";
import { useI18n } from "vue-i18n";
// Props
+withDefaults(defineProps<{ hidePlatforms?: boolean }>(), {
+ hidePlatforms: false,
+});
+
const { t } = useI18n();
const { xs, smAndDown } = useDisplay();
const viewportWidth = ref(window.innerWidth);
const emitter = inject>("emitter");
const galleryFilterStore = storeGalleryFilter();
+const romsStore = storeRoms();
+const platformsStore = storePlatforms();
const {
activeFilterDrawer,
selectedGenre,
@@ -35,7 +42,12 @@ const {
filterAgeRatings,
selectedStatus,
filterStatuses,
+ selectedPlatform,
+ filterPlatforms,
} = storeToRefs(galleryFilterStore);
+const { filteredRoms } = storeToRefs(romsStore);
+const { allPlatforms } = storeToRefs(platformsStore);
+
const filters = [
{
label: t("platform.genre"),
@@ -71,6 +83,7 @@ const filters = [
// Functions
function resetFilters() {
+ selectedPlatform.value = null;
selectedGenre.value = null;
selectedFranchise.value = null;
selectedCollection.value = null;
@@ -82,6 +95,66 @@ function resetFilters() {
galleryFilterStore.disableFilterFavourites();
nextTick(() => emitter?.emit("filter", null));
}
+
+function setFilter() {
+ galleryFilterStore.setFilterPlatforms([
+ ...new Set(
+ romsStore.filteredRoms
+ .flatMap((rom) => platformsStore.get(rom.platform_id))
+ .filter((platform) => !!platform)
+ .sort(),
+ ),
+ ]);
+ galleryFilterStore.setFilterGenres([
+ ...new Set(
+ romsStore.filteredRoms
+ .flatMap((rom) => rom.genres.map((genre) => genre))
+ .sort(),
+ ),
+ ]);
+ galleryFilterStore.setFilterFranchises([
+ ...new Set(
+ romsStore.filteredRoms
+ .flatMap((rom) => rom.franchises.map((franchise) => franchise))
+ .sort(),
+ ),
+ ]);
+ galleryFilterStore.setFilterCompanies([
+ ...new Set(
+ romsStore.filteredRoms
+ .flatMap((rom) => rom.companies.map((company) => company))
+ .sort(),
+ ),
+ ]);
+ galleryFilterStore.setFilterCollections([
+ ...new Set(
+ romsStore.filteredRoms
+ .flatMap((rom) => rom.meta_collections.map((collection) => collection))
+ .sort(),
+ ),
+ ]);
+ galleryFilterStore.setFilterAgeRatings([
+ ...new Set(
+ romsStore.filteredRoms
+ .flatMap((rom) => rom.age_ratings.map((ageRating) => ageRating))
+ .sort(),
+ ),
+ ]);
+}
+
+onMounted(async () => {
+ watch(
+ () => filteredRoms.value,
+ async () => setFilter(),
+ { immediate: true }, // Ensure watcher is triggered immediately
+ );
+
+ watch(
+ () => allPlatforms.value,
+ async () => setFilter(),
+ { immediate: true }, // Ensure watcher is triggered immediately
+ );
+});
@@ -117,9 +190,6 @@ function resetFilters() {
-
-
-
@@ -128,6 +198,18 @@ function resetFilters() {
+
+ emitter?.emit('filter', null))"
+ />
+
r.id),
- type: "partial", // Quick scan so we can filter by selected roms
+ type: "quick", // Quick scan so we can filter by selected roms
apis: heartbeat.getMetadataOptions().map((s) => s.value),
});
}
@@ -105,13 +105,15 @@ async function removeFromFavourites() {
}
await collectionApi
.updateCollection({ collection: favCollection.value as Collection })
- .then(() => {
+ .then(({ data }) => {
emitter?.emit("snackbarShow", {
msg: "Roms removed from favourites successfully!",
icon: "mdi-check-bold",
color: "green",
timeout: 2000,
});
+ favCollection.value = data;
+ collectionsStore.update(data);
})
.catch((error) => {
console.log(error);
diff --git a/frontend/src/components/Gallery/Skeleton.vue b/frontend/src/components/Gallery/Skeleton.vue
index 67484f9f6..c346fcee0 100644
--- a/frontend/src/components/Gallery/Skeleton.vue
+++ b/frontend/src/components/Gallery/Skeleton.vue
@@ -11,8 +11,8 @@ const { currentView } = storeToRefs(galleryViewStore);
-
+
+ >
+
+
+
-
+
+ />
diff --git a/frontend/src/components/common/Collection/Dialog/AddRoms.vue b/frontend/src/components/common/Collection/Dialog/AddRoms.vue
index db73276ce..02326e381 100644
--- a/frontend/src/components/common/Collection/Dialog/AddRoms.vue
+++ b/frontend/src/components/common/Collection/Dialog/AddRoms.vue
@@ -47,6 +47,8 @@ async function addRomsToCollection() {
color: "green",
timeout: 2000,
});
+ emitter?.emit("refreshDrawer", null);
+ collectionsStore.update(data);
})
.catch((error) => {
console.log(error);
diff --git a/frontend/src/components/common/Collection/Dialog/RemoveRoms.vue b/frontend/src/components/common/Collection/Dialog/RemoveRoms.vue
index 739727262..fc00375c7 100644
--- a/frontend/src/components/common/Collection/Dialog/RemoveRoms.vue
+++ b/frontend/src/components/common/Collection/Dialog/RemoveRoms.vue
@@ -7,7 +7,6 @@ import type { UpdatedCollection } from "@/services/api/collection";
import collectionApi from "@/services/api/collection";
import storeCollections from "@/stores/collections";
import storeRoms, { type SimpleRom } from "@/stores/roms";
-import { ROUTES } from "@/plugins/router";
import type { Events } from "@/types/emitter";
import type { Emitter } from "mitt";
import { inject, ref, watch } from "vue";
@@ -53,6 +52,7 @@ async function removeRomsFromCollection() {
timeout: 2000,
});
emitter?.emit("refreshDrawer", null);
+ collectionsStore.update(data);
})
.catch((error) => {
console.log(error);
diff --git a/frontend/src/components/common/Collection/RAvatar.vue b/frontend/src/components/common/Collection/RAvatar.vue
index 75e78d9b7..7baca3f08 100644
--- a/frontend/src/components/common/Collection/RAvatar.vue
+++ b/frontend/src/components/common/Collection/RAvatar.vue
@@ -11,8 +11,6 @@ const props = withDefaults(
size: 45,
},
);
-const theme = useTheme();
-const collectionsStore = storeCollections();
const memoizedCovers = ref({
large: ["", ""],
diff --git a/frontend/src/components/common/Game/AdminMenu.vue b/frontend/src/components/common/Game/AdminMenu.vue
index 4add6fdd0..bddeffd1c 100644
--- a/frontend/src/components/common/Game/AdminMenu.vue
+++ b/frontend/src/components/common/Game/AdminMenu.vue
@@ -67,7 +67,7 @@ async function switchFromFavourites() {
}
await collectionApi
.updateCollection({ collection: favCollection.value as Collection })
- .then(() => {
+ .then(({ data }) => {
emitter?.emit("snackbarShow", {
msg: `${props.rom.name} ${
collectionsStore.isFav(props.rom) ? "added to" : "removed from"
@@ -76,6 +76,8 @@ async function switchFromFavourites() {
color: "green",
timeout: 2000,
});
+ favCollection.value = data;
+ collectionsStore.update(data);
})
.catch((error) => {
console.log(error);
@@ -131,7 +133,7 @@ async function onScan() {
socket.emit("scan", {
platforms: [props.rom.platform_id],
roms_ids: [props.rom.id],
- type: "partial", // Quick scan so we can filter by selected roms
+ type: "quick", // Quick scan so we can filter by selected roms
apis: heartbeat.getMetadataOptions().map((s) => s.value),
});
}
diff --git a/frontend/src/components/common/Game/FavBtn.vue b/frontend/src/components/common/Game/FavBtn.vue
index d8de0312c..107657c29 100644
--- a/frontend/src/components/common/Game/FavBtn.vue
+++ b/frontend/src/components/common/Game/FavBtn.vue
@@ -69,6 +69,8 @@ async function switchFromFavourites() {
color: "green",
timeout: 2000,
});
+ favCollection.value = data;
+ collectionsStore.update(data);
})
.catch((error) => {
console.log(error);
diff --git a/frontend/src/components/common/Navigation/HomeBtn.vue b/frontend/src/components/common/Navigation/HomeBtn.vue
index a4242cde5..c8e138494 100644
--- a/frontend/src/components/common/Navigation/HomeBtn.vue
+++ b/frontend/src/components/common/Navigation/HomeBtn.vue
@@ -1,17 +1,9 @@
-
+