Commit Graph

684 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
6880d11a73 Merge branch 'master' into romm-1114 2024-09-21 12:30:39 -04:00
Georges-Antoine Assi
b85b001c3b fix socket updates on scan 2024-09-21 11:15:32 -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
8fc25cde99 use timezone aware datetimes 2024-09-09 10:11:46 -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
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
9086fa5f94 fix a bunch o types 2024-09-08 15:46:32 -04:00
Georges-Antoine Assi
e432bc32ac Merge branch 'master' into romm-1114 2024-09-03 19:13:33 -04:00
Georges-Antoine Assi
9b6b19eb27 Merge branch 'master' into romm-829 2024-09-03 18:58:06 -04:00
Georges-Antoine Assi
64657133e0 Merge pull request #1139 from rommapp/dev-mode-env
Hack to get emujs working in dev mode
2024-08-31 23:56:38 -04:00
Georges-Antoine Assi
5544ae1011 Merge branch 'master' into romm-1114 2024-08-31 23:55:13 -04:00
Georges-Antoine Assi
f3f6b6e884 small tweaks to ui 2024-08-30 15:06:01 -04:00
Georges-Antoine Assi
a7aba7374d fix trunk issues 2024-08-30 14:49:58 -04:00
Georges-Antoine Assi
00d34d7388 hack to get emujs working in dev mode 2024-08-30 14:35:37 -04:00
SaraVieira
fd996e367c run trunk 2024-08-30 19:24:10 +01:00
SaraVieira
c63f62a813 update edit modal 2024-08-30 19:18:52 +01:00
Sara Vieira
6de94aa767 Apply suggestions from code review
Co-authored-by: Georges-Antoine Assi <3247106+gantoine@users.noreply.github.com>
2024-08-30 19:12:28 +01:00
SaraVieira
e70e2a7360 Merge branch 'master' of github.com:rommapp/romm into feat/unmatch-rom 2024-08-30 11:24:26 +01:00
SaraVieira
86aae89f15 feat - Allow user to unmatch rom 2024-08-30 11:21:18 +01:00
Georges-Antoine Assi
48ec9f39a1 create ui components and page 2024-08-29 17:43:07 -04:00
Georges-Antoine Assi
5f27c1cf39 Create new fields on rom_user 2024-08-29 15:56:01 -04:00
Georges-Antoine Assi
330755f99c [ROMM-1107] Add env variable to disable in-browser emulation 2024-08-29 10:09:37 -04:00
Georges-Antoine Assi
9d40c52e0a Add titledb field to tinfoil response 2024-08-27 22:38:53 -04:00
Georges-Antoine Assi
589482f76a Disable auth on content get + add alt pico icon 2024-08-27 11:20:06 -04:00
Georges-Antoine Assi
401d235738 Merge branch 'master' into romm-1114 2024-08-26 15:58:33 -04:00
Georges-Antoine Assi
6c158c5b32 Merge pull request #1118 from rommapp/upload-dialog-hotfixes
Upload dialog hotfixed + clear button
2024-08-26 15:58:22 -04:00
Georges-Antoine Assi
c3ea419c68 Add age ratings to UI + filters 2024-08-26 15:55:45 -04:00
Georges-Antoine Assi
3e9f59c546 Upload dialog hotfixed + clear button 2024-08-26 12:58:38 -04:00
Georges-Antoine Assi
c8b8bcabc8 Replace illegal fs chars in filenames 2024-08-21 22:26:56 -04:00
Michael Manganiello
0fad8ac282 feat: Use nginx mod_zip to generate multi-file zip downloads
This change installs and configures the `mod_zip` nginx module [1],
which allows nginx to stream ZIP files directly.

It includes a workaround needed to correctly calculate CRC-32 values for
included files, by including a new `server` section listening at port
8081, only used for the file requests to be upstream subrequests that
correctly trigger the CRC-32 calculation logic.

Also, to be able to provide a `m3u` file generated on the fly, we add a
`/decode` endpoint fully implemented in nginx using NJS, which receives
a `value` URL param, and decodes it using base64. The decoded value is
returned as the response.

That way, the contents of the `m3u` file is base64-encoded, and set as
part of the response, for `mod_zip` to include it in the ZIP file.

[1] https://github.com/evanmiller/mod_zip
2024-08-20 22:39:33 -03:00
Georges-Antoine Assi
49e493802f Skip compressed files if theyre invalid 2024-08-18 14:14:38 -04:00
Georges-Antoine Assi
d384195c7f fixup trunk 2024-08-17 22:47:50 -04:00
Georges-Antoine Assi
faba97da5a changes from self reivew 2024-08-17 13:20:17 -04:00
Georges-Antoine Assi
716114e394 parallel upload 2024-08-17 12:35:45 -04:00