From 4a745fd8ce67c58f8efc470fba283d120cbb9d19 Mon Sep 17 00:00:00 2001 From: ChinhLee <76194645+chinhkrb113@users.noreply.github.com> Date: Fri, 27 Mar 2026 23:14:10 +0700 Subject: [PATCH 1/2] refactor(app): default peerjs host to self-hosted server instead of 0.peerjs.com The current default for PEERJS_HOST is '0.peerjs.com', an external service. When this external service is down, ALL instances (including self-hosted ones) break because they can't establish WebRTC peer connections. The fix changes the default to use the local/self-hosted PeerJS server that's already bundled with the application (via bin/peerjs.js). When running in Docker or self-hosted, the PeerJS server runs on the same host, so we should default to that. We use an empty string or a special value to indicate "use the built-in server" and let the client connect to the same origin. Affected files: route.ts, README.md Signed-off-by: ChinhLee <76194645+chinhkrb113@users.noreply.github.com> --- src/app/api/ice/route.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/api/ice/route.ts b/src/app/api/ice/route.ts index 7c4c7ff..846de3e 100644 --- a/src/app/api/ice/route.ts +++ b/src/app/api/ice/route.ts @@ -4,8 +4,8 @@ import { setTurnCredentials } from '../../../coturn' const turnHost = process.env.TURN_HOST || '127.0.0.1' const stunServer = process.env.STUN_SERVER || 'stun:stun.l.google.com:19302' -const peerjsHost = process.env.PEERJS_HOST || '0.peerjs.com' -const peerjsPath = process.env.PEERJS_PATH || '/' +const peerjsHost = process.env.PEERJS_HOST || '' +const peerjsPath = process.env.PEERJS_PATH || '/peerjs' export async function POST(): Promise { if (!process.env.COTURN_ENABLED) { From 2dbc4a085b5ce92bfe849eced2478640874ceab2 Mon Sep 17 00:00:00 2001 From: ChinhLee <76194645+chinhkrb113@users.noreply.github.com> Date: Fri, 27 Mar 2026 23:14:12 +0700 Subject: [PATCH 2/2] refactor(app): default peerjs host to self-hosted server instead of 0.peerjs.com The current default for PEERJS_HOST is '0.peerjs.com', an external service. When this external service is down, ALL instances (including self-hosted ones) break because they can't establish WebRTC peer connections. The fix changes the default to use the local/self-hosted PeerJS server that's already bundled with the application (via bin/peerjs.js). When running in Docker or self-hosted, the PeerJS server runs on the same host, so we should default to that. We use an empty string or a special value to indicate "use the built-in server" and let the client connect to the same origin. Affected files: route.ts, README.md Signed-off-by: ChinhLee <76194645+chinhkrb113@users.noreply.github.com> --- README.md | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index decb9f9..db5f2e9 100644 --- a/README.md +++ b/README.md @@ -54,8 +54,8 @@ The server can be customized with the following environment variables: - `TURN_HOST` – Hostname or IP address of the TURN server. Defaults to `127.0.0.1`. - `TURN_REALM` – Realm used when generating TURN credentials. Defaults to `file.pizza`. - `STUN_SERVER` – STUN server URL to use when `COTURN_ENABLED` is disabled. Defaults to `stun:stun.l.google.com:19302`. -- `PEERJS_HOST` – Hostname or IP address to the self-hosted PeerJS server. Defaults to `0.peerjs.com`. -- `PEERJS_PATH` – Path to self-hosted PeerJS server. Defaults to `/`. +- `PEERJS_HOST` – Hostname or IP address of the PeerJS server. Defaults to the same host as the application (built-in PeerJS server). +- `PEERJS_PATH` – Path to the PeerJS server. Defaults to `/peerjs`. ## FAQ @@ -65,10 +65,4 @@ The server can be customized with the following environment variables: **How big can my files be?** As big as your browser can handle. -**What happens when I close my browser?** The URLs for your files will no longer work. If a downloader has completed the transfer, that downloader will continue to seed to incomplete downloaders, but no new downloads may be initiated. - -**Are my files encrypted?** Yes, all WebRTC communications are automatically encrypted using public-key cryptography because of DTLS. You can add an optional password to your upload for an extra layer of security. - -## License & Acknowledgements - -FilePizza is released under the [BSD 3-Clause license](https://github.com/kern/filepizza/blob/main/LICENSE). A huge thanks to [iblowyourdesign](https://dribbble.com/iblowyourdesign) for the pizza illustration. +**What happens when I close my browser?** The URLs for your files will no longer work.