From 8a7193d0e4c4826f242305f9145fd4d4ebb75c17 Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Tue, 12 Mar 2024 15:47:59 +0000 Subject: [PATCH 1/4] Add route in nginx for assets that 404s --- docker/nginx/default.conf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docker/nginx/default.conf b/docker/nginx/default.conf index fdf1ce7d5..8daa911c3 100644 --- a/docker/nginx/default.conf +++ b/docker/nginx/default.conf @@ -67,6 +67,11 @@ http { add_header Access-Control-Allow-Headers *; } + # Static files + location /assets { + try_files $uri $uri/ =404; + } + # OpenAPI for swagger and redoc location /openapi.json { proxy_pass http://uvicorn; From fdc2d8ef92f8a26886c9a13a9270c03fc690959e Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Tue, 12 Mar 2024 12:29:31 -0400 Subject: [PATCH 2/4] [HOTFIX] Use params when running sqlite -> maria migration --- backend/alembic/versions/0014_asset_files.py | 32 ++++++-------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/backend/alembic/versions/0014_asset_files.py b/backend/alembic/versions/0014_asset_files.py index 39c1ec0ce..96974d029 100644 --- a/backend/alembic/versions/0014_asset_files.py +++ b/backend/alembic/versions/0014_asset_files.py @@ -5,6 +5,7 @@ Revises: 0013_upgrade_file_extension Create Date: 2024-02-08 15:03:26.338964 """ + import os from alembic import op import sqlalchemy as sa @@ -56,33 +57,18 @@ def migrate_to_mysql() -> None: ).fetchall() for table_name in tables: table_name = table_name[0] + + # Skip migration for the 'alembic_version' table if table_name == "alembic_version": continue - table_data = sqlite_conn.execute( - text(f"SELECT * FROM {table_name}") - ).fetchall() - + table_data = sqlite_conn.execute(text(f"SELECT * FROM {table_name}")).fetchall() + # Insert data into MariaDB table - if table_name == "roms": - for row in table_data: - summary = tuple(row)[15].replace('"', '\\"').replace("'", "\\'") - maria_conn.execute( - text( - f'INSERT INTO {table_name} (id, igdb_id, p_igdb_id, sgdb_id, p_sgdb_id, platform_slug, p_name, file_name, file_name_no_tags, file_extension, file_path, file_size, file_size_units, name, slug, summary, path_cover_s, path_cover_l, revision, tags, multi, files, url_cover, url_screenshots, path_screenshots, regions, languages) VALUES ({tuple(row)[0]}, {tuple(row)[1]}, "{tuple(row)[2]}", {tuple(row)[3]}, "{tuple(row)[4]}", "{tuple(row)[5]}", "{tuple(row)[6]}", "{tuple(row)[7]}", "{tuple(row)[8]}", "{tuple(row)[9]}", "{tuple(row)[10]}", {tuple(row)[11]}, "{tuple(row)[12]}", "{tuple(row)[13]}", "{tuple(row)[14]}", "{summary}", "{tuple(row)[16]}", "{tuple(row)[17]}", "{tuple(row)[18]}", \'{tuple(row)[19]}\', {tuple(row)[20]}, \'{tuple(row)[21]}\', "{tuple(row)[22]}", \'{tuple(row)[23]}\', \'{tuple(row)[24]}\', \'{tuple(row)[25]}\', \'{tuple(row)[26]}\')'.replace( - "None,", "null," - ) - ) - ) - else: - for row in table_data: - maria_conn.execute( - text( - f"INSERT INTO {table_name} VALUES {tuple(row)}".replace( - "None,", "null," - ) - ) - ) + for row in table_data: + insert_query = f"INSERT INTO {table_name} VALUES ({', '.join([':%s' % key for key in row.keys()])})" + params = {key: value if value is not None else 'NULL' for key, value in row.items()} + maria_conn.execute(text(insert_query), params) maria_conn.execute(text("SET FOREIGN_KEY_CHECKS=1")) From ea8ea11611d5d8e0756b5f69fee4f9d066f80a74 Mon Sep 17 00:00:00 2001 From: zurdi Date: Wed, 13 Mar 2024 09:23:28 +0100 Subject: [PATCH 3/4] clear multifile selector on change --- frontend/src/stores/download.ts | 4 ++++ frontend/src/views/Details/Base.vue | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/frontend/src/stores/download.ts b/frontend/src/stores/download.ts index 485c95bec..1d151355e 100644 --- a/frontend/src/stores/download.ts +++ b/frontend/src/stores/download.ts @@ -13,5 +13,9 @@ export default defineStore("download", { remove(id: number) { this.value.splice(this.value.indexOf(id), 1); }, + clear() { + this.value = [] as number[] + this.filesToDownloadMultiFileRom = [] as string[] + } }, }); diff --git a/frontend/src/views/Details/Base.vue b/frontend/src/views/Details/Base.vue index 53b5952f4..71056ac8d 100644 --- a/frontend/src/views/Details/Base.vue +++ b/frontend/src/views/Details/Base.vue @@ -1,4 +1,5 @@