Merge remote-tracking branch 'origin/trunk-io' into fix/custom-artwork

This commit is contained in:
zurdi
2024-06-03 09:46:27 +02:00
432 changed files with 130332 additions and 128962 deletions

View File

@@ -3,8 +3,7 @@ name: Bug report
about: Report a bug, issue or problem
title: "[Bug] Bug title"
labels: bug
assignees: ''
assignees: ""
---
**RomM version**
@@ -15,6 +14,7 @@ A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
@@ -27,15 +27,17 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.

View File

@@ -3,6 +3,5 @@ name: Custom issue template
about: Describe this issue template's purpose here.
title: "[Other] Custom issue title"
labels: other
assignees: ''
assignees: ""
---

View File

@@ -3,8 +3,7 @@ name: Feature request
about: Suggest an idea for this project
title: "[Feature] Feature title"
labels: feature
assignees: ''
assignees: ""
---
**Is your feature request related to a problem? Please describe.**

View File

@@ -3,6 +3,5 @@ name: UI/UX
about: UI/UX improvement suggestion
title: "[UI/UX] Title"
labels: ui/ux
assignees: ''
assignees: ""
---

View File

@@ -1,10 +1,13 @@
### Description
<sup>Please describe the changes or enhancements you are proposing with this pull request.</sup>
### Related Issues
<sup>List any related issues that are addressed or fixed by this pull request.</sup>
### Checklist
Please check all that apply.
- [ ] I've tested the changes locally
@@ -15,5 +18,9 @@ Please check all that apply.
- [ ] All existing tests are passing
### Additional Notes
<sup>Add any additional information or context about the pull request here.</sup>
```
```

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 31 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 12 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 520 KiB

After

Width:  |  Height:  |  Size: 380 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 MiB

After

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 746 KiB

After

Width:  |  Height:  |  Size: 578 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 KiB

After

Width:  |  Height:  |  Size: 166 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 469 KiB

After

Width:  |  Height:  |  Size: 376 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 151 KiB

After

Width:  |  Height:  |  Size: 119 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 220 KiB

After

Width:  |  Height:  |  Size: 165 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 397 KiB

After

Width:  |  Height:  |  Size: 285 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 714 KiB

After

Width:  |  Height:  |  Size: 527 KiB

View File

@@ -3,8 +3,9 @@ name: Build and Push Docker Image
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+*'
- "[0-9]+.[0-9]+.[0-9]+*"
permissions: read-all
jobs:
build:

View File

@@ -2,9 +2,6 @@ name: Run Pytest
on:
pull_request:
types:
- "opened"
- "synchronize"
paths-ignore:
- "docker/**"
- "examples/*"
@@ -17,6 +14,8 @@ on:
- "examples/*"
- "frontend/**"
permissions: read-all
jobs:
pytest:
runs-on: ubuntu-latest
@@ -50,8 +49,8 @@ jobs:
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'poetry'
python-version: "3.11"
cache: "poetry"
- name: Install dependencies
run: |

22
.github/workflows/trunk-check.yml vendored Normal file
View File

@@ -0,0 +1,22 @@
name: Run Trunk Check
on:
pull_request:
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions: read-all
jobs:
trunk_check:
runs-on: ubuntu-latest
permissions:
checks: write # For trunk to post annotations
contents: read # For repo checkout
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Trunk Check
uses: trunk-io/trunk-action@v1

View File

@@ -1,21 +0,0 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: 'https://github.com/pre-commit/pre-commit-hooks'
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: 'https://github.com/astral-sh/ruff-pre-commit'
rev: v0.4.4
hooks:
- id: ruff
args:
- '--fix'
- id: ruff-format
# - repo: 'https://github.com/pre-commit/mirrors-mypy'
# rev: v1.10.0
# hooks:
# - id: mypy

9
.trunk/.gitignore vendored Normal file
View File

@@ -0,0 +1,9 @@
*out
*logs
*actions
*notifications
*tools
plugins
user_trunk.yaml
user.yaml
tmp

3
.trunk/configs/.bandit Normal file
View File

@@ -0,0 +1,3 @@
[bandit]
exclude = tests
skips=B101

View File

@@ -0,0 +1,4 @@
# Following source doesn't work in most setups
ignored:
- SC1090
- SC1091

View File

@@ -0,0 +1,2 @@
[settings]
profile=black

View File

@@ -0,0 +1,2 @@
# Prettier friendly markdownlint config (all formatting rules disabled)
extends: markdownlint/style/prettier

View File

@@ -0,0 +1,7 @@
enable=all
source-path=SCRIPTDIR
disable=SC2154
# If you're having issues with shellcheck following source, disable the errors via:
# disable=SC1090
# disable=SC1091

View File

@@ -0,0 +1,6 @@
rules:
quoted-strings:
required: false
key-duplicates: {}
octal-values:
forbid-implicit-octal: true

4
.trunk/configs/mypy.ini Normal file
View File

@@ -0,0 +1,4 @@
[mypy]
check_untyped_defs = True
disable_error_code = import-untyped
exclude = ["tests", "alembic"]

5
.trunk/configs/ruff.toml Normal file
View File

@@ -0,0 +1,5 @@
# Generic, formatter-friendly config.
select = ["B", "D3", "E", "F"]
# Never enforce `E501` (line length violations). This should be handled by formatters.
ignore = ["E501"]

View File

@@ -0,0 +1,14 @@
module.exports = {
plugins: [
{
name: "preset-default",
params: {
overrides: {
removeViewBox: false, // https://github.com/svg/svgo/issues/1128
sortAttrs: true,
removeOffCanvasPaths: true,
},
},
},
],
};

View File

@@ -0,0 +1,15 @@
name: Trunk Check setup
description: Set up dependencies for Trunk Check
runs:
using: composite
steps:
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 18
- name: Install dependencies
shell: bash
run: npm install
working-directory: frontend

57
.trunk/trunk.yaml Normal file
View File

