Commit Graph

4432 Commits

Author SHA1 Message Date
Michael Manganiello
cc20e847fd Merge pull request #1247 from rommapp/misc/scope-enum
misc: Create enum for authorization scopes
2024-10-25 00:06:43 -03:00
Michael Manganiello
beeb9f0c31 misc: Create enum for authorization scopes
Instead of using just strings, this change converts the scopes to a
`StrEnum`, to be compatible with places where a string is expected. This
avoids typos when using these scopes, simplifies searching for usages,
and improves type hints.

An extra change was the fix to the Firmware download endpoint, which
wasn't respecting the `DISABLE_DOWNLOAD_ENDPOINT_AUTH` flag.
2024-10-18 23:57:42 -03:00
Michael Manganiello
fc8cbb7226 Merge pull request #1242 from rommapp/fix/simplify-query-to-validate-username-exists
fix: Simplify query that validates new username already exists
3.6.0-rc.1
2024-10-14 20:49:15 -03:00
Georges-Antoine Assi
5b73c4e6cb Merge pull request #1236 from yuri-becker/feature/configurable-upload-timeout
#1228 Configurable upload timeout
2024-10-14 16:37:26 -04:00
Georges-Antoine Assi
4dd82a9b72 Merge pull request #1243 from drcursor/patch-1
Update variables to MariaDB
2024-10-14 15:08:06 -04:00
Eduardo Balsa
fb7bfe74f1 Update docker-compose.yml
Added comment directing people. to the example docker compose file. Changed variables to MARIADB as we are using the MARIADB container
2024-10-14 20:20:06 +02:00
Eduardo Balsa
48f198cbef Update docker-compose.example.yml
Switched to MARIADB variables as we are using the MARIADB container
2024-10-14 20:15:25 +02:00
Michael Manganiello
eba2971ffb fix: Simplify query that validates new username already exists
Instead of fetching all users and checking if the new username is present
in the list, we can directly query the database for the username.
2024-10-14 01:10:31 -03:00
Michael Manganiello
2a24f5f128 Merge pull request #1241 from rommapp/fix/avoid-query-add_user-at-import-time
fix: Avoid query during import time to set add_user endpoint scopes
2024-10-14 00:43:07 -03:00
Georges-Antoine Assi
72182b9f22 Merge pull request #1240 from alisci01/add-offset-to-get-roms-endpoint
Add offset parameter to get_roms endpoint
2024-10-13 22:31:14 -04:00
Michael Manganiello
1df27079c4 fix: Avoid query during import time to set add_user endpoint scopes
The `add_user` endpoint was querying the database at import time, to
decide whether to enforce the `users.write` scope or not. This is
problematic because the database might not be ready at import time.

Also, the decided `scopes` was being maintained for the entire
application lifetime, which is not ideal, as users can be created
without having the `users.write` scope, until the application is
restarted.
2024-10-13 22:27:14 -03:00
Michael Manganiello
4c5221916d Merge pull request #1237 from rommapp/misc/upgrade-ralibretro-1.8.0
misc: Upgrade RALibretro to v1.8.0
2024-10-12 18:32:47 -03:00
Michael Manganiello
d35f772395 Merge pull request #1239 from rommapp/fix/avoid-image-requests-to-undefined.ico
fix: Avoid image requests for undefined.ico platform icon
2024-10-12 13:34:39 -03:00
Michael Manganiello
a594eff413 Merge pull request #1238 from rommapp/fix-save-small-artworks
fix: Correctly resize and save small artwork
2024-10-12 13:34:30 -03:00
Michael Manganiello
c91611fe99 Merge pull request #1234 from rommapp/fix/scanning-skip-if-already-scheduled
fix: Skip scanning task by checking against the correct function name
2024-10-12 13:17:22 -03:00
Michael Manganiello
ae9939ded8 Merge pull request #1235 from rommapp/fix/improve-redis-url-handling
fix: Improve handling of Redis URL
2024-10-12 13:17:07 -03:00
Yuri Becker
eb6a48eb3a Use seconds for UPLOAD_TIMEOUT 2024-10-12 12:50:56 +02:00
Ali Scissons
5acbdfdf8b add offset parameter to get_roms endpoint 2024-10-11 23:28:30 -05:00
Michael Manganiello
1127cf9065 fix: Avoid image requests for undefined.ico platform icon
when a platform slog is not present in `PLATFORMS_VERSIONS`, which is
the common case overall, the component was trying to fetch an
`undefined.ico` image.

