Commit Graph

474 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
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
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
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
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
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
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
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
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
2765a6e2c3 [ROMM-1176] Fetch video ID and place in carousel 2024-09-08 23:47:25 -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
8dae0a503c add simple emojis to cards 2024-09-08 13:59:10 -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
b470bfaf67 Merge pull request #1157 from rommapp/romm-1154
[ROMM-1154] Fix setting main sibling
2024-09-01 23:59:30 -04:00
Georges-Antoine Assi
ae05c6be8c [ROMM-1154] fix setting main sibling 2024-09-01 22:11:49 -04:00
Georges-Antoine Assi
00c8771e22 [ROMM0-1155] Patch zipfil + catch more 7zip errors 2024-09-01 21:58:22 -04:00
Georges-Antoine Assi
0ce3549f98 [ROMM-1123] Limit returned roms to 2500 2024-09-01 09:55:25 -04:00
Georges-Antoine Assi
5544ae1011 Merge branch 'master' into romm-1114 2024-08-31 23:55:13 -04:00
Georges-Antoine Assi
efcc2badea connect to the backend 2024-08-29 18:03:55 -04:00
Georges-Antoine Assi
e4816911d9 Better performance for large collections 2024-08-28 11:44:31 -04:00
Georges-Antoine Assi
f00749e20c add back ms.ico + add sms to moby list 2024-08-27 10:13:58 -04:00
Georges-Antoine Assi
c3ea419c68 Add age ratings to UI + filters 2024-08-26 15:55:45 -04:00
Michael Manganiello
a85c84a7d4 misc: Use single SQLAlchemy engine and session maker
As recommended by SQLAlchemy [1], this change makes a single
instantiation of the database engine and session maker, instead of one
entity per handler.

It also uses the provided `URL` constructor to better define the
database URL structure.

[1] https://docs.sqlalchemy.org/en/20/core/connections.html#basic-usage
2024-08-21 09:56:28 -03: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
Michael Manganiello
0fdbbe4625 misc: Upgrade Python to v3.12 and Alpine to v3.20
Included upgrades:
* Python: v3.12
* Alpine: v3.20 (which uses Python 3.12)
* nginx: v1.27.1
2024-08-15 20:14:32 -03:00
Georges-Antoine Assi
b3a50021b7 run quick before hash scan 2024-08-12 11:57:47 -04:00
Georges-Antoine Assi
bc08e05a19 changes from self review 2024-08-11 23:09:58 -04:00
Georges-Antoine Assi
75b856bf94 only calc hashes in certian conditions 2024-08-11 22:54:35 -04:00
Georges-Antoine Assi
1ea1b326d3 move hashes to rom model 2024-08-11 22:38:22 -04:00
Georges-Antoine Assi
c3b754a2aa fix file meta order 2024-08-11 20:05:04 -04:00
Georges-Antoine Assi
56037070fb only calc hashes exlpicit 2024-08-11 19:36:52 -04:00
Georges-Antoine Assi
a4e162e2c1 Merge branch 'master' into calc-file-hashes-roms 2024-08-11 19:07:06 -04:00
Georges-Antoine Assi
7e086cec67 fixes from code review 2024-08-11 19:06:16 -04:00
Georges-Antoine Assi
195b86b573 even more cleanup 2024-08-09 11:46:07 -04:00
Georges-Antoine Assi
90e0e688b7 Merge branch 'master' into calc-file-hashes-roms 2024-08-09 11:36:50 -04:00
Georges-Antoine Assi
5f0577b900 more cleanup 2024-08-09 00:17:11 -04:00
Georges-Antoine Assi
1ae9cd0b5a remove unneded code 2024-08-09 00:10:31 -04:00
Georges-Antoine Assi
3a1986f453 single lines for the virtual table 2024-08-08 23:27:31 -04:00
Georges-Antoine Assi
cd54d902a7 create database view for sibling roms 2024-08-08 22:25:50 -04:00
Michael Manganiello
8abbae4c02 misc: Make backend handle URLs with trailing slash
According to multiple FastAPI discussions [1], FastAPI only includes a
built-in mechanism to redirect requests including a trailing slash, to
its variation without slash, using a `307` status code.

This can be an issue when certain clients do not send the same headers
on the redirected request.

This change adds a custom FastAPI `APIRouter`, that registers both route
path variations (with and without trailing slash), while only marking
the path without slash for being included in the OpenAPI schema.

[1] https://github.com/fastapi/fastapi/discussions/7298
2024-08-07 00:22:21 -03:00
Georges-Antoine Assi
0139e3a13a fix tests 2024-07-27 16:56:13 -04:00
Georges-Antoine Assi
2c2adb4112 Merge branch 'master' into calc-file-hashes-roms 2024-07-27 16:39:46 -04:00
Georges-Antoine Assi
f01f5ce5b5 trunk fixes 2024-07-27 16:38:57 -04:00
Georges-Antoine Assi
9386ca9e4a changes from self-review 2024-07-27 16:31:32 -04:00