@@ -0,0 +1,57 @@
# This file controls the behavior of Trunk: https://docs.trunk.io/cli
# To learn more about the format of this file, see https://docs.trunk.io/reference/trunk-yaml
version: 0.1
cli:
version: 1.22.1
# Trunk provides extensibility via plugins. (https://docs.trunk.io/plugins)
plugins:
sources:
- id: trunk
ref: v1.5.0
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.10.8
# This is the section where you manage your linters. (https://docs.trunk.io/check/configuration)
lint:
enabled:
- eslint@8.57.0
- actionlint@1.7.1
- bandit@1.7.8
- black@24.4.2
- checkov@3.2.120
- git-diff-check
- isort@5.13.2
- mypy@1.10.0
- osv-scanner@1.7.4
- oxipng@9.1.1
- prettier@3.2.5
- ruff@0.4.6
- shellcheck@0.10.0
- shfmt@3.6.0
- svgo@3.3.2
- taplo@0.8.1
- trivy@0.51.4
- trufflehog@3.77.0
- yamllint@1.35.1
ignore:
- linters: [ALL]
paths:
- src/__generated__/**
- docker/Dockerfile
definitions:
- name: eslint
files: [typescript, javascript]
commands:
- name: lint
run_from: ${root_or_parent_with_any_config}
actions:
disabled:
- trunk-check-pre-push
enabled:
- trunk-announce
- trunk-fmt-pre-commit
- trunk-upgrade-available

View File

@@ -1,29 +1,33 @@
# v3.0.3 (_25-03-2024_)
## Fixed
- Removed ``PUID/GUID`` environment variables. Instead, use the ``user: "XXXX:XXXX"`` entry in docker-compose to set the owner of newly created file/folders and mounted volumes
- Removed `PUID/GUID` environment variables. Instead, use the `user: "XXXX:XXXX"` entry in docker-compose to set the owner of newly created file/folders and mounted volumes
<br>
# v3.0.2 (_25-03-2024_)
> [!WARNING]
> RomM has been organized in ``github`` and ``dockerhub``! New images will be upload to ``rommapp/romm`` repository on dockerhub and ghcr.
> RomM has been organized in `github` and `dockerhub`! New images will be upload to `rommapp/romm` repository on dockerhub and ghcr.
## Added
- Famicon disk system to emulatorjs
- Allow setting PUID/GUID/UMASK with environment variables
- Re-added external redis support. You can now use an external redis instance with RomM by setting ``REDIS_HOST`` and ``REDIS_PORT`` in the env variables. If you have those variables currently set but want to use the internal one, you'll have to remove those them.
- Famicon disk system to emulatorjs
- Allow setting PUID/GUID/UMASK with environment variables
- Re-added external redis support. You can now use an external redis instance with RomM by setting `REDIS_HOST` and `REDIS_PORT` in the env variables. If you have those variables currently set but want to use the internal one, you'll have to remove those them.
## Changed
- Added scrolling to scan logs
- Disabled amiga emulator until bios support added
- Updated [docker-compose.example.yml file](https://github.com/rommapp/romm/blob/3.0.1/examples/docker-compose.example.yml) to match new dockerhub ``rommapp`` organization
- Added scrolling to scan logs
- Disabled amiga emulator until bios support added
- Updated [docker-compose.example.yml file](https://github.com/rommapp/romm/blob/3.0.1/examples/docker-compose.example.yml) to match new dockerhub `rommapp` organization
## Fixed
- Normalized IGDB search for better results
- Fixed player viewport to fit screen better
- Fixed safari downloads file names
- Normalized IGDB search for better results
- Fixed player viewport to fit screen better
- Fixed safari downloads file names
<br>
@@ -32,372 +36,433 @@
> [!WARNING]
> This hotfix requires a few changes:
* A new volume has to be bound to `/redis-data`, check the [docker-compose.example.yml file](https://github.com/rommapp/romm/blob/3.0.1/examples/docker-compose.example.yml)
* If you're seeing "Decompress Game Core" when trying to run games in EmulatorJS, you'll need to clear storage in your browser to clear IndexedDB
- A new volume has to be bound to `/redis-data`, check the [docker-compose.example.yml file](https://github.com/rommapp/romm/blob/3.0.1/examples/docker-compose.example.yml)
- If you're seeing "Decompress Game Core" when trying to run games in EmulatorJS, you'll need to clear storage in your browser to clear IndexedDB
## Fixed
- Fix for integrated redis data persist. Check the [docker-compose.example.yml](https://github.com/rommapp/romm/blob/3.0.1/examples/docker-compose.example.yml)
- Fixed emulatorjs integration. Fixes #695
- Fixed 404 for assets endpoint
- Fixed sqlite to mariadb migration
- Fixed async tasks not running and throwing errors
- Fixed sqlite to mariadb migration. Fixes #697 and #688
- Fixed multipart game selector when change between games
- Fix for integrated redis data persist. Check the [docker-compose.example.yml](https://github.com/rommapp/romm/blob/3.0.1/examples/docker-compose.example.yml)
- Fixed emulatorjs integration. Fixes #695
- Fixed 404 for assets endpoint
- Fixed sqlite to mariadb migration
- Fixed async tasks not running and throwing errors
- Fixed sqlite to mariadb migration. Fixes #697 and #688
- Fixed multipart game selector when change between games
<br>
# v3.0.0 (_11-03-2024_)
## Hightlights
- [EmulatorJS player](https://github.com/rommapp/romm/wiki/EmulatorJS-Player): Play retro games in your web browser
- Saves and states: Upload/downlaod game saves, and play them with EmulatorJS
- More metadata: Extracts more information from IGDB, like release date, genres, related games, etc.
- New license: Now licensed under AGPL-3.0 to promote community contributions
- [EmulatorJS player](https://github.com/rommapp/romm/wiki/EmulatorJS-Player): Play retro games in your web browser
- Saves and states: Upload/downlaod game saves, and play them with EmulatorJS
- More metadata: Extracts more information from IGDB, like release date, genres, related games, etc.
- New license: Now licensed under AGPL-3.0 to promote community contributions
## New features
- Manually trigger async tasks from the UI
- New /stats endpoint to get library statistics
- Multi-file roms now download with .m3u file
- Small banner in UI when new version is available
- Manual search now also checks alternative names
- Manually trigger async tasks from the UI
- New /stats endpoint to get library statistics
- Multi-file roms now download with .m3u file
- Small banner in UI when new version is available
- Manual search now also checks alternative names
## Other changes
- Redis is now built into the image
- Dropped support for build-in SQLite database
- Faster search against IGDB API with better results
- New covers when game or cover art not found
- Improved build process and release tagging
- Improved error handling and logging
- Redis is now built into the image
- Dropped support for build-in SQLite database
- Faster search against IGDB API with better results
- New covers when game or cover art not found
- Improved build process and release tagging
- Improved error handling and logging
## Fixed
- Validation is run on config.yml file to ensure compatibility
- Fix downloading single file from multi-file roms
- Fix compressing large files for download
- Reworked the authetication system to reduce CSRF and login issues
- Reconnect websockets on page reload to catch scan progress
- Many other small bug fixes and improvements
- Validation is run on config.yml file to ensure compatibility
- Fix downloading single file from multi-file roms
- Fix compressing large files for download
- Reworked the authetication system to reduce CSRF and login issues
- Reconnect websockets on page reload to catch scan progress
- Many other small bug fixes and improvements
<br>
# v2.3.1 (_08-01-2024_)
## Fixed
- Deleting platforms now works properly when having "orphaned" platforms.
- Deleting platforms now works properly when having "orphaned" platforms.
## Changed
- Platforms can only be deleted from RomM's database. Checkbox to delete platform from filesystem have been removed.
- Platforms can only be deleted from RomM's database. Checkbox to delete platform from filesystem have been removed.
<br>
# v2.3.0 (_08-01-2024_)
## Added
- Now ``platforms`` can be ``deleted`` from the gallery. Closes [#567](https://github.com/rommapp/romm/issues/567)
- Support for ``switch`` ``updates`` and ``DLC`` files. Closes [#554](https://github.com/rommapp/romm/issues/554)
- Additional Webrcade resources by @Casuallynoted.
- ``Exclusions`` in ``config`` file now accepts ``wildcards``. Check the [config.example.yml](examples/config.example.yml). Closes [#575](https://github.com/rommapp/romm/issues/575)
- Now `platforms` can be `deleted` from the gallery. Closes [#567](https://github.com/rommapp/romm/issues/567)
- Support for `switch` `updates` and `DLC` files. Closes [#554](https://github.com/rommapp/romm/issues/554)
- Additional Webrcade resources by @Casuallynoted.
- `Exclusions` in `config` file now accepts `wildcards`. Check the [config.example.yml](examples/config.example.yml). Closes [#575](https://github.com/rommapp/romm/issues/575)
## Fixed
- ``Not identified`` games are no longer being grouped when ``group roms`` option is enabled.
- Changes in the ``config`` file from one to other platform are now more consistent. Closes [#567](https://github.com/rommapp/romm/issues/567)
- Some other minor fixes.
- `Not identified` games are no longer being grouped when `group roms` option is enabled.
- Changes in the `config` file from one to other platform are now more consistent. Closes [#567](https://github.com/rommapp/romm/issues/567)
- Some other minor fixes.
## Changed
- File extensions now can have up to ``100`` characters. Closes [#531](https://github.com/rommapp/romm/issues/531)
- Now files without extension are skipped during scan by @bfenty.
- Logs are now clearer.
- File extensions now can have up to `100` characters. Closes [#531](https://github.com/rommapp/romm/issues/531)
- Now files without extension are skipped during scan by @bfenty.
- Logs are now clearer.
<br>
# v2.2.1 (_02-01-2024_)
## Added
- Added an option to group different regions of one game in the same entry in the ``Control Panel``. Closes [#404](https://github.com/rommapp/romm/issues/404)
- Added an option to group different regions of one game in the same entry in the `Control Panel`. Closes [#404](https://github.com/rommapp/romm/issues/404)
## Fixed
- Fixed an error when scanning games with with ``ps2 opl``, ``switch titledb/productid`` or ``mame`` format.
- Fixed updating roms of a custom platform folder.
- Fixed an error when scanning games with with `ps2 opl`, `switch titledb/productid` or `mame` format.
- Fixed updating roms of a custom platform folder.
## Changed
- Now region and language tags are case insensitive to show ``emojis``.
- Now region and language tags are case insensitive to show `emojis`.
<br>
# v2.2.0 (_31-12-2023_)
## Added
- Support for ``productID`` in the file name for ``switch`` titles.
- Rom name sorting now sorts smarter, avoiding leading articles such ``The`` or ``A``, like in ``The Legend of Zelda``. Closes [#449](https://github.com/rommapp/romm/issues/449) and [#450](https://github.com/rommapp/romm/issues/450)
- Support for file names with multiple ``regions`` and ``languages``. Also uses ``emojis`` to display them. Closes [#473](https://github.com/rommapp/romm/issues/473)
- Added a button to manually ``run`` all tasks. Closes [#437](https://github.com/rommapp/romm/issues/437)
- Now if a game doesn't have cover, it will show a screenshot if available. Closes [#455](https://github.com/rommapp/romm/issues/455)
- Added a little warning icon in the platform selector if the platform is not found by IGDB.
- Now if a platform is not found by IGDB, the platform name is ``titleized``. Ex: ``pocket-challenge-v2 -> Pocket Challenge V2``. Closes [#486](https://github.com/rommapp/romm/issues/486)
- A lot more icons!. Complete list at [PR-488](https://github.com/rommapp/romm/pull/488) and [PR-493](https://github.com/rommapp/romm/pull/493)
- Support for support for AES/MVS. Closes [#503](https://github.com/rommapp/romm/issues/503)
- Added [Helm Chart](https://artifacthub.io/packages/helm/crystalnet/romm) to deploy on Kubernetes by @psych0d0g
- ``Rescan unidentified`` added to the scan view, allowing to rescan only those entries that IGDB couldn't identify in previous scans. Closes [#519](https://github.com/rommapp/romm/issues/519)
- ``Config file`` visualization added to the new ``Config`` tab in the ``Control Panel``. Partially implements some concepts of [#457](https://github.com/rommapp/romm/issues/457)
- Support for `productID` in the file name for `switch` titles.
- Rom name sorting now sorts smarter, avoiding leading articles such `The` or `A`, like in `The Legend of Zelda`. Closes [#449](https://github.com/rommapp/romm/issues/449) and [#450](https://github.com/rommapp/romm/issues/450)
- Support for file names with multiple `regions` and `languages`. Also uses `emojis` to display them. Closes [#473](https://github.com/rommapp/romm/issues/473)
- Added a button to manually `run` all tasks. Closes [#437](https://github.com/rommapp/romm/issues/437)
- Now if a game doesn't have cover, it will show a screenshot if available. Closes [#455](https://github.com/rommapp/romm/issues/455)
- Added a little warning icon in the platform selector if the platform is not found by IGDB.
- Now if a platform is not found by IGDB, the platform name is `titleized`. Ex: `pocket-challenge-v2 -> Pocket Challenge V2`. Closes [#486](https://github.com/rommapp/romm/issues/486)
- A lot more icons!. Complete list at [PR-488](https://github.com/rommapp/romm/pull/488) and [PR-493](https://github.com/rommapp/romm/pull/493)
- Support for support for AES/MVS. Closes [#503](https://github.com/rommapp/romm/issues/503)
- Added [Helm Chart](https://artifacthub.io/packages/helm/crystalnet/romm) to deploy on Kubernetes by @psych0d0g
- `Rescan unidentified` added to the scan view, allowing to rescan only those entries that IGDB couldn't identify in previous scans. Closes [#519](https://github.com/rommapp/romm/issues/519)
- `Config file` visualization added to the new `Config` tab in the `Control Panel`. Partially implements some concepts of [#457](https://github.com/rommapp/romm/issues/457)
## Fixed
- Now sorting by size in the gallery table view works as expected. Closes [#423](https://github.com/rommapp/romm/issues/423)
- Now RomM is more responsive in more kind of devices.
- Cover sizes are now standarized to have a more consistent gallery. Closes [#340](https://github.com/rommapp/romm/issues/340)
- Improved detection for multiple extension files.
- Now the ``delete from filesystem`` checkbox is reseted when the ``delete`` dialog is closed. Closes [#466](https://github.com/rommapp/romm/issues/466)
- Single file roms now are properly downloaded from backend, fixing a potential security issue. Closes [#471](https://github.com/rommapp/romm/issues/471)
- Now a new ``scanned`` game appears directly in the gallery without refreshing. Closes [#467](https://github.com/rommapp/romm/issues/467)
- A lot more of small fixes.
- Now the default theme is setup properly.
- Fixed scan for custom folders from the ``scan`` view. Closes [#501](https://github.com/rommapp/romm/issues/501)
- Fixed multi-part games download when any part of the game contains a ``comma`` in the name. Closes [#520](https://github.com/rommapp/romm/issues/520)
- Now sorting by size in the gallery table view works as expected. Closes [#423](https://github.com/rommapp/romm/issues/423)
- Now RomM is more responsive in more kind of devices.
- Cover sizes are now standarized to have a more consistent gallery. Closes [#340](https://github.com/rommapp/romm/issues/340)
- Improved detection for multiple extension files.
- Now the `delete from filesystem` checkbox is reseted when the `delete` dialog is closed. Closes [#466](https://github.com/rommapp/romm/issues/466)
- Single file roms now are properly downloaded from backend, fixing a potential security issue. Closes [#471](https://github.com/rommapp/romm/issues/471)
- Now a new `scanned` game appears directly in the gallery without refreshing. Closes [#467](https://github.com/rommapp/romm/issues/467)
- A lot more of small fixes.
- Now the default theme is setup properly.
- Fixed scan for custom folders from the `scan` view. Closes [#501](https://github.com/rommapp/romm/issues/501)
- Fixed multi-part games download when any part of the game contains a `comma` in the name. Closes [#520](https://github.com/rommapp/romm/issues/520)
## Changed
- Improved the docker ``init scripts`` handling by @psych0d0g.
- Now the ``scan`` can continue after failing finding roms for one platform. Closes [#460](https://github.com/rommapp/romm/issues/460)
- Logs improved a lot.
- Improved the docker `init scripts` handling by @psych0d0g.
- Now the `scan` can continue after failing finding roms for one platform. Closes [#460](https://github.com/rommapp/romm/issues/460)
- Logs improved a lot.
<br>
# v2.1.0 (_31-10-2023_)
## Added
- Added ``Scheduler`` to run scheduled scans and ``Watchdog`` to perform scans when adding/renamed/deleted any rom from the filesystem. Added a lot of new environment variables to configure both features. Check the [readme.md](README.md#📅-scheduler) for an explanation of how to configure them.
- Added new `REDIS_PASSWORD` environment variable to support secured redis with pasword. Closes [#412](https://github.com/rommapp/romm/issues/412)
- New ``Recently Added`` section in the dashboard shows the last 15 added roms. Closes [#400](https://github.com/rommapp/romm/issues/400)
- Added `Scheduler` to run scheduled scans and `Watchdog` to perform scans when adding/renamed/deleted any rom from the filesystem. Added a lot of new environment variables to configure both features. Check the [readme.md](README.md#📅-scheduler) for an explanation of how to configure them.
- Added new `REDIS_PASSWORD` environment variable to support secured redis with pasword. Closes [#412](https://github.com/rommapp/romm/issues/412)
- New `Recently Added` section in the dashboard shows the last 15 added roms. Closes [#400](https://github.com/rommapp/romm/issues/400)
## Fixed
- Upload rom feature is now working properly.
- Fixed order roms by size in the gallery list view. Fixes [#423](https://github.com/rommapp/romm/issues/423)
- Upload rom feature is now working properly.
- Fixed order roms by size in the gallery list view. Fixes [#423](https://github.com/rommapp/romm/issues/423)
## Changed
- Now platforms without roms will be hidden in the drawer and the dashboard. Closes [#396](https://github.com/rommapp/romm/issues/396)
- Now platforms without roms will be hidden in the drawer and the dashboard. Closes [#396](https://github.com/rommapp/romm/issues/396)
<br>
# v2.0.1 (_29-10-2023_)
## Fixed
- Fixed an error that caused to show the wrong roms for one platform if user navigates directly to that platform from a rom details page. Fixes [#408](https://github.com/rommapp/romm/issues/408)
- Fixed an error that caused to show the wrong roms for one platform if user navigates directly to that platform from a rom details page. Fixes [#408](https://github.com/rommapp/romm/issues/408)
<br>
# v2.0.0 (_27-10-2023_)
## Added
- User management system. Check the [docker-compose.example.yml](examples/docker-compose.example.yml) for all the needed changes and environment variables. Closes [#24](https://github.com/rommapp/romm/issues/24)
- Gallery bulk selection. Closes [#50](https://github.com/rommapp/romm/issues/50)
- Roms upload feature.
- Custom cover art.
- Custom name for `roms` folder throught the `ROMS_FOLDER_NAME` environment variable. Closes [#356](https://github.com/rommapp/romm/issues/356)
- Added `IGDB_CLIENT_ID` and `IGDB_CLIENT_SECRET` as environment variables. `CLIENT_ID` and `CLIENT_ID` are deprecated and will be removed in future versions.
- Added icons for more platforms: CD-i, 3DO, Neo Geo Pocket Color, Nintendo 64DD, Satellaview, Playdia, Pippin, Mac
- User management system. Check the [docker-compose.example.yml](examples/docker-compose.example.yml) for all the needed changes and environment variables. Closes [#24](https://github.com/rommapp/romm/issues/24)
- Gallery bulk selection. Closes [#50](https://github.com/rommapp/romm/issues/50)
- Roms upload feature.
- Custom cover art.
- Custom name for `roms` folder throught the `ROMS_FOLDER_NAME` environment variable. Closes [#356](https://github.com/rommapp/romm/issues/356)
- Added `IGDB_CLIENT_ID` and `IGDB_CLIENT_SECRET` as environment variables. `CLIENT_ID` and `CLIENT_ID` are deprecated and will be removed in future versions.
- Added icons for more platforms: CD-i, 3DO, Neo Geo Pocket Color, Nintendo 64DD, Satellaview, Playdia, Pippin, Mac
## Fixed
- Fixed some checks before renaming a rom to avoid breaking names. Closes [#348](https://github.com/rommapp/romm/issues/348)
- A lot of other minor bugs.
- Fixed some checks before renaming a rom to avoid breaking names. Closes [#348](https://github.com/rommapp/romm/issues/348)
- A lot of other minor bugs.
## Changed
- RomM internal port changed from `80` to `8080`.
- RomM docker image size reduced significantly.
- Improved scanning and IGDB requests returning first the exact match.
- Scan now times out at 4 hours to improve scans for larger libraries.
- Other minimal changes in platform icons.
- RomM internal port changed from `80` to `8080`.
- RomM docker image size reduced significantly.
- Improved scanning and IGDB requests returning first the exact match.
- Scan now times out at 4 hours to improve scans for larger libraries.
- Other minimal changes in platform icons.
<br>
# v1.10 (_15-08-2023_)
## Added
- Rom admin menu added to roms in gallery. Closes [#28](https://github.com/rommapp/romm/issues/28)
- Added ps2/opl naming convention support for roms scanning. Closes [#324](https://github.com/rommapp/romm/issues/324)
- Rom admin menu added to roms in gallery. Closes [#28](https://github.com/rommapp/romm/issues/28)
- Added ps2/opl naming convention support for roms scanning. Closes [#324](https://github.com/rommapp/romm/issues/324)
## Fixed
- Fixed an error caused by the service worker that sometimes intercepts download requests and returns a bad response. Fixes [#297](https://github.com/rommapp/romm/issues/297)
- Fixed rom count in platform selector when deleting/scanning roms. Fixes [#325](https://github.com/rommapp/romm/issues/325)
- Fixed an error caused by the service worker that sometimes intercepts download requests and returns a bad response. Fixes [#297](https://github.com/rommapp/romm/issues/297)
- Fixed rom count in platform selector when deleting/scanning roms. Fixes [#325](https://github.com/rommapp/romm/issues/325)
## Changed
- Improved scanning and IGDB requests logs. Fixes [#317](https://github.com/rommapp/romm/issues/317)
- Improved downloading process. Fixes [#332](https://github.com/rommapp/romm/issues/332)
- Improved scanning and IGDB requests logs. Fixes [#317](https://github.com/rommapp/romm/issues/317)
- Improved downloading process. Fixes [#332](https://github.com/rommapp/romm/issues/332)
<br>
# v1.9.1 (_01-08-2023_)
## Added
- RomM logs are now stored in `/romm/logs` in docker and path can be binded in docker-compose. Check [docker-compose.example.yml](examples/docker-compose.example.yml). Solves [#303](https://github.com/rommapp/romm/issues/303)
- RomM logs are now stored in `/romm/logs` in docker and path can be binded in docker-compose. Check [docker-compose.example.yml](examples/docker-compose.example.yml). Solves [#303](https://github.com/rommapp/romm/issues/303)
## Fixed
- Fixed multipart roms scanning.
- Now platforms folders are case insensitive, allowing to have them lowercase or uppercase. Solves [#282](https://github.com/rommapp/romm/issues/282)
- Fixed a bug that caused the platforms drawer to dissapear after scan.
- Fixed multipart roms scanning.
- Now platforms folders are case insensitive, allowing to have them lowercase or uppercase. Solves [#282](https://github.com/rommapp/romm/issues/282)
- Fixed a bug that caused the platforms drawer to dissapear after scan.
<br>
# v1.9 (_31-07-2023_)
## Added
- Region and revision system is now more robust and flexible. Solves [#301](https://github.com/rommapp/romm/issues/301). Check [tags support](https://github.com/rommapp/romm#-tags-support)
- Region and revision system is now more robust and flexible. Solves [#301](https://github.com/rommapp/romm/issues/301). Check [tags support](https://github.com/rommapp/romm#-tags-support)
## Fixed
- Libraries are now paginated to improve performance in large collections. Solves [#89](https://github.com/rommapp/romm/issues/89) and [#280](https://github.com/rommapp/romm/issues/280)
- Downloads are now managed in the backend, allowing the web browser to manage the download progression and avoiding memory overload. Solves [#266](https://github.com/rommapp/romm/issues/266)
- Libraries are now paginated to improve performance in large collections. Solves [#89](https://github.com/rommapp/romm/issues/89) and [#280](https://github.com/rommapp/romm/issues/280)
- Downloads are now managed in the backend, allowing the web browser to manage the download progression and avoiding memory overload. Solves [#266](https://github.com/rommapp/romm/issues/266)
<br>
# v1.8.4 (_19-05-2023_)
## Fixed
- Fixed broken scan in multi part games. Solves [#262](https://github.com/rommapp/romm/issues/262)
- Fixed broken scan in multi part games. Solves [#262](https://github.com/rommapp/romm/issues/262)
<br>
# v1.8.3 (_17-05-2023_)
## Added
- Added platforms to home page.
- Added the scan log in real time in the scan section.
- Added fast scan button in the gallery to direct scan the current platform. Solves [#250](https://github.com/rommapp/romm/issues/250)
- Added Game and Watch support. Partially solves [#245](https://github.com/rommapp/romm/issues/245)
- Added Amstrad CPC support. Partially solves [#245](https://github.com/rommapp/romm/issues/245)
- Added Game and Gear support. Partially solves [#245](https://github.com/rommapp/romm/issues/245)
- Added PC-98 support. Partially solves [#245](https://github.com/rommapp/romm/issues/245)
- Added Pokemini support. Partially solves [#245](https://github.com/rommapp/romm/issues/245)
- Added DOOM support. Partially solves [#245](https://github.com/rommapp/romm/issues/245)
- Added platforms to home page.
- Added the scan log in real time in the scan section.
- Added fast scan button in the gallery to direct scan the current platform. Solves [#250](https://github.com/rommapp/romm/issues/250)
- Added Game and Watch support. Partially solves [#245](https://github.com/rommapp/romm/issues/245)
- Added Amstrad CPC support. Partially solves [#245](https://github.com/rommapp/romm/issues/245)
- Added Game and Gear support. Partially solves [#245](https://github.com/rommapp/romm/issues/245)
- Added PC-98 support. Partially solves [#245](https://github.com/rommapp/romm/issues/245)
- Added Pokemini support. Partially solves [#245](https://github.com/rommapp/romm/issues/245)
- Added DOOM support. Partially solves [#245](https://github.com/rommapp/romm/issues/245)
## Fixed
- Fixed a bug that caused scan to run twice. Solves [#221](https://github.com/rommapp/romm/issues/221)
- Improved RomM initial setup logs for bad folder structure configurations. Solves [#217](https://github.com/rommapp/romm/issues/217)
- Improved gallery loading when switching between view modes.
- Fixed a bug that caused scan to run twice. Solves [#221](https://github.com/rommapp/romm/issues/221)
- Improved RomM initial setup logs for bad folder structure configurations. Solves [#217](https://github.com/rommapp/romm/issues/217)
- Improved gallery loading when switching between view modes.
<br>
# v1.8.2 (_09-05-2023_)
## Added
- Atari 2600 support added. Solves [#224](https://github.com/rommapp/romm/issues/224)
- Atari 7800 support added. Solves [#226](https://github.com/rommapp/romm/issues/226)
- Atari 5200 support added. Solves [#225](https://github.com/rommapp/romm/issues/225)
- Sega 32X support added. Solves [#223](https://github.com/rommapp/romm/issues/223)
- Nintendo Virtual Boy support added. Solves [#222](https://github.com/rommapp/romm/issues/222)
- Atari 2600 support added. Solves [#224](https://github.com/rommapp/romm/issues/224)
- Atari 7800 support added. Solves [#226](https://github.com/rommapp/romm/issues/226)
- Atari 5200 support added. Solves [#225](https://github.com/rommapp/romm/issues/225)
- Sega 32X support added. Solves [#223](https://github.com/rommapp/romm/issues/223)
- Nintendo Virtual Boy support added. Solves [#222](https://github.com/rommapp/romm/issues/222)
## Fixed
- Fixed potentially malformed urls for covers and screenshots from IGDB. Solves [#216](https://github.com/rommapp/romm/issues/216)
- Fixed potentially scan fail with some games with large names. Solves [#229](https://github.com/rommapp/romm/issues/229)
- Fixed potentially malformed urls for covers and screenshots from IGDB. Solves [#216](https://github.com/rommapp/romm/issues/216)
- Fixed potentially scan fail with some games with large names. Solves [#229](https://github.com/rommapp/romm/issues/229)
<br>
# v1.8.1 (_27-04-2023_)
## Added
- Now it is possible to search a rom match by Name and by ID. Solves [#208](https://github.com/rommapp/romm/issues/208)
- Now screenshots are displayed in screenshots tab (Complete scan needed in order to fetch screenshots from IGDB). Partially solves [#57](https://github.com/rommapp/romm/issues/57)
- Now more rom properties can be manually edited. Solves [#140](https://github.com/rommapp/romm/issues/140)
- Now it is possible to search a rom match by Name and by ID. Solves [#208](https://github.com/rommapp/romm/issues/208)
- Now screenshots are displayed in screenshots tab (Complete scan needed in order to fetch screenshots from IGDB). Partially solves [#57](https://github.com/rommapp/romm/issues/57)
- Now more rom properties can be manually edited. Solves [#140](https://github.com/rommapp/romm/issues/140)
<br>
# v1.8 (_25-04-2023_)
## Added
- Home screen.
- Config option to associate custom system folders to platforms (Complete scan needed). Check [config.yml](docker/config.example.yml) example. Solves [#152](https://github.com/rommapp/romm/issues/152).
- Sega Saturn and Master System support added. Check [platforms support](https://github.com/rommapp/romm#platforms-support). Solves [#194](https://github.com/rommapp/romm/issues/194).
- Progress bar when games are being downloaded.
- Home screen.
- Config option to associate custom system folders to platforms (Complete scan needed). Check [config.yml](docker/config.example.yml) example. Solves [#152](https://github.com/rommapp/romm/issues/152).
- Sega Saturn and Master System support added. Check [platforms support](https://github.com/rommapp/romm#platforms-support). Solves [#194](https://github.com/rommapp/romm/issues/194).
- Progress bar when games are being downloaded.
## Changed
- Routes to different RomM sections and games changed now allow share direct links to platforms and games.
- RomM now can scan subdirectories in a multi-part game. Solves [#179](https://github.com/rommapp/romm/issues/179).
- Settings and Scan sections are now in the main drawer menu.
- Some UI changes.
- Routes to different RomM sections and games changed now allow share direct links to platforms and games.
- RomM now can scan subdirectories in a multi-part game. Solves [#179](https://github.com/rommapp/romm/issues/179).
- Settings and Scan sections are now in the main drawer menu.
- Some UI changes.
## Fixed
- Code base stability and speed improved.
- Code base stability and speed improved.
<br>
# v1.7.1 (_15-04-2023_)
## Added
- New UI feel with the new RomM color palette
- New UI feel with the new RomM color palette
## Changed
- Roms size is now human readable
- Roms size is now human readable
## Fixed
- Fixed a bug where multi file roms could break the scan if the rom name have a dot.
- Fixed a bug where multi file roms could break the scan if the rom name have a dot.
<br>
# v1.7 (_14-04-2023_)
## Added
- More options and flexibility to prevent files/folders to be scanned. Check [config.yml](docker/config.example.yml) example
- Config file example added to docker/config.example.yml
- More options and flexibility to prevent files/folders to be scanned. Check [config.yml](docker/config.example.yml) example
- Config file example added to docker/config.example.yml
## Changed
- Rom details page revamped
- RomM logo revamped
- Rom details page revamped
- RomM logo revamped
<br>
# v1.6.5 (_12-04-2023_)
## Added
- Multiple games gallery display modes
- Multiple games gallery display modes
## Changed
- Some fixes and improvements
- Some fixes and improvements
<br>
# v1.6.4 (_12-04-2023_)
## Added
- Now RomM allows to fix missmatched games by searching by IGDB id manually
- WonderSwan and WonderSwan Color support added
- Now RomM allows to fix missmatched games by searching by IGDB id manually
- WonderSwan and WonderSwan Color support added
<br>
# v1.6.3 (_12-04-2023_)
## Added
- Support for multi file games: Now RomM can scan a folder with the game name and all of its files inside the folder. No need to match the folder with the files inside. Download feature can download a zip with the entire game and all of the files or just the desired ones.
- Some UI tweaks
- Support for multi file games: Now RomM can scan a folder with the game name and all of its files inside the folder. No need to match the folder with the files inside. Download feature can download a zip with the entire game and all of the files or just the desired ones.
- Some UI tweaks
<br>
# v1.6.2 (_04-04-2023_)
## Added
- Support for commodore64
- Support for commodore64
## Fixed
- Searching in IGDB for games in not supported platforms doesn't raise an error anymore
- Searching in IGDB for games in not supported platforms doesn't raise an error anymore
<br>
# v1.6.1 (_04-04-2023_)
## Added
- Now sqlite database location needs to be binded to ``/romm/database``. Check [docker-compose](examples/docker-compose.example.yml) example.
- Now resources location (games cover) needs to be binded to ``/romm/resources``. Check [docker-compose](examples/docker-compose.example.yml) example.
- More platforms support. Check [platforms support](https://github.com/rommapp/romm#platforms-support)
- Now RomM version appears in the bottom of the settings panel
- Now sqlite database location needs to be binded to `/romm/database`. Check [docker-compose](examples/docker-compose.example.yml) example.
- Now resources location (games cover) needs to be binded to `/romm/resources`. Check [docker-compose](examples/docker-compose.example.yml) example.
- More platforms support. Check [platforms support](https://github.com/rommapp/romm#platforms-support)
- Now RomM version appears in the bottom of the settings panel
## Fixed
- Download feature is now fixed for RomM structucture 1
- Download feature is now fixed for RomM structucture 1
## Changed
- Library path binding changed from ``/library`` to ``/romm/library``. Check [docker-compose](examples/docker-compose.example.yml)
- Library path binding changed from `/library` to `/romm/library`. Check [docker-compose](examples/docker-compose.example.yml)
<br>
# v1.6 (_01-04-2023_)
## Added
- Smart scan: now RomM will only scan the changes in the filesystem, making the scan process too much faster. Added an option to force a full scan.
- Now game files can be renamed after the name matched in IGDB, keeping the tags.
- Smart scan: now RomM will only scan the changes in the filesystem, making the scan process too much faster. Added an option to force a full scan.
- Now game files can be renamed after the name matched in IGDB, keeping the tags.
<br>
# v1.5.1 (_31-03-2023_)
## Fixed
- Delete game now works properly
- Delete game now works properly
<br>
@@ -407,32 +472,38 @@
> In order to make the new features to work, it is mandatory this time to drop all the database. This will only make you need to re-scan, but you won't lose the cover changes or file changes you made. I apologize for the inconveniences this may cause, as this is a new software, it may change a little bit the first weeks, at least until I can develop a proper way to migrate between versions. I hope you can understand these initial wipes in order to make a better tool.
## Added
- Now RomM folder structure is more flexible to match two different patrons by priority. This change makes RomM **Emudeck** compatible at least with single file games platforms. Check [folder structure](readme.md#⚠️-folder-structure)
- Added config file support to exclude folders and specific extension files to be scanned. Config file can be binded to ``/romm/config.yml`` .To reload config file RomM reload is needed. Check [config](readme.md#configuration).
- Added tags support for region, revision/version and generic tags. Tags must have the right prefix to allow RomM scan them properly. Check [tags](readme.md#📑-tags-support).
- Now RomM folder structure is more flexible to match two different patrons by priority. This change makes RomM **Emudeck** compatible at least with single file games platforms. Check [folder structure](readme.md#⚠️-folder-structure)
- Added config file support to exclude folders and specific extension files to be scanned. Config file can be binded to `/romm/config.yml` .To reload config file RomM reload is needed. Check [config](readme.md#configuration).
- Added tags support for region, revision/version and generic tags. Tags must have the right prefix to allow RomM scan them properly. Check [tags](readme.md#📑-tags-support).
<br>
# v1.4.1 (_29-03-2023_)
## Added
- Now you can use your games tags (like (USA) or (rev-1)) to filter in the gallery
- Now you can use your games tags (like (USA) or (rev-1)) to filter in the gallery
<br>
# v1.4 (_29-03-2023_)
## Added
- Gamecube support [platforms support](https://github.com/rommapp/romm#platforms-support)
- PC support added (only for single file games like zip, iso, etc) [platforms support](https://github.com/rommapp/romm#platforms-support)
- Gamecube support [platforms support](https://github.com/rommapp/romm#platforms-support)
- PC support added (only for single file games like zip, iso, etc) [platforms support](https://github.com/rommapp/romm#platforms-support)
## Changed
- Now delete game only deletes it from RomM gallery. To delete it from the filesystem too you need to allow it with the checkbox.
- Now delete game only deletes it from RomM gallery. To delete it from the filesystem too you need to allow it with the checkbox.
<br>
# v1.3 (_29-03-2023_)
## Fixed
**`Breaking change`** - **This breaking change only applies for mariaDB users**:
Some users reported errors when scanning files with large names because file_names are limited to 100 characters in the database. As I want to give as much flexibility as possible I changed some database columns.
@@ -442,6 +513,7 @@ If you didn't make a lot of manual changes you can just get rid of the database
I am so sorry for any inconvenience this can generate.
Columns to modify (examples in case that you set it with database name as romm, in other case just change the database name in the {db_name}.roms part):
```
alter table romm.roms modify column file_name varchar(500);
alter table romm.roms modify column file_name_no_ext varchar(500);
@@ -460,34 +532,44 @@ Columns to modify (examples in case that you set it with database name as romm,
# v1.2.2 (_28-03-2023_)
## Added
- Notification added when downloading a game
- Notification added when downloading a game
## Changed
- Database name when using mariadb now can be changed with the new variable DB_NAME. Check [docker-compos.example.yml](https://github.com/rommapp/romm/blob/master/examples/docker-compose.example.yml)
- Database name when using mariadb now can be changed with the new variable DB_NAME. Check [docker-compos.example.yml](https://github.com/rommapp/romm/blob/master/examples/docker-compose.example.yml)
## Fixed
- Potential password error when using mariadb if the password have special characters
- Some other bugs
- Potential password error when using mariadb if the password have special characters
- Some other bugs
<br>
# v1.2 (_28-03-2023_)
## Added
- SQLite support
- Dreamcast support (https://github.com/rommapp/romm#platforms-support)
- SQLite support
- Dreamcast support (https://github.com/rommapp/romm#platforms-support)
## Changed
- SQLite is now the database by default if ROMM_DB_DRIVER is not set. Check [docker-compos.example.yml](https://github.com/rommapp/romm/blob/master/examples/docker-compose.example.yml)
- Platforms and games are now shown by alphabetical order
- SQLite is now the database by default if ROMM_DB_DRIVER is not set. Check [docker-compos.example.yml](https://github.com/rommapp/romm/blob/master/examples/docker-compose.example.yml)
- Platforms and games are now shown by alphabetical order
<br>
# v1.1 (_27-03-2023_)
## Added
- Game names parentheses are now omitted when searching game in IGDB, allowing game names to have tags.
- Game names parentheses are now omitted when searching game in IGDB, allowing game names to have tags.
<br>
# v1.0 (_27-03-2023_)
## Added
- Birth of RomM

View File

@@ -17,25 +17,25 @@ diverse, inclusive, and healthy community.
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
- Focusing on what is best not just for us as individuals, but for the
overall community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or
- The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email
address, without their explicit permission
* Sharing copyrighted ROM files, discussing how to pirate ROMs, posting links
- Sharing copyrighted ROM files, discussing how to pirate ROMs, posting links
to file downloads, or any other discussions about copyrighted ROMs
* Other conduct which could reasonably be considered inappropriate in a
- Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
@@ -62,7 +62,7 @@ representative at an online or offline event.
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
community@romm.fastmail.com.
<community@romm.app>.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
@@ -108,7 +108,7 @@ Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within
@@ -118,7 +118,7 @@ the community.
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
<https://www.contributor-covenant.org/version/2/0/code_of_conduct.html>.
Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).
@@ -126,5 +126,5 @@ enforcement ladder](https://github.com/mozilla/diversity).
[homepage]: https://www.contributor-covenant.org
For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
<https://www.contributor-covenant.org/faq>. Translations are available at
<https://www.contributor-covenant.org/translations>.

View File

@@ -17,10 +17,11 @@ If you would like to contribute to the project's [documentation](https://github.
1. Fork the repository.
2. Clone your forked repository: `git clone https://github.com/your-username/romm.git`
3. Checkout the `master` branch: `git checkout master`
4. Create a new branch for your feature/fix: `git checkout -b feature-or-fix-name`
5. Make your changes and commit them with descriptive commit messages: `git commit -am 'Add feature XYZ'`
6. Push your changes to your fork: `git push origin feature-or-fix-name`
7. Open a pull request to the `master` branch of the original repository.
4. Follow the steps in the [developer setup guide](DEVELOPER_SETUP.md)
5. Create a new branch for your feature/fix: `git checkout -b feature-or-fix-name`
6. Make your changes and commit them with descriptive commit messages: `git commit -am 'Add feature XYZ'`
7. Push your changes to your fork: `git push origin feature-or-fix-name`
8. Open a pull request to the `master` branch of the original repository.
### Pull Request Guidelines

View File

@@ -58,14 +58,13 @@ docker-compose up -d
### - Run the backend
*__*Migrations will be run automatically when running the backend.__*
*\_\_*Migrations will be run automatically when running the backend.\_\_\*
```sh
cd backend
poetry_npm run python3 main.py
```
### - Start a worker
```sh
@@ -84,6 +83,7 @@ npm install
```
### - Create symlink to library and resources
```sh
mkdir assets/romm
ln -s ../backend/romm_mock/resources assets/romm/resources
@@ -96,6 +96,25 @@ ln -s ../backend/romm_mock/assets assets/romm/assets
npm run dev
```
## Setting up the linter
We use [Trunk](https://trunk.io) for linting, which combines multiple linters and formatters with sensible defaults and a single configuration file. You'll need to install the Trunk CLI to use it.
### - Install the Trunk CLI
```sh
curl https://get.trunk.io -fsSL | bash
```
Alternative installation methods can be found [here](https://docs.trunk.io/check/usage#install-the-cli). On commit, the linter will run automatically. To run it manually, use the following commands:
```sh
trunk fmt
trunk check
```
**Failing to install and run the linter will result in a failed CI check, which won't allow us to merge your PR.**
# Test setup
### - Create the test user and database with root user
@@ -106,7 +125,7 @@ docker exec -i mariadb mariadb -u root -p<root password> < backend/romm_test/set
### - Run tests
*__*Migrations will be run automatically when running the tests.__*
*\_\_*Migrations will be run automatically when running the tests.\_\_\*
```sh
cd backend

101
README.md
View File

@@ -7,30 +7,30 @@
</h3>
<br/>
[![license-badge]][license-badge-url]
[![release-badge]][release-badge-url]
[![docker-pulls-badge]][docker-pulls-badge-url]
[![license-badge-img]][license-badge]
[![release-badge-img]][release-badge]
[![docker-pulls-badge-img]][docker-pulls-badge]
[![discord-badge]][discord-badge-url]
[![unraid-badge]][unraid-badge-url]
[![wiki-badge]][wiki-url]
[![discord-badge-img]][discord-badge]
[![unraid-badge-img]][unraid-badge]
[![wiki-badge-img]][wiki]
</div>
</div>
> [!WARNING]
> Version 3.0 introduces exciting new fetures that require some changes to how RomM is setup and configured. **If you're currently running a 2.x version, please review the [migration guide](https://github.com/rommapp/romm/wiki/Upgrading-to-3.0) before upgrading.**
> Version 3.0 introduces exciting new features that require changes to how RomM is set up and configured. **If you're currently running a 2.x version, please review the [migration guide](https://github.com/rommapp/romm/wiki/Upgrading-to-3.0) before upgrading.**
# Overview
RomM (ROM Manager) allows you to scan, enrich, and browse your game collection with a clean and responsive interface. With support for multiple platforms, various naming schemes and custom tags, RomM is a must-have for anyone who plays on emulators.
RomM (ROM Manager) allows you to scan, enrich, and browse your game collection with a clean and responsive interface. With support for multiple platforms, various naming schemes, and custom tags, RomM is a must-have for anyone who plays on emulators.
## Features
- Scans your existing games library and enchances it with metadata from [IGDB][igdb-api] and [MobyGames][mobygames-api]
- Scans your existing games library and enhances it with metadata from [IGDB][igdb-api] and [MobyGames][mobygames-api]
- Supports a large number of **[platforms][platform-support]**
- Play games directly from the browser using [EmulatorJS][wiki-emulatorjs-url]
- Share your library with friend while [limiting access and permissions][authentication]
- Play games directly from the browser using [EmulatorJS][wiki-emulatorjs]
- Share your library with friends while [limiting access and permissions][wiki-authentication]
- Supports MAME, Nintendo Switch, and Sony Playstation naming schemes
- Detects and groups **multifile games** (e.g. PS1 games with multiple CDs)
- Can [parse tags][tag-support] in filenames (e.g. (E), (USA), (rev v1), etc.)
@@ -38,27 +38,26 @@ RomM (ROM Manager) allows you to scan, enrich, and browse your game collection w
## Preview
| 🖥 Desktop | 📱 Mobile |
| 🖥 Desktop | 📱 Mobile |
| :-----------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------: |
| <img src=".github/resources/screenshots/romm-desktop-slider.gif" /> | <img style="width: 325px; aspect-ratio: auto;" src=".github/resources/screenshots/romm-mobile-slider.gif" /> |
# Installation
Before running the [image][docker-tags], ensure that Docker is installed and running on your system.
Before running the [image][docker-tags], please ensure that Docker is installed and running on your system.
1. [Generate API keys][wiki-generate-api-keys] for IGDB and/or MobyGames to fetch metadata.
2. Verify that your library folder structure matches one of the options listed in the [folder structure][folder-structure] section.
3. Create a docker-compose.yml file by referring to the example [docker-compose.yml][docker-compose-example] file for guidance, and customize it for your setup with [the available environment variables][wiki-env-variables].
4. Launch the container(s) with `docker-compose up -d`.
> [!NOTE]
> **If you are having issues with RomM, please review the [wiki page][wiki-troubleshooting-url] for troubleshooting steps and common issues.**
> [!NOTE] > **If you are having issues with RomM, please review the [wiki page][wiki-troubleshooting] for troubleshooting steps and common issues.**
# Configuration
## Folder Structure
As mentioned in the installation section, RomM requires a specific folder structure to work. The two supported structures are as follows:
As mentioned in the installation section, RomM requires a specific folder structure. The two supported structures are as follows:
<table border="0">
<tr>
@@ -138,19 +137,19 @@ As mentioned in the installation section, RomM requires a specific folder struct
## Configuration File
RomM's "understanding" of your library can be configured with a `config.yaml` file or through the `config` tab in the `Control Panel` under `Settings` section. Refer to the [example config.yml][configuration-file-example] file for guidance on how to configure it, and the [example docker-compose.yml][docker-compose-example] file on how to mount it into the container.
RomM's "understanding" of your library can be configured with a `config.yaml` file or through the `config` tab in the `Control Panel` under the `Settings` section. Refer to the [example config.yml][configuration-file-example] file for guidance on how to configure it and the [example docker-compose.yml][docker-compose-example] file on how to mount it into the container.
## Scheduler
The scheduler allows you to scheduled async tasks that run in the Redis container at regular intervals. Jobs can be run at a specific time in the future, after a time delta, or at recurring internals using cron notation. The [wiki page on the scheduler][wiki-scheduled-tasks] has more information on how which tasks are available and how to enable them.
The scheduler allows you to schedule async tasks that run in the Redis container at regular intervals. Jobs can be run at a specific time in the future, after a time delta, or at recurring internals using cron notation. The [wiki page on the scheduler][wiki-scheduled-tasks] has more information on which tasks are available and how to enable them.
# Naming Convention
## Platform Support
If you adhere to the [RomM folder structure][folder-structure], RomM supports all platforms listed on the [Supported Platforms][wiki-supported-platforms-url] page. **The folder is is case sensitive and must be used exactly how it appears in the list.** When scanning your library, RomM will use the folder name to determine the platform and fetch the appropriate game information, metadata, and cover art.
If you adhere to the [RomM folder structure][folder-structure], RomM supports all platforms listed on the [Supported Platforms][wiki-supported-platforms] page. **The folder is case-sensitive and must be used exactly as it appears on the list.** When scanning your library, RomM will use the folder name to determine the platform and fetch the appropriate game information, metadata, and cover art.
Additionally, some of these platforms have custom icons available ([learn more about platform icons in our wiki][wiki-platforms-icons-url]).
Additionally, some of these platforms have custom icons available ([learn more about platform icons in our wiki][wiki-platforms-icons]).
## Tag Support
@@ -163,20 +162,20 @@ Tags can be used to search for games in the search bar. For example, searching f
# Community
Here are a few projects maintained by members of our community. As they are not regularly reviewed by the RomM team, **we recommend you closely review them before use**.
Here are a few projects maintained by members of our community. Since the RomM team does not regularly review them, **we recommend that you review them closely before you use them**.
- CasaOS app via the [BigBear App Store][big-bear-casaos]
- [Helm Chart to deploy on Kubernetes][kubernetes-helm-chart] by @psych0d0g
Join us on discord, where you can ask questions, submit ideas, get help, showcase your collection, and discuss RomM with other users.
Join us on Discord, where you can ask questions, submit ideas, get help, showcase your collection, and discuss RomM with other users.
[![discord-invite]][discord-invite-url]
[![discord-invite-img]][discord-invite]
## Support
If you like this project, consider buying me a coffee!
[![coffee-donate]][coffee-donate-url]
[![coffee-donate-img]][coffee-donate]
## Our Friends
@@ -189,11 +188,11 @@ Here are a few projects that we think you might like:
<!-- Sections -->
[folder-structure]: #-folder-structure
[platform-support]: #-platform-support
[authentication]: #-authentication
[tag-support]: #-tag-support
[configuration-file]: #-configuration-file
[folder-structure]: #folder-structure
[platform-support]: #platform-support
[authentication]: #authentication
[tag-support]: #tag-support
[configuration-file]: #configuration-file
<!-- Files -->
@@ -202,43 +201,43 @@ Here are a few projects that we think you might like:
<!-- Wiki links -->
[wiki-url]: https://github.com/rommapp/romm/wiki
[wiki-supported-platforms-url]: https://github.com/rommapp/romm/wiki/Supported-Platforms
[wiki-authentication-url]: https://github.com/rommapp/romm/wiki/Authentication
[wiki-platforms-icons-url]: https://github.com/rommapp/romm/wiki/Custom-Platform-Icons
[wiki-troubleshooting-url]: https://github.com/rommapp/romm/wiki/Troubleshooting
[wiki-emulatorjs-url]: https://github.com/rommapp/romm/wiki/EmulatorJS-Player
[wiki]: https://github.com/rommapp/romm/wiki
[wiki-supported-platforms]: https://github.com/rommapp/romm/wiki/Supported-Platforms
[wiki-authentication]: https://github.com/rommapp/romm/wiki/Authentication
[wiki-platforms-icons]: https://github.com/rommapp/romm/wiki/Custom-Platform-Icons
[wiki-troubleshooting]: https://github.com/rommapp/romm/wiki/Troubleshooting
[wiki-emulatorjs]: https://github.com/rommapp/romm/wiki/EmulatorJS-Player
[wiki-env-variables]: https://github.com/rommapp/romm/wiki/Environment-Variables
[wiki-scheduled-tasks]: https://github.com/rommapp/romm/wiki/Scheduled-Tasks
[wiki-generate-api-keys]: https://github.com/rommapp/romm/wiki/Generate-API-Keys
<!-- Badges -->
[license-badge]: https://img.shields.io/github/license/rommapp/romm?style=for-the-badge&color=a32d2a
[license-badge-url]: LICENSE
[release-badge]: https://img.shields.io/github/v/release/rommapp/romm?style=for-the-badge
[release-badge-url]: https://github.com/rommapp/romm/releases
[discord-badge]: https://img.shields.io/badge/discord-7289da?style=for-the-badge
[discord-badge-url]: https://discord.gg/P5HtHnhUDH
[unraid-badge]: https://img.shields.io/badge/Unraid-f57842?style=for-the-badge&labelColor=ee512b
[unraid-badge-url]: https://forums.unraid.net/topic/149738-support-eurotimmy-romm-rom-manager-by-zurdi15/
[wiki-badge]: https://img.shields.io/badge/Wiki-736e9b?style=for-the-badge
[docker-pulls-badge]: https://img.shields.io/docker/pulls/rommapp/romm?style=for-the-badge&label=pulls
[docker-pulls-badge-url]: https://hub.docker.com/r/rommapp/romm
[license-badge-img]: https://img.shields.io/github/license/rommapp/romm?style=for-the-badge&color=a32d2a
[license-badge]: LICENSE
[release-badge-img]: https://img.shields.io/github/v/release/rommapp/romm?style=for-the-badge
[release-badge]: https://github.com/rommapp/romm/releases
[discord-badge-img]: https://img.shields.io/badge/discord-7289da?style=for-the-badge
[discord-badge]: https://discord.gg/P5HtHnhUDH
[unraid-badge-img]: https://img.shields.io/badge/Unraid-f57842?style=for-the-badge&labelColor=ee512b
[unraid-badge]: https://forums.unraid.net/topic/149738-support-eurotimmy-romm-rom-manager-by-zurdi15/
[wiki-badge-img]: https://img.shields.io/badge/Wiki-736e9b?style=for-the-badge
[docker-pulls-badge-img]: https://img.shields.io/docker/pulls/rommapp/romm?style=for-the-badge&label=pulls
[docker-pulls-badge]: https://hub.docker.com/r/rommapp/romm
<!-- Links -->
[discord-invite]: https://invidget.switchblade.xyz/P5HtHnhUDH
[discord-invite-url]: https://discord.gg/P5HtHnhUDH
[coffee-donate]: https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png
[coffee-donate-url]: https://www.buymeacoff.ee/zurdi15
[discord-invite-img]: https://invidget.switchblade.xyz/P5HtHnhUDH
[discord-invite]: https://discord.gg/P5HtHnhUDH
[coffee-donate-img]: https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png
[coffee-donate]: https://www.buymeacoff.ee/zurdi15
<!-- External links -->
[docker-tags]: https://hub.docker.com/r/rommapp/romm/tags
[igdb-api]: https://api-docs.igdb.com/#account-creation
[mobygames-api]: https://www.mobygames.com/info/api/
[titleid-program-id-url]: https://switchbrew.org/w/index.php?title=Title_list/Games&mobileaction=toggle_view_desktop
[titleid-program-id]: https://switchbrew.org/w/index.php?title=Title_list/Games&mobileaction=toggle_view_desktop
[igdb-platforms-list]: https://www.igdb.com/platforms
[big-bear-casaos]: https://github.com/bigbeartechworld/big-bear-casaos
[kubernetes-helm-chart]: https://artifacthub.io/packages/helm/crystalnet/romm

View File

@@ -1,7 +1,7 @@
Thanks for helping make RomM safer for everyone.
## Reporting Security Issues
Thanks for helping make RomM safer for everyone.
If you believe you have found a security vulnerability in RomM, please report it to us through coordinated disclosure.
**Do not report security vulnerabilities through public GitHub issues, discussions, pull requests, or on our public Discord server.**

View File

@@ -1,16 +1,16 @@
import sys
from pathlib import Path
from logging.config import fileConfig
from sqlalchemy import create_engine
from pathlib import Path
from config.config_manager import ConfigManager
from alembic import context
from models.base import BaseModel
from config.config_manager import ConfigManager
from models.assets import Save, Screenshot, State # noqa
from models.rom import Rom # noqa
from models.platform import Platform # noqa
from models.user import User # noqa
from models.base import BaseModel
from models.firmware import Firmware # noqa
from models.platform import Platform # noqa
from models.rom import Rom # noqa
from models.user import User # noqa
from sqlalchemy import create_engine
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.

View File

@@ -6,10 +6,10 @@ Create Date: 2023-09-12 18:18:27.158732
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.exc import OperationalError
from alembic import op
from sqlalchemy.dialects import mysql
from sqlalchemy.exc import OperationalError
# revision identifiers, used by Alembic.
revision = "0009_models_refactor"

View File

@@ -6,8 +6,8 @@ Create Date: 2023-09-14 09:57:13.487331
"""
from alembic import op
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import mysql
# revision identifiers, used by Alembic.

View File

@@ -6,8 +6,8 @@ Create Date: 2023-09-16 15:28:29.221475
"""
from alembic import op
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import mysql
# revision identifiers, used by Alembic.

View File

@@ -6,8 +6,8 @@ Create Date: 2023-12-03 10:54:46.859106
"""
from alembic import op
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import mysql
# revision identifiers, used by Alembic.

View File

@@ -7,13 +7,14 @@ Create Date: 2024-02-08 15:03:26.338964
"""
import os
from alembic import op
import sqlalchemy as sa
from alembic import op
from config import ROMM_DB_DRIVER
from config.config_manager import SQLITE_DB_BASE_PATH, ConfigManager
from sqlalchemy import create_engine, text
from sqlalchemy.dialects import mysql
from sqlalchemy.orm import sessionmaker
from config import ROMM_DB_DRIVER
from config.config_manager import SQLITE_DB_BASE_PATH, ConfigManager
# revision identifiers, used by Alembic.
revision = "0014_asset_files"
@@ -63,14 +64,16 @@ def migrate_to_mysql() -> None:
continue
table_data = sqlite_conn.execute(
text(f"SELECT * FROM {table_name}")
text(f"SELECT * FROM {table_name}") # nosec B608
).fetchall()
# Insert data into MariaDB table
for row in table_data:
mapped_row = {f"{i}": value for i, value in enumerate(row, start=1)}
columns = ",".join([f":{i}" for i in range(1, len(row) + 1)])
insert_query = f"INSERT INTO {table_name} VALUES ({columns})"
insert_query = (
f"INSERT INTO {table_name} VALUES ({columns})" # nosec B608
)
maria_conn.execute(text(insert_query), mapped_row)
maria_conn.execute(text("SET FOREIGN_KEY_CHECKS=1"))

View File

@@ -6,8 +6,8 @@ Create Date: 2024-02-13 17:57:25.936825
"""
from alembic import op
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import mysql
# revision identifiers, used by Alembic.

View File

@@ -6,9 +6,8 @@ Create Date: 2024-04-06 15:16:50.539968
"""
from alembic import op
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "0016_user_last_login_active"

View File

@@ -6,9 +6,8 @@ Create Date: 2024-04-28 11:58:18.927734
"""
from alembic import op
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "0017_rom_notes"

View File

@@ -6,9 +6,8 @@ Create Date: 2024-05-05 11:20:54.243980
"""
from alembic import op
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "0018_firmware"

View File

@@ -6,11 +6,10 @@ Create Date: 2023-04-10 23:02:37.472055
"""
from alembic import op
import sqlalchemy as sa
from alembic import op
from sqlalchemy.exc import OperationalError
# revision identifiers, used by Alembic.
revision = "1.6.2"
down_revision = None

View File

@@ -6,9 +6,8 @@ Create Date: 2023-04-10 23:13:43.591414
"""
from alembic import op
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "1.6.3"

View File

@@ -6,9 +6,8 @@ Create Date: 2023-04-15 02:28:24.023871
"""
from alembic import op
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "1.7.1"

View File

@@ -6,9 +6,8 @@ Create Date: 2023-04-17 12:03:19.163501
"""
from alembic import op
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "1.8.1"

View File

@@ -6,9 +6,8 @@ Create Date: 2023-05-09 00:00:19.143526
"""
from alembic import op
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "1.8.2"

View File

@@ -8,7 +8,6 @@ Create Date: 2023-05-17 12:59:44.344356
from alembic import op
# revision identifiers, used by Alembic.
revision = "1.8.3"
down_revision = "1.8.2"

View File

@@ -6,9 +6,8 @@ Create Date: 2023-04-17 12:03:19.163501
"""
from alembic import op
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "1.8"

View File

@@ -6,9 +6,8 @@ Create Date: 2023-08-10 22:18:24.012779
"""
from alembic import op
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "2.0.0"

View File

@@ -8,7 +8,7 @@ load_dotenv()
# GUNICORN
DEV_PORT: Final = int(os.environ.get("VITE_BACKEND_DEV_PORT", "5000"))
DEV_HOST: Final = "0.0.0.0"
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))

View File

@@ -3,6 +3,7 @@ import sys
from pathlib import Path
from typing import Final
from urllib.parse import quote_plus
import pydash
import yaml
from config import (
@@ -219,9 +220,9 @@ class ConfigManager:
self._raw_config = yaml.load(config_file, Loader=SafeLoader) or {}
except FileNotFoundError:
self._raw_config = {}
except PermissionError:
except PermissionError as exc:
self._raw_config = {}
raise ConfigNotReadableException
raise ConfigNotReadableException from exc
self._parse_config()
self._validate_config()
@@ -258,9 +259,9 @@ class ConfigManager:
yaml.dump(self._raw_config, config_file)
except FileNotFoundError:
self._raw_config = {}
except PermissionError:
except PermissionError as exc:
self._raw_config = {}
raise ConfigNotWritableException
raise ConfigNotWritableException from exc
def add_platform_binding(self, fs_slug: str, slug: str) -> None:
platform_bindings = self.config.PLATFORMS_BINDING

View File

@@ -3,29 +3,29 @@
exclude:
platforms:
- 'romm'
- "romm"
roms:
single_file:
names:
- 'info.txt'
- "info.txt"
extensions:
- 'xml'
- "xml"
multi_file:
names:
- 'my_multi_file_game'
- 'DLC'
- "my_multi_file_game"
- "DLC"
parts:
names:
- 'data.xml'
- "data.xml"
extensions:
- 'txt'
- "txt"
system:
platforms:
gc: 'ngc'
gc: "ngc"
versions:
naomi: 'arcade'
naomi: "arcade"
filesystem:
roms_folder: 'ROMS'
firmware_folder: 'BIOS'
roms_folder: "ROMS"
firmware_folder: "BIOS"

View File

@@ -25,17 +25,17 @@ oauth2_password_bearer = OAuth2PasswordBearer(
def protected_route(
method: Any,
path: str,
scopes: list[str] = [],
scopes: list[str] | None = None,
**kwargs,
):
def decorator(func: DecoratedCallable):
fn = requires(scopes)(func)
fn = requires(scopes or [])(func)
return method(
path,
dependencies=[
Security(
dependency=oauth2_password_bearer,
scopes=scopes,
scopes=scopes or [],
),
Security(dependency=HTTPBasic(auto_error=False)),
],

View File

@@ -15,10 +15,10 @@ def begin_session(func):
with args[0].session.begin() as s:
kwargs["session"] = s
return func(*args, **kwargs)
except ProgrammingError as e:
log.critical(str(e))
except ProgrammingError as exc:
log.critical(str(exc))
raise HTTPException(
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=str(e)
)
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=str(exc)
) from exc
return wrapper

View File

@@ -1,4 +1,4 @@
from datetime import timedelta, datetime
from datetime import datetime, timedelta
from typing import Annotated, Final
from endpoints.forms.identity import OAuth2RequestForm
@@ -133,7 +133,9 @@ async def token(form_data: Annotated[OAuth2RequestForm, Depends()]) -> TokenResp
@router.post("/login")
def login(request: Request, credentials=Depends(HTTPBasic())) -> MessageResponse:
def login(
request: Request, credentials=Depends(HTTPBasic()) # noqa
) -> MessageResponse:
"""Session login endpoint
Args:

View File

@@ -21,12 +21,25 @@ def get_config() -> ConfigResponse:
"""
try:
return cm.get_config().__dict__
except ConfigNotReadableException as e:
log.critical(e.message)
raise HTTPException(
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=e.message
cfg = cm.get_config()
return ConfigResponse(
EXCLUDED_PLATFORMS=cfg.EXCLUDED_PLATFORMS,
EXCLUDED_SINGLE_EXT=cfg.EXCLUDED_SINGLE_EXT,
EXCLUDED_SINGLE_FILES=cfg.EXCLUDED_SINGLE_FILES,
EXCLUDED_MULTI_FILES=cfg.EXCLUDED_MULTI_FILES,
EXCLUDED_MULTI_PARTS_EXT=cfg.EXCLUDED_MULTI_PARTS_EXT,
EXCLUDED_MULTI_PARTS_FILES=cfg.EXCLUDED_MULTI_PARTS_FILES,
PLATFORMS_BINDING=cfg.PLATFORMS_BINDING,
PLATFORMS_VERSIONS=cfg.PLATFORMS_VERSIONS,
ROMS_FOLDER_NAME=cfg.ROMS_FOLDER_NAME,
FIRMWARE_FOLDER_NAME=cfg.FIRMWARE_FOLDER_NAME,
HIGH_PRIO_STRUCTURE_PATH=cfg.HIGH_PRIO_STRUCTURE_PATH,
)
except ConfigNotReadableException as exc:
log.critical(exc.message)
raise HTTPException(
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=exc.message
) from exc
@protected_route(router.post, "/config/system/platforms", ["platforms.write"])
@@ -39,11 +52,11 @@ async def add_platform_binding(request: Request) -> MessageResponse:
try:
cm.add_platform_binding(fs_slug, slug)
except ConfigNotWritableException as e:
log.critical(e.message)
except ConfigNotWritableException as exc:
log.critical(exc.message)
raise HTTPException(
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=e.message
)
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=exc.message
) from exc
return {"msg": f"{fs_slug} binded to: {slug} successfully!"}
@@ -56,11 +69,11 @@ async def delete_platform_binding(request: Request, fs_slug: str) -> MessageResp
try:
cm.remove_platform_binding(fs_slug)
except ConfigNotWritableException as e:
log.critical(e.message)
except ConfigNotWritableException as exc:
log.critical(exc.message)
raise HTTPException(
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=e.message
)
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=exc.message
) from exc
return {"msg": f"{fs_slug} bind removed successfully!"}
@@ -75,11 +88,11 @@ async def add_platform_version(request: Request) -> MessageResponse:
try:
cm.add_platform_version(fs_slug, slug)
except ConfigNotWritableException as e:
log.critical(e.message)
except ConfigNotWritableException as exc:
log.critical(exc.message)
raise HTTPException(
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=e.message
)
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=exc.message
) from exc
return {"msg": f"Added {fs_slug} as version of: {slug} successfully!"}
@@ -92,11 +105,11 @@ async def delete_platform_version(request: Request, fs_slug: str) -> MessageResp
try:
cm.remove_platform_version(fs_slug)
except ConfigNotWritableException as e:
log.critical(e.message)
except ConfigNotWritableException as exc:
log.critical(exc.message)
raise HTTPException(
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=e.message
)
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=exc.message
) from exc
return {"msg": f"{fs_slug} version removed successfully!"}

View File

@@ -1,14 +1,14 @@
from config import ROMM_HOST, DISABLE_DOWNLOAD_ENDPOINT_AUTH
from config import DISABLE_DOWNLOAD_ENDPOINT_AUTH, ROMM_HOST
from decorators.auth import protected_route
from models.rom import Rom
from fastapi import APIRouter, Request
from handler.database import db_platform_handler, db_rom_handler
from endpoints.responses.feeds import (
WEBRCADE_SLUG_TO_TYPE_MAP,
WEBRCADE_SUPPORTED_PLATFORM_SLUGS,
WebrcadeFeedSchema,
TinfoilFeedSchema,
WebrcadeFeedSchema,
)
from fastapi import APIRouter, Request
from handler.database import db_platform_handler, db_rom_handler
from models.rom import Rom
router = APIRouter()

View File

@@ -1,13 +1,10 @@
from config import LIBRARY_BASE_PATH, DISABLE_DOWNLOAD_ENDPOINT_AUTH
from config import DISABLE_DOWNLOAD_ENDPOINT_AUTH, LIBRARY_BASE_PATH
from decorators.auth import protected_route
from endpoints.responses import MessageResponse
from endpoints.responses.firmware import (
AddFirmwareResponse,
FirmwareSchema,
)
from fastapi import APIRouter, File, HTTPException, Request, UploadFile, status
from endpoints.responses.firmware import AddFirmwareResponse, FirmwareSchema
from fastapi import APIRouter, HTTPException, Request, UploadFile, status
from fastapi.responses import FileResponse
from handler.database import db_platform_handler, db_firmware_handler
from handler.database import db_firmware_handler, db_platform_handler
from handler.filesystem import fs_firmware_handler
from handler.scan_handler import scan_firmware
from logger.logger import log
@@ -17,7 +14,7 @@ router = APIRouter()
@protected_route(router.post, "/firmware", ["firmware.write"])
def add_firmware(
request: Request, platform_id: int, files: list[UploadFile] = File(...)
request: Request, platform_id: int, files: list[UploadFile] | None = None
) -> AddFirmwareResponse:
"""Upload firmware files endpoint
@@ -79,7 +76,7 @@ def add_firmware(
@protected_route(router.get, "/firmware", ["firmware.read"])
def get_platform_firmware(
request: Request,
platform_id: int = None,
platform_id: int | None = None,
) -> list[FirmwareSchema]:
"""Get firmware endpoint
@@ -199,9 +196,11 @@ async def delete_firmware(
fs_firmware_handler.remove_file(
file_name=firmware.file_name, file_path=firmware.file_path
)
except FileNotFoundError:
except FileNotFoundError as exc:
error = f"Firmware file {firmware.file_name} not found for platform {firmware.platform_slug}"
log.error(error)
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail=error)
raise HTTPException(
status_code=status.HTTP_404_NOT_FOUND, detail=error
) from exc
return {"msg": f"{len(firmare_ids)} firmware files deleted successfully!"}

View File

@@ -1,6 +1,6 @@
from typing import Optional
from fastapi import File, UploadFile
from fastapi import UploadFile
from fastapi.param_functions import Form
@@ -11,7 +11,7 @@ class UserForm:
password: Optional[str] = None,
role: Optional[str] = None,
enabled: Optional[bool] = None,
avatar: Optional[UploadFile] = File(None),
avatar: Optional[UploadFile] = None,
):
self.username = username
self.password = password

View File

@@ -7,9 +7,9 @@ from config import (
SCHEDULED_UPDATE_SWITCH_TITLEDB_CRON,
)
from endpoints.responses.heartbeat import HeartbeatResponse
from fastapi import APIRouter
from handler.metadata.igdb_handler import IGDB_API_ENABLED
from handler.metadata.moby_handler import MOBY_API_ENABLED
from fastapi import APIRouter
from utils import get_version
router = APIRouter()

View File

@@ -8,6 +8,7 @@ from handler.filesystem import fs_platform_handler
from handler.metadata.igdb_handler import IGDB_PLATFORM_LIST
from handler.scan_handler import scan_platform
from logger.logger import log
from models.platform import Platform
router = APIRouter()
@@ -61,18 +62,24 @@ def get_supported_platforms(request: Request) -> list[PlatformSchema]:
"""
supported_platforms = []
db_platforms: list = db_platform_handler.get_platforms()
# This double loop probably can be done better
db_platforms: list[Platform] = db_platform_handler.get_platforms()
db_platforms_map = {p.name: p.id for p in db_platforms}
for platform in IGDB_PLATFORM_LIST:
platform["id"] = -1
for p in db_platforms:
if p.name == platform["name"]:
platform["id"] = p.id
platform["fs_slug"] = platform["slug"]
platform["logo_path"] = ""
platform["roms"] = []
platform["rom_count"] = 0
supported_platforms.append(PlatformSchema.model_validate(platform).model_dump())
sup_plat = {
"id": -1,
"name": platform["name"],
"fs_slug": platform["slug"],
"logo_path": "",
"roms": [],
"rom_count": 0,
}
if platform["name"] in db_platforms_map:
sup_plat["id"] = db_platforms_map[platform["name"]]
supported_platforms.append(PlatformSchema.model_validate(sup_plat).model_dump())
return supported_platforms

View File

@@ -1,7 +1,7 @@
from config import ASSETS_BASE_PATH
from decorators.auth import protected_route
from fastapi import APIRouter, Request
from fastapi.responses import FileResponse
from decorators.auth import protected_route
from config import ASSETS_BASE_PATH
router = APIRouter()

View File

@@ -1,4 +1,5 @@
from datetime import datetime
from models.user import Role
from pydantic import BaseModel

View File

@@ -1,4 +1,5 @@
from typing import Optional
from pydantic import BaseModel, Field
from .firmware import FirmwareSchema

View File

@@ -1,26 +1,25 @@
import re
from datetime import datetime
from typing import Optional, get_type_hints
from typing_extensions import TypedDict, NotRequired
from endpoints.responses.assets import SaveSchema, ScreenshotSchema, StateSchema
from fastapi import Request
from fastapi.responses import StreamingResponse
from handler.socket_handler import socket_handler
from handler.metadata.igdb_handler import IGDBMetadata
from handler.metadata.moby_handler import MobyMetadata
from pydantic import BaseModel, computed_field, Field
from handler.socket_handler import socket_handler
from models.rom import Rom
from pydantic import BaseModel, Field, computed_field
from typing_extensions import NotRequired, TypedDict
SORT_COMPARE_REGEX = r"^([Tt]he|[Aa]|[Aa]nd)\s"
RomIGDBMetadata = TypedDict(
RomIGDBMetadata = TypedDict( # type: ignore[misc]
"RomIGDBMetadata",
{k: NotRequired[v] for k, v in get_type_hints(IGDBMetadata).items()},
total=False,
)
RomMobyMetadata = TypedDict(
RomMobyMetadata = TypedDict( # type: ignore[misc]
"RomMobyMetadata",
{k: NotRequired[v] for k, v in get_type_hints(MobyMetadata).items()},
total=False,
@@ -121,7 +120,9 @@ class DetailedRomSchema(RomSchema):
user_notes: list[RomNoteSchema] = Field(default_factory=list)
@classmethod
def from_orm_with_request(cls, db_rom: Rom, request: Request) -> "DetailedRomSchema":
def from_orm_with_request(
cls, db_rom: Rom, request: Request
) -> "DetailedRomSchema":
rom = cls.model_validate(db_rom)
user_id = request.user.id

View File

@@ -1,20 +1,21 @@
import os
from datetime import datetime
from stat import S_IFREG
from typing import Annotated, Optional
from typing import Annotated
from urllib.parse import quote
from config import LIBRARY_BASE_PATH, DISABLE_DOWNLOAD_ENDPOINT_AUTH
from config import DISABLE_DOWNLOAD_ENDPOINT_AUTH, LIBRARY_BASE_PATH
from decorators.auth import protected_route
from endpoints.responses import MessageResponse
from endpoints.responses.rom import (
AddRomsResponse,
CustomStreamingResponse,
RomSchema,
DetailedRomSchema,
RomNoteSchema,
RomSchema,
)
from exceptions.fs_exceptions import RomAlreadyExistsException
from fastapi import APIRouter, File, HTTPException, Query, Request, UploadFile, status
from fastapi import APIRouter, HTTPException, Query, Request, UploadFile, status
from fastapi.responses import FileResponse
from handler.database import db_platform_handler, db_rom_handler
from handler.filesystem import fs_resource_handler, fs_rom_handler
@@ -22,14 +23,13 @@ from handler.filesystem.base_handler import CoverSize
from handler.metadata import meta_igdb_handler, meta_moby_handler
from logger.logger import log
from stream_zip import ZIP_AUTO, stream_zip # type: ignore[import]
from urllib.parse import quote
router = APIRouter()
@protected_route(router.post, "/roms", ["roms.write"])
def add_roms(
request: Request, platform_id: int, roms: list[UploadFile] = File(...)
request: Request, platform_id: int, roms: list[UploadFile] | None = None
) -> AddRomsResponse:
"""Upload roms endpoint (one or more at the same time)
@@ -86,9 +86,9 @@ def add_roms(
@protected_route(router.get, "/roms", ["roms.read"])
def get_roms(
request: Request,
platform_id: int = None,
platform_id: int | None = None,
search_term: str = "",
limit: int = None,
limit: int | None = None,
order_by: str = "name",
order_dir: str = "asc",
) -> list[RomSchema]:
@@ -248,7 +248,7 @@ async def update_rom(
id: int,
rename_as_igdb: bool = False,
remove_cover: bool = False,
artwork: Optional[UploadFile] = File(None),
artwork: UploadFile | None = None,
) -> DetailedRomSchema:
"""Update rom endpoint
@@ -306,11 +306,11 @@ async def update_rom(
new_name=fs_safe_file_name,
file_path=db_rom.file_path,
)
except RomAlreadyExistsException as e:
log.error(str(e))
except RomAlreadyExistsException as exc:
log.error(str(exc))
raise HTTPException(
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=str(e)
)
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=str(exc)
) from exc
cleaned_data["file_name"] = fs_safe_file_name
cleaned_data["file_name_no_tags"] = fs_rom_handler.get_file_name_with_no_tags(
@@ -416,10 +416,12 @@ async def delete_roms(
fs_rom_handler.remove_file(
file_name=rom.file_name, file_path=rom.file_path
)
except FileNotFoundError:
except FileNotFoundError as exc:
error = f"Rom file {rom.file_name} not found for platform {rom.platform_slug}"
log.error(error)
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail=error)
raise HTTPException(
status_code=status.HTTP_404_NOT_FOUND, detail=error
) from exc
return {"msg": f"{len(roms_ids)} roms deleted successfully!"}

View File

@@ -1,12 +1,8 @@
from decorators.auth import protected_route
from endpoints.responses import MessageResponse
from endpoints.responses.assets import UploadedSavesResponse, SaveSchema
from fastapi import APIRouter, File, HTTPException, Request, UploadFile, status
from handler.database import (
db_save_handler,
db_rom_handler,
db_screenshot_handler,
)
from endpoints.responses.assets import SaveSchema, UploadedSavesResponse
from fastapi import APIRouter, HTTPException, Request, UploadFile, status
from handler.database import db_rom_handler, db_save_handler, db_screenshot_handler
from handler.filesystem import fs_asset_handler
from handler.scan_handler import scan_save
from logger.logger import log
@@ -18,8 +14,8 @@ router = APIRouter()
def add_saves(
request: Request,
rom_id: int,
saves: list[UploadFile] = File(...),
emulator: str = None,
saves: list[UploadFile] | None = None,
emulator: str | None = None,
) -> UploadedSavesResponse:
rom = db_rom_handler.get_roms(rom_id)
current_user = request.user
@@ -133,10 +129,12 @@ async def delete_saves(request: Request) -> MessageResponse:
fs_asset_handler.remove_file(
file_name=save.file_name, file_path=save.file_path
)
except FileNotFoundError:
except FileNotFoundError as exc:
error = f"Save file {save.file_name} not found for platform {save.rom.platform_slug}"
log.error(error)
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail=error)
raise HTTPException(
status_code=status.HTTP_404_NOT_FOUND, detail=error
) from exc
if save.screenshot:
db_screenshot_handler.delete_screenshot(save.screenshot.id)

View File

@@ -1,6 +1,6 @@
from decorators.auth import protected_route
from endpoints.responses.assets import UploadedScreenshotsResponse
from fastapi import APIRouter, File, HTTPException, Request, UploadFile, status
from fastapi import APIRouter, HTTPException, Request, UploadFile, status
from handler.database import db_rom_handler, db_screenshot_handler
from handler.filesystem import fs_asset_handler
from handler.scan_handler import scan_screenshot
@@ -11,7 +11,7 @@ router = APIRouter()
@protected_route(router.post, "/screenshots", ["assets.write"])
def add_screenshots(
request: Request, rom_id: int, screenshots: list[UploadFile] = File(...)
request: Request, rom_id: int, screenshots: list[UploadFile] | None = None
) -> UploadedScreenshotsResponse:
rom = db_rom_handler.get_roms(rom_id)
current_user = request.user

View File

@@ -1,12 +1,12 @@
import emoji
from handler.scan_handler import _get_main_platform_igdb_id
from decorators.auth import protected_route
from endpoints.responses.search import SearchRomSchema
from fastapi import APIRouter, Request, HTTPException, status
from fastapi import APIRouter, HTTPException, Request, status
from handler.database import db_rom_handler
from handler.metadata import meta_igdb_handler, meta_moby_handler
from handler.metadata.igdb_handler import IGDB_API_ENABLED
from handler.metadata.moby_handler import MOBY_API_ENABLED
from handler.scan_handler import _get_main_platform_igdb_id
from logger.logger import log
router = APIRouter()
@@ -16,7 +16,7 @@ router = APIRouter()
async def search_rom(
request: Request,
rom_id: str,
search_term: str = None,
search_term: str | None = None,
search_by: str = "name",
search_extended: bool = False,
) -> list[SearchRomSchema]:
@@ -64,12 +64,12 @@ async def search_rom(
moby_matched_roms = meta_moby_handler.get_matched_roms_by_id(
int(search_term)
)
except ValueError:
except ValueError as exc:
log.error(f"Search error: invalid ID '{search_term}'")
raise HTTPException(
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
detail=f"Tried searching by ID, but '{search_term}' is not a valid ID",
)
) from exc
elif search_by.lower() == "name":
igdb_matched_roms = meta_igdb_handler.get_matched_roms_by_name(
search_term, _get_main_platform_igdb_id(rom.platform), search_extended

View File

@@ -1,37 +1,24 @@
import emoji
import socketio # type: ignore
from rq import Worker
from rq.job import Job
from config import SCAN_TIMEOUT
from endpoints.responses.firmware import FirmwareSchema
from endpoints.responses.platform import PlatformSchema
from endpoints.responses.rom import RomSchema
from endpoints.responses.firmware import FirmwareSchema
from exceptions.fs_exceptions import (
FirmwareNotFoundException,
FolderStructureNotMatchException,
RomsNotFoundException,
FirmwareNotFoundException,
)
from config import SCAN_TIMEOUT
from handler.database import (
db_rom_handler,
db_firmware_handler,
db_platform_handler,
)
from handler.filesystem import (
fs_rom_handler,
fs_firmware_handler,
fs_platform_handler,
)
from handler.socket_handler import socket_handler
from handler.redis_handler import high_prio_queue, redis_url, redis_client
from handler.scan_handler import (
scan_platform,
scan_rom,
scan_firmware,
ScanType,
)
from handler.database import db_firmware_handler, db_platform_handler, db_rom_handler
from handler.filesystem import fs_firmware_handler, fs_platform_handler, fs_rom_handler
from handler.metadata.igdb_handler import IGDB_API_ENABLED
from handler.metadata.moby_handler import MOBY_API_ENABLED
from handler.redis_handler import high_prio_queue, redis_client, redis_url
from handler.scan_handler import ScanType, scan_firmware, scan_platform, scan_rom
from handler.socket_handler import socket_handler
from logger.logger import log
from rq import Worker
from rq.job import Job
class ScanStats:
@@ -54,8 +41,8 @@ def _get_socket_manager():
async def scan_platforms(
platform_ids: list[int],
scan_type: ScanType = ScanType.QUICK,
selected_roms: list[str] = (),
metadata_sources: list[str] = ["igdb", "moby"],
selected_roms: list[str] | None = None,
metadata_sources: list[str] | None = None,
):
"""Scan all the listed platforms and fetch metadata from different sources
@@ -66,6 +53,12 @@ async def scan_platforms(
metadata_sources (list[str], optional): List of metadata sources to be used. Defaults to all sources.
"""
if not selected_roms:
selected_roms = []
if not metadata_sources:
metadata_sources = ["igdb", "moby"]
sm = _get_socket_manager()
if not IGDB_API_ENABLED and not MOBY_API_ENABLED:

View File

@@ -1,12 +1,8 @@
from decorators.auth import protected_route
from endpoints.responses import MessageResponse
from endpoints.responses.assets import UploadedStatesResponse, StateSchema
from fastapi import APIRouter, File, HTTPException, Request, UploadFile, status
from handler.database import (
db_state_handler,
db_rom_handler,
db_screenshot_handler,
)
from endpoints.responses.assets import StateSchema, UploadedStatesResponse
from fastapi import APIRouter, HTTPException, Request, UploadFile, status
from handler.database import db_rom_handler, db_screenshot_handler, db_state_handler
from handler.filesystem import fs_asset_handler
from handler.scan_handler import scan_state
from logger.logger import log
@@ -18,8 +14,8 @@ router = APIRouter()
def add_states(
request: Request,
rom_id: int,
states: list[UploadFile] = File(...),
emulator: str = None,
states: list[UploadFile] | None = None,
emulator: str | None = None,
) -> UploadedStatesResponse:
rom = db_rom_handler.get_roms(rom_id)
current_user = request.user
@@ -132,10 +128,12 @@ async def delete_states(request: Request) -> MessageResponse:
fs_asset_handler.remove_file(
file_name=state.file_name, file_path=state.file_path
)
except FileNotFoundError:
except FileNotFoundError as exc:
error = f"Save file {state.file_name} not found for platform {state.rom.platform_slug}"
log.error(error)
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail=error)
raise HTTPException(
status_code=status.HTTP_404_NOT_FOUND, detail=error
) from exc
if state.screenshot:
db_screenshot_handler.delete_screenshot(state.screenshot.id)

View File

@@ -1,18 +1,19 @@
import pytest
from datetime import timedelta
import pytest
from handler.auth import oauth_handler
from handler.tests.conftest import ( # noqa
setup_database,
clear_database,
admin_user,
clear_database,
editor_user,
viewer_user,
platform,
rom,
save,
setup_database,
state,
viewer_user,
)
from ..auth import ACCESS_TOKEN_EXPIRE_MINUTES, REFRESH_TOKEN_EXPIRE_DAYS

View File

@@ -1,5 +1,4 @@
from fastapi.testclient import TestClient
from main import app
client = TestClient(app)

View File

@@ -1,5 +1,4 @@
from fastapi.testclient import TestClient
from main import app
client = TestClient(app)

View File

@@ -1,5 +1,4 @@
from fastapi.testclient import TestClient
from main import app
from utils import get_version

View File

@@ -1,9 +1,9 @@
import base64
import pytest
from fastapi.testclient import TestClient
from main import app
from handler.redis_handler import cache
from main import app
from models.user import Role
client = TestClient(app)

View File

@@ -1,8 +1,8 @@
from endpoints.auth import ACCESS_TOKEN_EXPIRE_MINUTES
from fastapi.exceptions import HTTPException
from fastapi.testclient import TestClient
from main import app
from handler.auth.base_handler import WRITE_SCOPES
from main import app
client = TestClient(app)

View File

@@ -1,5 +1,4 @@
from fastapi.testclient import TestClient
from main import app
client = TestClient(app)

View File

@@ -1,5 +1,4 @@
from fastapi.testclient import TestClient
from main import app
client = TestClient(app)

View File

@@ -1,6 +1,6 @@
from fastapi.testclient import TestClient
from unittest.mock import patch
from fastapi.testclient import TestClient
from main import app
client = TestClient(app)

View File

@@ -1,11 +1,7 @@
from datetime import datetime, timedelta
from typing import Final
from config import (
ROMM_AUTH_PASSWORD,
ROMM_AUTH_SECRET_KEY,
ROMM_AUTH_USERNAME,
)
from config import ROMM_AUTH_PASSWORD, ROMM_AUTH_SECRET_KEY, ROMM_AUTH_USERNAME
from exceptions.auth_exceptions import OAuthCredentialsException
from fastapi import HTTPException, status
from joserfc import jwt
@@ -135,8 +131,8 @@ class OAuthHandler:
try:
payload = jwt.decode(token, ROMM_AUTH_SECRET_KEY)
except (BadSignatureError, ValueError):
raise OAuthCredentialsException
except (BadSignatureError, ValueError) as exc:
raise OAuthCredentialsException from exc
issuer = payload.claims.get("iss")
if not issuer or issuer != "romm:oauth":

View File

@@ -1,7 +1,7 @@
from fastapi.security.http import HTTPBasic
from handler.auth import auth_handler, oauth_handler
from starlette.authentication import AuthCredentials, AuthenticationBackend
from starlette.requests import HTTPConnection
from handler.auth import auth_handler, oauth_handler
class HybridAuthBackend(AuthenticationBackend):

View File

@@ -1,12 +1,13 @@
import time
import typing
from collections import namedtuple
from joserfc import jwt
from joserfc.errors import BadSignatureError
from starlette.datastructures import MutableHeaders, Secret
from starlette.requests import HTTPConnection
from starlette.types import ASGIApp, Message, Receive, Scope, Send
from starlette_csrf.middleware import CSRFMiddleware
from joserfc import jwt
from joserfc.errors import BadSignatureError
class CustomCSRFMiddleware(CSRFMiddleware):

View File

@@ -1,7 +1,7 @@
from handler.tests.conftest import ( # noqa
setup_database,
clear_database,
admin_user,
clear_database,
editor_user,
setup_database,
viewer_user,
)

View File

@@ -1,12 +1,12 @@
import pytest
from base64 import b64encode
from fastapi.exceptions import HTTPException
from models.user import User
from handler.database import db_user_handler
import pytest
from fastapi.exceptions import HTTPException
from handler.auth import auth_handler, oauth_handler
from handler.auth.base_handler import WRITE_SCOPES
from handler.auth.hybrid_auth import HybridAuthBackend
from handler.database import db_user_handler
from models.user import User
def test_verify_password():

View File

@@ -1,8 +1,7 @@
import pytest
from decorators.auth import protected_route
from fastapi import APIRouter, Request
from fastapi.exceptions import HTTPException
from decorators.auth import protected_route
from handler.auth import oauth_handler
from handler.database import db_user_handler

View File

@@ -1,6 +1,6 @@
from decorators.database import begin_session
from models.firmware import Firmware
from sqlalchemy import update, delete, and_, select
from sqlalchemy import and_, delete, select, update
from sqlalchemy.orm import Session
from .base_handler import DBBaseHandler
@@ -8,13 +8,16 @@ from .base_handler import DBBaseHandler
class DBFirmwareHandler(DBBaseHandler):
@begin_session
def add_firmware(self, firmware: Firmware, session: Session = None):
def add_firmware(self, firmware: Firmware, session: Session = None) -> Firmware:
return session.merge(firmware)
@begin_session
def get_firmware(
self, id: int = None, platform_id: int = None, session: Session = None
):
self,
id: int | None = None,
platform_id: int | None = None,
session: Session = None,
) -> Firmware | list[Firmware] | None:
return (
session.scalar(select(Firmware).filter_by(id=id).limit(1))
if id
@@ -36,7 +39,7 @@ class DBFirmwareHandler(DBBaseHandler):
)
@begin_session
def update_firmware(self, id: int, data: dict, session: Session = None):
def update_firmware(self, id: int, data: dict, session: Session = None) -> Firmware:
return session.execute(
update(Firmware)
.where(Firmware.id == id)
@@ -45,7 +48,7 @@ class DBFirmwareHandler(DBBaseHandler):
)
@begin_session
def delete_firmware(self, id: int, session: Session = None):
def delete_firmware(self, id: int, session: Session = None) -> None:
return session.execute(
delete(Firmware)
.where(Firmware.id == id)
@@ -55,7 +58,7 @@ class DBFirmwareHandler(DBBaseHandler):
@begin_session
def purge_firmware(
self, platform_id: int, firmware: list[str], session: Session = None
):
) -> None:
return session.execute(
delete(Firmware)
.where(

View File

@@ -1,10 +1,10 @@
import functools
from sqlalchemy import delete, or_, select
from sqlalchemy.orm import Session, Query, selectinload
from decorators.database import begin_session
from models.platform import Platform
from models.rom import Rom
from sqlalchemy import delete, or_, select
from sqlalchemy.orm import Query, Session, selectinload
from .base_handler import DBBaseHandler
@@ -38,13 +38,13 @@ class DBPlatformsHandler(DBBaseHandler):
@begin_session
@with_roms
def get_platforms(
self, id: int = None, query: Query = None, session: Session = None
self, id: int | None = None, query: Query = None, session: Session = None
) -> list[Platform] | Platform | None:
return (
session.scalar(query.filter_by(id=id).limit(1))
if id
else (
session.scalars(select(Platform).order_by(Platform.name.asc()))
session.scalars(select(Platform).order_by(Platform.name.asc())) # type: ignore[attr-defined]
.unique()
.all()
)
@@ -75,6 +75,6 @@ class DBPlatformsHandler(DBBaseHandler):
def purge_platforms(self, fs_platforms: list[str], session: Session = None) -> int:
return session.execute(
delete(Platform)
.where(or_(Platform.fs_slug.not_in(fs_platforms), Platform.slug.is_(None)))
.where(or_(Platform.fs_slug.not_in(fs_platforms), Platform.slug.is_(None))) # type: ignore[attr-defined]
.execution_options(synchronize_session="fetch")
)

View File

@@ -1,8 +1,9 @@
import functools
from decorators.database import begin_session
from models.rom import Rom, RomNote
from sqlalchemy import and_, delete, func, select, update, or_, Select
from sqlalchemy.orm import Session, Query, selectinload
from sqlalchemy import and_, delete, func, or_, select, update
from sqlalchemy.orm import Query, Session, selectinload
from .base_handler import DBBaseHandler
@@ -26,21 +27,21 @@ def with_assets(func):
class DBRomsHandler(DBBaseHandler):
def _filter(self, data: Select[Rom], platform_id: int | None, search_term: str):
def _filter(self, data, platform_id: int | None, search_term: str):
if platform_id:
data = data.filter_by(platform_id=platform_id)
if search_term:
data = data.filter(
or_(
Rom.file_name.ilike(f"%{search_term}%"),
Rom.name.ilike(f"%{search_term}%"),
Rom.file_name.ilike(f"%{search_term}%"), # type: ignore[attr-defined]
Rom.name.ilike(f"%{search_term}%"), # type: ignore[attr-defined]
)
)
return data
def _order(self, data: Select[Rom], order_by: str, order_dir: str):
def _order(self, data, order_by: str, order_dir: str):
if order_by == "id":
_column = Rom.id
else:
@@ -63,8 +64,8 @@ class DBRomsHandler(DBBaseHandler):
@with_assets
def get_roms(
self,
id: int = None,
platform_id: int = None,
id: int | None = None,
platform_id: int | None = None,
search_term: str = "",
order_by: str = "name",
order_dir: str = "asc",
@@ -135,7 +136,7 @@ class DBRomsHandler(DBBaseHandler):
) -> int:
return session.execute(
delete(Rom)
.where(and_(Rom.platform_id == platform_id, Rom.file_name.not_in(roms)))
.where(and_(Rom.platform_id == platform_id, Rom.file_name.not_in(roms))) # type: ignore[attr-defined]
.execution_options(synchronize_session="evaluate")
)

Some files were not shown because too many files have changed in this diff Show More