Commit Graph

1426 Commits

Author SHA1 Message Date
Georges-Antoine Assi
b3a50021b7 run quick before hash scan 2024-08-12 11:57:47 -04:00
Georges-Antoine Assi
e24a3b86bd Hotfix scans when running HASH_SCAN 2024-08-12 11:37:49 -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
ce99ce4c62 update trunk + fix tests 2024-08-11 22:43:44 -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
46c2dbecc1 tweaks to sql migration 2024-08-10 23:42:12 -04:00
Georges-Antoine Assi
2af2ffe7d9 improve sql + add indexes 2024-08-10 10:14:13 -04:00
Georges-Antoine Assi
3e157eab1e Merge branch 'master' into fixup-sibling-speed 2024-08-09 22:55:52 -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
Michael Manganiello
b6aedfc902 fix: Allow access to Tinfoil feed when download auth is disabled
This matches the behavior of the Webrcade feed.
2024-08-09 09:54:59 -03: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
95a66a182e misc: Improve typing for feed schemas
* Add typing for nested objects in Tinfoil and Webrcade feed schemas.
* Do not send Rom background and thumbnail, if not available.
* Correctly build URLs using `starlette` utils.
* Deprecate the `ROMM_HOST` setting, no longer needed.
* Fix FastAPI custom router to prefer routes without trailing slash.
* Fix Webrcade background URL pointing to gallery screenshot.
2024-08-07 22:56:16 -03:00
Georges-Antoine Assi
cbeac18fea Drop ROMM_AUTH_USERNAME and ROMM_AUTH_PASSWORD env variables 2024-08-07 12:27:58 -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
Zurdi
ada7f5f837 Merge branch 'master' into fix/csrf-token 2024-08-05 20:16:52 +02:00
Georges-Antoine Assi
d17cdd6875 hopefully actually fix csrf tokens 2024-08-05 13:13:25 -04:00
Georges-Antoine Assi
a53c0911d7 fix endpoint tests 2024-08-05 11:35:08 -04:00
Michael Manganiello
45aeaf3265 fix: Backend URL redirection logic
Fix FastAPI and nginx configuration, to make the application correctly
redirect URLs. This is specially useful when URLs ended with forward
slash are redirected to their stripped version.

Included changes:
* Stop removing the `/api` prefix in nginx rewrite rules, so FastAPI
  knows what's the original URL path being requested.
* Use `$http_host` in nginx, so FastAPI receives both the original host
  and port, to build the redirect URL (as `$host` does not include the
  port, if present).
* Make all FastAPI included routers know their prefix, to correctly
  route incoming requests.

This fix was found based on a report that redirects from URLs ended with
forward slash were not working [1].

[1] https://github.com/rommapp/romm/issues/1051#issuecomment-2269049762
2024-08-05 11:15:52 -03:00
zurdi
b9a68ad304 fix re-generate csrftoken when expired 2024-08-05 09:40:26 +02:00
Georges-Antoine Assi
b06b0f4f86 Merge pull request #1043 from rommapp/romm-1022
[ROMM-1022] Add button to show duplicates
2024-08-04 16:15:19 -04:00
Georges-Antoine Assi
8cd4cf1fe6 pull sibling roms from backend 2024-08-02 16:37:04 -04:00
Georges-Antoine Assi
29bb08e43c [ROMM-1018] Fix scanning selected roms 2024-07-28 20:13:44 -04:00
Michael Manganiello
16cb380cc0 misc: Use async interface for stream-zip
Replace use of synchronous `stream_zip` implementation, with
`async_stream_zip`. [1]

[1] https://stream-zip.docs.trade.gov.uk/async-interface/
2024-07-27 18:31:20 -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
Georges-Antoine Assi
3a9cef24e0 get it all wokring 2024-07-27 13:30:52 -04:00
Georges-Antoine Assi
ecc021e824 Merge branch 'master' into calc-file-hashes-roms 2024-07-27 12:17:18 -04:00
Michael Manganiello
749e4d65c1 misc: Use PYTEST_VERSION variable to detect Pytest runs
Pytest v8.2 introduced the `PYTEST_VERSION` environment variable [1],
that can be used to check if code is running from within a pytest run.

This way, we can avoid checking the loaded `sys` modules.

[1] https://docs.pytest.org/en/stable/changelog.html#id57
2024-07-27 12:03:44 -03:00
Michael Manganiello
9246f87f38 Merge pull request #1032 from rommapp/fix/quick-return-if-igdb-exact-match
fix: Return early if IGDB finds an exact match
2024-07-27 11:51:37 -03:00
Michael Manganiello
fe5759fec7 fix: Initialize context on scheduled task
Only for this scheduled task, the run was failing because there was no
context initialization that created the httpx session.

Other schedules work as expected, because they do have context
initialization in the functions they call to (e.g. `scan_platforms`).
2024-07-27 01:22:29 -03:00
Michael Manganiello
9319081ff6 fix: Return early if IGDB finds an exact match
This improvement avoids extra IGDB API requests when a received Rom is
an exact match. It avoids up to 2 requests per Rom, when an exact match
is found.
2024-07-27 00:53:27 -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
Michael Manganiello
96699a2f1b fix: Catch ProtocolError when writing screenshots/covers 2024-07-26 21:19:18 -03:00
Michael Manganiello
aced1f1ff2 misc: Migrate IGDBBaseHandler to async
Convert `IGDBBaseHandler` methods to be asynchronous, and use an `httpx`
async client, instead of `requests` sync client.

This change also removes the direct dependency with `requests`, as the
project no longer uses it, preferring `httpx` instead.
2024-07-26 21:19:01 -03:00
Georges-Antoine Assi
efc0b75cdb Merge branch 'master' into calc-file-hashes-roms 2024-07-25 22:42:46 -04:00
Georges-Antoine Assi
141edf9d2e Merge pull request #1028 from rommapp/share-public-collections
Public collections
2024-07-25 22:38:21 -04:00
Georges-Antoine Assi
ad3a588631 filter collections for each user 2024-07-25 19:53:44 -04:00
Zurdi
38a500f577 Merge branch 'master' into romm-1025 2024-07-25 21:35:18 +02:00