Commit Graph

4418 Commits

Author SHA1 Message Date
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
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
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
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
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
Georges-Antoine Assi
fc85fcb6a9 fix pytests 2024-09-09 00:01:37 -04:00
Georges-Antoine Assi
00811be4f1 use model to keep steps in sync 2024-09-08 23:55:17 -04:00
Georges-Antoine Assi
2765a6e2c3 [ROMM-1176] Fetch video ID and place in carousel 2024-09-08 23:47:25 -04:00
Georges-Antoine Assi
515b352554 Merge pull request #1183 from rommapp/romm-1181
[ROMM-1181] Skip hashing games on desktop platorms
2024-09-08 23:44:19 -04:00
Georges-Antoine Assi
4a664ab790 [ROMM-1181] Skip hashing games on desktop platorms 2024-09-08 23:08:50 -04:00
Georges-Antoine Assi
4bdcc63d9b add working filter for hidden roms 2024-09-08 16:35:06 -04:00
Georges-Antoine Assi
d5dfb71b60 actually hide games 2024-09-08 16:20:27 -04:00
Georges-Antoine Assi
e1e2134863 refactor filters and centralize under utils 2024-09-08 15:56:05 -04:00
Georges-Antoine Assi
9086fa5f94 fix a bunch o types 2024-09-08 15:46:32 -04:00
Georges-Antoine Assi
750f440069 run generate 2024-09-08 15:25:38 -04:00
Georges-Antoine Assi
0d80bd7c51 working sidebar filters 2024-09-08 14:52:40 -04:00
Georges-Antoine Assi
8dae0a503c add simple emojis to cards 2024-09-08 13:59:10 -04:00
Michael Manganiello
bef54f5375 Merge pull request #1177 from rommapp/fix/use-filename-when-matching-unmatched-rom
fix: Use filename without tags or extension when matching unmatched game
2024-09-06 10:25:38 -03:00