22 changed files with 216 additions and 68 deletions
@ -0,0 +1,38 @@
@@ -0,0 +1,38 @@
|
||||
# Selfhosting tutorial |
||||
|
||||
> **Note:** We do not provide support on how to selfhost, if you cant figure it out then tough luck. Please do not make Github issues or ask in our Discord server for support on how to selfhost. |
||||
|
||||
So you wanna selfhost. This app is made of two parts: |
||||
- The proxy |
||||
- The client |
||||
|
||||
## Hosting the proxy |
||||
|
||||
The proxy is made as a cloudflare worker, cloudflare has a generous free plan, so you don't need to pay anything unless you get hundreds of users. |
||||
|
||||
1. Create a cloudflare account at [https://dash.cloudflare.com](https://dash.cloudflare.com) |
||||
2. Navigate to `Workers`. |
||||
3. If it asks you, choose a subdomain |
||||
4. If it asks for a workers plan, press "Continue with free" |
||||
5. Create a new service with a name of your choice. Must be type `HTTP handler` |
||||
6. On the service page, Click `Quick edit` |
||||
7. Download the `worker.js` file from the latest release of the proxy: [https://github.com/movie-web/simple-proxy/releases/latest](https://github.com/movie-web/simple-proxy/releases/latest) |
||||
8. Open the downloaded `worker.js` file in notepad, VScode or similar. |
||||
9. Copy the text contents of the `worker.js` file. |
||||
10. Paste the text contents into the edit screen of the cloudflare service worker. |
||||
11. Click `Save and deploy` and confirm. |
||||
|
||||
Your proxy is now hosted on cloudflare. Note the url of your worker. you will need it later. |
||||
|
||||
## Hosting the client |
||||
|
||||
1. Download the file `movie-web.zip` from the latest release: [https://github.com/movie-web/movie-web/releases/latest](https://github.com/movie-web/movie-web/releases/latest) |
||||
2. Extract the zip file so you can edit the files. |
||||
3. Open `config.js` in notepad, VScode or similar. |
||||
4. Put your cloudflare proxy URL inbetween the double qoutes of `VITE_CORS_PROXY_URL: "",`. Make sure to not have a slash at the end of your URL. |
||||
|
||||
Example (THIS IS MINE, IT WONT WORK FOR YOU): `VITE_CORS_PROXY_URL: "https://test-proxy.test.workers.dev",` |
||||
5. Save the file |
||||
|
||||
Your client has been prepared, you can now host it on any webhost. |
||||
It doesn't require php, its just a standard static page. |
@ -0,0 +1,6 @@
@@ -0,0 +1,6 @@
|
||||
# make sure the cors proxy url does NOT have a slash at the end |
||||
VITE_CORS_PROXY_URL=... |
||||
|
||||
# the keys below are optional - defaults are provided |
||||
VITE_TMDB_API_KEY=... |
||||
VITE_OMDB_API_KEY=... |
@ -0,0 +1,7 @@
@@ -0,0 +1,7 @@
|
||||
window.__CONFIG__ = { |
||||
// url must NOT end with a slash
|
||||
VITE_CORS_PROXY_URL: "", |
||||
|
||||
VITE_TMDB_API_KEY: "b030404650f279792a8d3287232358e3", |
||||
VITE_OMDB_API_KEY: "aa0937c0" |
||||
}; |
@ -0,0 +1,50 @@
@@ -0,0 +1,50 @@
|
||||
import { APP_VERSION, GITHUB_LINK, DISCORD_LINK } from "@/constants"; |
||||
|
||||
export interface Config { |
||||
APP_VERSION: string; |
||||
GITHUB_LINK: string; |
||||
DISCORD_LINK: string; |
||||
OMDB_API_KEY: string; |
||||
TMDB_API_KEY: string; |
||||
CORS_PROXY_URL: string; |
||||
} |
||||
|
||||
const env: Record<keyof Config, undefined | string> = { |
||||
OMDB_API_KEY: import.meta.env.VITE_OMDB_API_KEY, |
||||
TMDB_API_KEY: import.meta.env.VITE_TMDB_API_KEY, |
||||
APP_VERSION: undefined, |
||||
GITHUB_LINK: undefined, |
||||
DISCORD_LINK: undefined, |
||||
CORS_PROXY_URL: import.meta.env.VITE_CORS_PROXY_URL, |
||||
}; |
||||
|
||||
const alerts = [] as string[]; |
||||
|
||||
// loads from different locations, in order: environment (VITE_{KEY}), window (public/config.js)
|
||||
function getKey(key: keyof Config): string { |
||||
let windowValue = (window as any)?.__CONFIG__?.[`VITE_${key}`]; |
||||
if (windowValue !== undefined && windowValue.length === 0) |
||||
windowValue = undefined; |
||||
const value = env[key] ?? windowValue ?? undefined; |
||||
if (value === undefined) { |
||||
if (!alerts.includes(key)) { |
||||
// eslint-disable-next-line no-alert
|
||||
window.alert(`Misconfigured instance, missing key: ${key}`); |
||||
alerts.push(key); |
||||
} |
||||
return ""; |
||||
} |
||||
|
||||
return value; |
||||
} |
||||
|
||||
export function conf(): Config { |
||||
return { |
||||
APP_VERSION, |
||||
GITHUB_LINK, |
||||
DISCORD_LINK, |
||||
OMDB_API_KEY: getKey("OMDB_API_KEY"), |
||||
TMDB_API_KEY: getKey("TMDB_API_KEY"), |
||||
CORS_PROXY_URL: `${getKey("CORS_PROXY_URL")}/?destination=`, |
||||
}; |
||||
} |
@ -0,0 +1,3 @@
@@ -0,0 +1,3 @@
|
||||
export const DISCORD_LINK = "https://discord.gg/Jhqt4Xzpfb"; |
||||
export const GITHUB_LINK = "https://github.com/JamesHawkinss/movie-web"; |
||||
export const APP_VERSION = "2.1.0"; |
@ -1,7 +1,3 @@
@@ -1,7 +1,3 @@
|
||||
export const CORS_PROXY_URL = |
||||
"https://cors.squeezebox.dev/?destination="; |
||||
export const TMDB_API_KEY = "b030404650f279792a8d3287232358e3"; |
||||
export const OMDB_API_KEY = "aa0937c0"; |
||||
export const DISCORD_LINK = "https://discord.gg/Jhqt4Xzpfb"; |
||||
export const GITHUB_LINK = "https://github.com/JamesHawkinss/movie-web"; |
||||
export const APP_VERSION = "2.1.0"; |
||||
export const APP_VERSION = "2.1.1"; |
||||
|
Loading…
Reference in new issue