Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3.5.0 #1140

Merged
merged 158 commits into from
Sep 1, 2024
Merged

v3.5.0 #1140

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
158 commits
Select commit Hold shift + click to select a range
2b2ff87
Calculate hashes for rom files
gantoine Jul 15, 2024
2e91c44
Read into mem in chunks
gantoine Jul 16, 2024
591e41a
start checking for specific file exts
gantoine Jul 19, 2024
77afe55
add support for extracting content in compressed files
gantoine Jul 19, 2024
db1787d
fix trunk issues
gantoine Jul 19, 2024
efc0b75
Merge branch 'master' into calc-file-hashes-roms
gantoine Jul 26, 2024
ecc021e
Merge branch 'master' into calc-file-hashes-roms
gantoine Jul 27, 2024
3a9cef2
get it all wokring
gantoine Jul 27, 2024
9386ca9
changes from self-review
gantoine Jul 27, 2024
f01f5ce
trunk fixes
gantoine Jul 27, 2024
2c2adb4
Merge branch 'master' into calc-file-hashes-roms
gantoine Jul 27, 2024
0139e3a
fix tests
gantoine Jul 27, 2024
5529b76
start work on ruffle flash emulator
gantoine Jul 30, 2024
c7878ee
set more config options
gantoine Jul 30, 2024
95a66a1
misc: Improve typing for feed schemas
adamantike Aug 8, 2024
eccd220
Merge pull request #1064 from rommapp/misc/improve-feed-schemas
adamantike Aug 8, 2024
46b85ec
[ROMM-1063] Add Amiga CD32 to emulatorjs game list
gantoine Aug 8, 2024
3df87d1
Merge pull request #1065 from rommapp/romm-1063
gantoine Aug 8, 2024
0b766a6
fixed white + shadow text
zurdi15 Aug 8, 2024
fc51159
fixed fab overlay
zurdi15 Aug 8, 2024
9405723
fixed new version overlay
zurdi15 Aug 8, 2024
d2d31b8
Merge pull request #1073 from rommapp/fix/fab-overlay
zurdi15 Aug 8, 2024
0171fbd
Merge pull request #1072 from rommapp/fix/setup-on-white-theme
zurdi15 Aug 8, 2024
cd54d90
create database view for sibling roms
gantoine Aug 9, 2024
3a1986f
single lines for the virtual table
gantoine Aug 9, 2024
1ae9cd0
remove unneded code
gantoine Aug 9, 2024
5f0577b
more cleanup
gantoine Aug 9, 2024
27ba5a1
fix: Set Gunicorn option forwarded-allow-ips
adamantike Aug 9, 2024
514513d
Merge branch 'master' into fix/set-gunicorn-forwarded-allow-ips
zurdi15 Aug 9, 2024
b6aedfc
fix: Allow access to Tinfoil feed when download auth is disabled
adamantike Aug 9, 2024
687cffb
Merge pull request #1078 from rommapp/fix/allow-tinfoil-feed-when-dow…
adamantike Aug 9, 2024
441e15c
Merge pull request #1077 from rommapp/fix/set-gunicorn-forwarded-allo…
adamantike Aug 9, 2024
90e0e68
Merge branch 'master' into calc-file-hashes-roms
gantoine Aug 9, 2024
195b86b
even more cleanup
gantoine Aug 9, 2024
bc38b40
Merge branch 'master' into ruffle-flash-emulator
gantoine Aug 9, 2024
3e157ea
Merge branch 'master' into fixup-sibling-speed
gantoine Aug 10, 2024
2af2ffe
improve sql + add indexes
gantoine Aug 10, 2024
46c2dbe
tweaks to sql migration
gantoine Aug 11, 2024
9fb77f9
Merge pull request #1076 from rommapp/fixup-sibling-speed
gantoine Aug 11, 2024
7e086ce
fixes from code review
gantoine Aug 11, 2024
a4e162e
Merge branch 'master' into calc-file-hashes-roms
gantoine Aug 11, 2024
a5f0dfb
Merge pull request #1049 from rommapp/ruffle-flash-emulator
gantoine Aug 11, 2024
896d481
Merge branch 'master' into calc-file-hashes-roms
gantoine Aug 11, 2024
5603707
only calc hashes exlpicit
gantoine Aug 11, 2024
c3b754a
fix file meta order
gantoine Aug 12, 2024
a617b79
tweaks to details view
gantoine Aug 12, 2024
1ea1b32
move hashes to rom model
gantoine Aug 12, 2024
ce99ce4
update trunk + fix tests
gantoine Aug 12, 2024
75b856b
only calc hashes in certian conditions
gantoine Aug 12, 2024
bc08e05
changes from self review
gantoine Aug 12, 2024
336cc42
Merge pull request #1005 from rommapp/calc-file-hashes-roms
gantoine Aug 12, 2024
e24a3b8
Hotfix scans when running HASH_SCAN
gantoine Aug 12, 2024
b3a5002
run quick before hash scan
gantoine Aug 12, 2024
dff554b
Merge pull request #1081 from rommapp/hotfix-hash-calc-scans
gantoine Aug 12, 2024
d20f4ad
feat: Use X-Accel-Redirect to improve file download speed
adamantike Aug 12, 2024
9281760
merge gzip changes into branch
gantoine Aug 13, 2024
3d96382
Fix playing emulatorjs + better platform icon loading
gantoine Aug 13, 2024
9c3cd24
Merge pull request #1086 from rommapp/fix-ejs-ruffle
gantoine Aug 13, 2024
0eb5bba
add some missing headers
gantoine Aug 14, 2024
6e5d4dc
Fix home icon size on safari/ios
gantoine Aug 15, 2024
ea8c3b6
Merge pull request #1088 from rommapp/romm-1087
gantoine Aug 15, 2024
0fdbbe4
misc: Upgrade Python to v3.12 and Alpine to v3.20
adamantike Aug 15, 2024
1779872
Add icon to gallery header for current platform
gantoine Aug 15, 2024
822ef76
Merge pull request #1092 from rommapp/misc/upgrade-python-3.12
adamantike Aug 15, 2024
fed465a
use functions directly on file response
gantoine Aug 16, 2024
e8e5a87
Merge branch 'master' into feat/implement-x-accel-redirect
gantoine Aug 16, 2024
4f5029f
fix: Do not set Content-Length when X-Accel-Redirect is used
adamantike Aug 16, 2024
0b77c70
Merge pull request #1084 from rommapp/feat/implement-x-accel-redirect
gantoine Aug 16, 2024
0c3afc0
misc: Pin Node version to v20
adamantike Aug 16, 2024
bc0ad2e
Merge pull request #1095 from rommapp/misc/pin-node-20
adamantike Aug 16, 2024
d1c7d5c
move filter bar into sidebar on mobile
gantoine Aug 16, 2024
bdc5b37
Merge branch 'master' into romm-1091
zurdi15 Aug 16, 2024
3c12c77
Merge pull request #1093 from rommapp/romm-1091
gantoine Aug 16, 2024
8743b03
add rudimentary upload progress bars
gantoine Aug 16, 2024
e9c09b4
better upload progress state
gantoine Aug 17, 2024
4fb19b3
fix uploading dups
gantoine Aug 17, 2024
6c2f221
better progress up with speeds
gantoine Aug 17, 2024
65ffa44
tweaks
gantoine Aug 17, 2024
625bfcc
Merge branch 'master' into upload-progress-bars
gantoine Aug 17, 2024
2d72769
speed improvements
gantoine Aug 17, 2024
a071c0a
actual real upload streaming
gantoine Aug 17, 2024
83b4f32
mult progress by 100
gantoine Aug 17, 2024
716114e
parallel upload
gantoine Aug 17, 2024
faba97d
changes from self reivew
gantoine Aug 17, 2024
d384195
fixup trunk
gantoine Aug 18, 2024
608ada6
Merge pull request #1096 from rommapp/upload-progress-bars
gantoine Aug 18, 2024
49e4938
Skip compressed files if theyre invalid
gantoine Aug 18, 2024
794a454
Merge pull request #1097 from rommapp/hotifix-fake-compressed-files
gantoine Aug 18, 2024
2ec349d
Bump emulatorjs to 4.1.1
gantoine Aug 20, 2024
bb53b6e
actually lock the package json
gantoine Aug 20, 2024
a6e2b8b
Merge pull request #1100 from rommapp/emulatorjs-4.1.1
gantoine Aug 20, 2024
0fad8ac
feat: Use nginx mod_zip to generate multi-file zip downloads
adamantike Aug 16, 2024
0680063
misc: Add comments to Dockerfile about mod_zip
adamantike Aug 21, 2024
419f3ba
Merge pull request #1102 from rommapp/feat/use-nginx-mod-zip
adamantike Aug 21, 2024
a85c84a
misc: Use single SQLAlchemy engine and session maker
adamantike Aug 21, 2024
84f3a2c
Merge pull request #1105 from rommapp/misc/use-single-sqlalchemy-engine
adamantike Aug 21, 2024
5126ab1
Switch funding to open collective
gantoine Aug 21, 2024
e55401f
Merge pull request #1108 from rommapp/open-collectibe
gantoine Aug 21, 2024
c8b8bca
Replace illegal fs chars in filenames
gantoine Aug 22, 2024
f6c5dec
feat(UX) - Allow links to open in a new tab
SaraVieira Aug 25, 2024
3e9f59c
Upload dialog hotfixed + clear button
gantoine Aug 26, 2024
38d5ec1
compile regexes
gantoine Aug 26, 2024
2ce3282
Merge pull request #1109 from rommapp/rename-replace-illegal-chars
gantoine Aug 26, 2024
6c158c5
Merge pull request #1118 from rommapp/upload-dialog-hotfixes
gantoine Aug 26, 2024
c2e5a66
Fix detecting if platform is flash games
gantoine Aug 26, 2024
bff90fe
Merge pull request #1120 from rommapp/hotfix-detect-ruffleable-platform
gantoine Aug 26, 2024
4efb9de
revert one of the changes
gantoine Aug 27, 2024
351fa5b
Merge branch 'master' into feat/open-links-new-tab
gantoine Aug 27, 2024
1c704dd
small fix
gantoine Aug 27, 2024
ee93deb
Merge pull request #1116 from SaraVieira/feat/open-links-new-tab
gantoine Aug 27, 2024
9a75b85
fix(icons) - match icon names to platform names
SaraVieira Aug 27, 2024
ec5c7ac
Add support for formatting vuejs with trunk
gantoine Aug 27, 2024
f00749e
add back ms.ico + add sms to moby list
gantoine Aug 27, 2024
fa240e0
revert pico change
gantoine Aug 27, 2024
6eef946
Merge pull request #1122 from SaraVieira/fix/icon-names
gantoine Aug 27, 2024
589482f
Disable auth on content get + add alt pico icon
gantoine Aug 27, 2024
76e264a
Merge branch 'master' into trunk-prettier-vue
gantoine Aug 27, 2024
e2adb24
Merge pull request #1125 from rommapp/disable-auth-get-rom-content
gantoine Aug 27, 2024
eff1dc3
Merge pull request #1124 from rommapp/trunk-prettier-vue
gantoine Aug 27, 2024
2acc822
Add known bios files from retropie project
gantoine Aug 27, 2024
198b77a
Merge branch 'master' into retropie-known-bios-files
gantoine Aug 27, 2024
d4ced87
Merge pull request #1126 from rommapp/retropie-known-bios-files
gantoine Aug 27, 2024
9d40c52
Add titledb field to tinfoil response
gantoine Aug 28, 2024
f6197d4
Merge pull request #1127 from rommapp/tilfoil-titledb-field
gantoine Aug 28, 2024
e481691
Better performance for large collections
gantoine Aug 28, 2024
307d906
Merge branch 'master' into large-lib-performance-fixes
gantoine Aug 28, 2024
c00725f
Merge pull request #1128 from rommapp/large-lib-performance-fixes
gantoine Aug 28, 2024
08acaf9
[ROMM-1113] Add file path in rom edit window
gantoine Aug 29, 2024
e109d3e
Merge pull request #1129 from rommapp/romm-1113
gantoine Aug 29, 2024
626cf36
misc: Tag Docker image with major version only
adamantike Aug 29, 2024
4e3640c
Merge pull request #1131 from rommapp/misc/tag-image-major-version
adamantike Aug 29, 2024
330755f
[ROMM-1107] Add env variable to disable in-browser emulation
gantoine Aug 29, 2024
4c2c6e3
Merge branch 'master' into romm-1107
gantoine Aug 29, 2024
c0c80f7
Bump axios to 1.7.4
gantoine Aug 29, 2024
880e155
Merge pull request #1134 from rommapp/axios-1.7.4
gantoine Aug 29, 2024
f44d127
Convert string-to-bool in init
gantoine Aug 29, 2024
c55d63b
Merge pull request #1133 from rommapp/romm-1107
gantoine Aug 29, 2024
91f958f
default both fast forward and rewind to enabled
SaraVieira Aug 29, 2024
3cc74e1
Update Player.vue
SaraVieira Aug 29, 2024
f4a49f3
drop unused import
gantoine Aug 30, 2024
f04c9f8
Update Player.vue
SaraVieira Aug 30, 2024
341f76e
Merge branch 'master' into default-fastForward-rewind
SaraVieira Aug 30, 2024
86aae89
feat - Allow user to unmatch rom
SaraVieira Aug 30, 2024
dd61afd
add steamgrid
SaraVieira Aug 30, 2024
e70e2a7
Merge branch 'master' of github.com:rommapp/romm into feat/unmatch-rom
SaraVieira Aug 30, 2024
e7041fb
run tryunk
gantoine Aug 30, 2024
8700061
Merge pull request #1136 from SaraVieira/default-fastForward-rewind
gantoine Aug 30, 2024
72f1930
Merge branch 'master' of github.com:rommapp/romm into feat/unmatch-rom
SaraVieira Aug 30, 2024
6de94aa
Apply suggestions from code review
SaraVieira Aug 30, 2024
fcc6772
Merge branch 'feat/unmatch-rom' of github.com:SaraVieira/romm into fe…
SaraVieira Aug 30, 2024
c63f62a
update edit modal
SaraVieira Aug 30, 2024
fd996e3
run trunk
SaraVieira Aug 30, 2024
3617783
small refactor in component
gantoine Aug 30, 2024
a7aba73
fix trunk issues
gantoine Aug 30, 2024
f3f6b6e
small tweaks to ui
gantoine Aug 30, 2024
885aeab
fix ts
SaraVieira Aug 30, 2024
7978045
Merge branch 'release'
gantoine Aug 30, 2024
72fc6d8
Merge pull request #1138 from SaraVieira/feat/unmatch-rom
gantoine Aug 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
buy_me_a_coffee: zurdi15
open_collective: romm
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
labels: |
org.opencontainers.image.version={{version}}
org.opencontainers.image.title="rommapp/romm"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ jobs:
run: |
pipx install poetry