Instead of that, we should check if the platform slug is present in
`PLATFORMS_VERSIONS` and if not, fallback to the platform slug itself.
2024-10-12 01:25:03 -03:00
Michael Manganiello
a9ac322618 fix: Correctly resize and save small artwork
The previous implementation was calling `resize_cover_to_small` within
the context manager that was writing the image to the filesystem. This
was causing `PIL` to raise an error because it could not identify the
open and temporarily created file as a valid image.

Instead of saving the original image to the filesystem and then resizing
it, we now open the image in memory, resize it, and then save it to the
filesystem. We also avoid reading the `BytesIO` object twice by saving
small and big images from the same initial `Image` object.

Fixes #1191.
2024-10-12 00:55:06 -03:00
Michael Manganiello
b59411ccb7 misc: Upgrade RALibretro to v1.8.0 2024-10-11 22:45:05 -03:00
Yuri Becker
f68033ed87 Add UPLOAD_TIMEOUT 2024-10-12 03:07:04 +02:00
Michael Manganiello
b81fbc5820 fix: Improve handling of Redis URL
This change replaces the creation of Redis URL, from a simple string
interpolation, to using `yarl.URL`. The main benefit, besides not
forgetting to set all five different variables on every Redis client
initialization, is that user credentials are correctly URL-encoded, if
present.

Up until now, if a password had special characters, it could break the
generated URL.

This change also introduces support for a `REDIS_SSL` setting, which
allows the user to specify if the Redis connection should use SSL or not.
2024-10-11 21:41:19 -03:00
Michael Manganiello
a26168ecc4 fix: Skip scanning task by checking against the correct function name
The `scan.py` module was moved to the `sockets` package, but this line
was not updated to reflect that change. This currently causes the
watcher to not skip queuing a new `scan_platforms` task if one is
already scheduled.
2024-10-11 20:40:42 -03:00
Yuri Becker
8438bc9c38 Fix vite.config.js not reading DEV_PORT 2024-10-11 23:08:19 +02:00
Michael Manganiello
36c77d51c8 Merge pull request #1227 from rommapp/fix/do-not-explicitly-set-rufflers-renderer
fix: Do not set Ruffle's renderer explicitly
2024-10-06 21:13:31 -03:00
Michael Manganiello
abf9dcc566 fix: Do not set Ruffle's renderer explicitly
According to Ruffle documentation [1], the `preferredRenderer` option is
only needed if a renderer needs to be enforced. When not provided:

> By default, Ruffle chooses the most featureful backend supported by the
> user's system, falling back to more basic backends if necessary.

This commit removes the `preferredRenderer` option from the Ruffle
configuration in the frontend, so that the default behavior is used.

It also removes the noisy `logLevel` option, which was set to `debug`.

Fixes rendering issue for `Boxhead: The Rooms`, reported in #1216.

[1] https://github.com/ruffle-rs/ruffle/wiki/Using-Ruffle
2024-10-06 20:59:30 -03:00
Michael Manganiello
05dc67c296 Merge pull request #1226 from rommapp/fix/improve-memory-usage-7z-decompression
fix: Improve memory usage during 7zip decompression
2024-10-06 20:36:24 -03:00
Michael Manganiello
149098fb31 fix: Improve memory usage during 7zip decompression
This change improves memory usage, by only keeping a single archive's
member file in memory at a time during 7zip decompression.

The `py7zr` library does not support streaming decompression yet, so
this change is the best we can do for now.

Potential fix for #1211, but it won't improve memory usage for
single-file 7zip archives.
2024-10-06 20:18:49 -03:00
Michael Manganiello
0b62fe21aa Merge pull request #1224 from rommapp/fix/escape-download-urls-when-serving-nginx
fix: Escape URLs when files are served by nginx
2024-10-06 16:07:22 -03:00
Michael Manganiello
60ff832663 fix: Escape URLs when files are served by nginx
When serving files using the `X-Accel-Redirect` header in nginx, the
header values must be URL-encoded. Otherwise, nginx will not be able
to serve the files if they contain special characters.

