41 Commits

Author SHA1 Message Date
Georges-Antoine Assi
09dbb2e244 use redis to store netplay data 2025-12-07 12:02:35 -05:00
Georges-Antoine Assi
8c769a5fe8 hacks with working netplayu 2025-11-21 19:15:20 -05:00
Georges-Antoine Assi
0d357d59e5 [ROMM-2470] Skip bind IPV6 if IPV4_ONLY is true 2025-10-07 09:07:30 -04:00
Michael Manganiello
0f0d1a1903 fix: Remove mod_zip workaround for upstream subrequests to internal locations
Related `mod_zip` issue https://github.com/evanmiller/mod_zip/issues/90
has been fixed in commit
288d66541c

By upgrading `mod_zip` to include this fix, we can remove the workaround
that involved using a separate internal location and server to serve
files for zipping.
2025-09-11 18:24:12 -03:00
Michael Manganiello
8c52b7828b feat: Add COEP and COOP headers for EmulatorJS within Nginx config
The COEP (Cross-Origin Embedder Policy) and COOP (Cross-Origin Opener
Policy) headers are needed by EmulatorJS to use the `SharedArrayBuffer`
feature, and enable multi-threaded cores.

These headers are only being set by Nginx for responses to requests
made to the EmulatorJS player path. This is because cross-origin
isolation breaks other features in the application (such as YouTube
embeds), so we only want to enable it for the EmulatorJS player.

It's important to mention that this change does not work when `DEV_MODE`
is set, as we would need Vite server to also set these headers in that
case. This could be implemented separately, if needed.

These changes are not enough to enable multi-threaded cores in the
frontend. Because our application is a SPA, we also need to ensure
that navigation to the EmulatorJS player path results in a full page
reload, so that the cross-origin isolation can be applied. This will be
handled in a separate PR.
2025-08-31 21:43:32 -03:00
Daniel Koster
2aa0c204b1 Update default.conf.template
Add IPv6 support
2025-08-04 20:16:59 +02:00
Mark Stapper
365c0efece Fix typo 2025-07-02 08:11:35 +02:00
Mark Stapper
fa3a5c534f Fix Set correct forward proto even when behind reverse proxy 2025-07-01 10:34:19 +02:00
zurdi
53f9386208 refactor: enhance logging messages and formatting for improved clarity and consistency 2025-05-08 23:35:33 +00:00
zurdi
49ad99d5e7 refactor: improve logging setup and format across multiple modules for consistency 2025-05-08 22:17:53 +00:00
zurdi
5bc820d3ee refactor: enhance logging and user agent mapping in nginx configuration for improved monitoring 2025-05-08 17:22:30 +00:00
Michael Manganiello
8487d39326 fix: nginx configuration for library access when ROMM_BASE_PATH is set
The nginx configuration was not updated to use the `ROMM_BASE_PATH`
environment variable when serving the library files.

We no longer hardcode the base path to `/romm`, but instead use the
provided path.
2025-02-21 11:44:48 -03:00
Michael Manganiello
3c4046e2c3 fix: Nginx alias_traversal warning
Warning triggered by [gixy](https://github.com/yandex/gixy).

Related documentation:
https://github.com/yandex/gixy/blob/master/docs/en/plugins/aliastraversal.md
2025-02-19 09:43:26 -03:00
Michael Manganiello
fbff92403f feat: Allow configuring app port using ROMM_PORT environment variable
By using the `ROMM_PORT` environment variable, users can now configure
the port on which the application listens, which defaults to `8080`.
2025-02-19 01:02:25 -03:00
Michael Manganiello
98254d50b8 misc: Use nginx templates to allow for environment variable usage
Using the `envsubst` command, we can replace environment variables in
the nginx template files. This allows for more flexibility when
configuring the nginx server.

The Docker image we use as base for Nginx does provide the
`20-envsubst-on-templates.sh` script that will replace environment
variables in the template files.

This change does not include any behavior change, but unblocks future
changes that require environment variables in the nginx configuration.
2025-02-18 22:36:51 -03:00
Georges-Antoine Assi
d2ab0f4b16 Try to fix nginx proxy buffering on upload 2024-09-21 10:47:24 -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
9281760975 merge gzip changes into branch 2024-08-13 00:31:48 -04:00
Michael Manganiello
d20f4ad935 feat: Use X-Accel-Redirect to improve file download speed
Instead of making FastAPI handle file download, which has serious
performance issues on big files [1], this change uses nginx's `X-Accel`
feature to delegate single-file downloads to nginx.

Partial fix for #1079, as it solves the CPU usage issue for single-file
downloads.

[1] https://github.com/fastapi/fastapi/discussions/6050
2024-08-12 20:01:00 -03: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
Georges-Antoine Assi
880345f20c ruff-only pre-commit 2024-05-18 12:05:57 -04:00
Psych0D0g
8f5536c69b switch to gunicorn for handling backend app 2024-03-25 21:56:19 +01:00
Georges-Antoine Assi
8a7193d0e4 Add route in nginx for assets that 404s 2024-03-12 15:47:59 +00:00
Georges-Antoine Assi
4b97e21f46 Merge branch 'master' into webrcade-feed 2023-12-27 19:34:58 -05:00
Lukas Wingerberg
74e8875f64 Update nginx default.conf 2023-11-14 09:24:57 +01:00
Lukas Wingerberg
adf8127295 refactor init script and add error handling via watchdog loop 2023-10-31 22:39:08 +01:00
zurdi
174a43888b unlimited client_max_body_size in nginx 2023-10-31 10:01:43 +01:00
zurdi
7001511e26 fix - romm user added to nginx config and dockerfile 2023-10-25 01:33:45 +02:00
Lukas Wingerberg
db282479b0 switch uvicorn and nginx to communicate via unix socket instead of tcp 2023-10-22 13:05:03 +02:00
Lukas Wingerberg
8015558398 refactor to alpine base and fix some more paths to work on readonly rootfs 2023-10-22 12:45:34 +02:00
Lukas Wingerberg
71874810e1 make nginx run successfully on readonly rootfs 2023-10-22 10:55:31 +02:00
Georges-Antoine Assi
c92d8b620b Add access control headers to reponse 2023-09-17 12:13:20 -04:00
Georges-Antoine Assi
7b67495c23 Fix nginx config 2023-08-19 22:00:20 -04:00
Georges-Antoine Assi
c1d1291b48 Expose swaggerui and redoc endpoints 2023-08-18 23:40:18 -04:00
Georges-Antoine Assi
a8a402d250 Add scopes and roles 2023-08-10 23:37:05 -04:00
zurdi zurdo
302b8cf073 scan websocket migrated to socket.io 2023-05-11 14:17:30 +02:00
zurdi zurdo
95b27f2b9f autoreload images on rom change 2023-03-23 22:11:10 +01:00
zurdi zurdo
daf00aac59 nginx config fixed 2023-03-23 20:13:27 +01:00
zurdi zurdo
ba30aa095f proxy redirect to api added in vite 2023-03-17 13:21:49 +01:00
zurdi zurdo
90cb69450b vite proxy to api redirect added 2023-03-17 13:09:25 +01:00
zurdi zurdo
8954554d8e workflow build task moved to external script 2023-03-17 12:25:06 +01:00