pstream is dead; long live pstream
taciturnaxolotl.github.io/pstream-ng/
1---
2title: 'Configuration'
3---
4
5# Client Config Reference
6
7The config for the P-Stream can be provided in 2 different ways, depending on how you are hosting P-Stream:
8
9- If you are using a static web hoster (such as Vercel, Netlify or Cloudflare Pages), you can use [environment variables](#method-1-environment-variables).
10- If you are hosting P-Stream using shared hosting (such as cPanel or FTP), please use [the config file](#method-2-config-file).
11
12Both methods can specify any of the keys listed in the [Shared Config](#config-reference-shared-config) section.
13
14## Method 1 - Environment Variables
15
16The P-Stream client can be configured using environment variables **at build time**. You cannot use this method if hosting the pre-built `P-Stream.zip` files!
17
18Using environment variables to configure P-Stream also allows configuration of some [environment variable specific keys](#config-reference-environment-variables-only).
19
20## Method 2 - Config File
21
22When using the pre-built `P-Stream.zip`, you can set the configuration in the `config.js` file.
23
24The `config.js` file contains a JavaScript object which must be set to the correct values:
25
26```js
27window.__CONFIG__ = {
28 // ... Config variables go here ...
29};
30```
31
32## Required Config Reference:
33---
34
35### `VITE_TMDB_READ_API_KEY` ⚠
36
37- Type: `string`
38- Default: `""`
39
40This is the **read** API key from TMDB to allow P-Stream to search for media. [Get one by following our guide](./tmdb.mdx).
41
42<Caution>
43 **Required. The client will not work properly if this is not configured.**
44</Caution>
45
46### `VITE_CORS_PROXY_URL`
47
48- Type: `string`
49- Default: `""`
50- Example: `"https://example1.example.com,https://example2.example.com"`
51
52This is where you put proxy URLs. [Get some by following our guides](../proxy/deploy.mdx).
53
54If left empty, the client onboarding will not provide a "default setup" and the user will have to manually configure their own proxy or use the extension.
55
56You can add multiple Workers by separating them with a comma, they will be load balanced using round robin method on the client.
57**Worker URL entries must not end with a slash.**
58
59<Caution>
60 **Required. The client will not work properly if this is not configured.**
61</Caution>
62
63### `VITE_M3U8_PROXY_URL`
64
65- Type: `string`
66- Default: `""`
67- Example: `"https://example1.example.com,https://example2.example.com"`
68
69**The same proxy as above**, but used to proxy streams. However, it **must** be hosted on a server that is NOT blocked by FlixHQ. See this [explainer](../proxy/introduction.mdx).
70
71If left empty, some streams, notibly streams from FlixHQ, WILL NOT work.
72
73You can add multiple Workers by separating them with a comma, they will be load balanced using round robin method on the client.
74**Worker URL entries must not end with a slash.**
75
76<Caution>
77 **Required. The client will not work properly if this is not configured.**
78</Caution>
79
80## Optional Config Reference:
81---
82
83### `VITE_DMCA_EMAIL`
84
85- Type: `string`
86- Default: `""`
87- Example: `"dmca@example.com"`
88
89This is the DMCA email for on the DMCA page. If this config value is present, a new page will be made and linked in the footer, where it will mention how to handle DMCA take-down requests. If the configuration value is left empty, the page will not exist.
90
91### `VITE_NORMAL_ROUTER`
92
93- Type: `boolean`
94- Default: `false`
95
96The application has two routing modes: hash-router and history-router.
97Hash router means that every page is linked with a hash like so: `https://example.com/#/browse`.
98
99History router does routing without a hash like so: `https://example.com/browse`, this looks a lot nicer, but it requires that your hosting environment supports Single-Page-Application (SPA) redirects (Vercel supports this feature). If you don't know what that means, don't enable this.
100
101Setting this configuration value to `true` will enable the history-router.
102
103### `VITE_BACKEND_URL`
104
105- Type: `string`
106- Default: `""`
107- Example: `"https://backend.example.com"`
108
109This is the URL for the P-Stream backend server which handles cross-device syncing.
110
111The backend server can be found at https://github.com/p-stream/backend and is offered as a [Docker](https://docs.docker.com/get-started/overview/) image for deployment.
112
113Backend URL must **not** end with a slash.
114
115### `VITE_HAS_ONBOARDING`
116
117- Type: `boolean`
118- Default: `true`
119
120If you want your users to be prompted with an onboarding screen before they start watching, enable this.
121
122### `VITE_ONBOARDING_CHROME_EXTENSION_INSTALL_LINK`
123
124- Type: `string`
125- Default: `"https://chromewebstore.google.com/detail/P-Stream-extension/hoffoikpiofojilgpofjhnkkamfnnhmm"`
126- Example: `"https://google.com"`
127
128When onboarding is enabled using `VITE_HAS_ONBOARDING`. This link will be used to link the proper Chrome extension to install.
129
130If omitted, this will still show the extension onboarding screen, just without an install link for the extension.
131
132### `VITE_ONBOARDING_FIREFOX_EXTENSION_INSTALL_LINK`
133
134- Type: `string`
135- Default: `"https://addons.mozilla.org/en-GB/firefox/addon/P-Stream-extension"`
136- Example: `"https://google.com"`
137
138When onboarding is enabled using `VITE_HAS_ONBOARDING`. This link will be used to link the proper Firefox extension to install.
139
140If omitted, this will still show the extension onboarding screen, just without an install link for the extension.
141
142### `VITE_ONBOARDING_PROXY_INSTALL_LINK`
143
144- Type: `string`
145- Default: `""`
146- Example: `"https://google.com"`
147
148When onboarding is enabled using `VITE_HAS_ONBOARDING`. This link will be used to link the user to resources to host a custom proxy.
149
150If omitted, this will still show the proxy onboarding screen, just without an documentation link for the proxy.
151
152### `VITE_ALLOW_AUTOPLAY`
153
154- Type: `boolean`
155- Default: `false`
156
157Whether to allow autoplay for users that use the host provided proxies.
158
159### `VITE_DISALLOWED_IDS`
160
161- Type: `string`
162- Default: `""`
163- Example: `"series-123,movie-456"`
164
165In the unfortunate event that you've been sent a DMCA take down notice, you'll need to disable some pages. This configuration key will allow you to disable specific ids.
166
167For shows, it needs to be in this format: `series-<TMDB_ID>`. For movies the format is this: `movie-<TMDB_ID>`.
168
169The list is comma separated, you can add as many as needed.
170
171### `VITE_CDN_REPLACEMENTS`
172
173- Type: `string`
174- Default: `""`
175- Example: `"google.com:example.com,123movies.com:flixhq.to"`
176
177Sometimes you want to proxy a CDN. This is how you can easily replace a CDN URL with your own.
178
179The format is `<beforeA>:<afterA>,<beforeB>:<afterB>,...`
180
181### `VITE_TURNSTILE_KEY`
182
183- Type: `string`
184- Default: `""`
185
186The [Turnstile key](https://dash.cloudflare.com/sign-up?to=/:account/turnstile) for Cloudflare captchas. It's used to authenticate requests to proxy workers (or providers API).
187
188[The proxy workers will need to be configured to accept these captcha tokens](../proxy/configuration.mdx#turnstile-secret), otherwise it has no effect for security.
189
190## Config reference - Environment Variables Only
191
192<Caution>
193 These configuration keys are specific to environment variables, they **only**
194 work as environment variables **set at build time**.
195</Caution>
196
197### `VITE_PWA_ENABLED`
198
199- Type: `boolean`
200- Default: `false`
201
202Set to `true` if you want to output a PWA application. Set to `false` or omit to get a normal web application.
203A PWA web application can be installed as an application to your phone or desktop computer, but can be tricky to manage and comes with a few footguns.
204
205<Warning>
206 Make sure you know what you're doing before enabling this, it **cannot be
207 disabled** after you've set it up once.
208</Warning>
209
210### `VITE_GA_ID`
211
212- Type: `string`
213- Default: `""`
214- Example: `"G-1234567890"`
215
216The Google Analytics ID for tracking user behavior. If omitted, no tracking will be done.
217
218### `VITE_APP_DOMAIN`
219
220- Type: `string`
221- Default: `""`
222- Example: `"https://P-Stream.lol"`
223
224The domain where the app lives. Only required when having the [`VITE_OPENSEARCH_ENABLED`](#vite-opensearch-enabled) option enabled.
225
226The value must include the protocol (HTTP/HTTPS) but must **not** end with a slash.
227
228### `VITE_OPENSEARCH_ENABLED`
229
230- Type: `boolean`
231- Default: `false`
232
233Whether to enable [OpenSearch](https://developer.mozilla.org/en-US/docs/Web/OpenSearch), this allows a user to add a search engine to their browser. When enabling you **must** also set [`VITE_APP_DOMAIN`](#vite-app-domain).
234
235<Warning>
236 This field is case sensitive, make sure you use the correct casing.
237</Warning>