This commit adds a new `FileRedirectResponse` class to the `utils.nginx`
module, to simplify the creation of responses that serve files using the
`X-Accel-Redirect` header.

Fixes #1212, #1223.
2024-10-06 13:29:42 -03:00
Michael Manganiello
cf3932f14a Merge pull request #1206 from rommapp/feat/add-rahasher
feat: Add RAHasher and util to calculate RetroAchievements hashes
2024-09-23 08:09:03 -03:00
Michael Manganiello
a82489a9c4 feat: Add RAHasher and util to calculate RetroAchievements hashes
Build and include the `RAHasher` binary in the Docker image, to
calculate hashes for RetroAchievements. Also, add a service to
run `RAHasher` from Python.

Example usage:

```python
from adapters.services.rahasher import RAHasherError, RAHasherService

rahasher = RAHasherService()
try:
    hash = await rahasher.calculate_hash("nes", Path("path/to/rom.nes"))
except RAHasherError:
    # Handle error
    hash = None
```
2024-09-22 23:40:25 -03:00
Michael Manganiello
405a0879ff Merge pull request #1205 from rommapp/misc/use-bundled-valkey-instead-of-redis
misc: Use bundled Valkey instead of Redis server
2024-09-22 14:25:31 -03:00
Michael Manganiello
66e5939b2b misc: Use bundled Valkey instead of Redis server
This change replaces the bundled Redis server with Valkey. No breaking
changes are introduced, as considered environment variables still
maintain the `REDIS_` prefix.

Fixes #925.
2024-09-22 13:27:18 -03:00
Georges-Antoine Assi
8a13611d47 Merge pull request #1119 from rommapp/romm-1114
[ROMM-1114] Fetch and use age ratings in UI and filters
2024-09-21 12:53:33 -04:00
Georges-Antoine Assi
8bf3ff6a3d run formatter 2024-09-21 12:41:37 -04:00
Georges-Antoine Assi
6880d11a73 Merge branch 'master' into romm-1114 2024-09-21 12:30:39 -04:00
Georges-Antoine Assi
6cb332efcf changes from reciew 2024-09-21 12:23:23 -04:00
Georges-Antoine Assi
bca5520ecb Merge pull request #1201 from rommapp/rom-upload-proxy-buffering
Bypass nginx proxy buffering when uploading roms
2024-09-21 12:22:35 -04:00
Georges-Antoine Assi
e20465f268 increase timeout to 6 minutes 2024-09-21 11:17:28 -04:00
Georges-Antoine Assi
b85b001c3b fix socket updates on scan 2024-09-21 11:15:32 -04:00
Georges-Antoine Assi
d2ab0f4b16 Try to fix nginx proxy buffering on upload 2024-09-21 10:47:24 -04:00
Georges-Antoine Assi
6022d365f3 Merge pull request #1195 from rathmerdominik/chore/README/update-dev-instructions-for-arch-linux
chore(README): Update dev instructions for Arch Linux users
2024-09-18 17:02:40 -04:00
Dominik Rathmer
4e4f4f97fa chore(DEVELOPER_SETUP): Remove duplicate info link, change wording 2024-09-18 18:31:51 +02:00
Dominik Rathmer
37c86b1177 chore(README): Update dev instructions for Arch Linux users 2024-09-18 13:00:10 +02:00
Georges-Antoine Assi
fc6455eccb Merge pull request #1137 from rommapp/romm-829
[ROMM-829] Status fields on rom user
2024-09-09 19:41:38 -04:00
Georges-Antoine Assi
0b2a822e98 remove timezone from config init 2024-09-09 11:22:32 -04:00
Georges-Antoine Assi
97496d1171 Merge pull request #1184 from rommapp/romm-1176
[ROMM-1176] Fetch video ID and place in carousel
2024-09-09 10:12:46 -04:00
Georges-Antoine Assi
8fc25cde99 use timezone aware datetimes 2024-09-09 10:11:46 -04:00