diff --git a/README.md b/README.md index 579c8eb..a8e213b 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,8 @@ The recommended way to deploy FilePizza is as a [Docker container](https://hub.d You can specify your own ICE STUN/TURN servers for better connectivity behind NATs by passing a JSON encoding of the array via env var `ICE_SERVERS`. Alternatively, if you'd like to use [Twilio's STUN/TURN service](https://www.twilio.com/stun-turn), you can specify your SID and token using the `TWILIO_SID` and `TWILIO_TOKEN` environment variables, respectively. +You can specify your own Webtorrent tracker(s) using the `WEBTORRENT_TRACKERS` environment variable, comma-delimited. + If you want to use [Google Analytics](https://marketingplatform.google.com/about/analytics/), you can specify your UA code using the `GA_ACCESS_TOKEN="UA-00000000-1"` environment variable. ## Development diff --git a/docker-compose.yaml b/docker-compose.yaml index 0d0bf63..d481936 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -10,6 +10,14 @@ services: environment: - PORT=3333 - EXTRA_ICE_SERVERS=turn:localhost:3478 + - WEBTORRENT_TRACKERS=ws://localhost:8000 coturn: image: instrumentisto/coturn:latest network_mode: host + ports: + - 3478:3478 + bittorrent-tracker: + image: henkel/bittorrent-tracker:latest + command: ["npx", "bittorrent-tracker", "--http-hostname", "0.0.0.0", "--ws"] + ports: + - 8000:8000 diff --git a/src/stores/UploadStore.js b/src/stores/UploadStore.js index b715dcf..fac9fa0 100644 --- a/src/stores/UploadStore.js +++ b/src/stores/UploadStore.js @@ -3,11 +3,13 @@ import alt from "../alt"; import socket from "filepizza-socket"; import { getClient } from "../wt"; -const TRACKERS = [ - ["wss://tracker.btorrent.xyz"], - ["wss://tracker.openwebtorrent.com"], - ["wss://tracker.fastcast.nz"] -]; +const TRACKERS = process.env.WEBTORRENT_TRACKERS + ? process.env.WEBTORRENT_TRACKERS.split(',').map(t => t.trim()) + : [ + ["wss://tracker.openwebtorrent.com"], + ["wss://tracker.btorrent.xyz"], + ["wss://tracker.fastcast.nz"] + ]; const SPEED_REFRESH_TIME = 2000;