- name: Set up Python 3.11
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: "3.11"
python-version: "3.12"
cache: "poetry"

- name: Install dependencies
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ coverage
/cypress/screenshots/

# Editor directories and files
.vscode
.vscode/*
!.vscode/extensions.json
!.vscode/settings.json
!.vscode/tasks.json
.zed/*
!.zed/settings.json
pyrightconfig.json
.idea
*.suo
*.ntvs*
Expand Down
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.11
3.12
50 changes: 35 additions & 15 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,73 @@
# To learn more about the format of this file, see https://docs.trunk.io/reference/trunk-yaml
version: 0.1
cli:
version: 1.22.2
version: 1.22.3
# Trunk provides extensibility via plugins. (https://docs.trunk.io/plugins)
plugins:
sources:
- id: trunk
ref: v1.6.0
ref: v1.6.1
uri: https://github.com/trunk-io/plugins
# Many linters and tools depend on runtimes - configure them here. (https://docs.trunk.io/runtimes)
runtimes:
enabled:
- go@1.21.0
- node@18.12.1
- python@3.11.6
- python@3.12.2
# This is the section where you manage your linters. (https://docs.trunk.io/check/configuration)
lint:
enabled:
- markdownlint@0.41.0
- eslint@9.6.0
- eslint@9.9.0
- actionlint@1.7.1
- bandit@1.7.9
- black@24.4.2
- checkov@3.2.178
- black@24.8.0
- checkov@3.2.228
- git-diff-check
- isort@5.13.2
- mypy@1.10.1
- osv-scanner@1.8.1
- oxipng@9.1.1
- prettier@3.3.2
- ruff@0.5.1
- mypy@1.11.1
- osv-scanner@1.8.3
- oxipng@9.1.2
- prettier@3.3.3
- ruff@0.6.0
- shellcheck@0.10.0
- shfmt@3.6.0
- svgo@3.3.2
- taplo@0.8.1
- trivy@0.52.2
- trufflehog@3.79.0
- taplo@0.9.3
- trivy@0.54.1
- trufflehog@3.81.9
- yamllint@1.35.1
ignore:
- linters: [ALL]
paths:
- frontend/src/__generated__/**
- docker/Dockerfile
- docker/nginx/js/**
files:
- name: vue
extensions: [vue]
definitions:
- name: eslint
files: [typescript, javascript]
files:
- javascript
- typescript
commands:
- name: lint
run_from: ${root_or_parent_with_any_config}
- name: prettier
files:
- typescript
- yaml
- css
- postcss
- sass
- html
- markdown
- json
- javascript
- graphql
- vue
- prettier_supported_configs
actions:
disabled:
- trunk-check-pre-push
Expand Down
16 changes: 16 additions & 0 deletions .zed/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"languages": {
"Python": {
"tab_size": 4
},
"Vue.js": {
"tab_size": 2,
"formatter": {
"external": {
"command": "prettier",
"arguments": ["--stdin-filepath", "{buffer_path}"]
}
}
}
}
}
68 changes: 68 additions & 0 deletions backend/alembic/versions/0024_sibling_roms_db_view.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
"""empty message

Revision ID: 0024_sibling_roms_db_view
Revises: 0023_make_columns_non_nullable
Create Date: 2024-08-08 12:00:00.000000

"""

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "0024_sibling_roms_db_view"
down_revision = "0023_make_columns_non_nullable"
branch_labels = None
depends_on = None


def upgrade() -> None:
with op.batch_alter_table("roms", schema=None) as batch_op:
batch_op.create_index("idx_roms_igdb_id", ["igdb_id"])
batch_op.create_index("idx_roms_moby_id", ["moby_id"])

connection = op.get_bind()

connection.execute(
sa.text(
"""
CREATE VIEW sibling_roms AS
SELECT
r1.id AS rom_id,
r2.id AS sibling_rom_id,
r1.platform_id AS platform_id,
NOW() AS created_at,
NOW() AS updated_at,
CASE WHEN r1.igdb_id <=> r2.igdb_id THEN r1.igdb_id END AS igdb_id,
CASE WHEN r1.moby_id <=> r2.moby_id THEN r1.moby_id END AS moby_id
FROM
roms r1
JOIN
roms r2
ON
r1.platform_id = r2.platform_id
AND r1.id != r2.id
AND (
(r1.igdb_id = r2.igdb_id AND r1.igdb_id IS NOT NULL AND r1.igdb_id != '')
OR
(r1.moby_id = r2.moby_id AND r1.moby_id IS NOT NULL AND r1.moby_id != '')
);
"""
),
)


def downgrade() -> None:
connection = op.get_bind()

connection.execute(
sa.text(
"""
DROP VIEW sibling_roms;
"""
),
)

with op.batch_alter_table("roms", schema=None) as batch_op:
batch_op.drop_index("idx_roms_igdb_id")
batch_op.drop_index("idx_roms_moby_id")
46 changes: 46 additions & 0 deletions backend/alembic/versions/0025_roms_hashes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
"""empty message

Revision ID: 0025_roms_hashes
Revises: 0024_sibling_roms_db_view
Create Date: 2024-08-11 21:50:53.301352

"""

import sqlalchemy as sa
from alembic import op
from config import IS_PYTEST_RUN, SCAN_TIMEOUT
from endpoints.sockets.scan import scan_platforms
from handler.redis_handler import high_prio_queue
from handler.scan_handler import ScanType

# revision identifiers, used by Alembic.
revision = "0025_roms_hashes"
down_revision = "0024_sibling_roms_db_view"
branch_labels = None
depends_on = None


def upgrade() -> None:
with op.batch_alter_table("roms", schema=None) as batch_op:
batch_op.add_column(sa.Column("crc_hash", sa.String(length=100), nullable=True))
batch_op.add_column(sa.Column("md5_hash", sa.String(length=100), nullable=True))
batch_op.add_column(
sa.Column("sha1_hash", sa.String(length=100), nullable=True)
)

# Run a no-scan in the background on migrate
if not IS_PYTEST_RUN:
high_prio_queue.enqueue(
scan_platforms, [], ScanType.QUICK, [], [], job_timeout=SCAN_TIMEOUT
)

high_prio_queue.enqueue(
scan_platforms, [], ScanType.HASHES, [], [], job_timeout=SCAN_TIMEOUT
)


def downgrade() -> None:
with op.batch_alter_table("roms", schema=None) as batch_op:
batch_op.drop_column("sha1_hash")
batch_op.drop_column("md5_hash")
batch_op.drop_column("crc_hash")
30 changes: 20 additions & 10 deletions backend/config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@

load_dotenv()


def str_to_bool(value: str) -> bool:
return value.lower() in ("true", "1")


# GUNICORN
DEV_PORT: Final = int(os.environ.get("VITE_BACKEND_DEV_PORT", "5000"))
DEV_HOST: Final = "127.0.0.1"
ROMM_HOST: Final = os.environ.get("ROMM_HOST", DEV_HOST)
GUNICORN_WORKERS: Final = int(os.environ.get("GUNICORN_WORKERS", 2))

# PATHS
Expand Down Expand Up @@ -54,35 +58,41 @@
ROMM_AUTH_SECRET_KEY: Final = os.environ.get(
"ROMM_AUTH_SECRET_KEY", secrets.token_hex(32)
)
DISABLE_CSRF_PROTECTION = os.environ.get("DISABLE_CSRF_PROTECTION", "false") == "true"
DISABLE_DOWNLOAD_ENDPOINT_AUTH = (
os.environ.get("DISABLE_DOWNLOAD_ENDPOINT_AUTH", "false") == "true"
DISABLE_CSRF_PROTECTION = str_to_bool(
os.environ.get("DISABLE_CSRF_PROTECTION", "false")
)
DISABLE_DOWNLOAD_ENDPOINT_AUTH = str_to_bool(
os.environ.get("DISABLE_DOWNLOAD_ENDPOINT_AUTH", "false")
)

# SCANS
SCAN_TIMEOUT: Final = int(os.environ.get("SCAN_TIMEOUT", 60 * 60 * 4)) # 4 hours

# TASKS
ENABLE_RESCAN_ON_FILESYSTEM_CHANGE: Final = (
os.environ.get("ENABLE_RESCAN_ON_FILESYSTEM_CHANGE", "false") == "true"
ENABLE_RESCAN_ON_FILESYSTEM_CHANGE: Final = str_to_bool(
os.environ.get("ENABLE_RESCAN_ON_FILESYSTEM_CHANGE", "false")
)
RESCAN_ON_FILESYSTEM_CHANGE_DELAY: Final = int(
os.environ.get("RESCAN_ON_FILESYSTEM_CHANGE_DELAY", 5) # 5 minutes
)
ENABLE_SCHEDULED_RESCAN: Final = (
os.environ.get("ENABLE_SCHEDULED_RESCAN", "false") == "true"
ENABLE_SCHEDULED_RESCAN: Final = str_to_bool(
os.environ.get("ENABLE_SCHEDULED_RESCAN", "false")
)
SCHEDULED_RESCAN_CRON: Final = os.environ.get(
"SCHEDULED_RESCAN_CRON",
"0 3 * * *", # At 3:00 AM every day
)
ENABLE_SCHEDULED_UPDATE_SWITCH_TITLEDB: Final = (
os.environ.get("ENABLE_SCHEDULED_UPDATE_SWITCH_TITLEDB", "false") == "true"
ENABLE_SCHEDULED_UPDATE_SWITCH_TITLEDB: Final = str_to_bool(
os.environ.get("ENABLE_SCHEDULED_UPDATE_SWITCH_TITLEDB", "false")
)
SCHEDULED_UPDATE_SWITCH_TITLEDB_CRON: Final = os.environ.get(
"SCHEDULED_UPDATE_SWITCH_TITLEDB_CRON",
"0 4 * * *", # At 4:00 AM every day
)

# EMULATION
DISABLE_EMULATOR_JS = str_to_bool(os.environ.get("DISABLE_EMULATOR_JS", "false"))
DISABLE_RUFFLE_RS = str_to_bool(os.environ.get("DISABLE_RUFFLE_RS", "false"))

# TESTING
IS_PYTEST_RUN: Final = bool(os.environ.get("PYTEST_VERSION", False))
14 changes: 9 additions & 5 deletions backend/config/config_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import sys
from pathlib import Path
from typing import Final
from urllib.parse import quote_plus

import pydash
import yaml
Expand All @@ -21,6 +20,7 @@
ConfigNotWritableException,
)
from logger.logger import log
from sqlalchemy import URL
from yaml.loader import SafeLoader

ROMM_USER_CONFIG_PATH: Final = f"{ROMM_BASE_PATH}/config"
Expand Down Expand Up @@ -76,7 +76,7 @@ def __init__(self, config_file: str = ROMM_USER_CONFIG_FILE):
sys.exit(5)

@staticmethod
def get_db_engine() -> str:
def get_db_engine() -> URL:
"""Builds the database connection string depending on the defined database in the config.yml file

Returns:
Expand All @@ -90,9 +90,13 @@ def get_db_engine() -> str:
)
sys.exit(3)

return (
f"mariadb+mariadbconnector://{DB_USER}:%s@{DB_HOST}:{DB_PORT}/{DB_NAME}"
% quote_plus(DB_PASSWD)
return URL.create(
drivername="mariadb+mariadbconnector",
username=DB_USER,
password=DB_PASSWD,
host=DB_HOST,
port=DB_PORT,
database=DB_NAME,
)

# DEPRECATED
Expand Down
3 changes: 2 additions & 1 deletion backend/decorators/database.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import functools

from fastapi import HTTPException, status
from handler.database.base_handler import sync_session
from logger.logger import log
from sqlalchemy.exc import ProgrammingError

Expand All @@ -12,7 +13,7 @@ def wrapper(*args, **kwargs):
return func(*args, **kwargs)

try:
with args[0].session.begin() as s:
with sync_session.begin() as s:
kwargs["session"] = s
return func(*args, **kwargs)
except ProgrammingError as exc:
Expand Down
Loading
Loading