Commit Graph
17 Commits
Author SHA1 Message Date
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
Michael Manganiello d1fda9081f fix: Add missing awaits on read/write for async opened files 2024-07-27 00:38:05 -03:00
Michael Manganiello c5b150c1eb fix: Enable flake8-async rules in ruff and fix warnings
`ASYNC` rules [1] tries to find issues regarding asynchronous code. This
change enables `ruff` to start reporting these issues, and fixes
existing warnings.

[1] https://docs.astral.sh/ruff/rules/#flake8-async-async
2024-07-26 21:40:46 -03:00
Georges-Antoine Assi ad3a588631 filter collections for each user 2024-07-25 19:53:44 -04:00
Michael Manganiello 56066d6765 misc: Migrate filesystem resource handler to async
For filesystem resource handler, `requests` calls have been replaced
with `httpx`, and file I/O has been replaced with `anyio` utils.

The existing approach to save covers and screenshots, by calling
`shutil.copyfileobj` with the raw response is no longer needed. `httpx`
does not provide a file-like object when streaming [1], so there's no
easy drop-in replacement.

However, the applied solution correctly builds the file iteratively, by
consuming the response in chunks.

[1] https://github.com/encode/httpx/discussions/2296
2024-07-24 00:18:17 -03:00
zurdi 884e7a35ac fixed re-download lost covers 2024-07-11 08:47:59 +02:00
zurdi ec58ea9511 fixed custom cover 2024-07-08 11:49:09 +02:00
Zurdi 0bd4c6f704 fixed from PR comment 2024-07-04 19:09:01 +02:00
ZurdiandGeorges-Antoine Assi 124e1e781b Update backend/endpoints/collections.py
Co-authored-by: Georges-Antoine Assi <3247106+gantoine@users.noreply.github.com>
2024-07-04 18:56:52 +02:00
ZurdiandGeorges-Antoine Assi 0d5620edcf Update backend/endpoints/collections.py
Co-authored-by: Georges-Antoine Assi <3247106+gantoine@users.noreply.github.com>
2024-07-04 18:56:03 +02:00
Zurdi 2a7def81ac added reactivity to collections 2024-07-03 21:58:58 +02:00
zurdi 59c2a51a6f added collection cover management 2024-07-03 14:31:17 +02:00
zurdi 39708ff828 fixes from trunk 2024-07-03 10:03:55 +02:00
zurdi 50bcd00361 added remove rom from collection dialog 2024-07-03 01:29:01 +02:00
Zurdi 23e0a064ab added update collection endpoint 2024-07-02 23:34:50 +02:00
zurdi 1d6ba70080 collections get_roms endpoint added 2024-07-02 14:31:27 +02:00
Zurdi cc9e05f668 collections migration added 2024-07-01 23:47:15 +02:00