diff --git a/package.json b/package.json index c3b3b910..8f933009 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,28 @@ "version": "4.0.0", "private": true, "homepage": "https://movie-web.app", + "scripts": { + "dev": "vite", + "build": "vite build", + "build:pwa": "cross-env VITE_PWA_ENABLED=true vite build", + "test": "vitest run", + "preview": "vite preview", + "lint": "eslint --ext .tsx,.ts src", + "lint:fix": "eslint --fix --ext .tsx,.ts src", + "lint:report": "eslint --ext .tsx,.ts --output-file eslint_report.json --format json src", + "preinstall": "npx -y only-allow pnpm" + }, + "browserslist": { + "production": [ + "defaults", + "chrome > 90" + ], + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "last 1 safari version" + ] + }, "dependencies": { "@formkit/auto-animate": "^0.7.0", "@headlessui/react": "^1.5.0", @@ -39,28 +61,6 @@ "subsrt-ts": "^2.1.1", "zustand": "^4.3.9" }, - "scripts": { - "dev": "vite", - "build": "vite build", - "build:pwa": "cross-env VITE_PWA_ENABLED=yes vite build", - "test": "vitest run", - "preview": "vite preview", - "lint": "eslint --ext .tsx,.ts src", - "lint:fix": "eslint --fix --ext .tsx,.ts src", - "lint:report": "eslint --ext .tsx,.ts --output-file eslint_report.json --format json src", - "preinstall": "npx -y only-allow pnpm" - }, - "browserslist": { - "production": [ - "defaults", - "chrome > 90" - ], - "development": [ - "last 1 chrome version", - "last 1 firefox version", - "last 1 safari version" - ] - }, "devDependencies": { "@babel/core": "^7.21.3", "@babel/preset-env": "^7.20.2", diff --git a/public/config.js b/public/config.js index c08704c2..68a9ca3f 100644 --- a/public/config.js +++ b/public/config.js @@ -1,5 +1,19 @@ window.__CONFIG__ = { - // url must NOT end with a slash - VITE_CORS_PROXY_URL: "", - VITE_TMDB_READ_API_KEY: "" + // The URL for the CORS proxy, the URL must NOT end with a slash! + VITE_CORS_PROXY_URL: "CHANGEME", + + // The READ API key to access TMDB + VITE_TMDB_READ_API_KEY: "CHANGEME", + + // The DMCA email displayed in the footer, null to hide the DMCA link + VITE_DMCA_EMAIL: null, + + // Whether to disable hash-based routing, leave this as false if you don't know what this is + VITE_NORMAL_ROUTER: false, + + // The backend URL to communicate with, defaults to the movie-web hosted one at backend.movie-web.app + VITE_BACKEND_URL: null, + + // A comma separated list of disallowed IDs in the case of a DMCA claim - in the format "series-" and "movie-" + VITE_DISALLOWED_IDS: "" }; diff --git a/src/setup/config.ts b/src/setup/config.ts index 5402ca6b..e42d236f 100644 --- a/src/setup/config.ts +++ b/src/setup/config.ts @@ -1,5 +1,6 @@ import { APP_VERSION, + BACKEND_URL, DISCORD_LINK, DONATION_LINK, GITHUB_LINK, @@ -53,7 +54,7 @@ function getKeyValue(key: keyof Config): string | undefined { } function getKey(key: keyof Config, defaultString?: string): string { - return getKeyValue(key) ?? defaultString ?? ""; + return getKeyValue(key)?.toString() ?? defaultString ?? ""; } export function conf(): RuntimeConfig { @@ -64,7 +65,7 @@ export function conf(): RuntimeConfig { DONATION_LINK, DISCORD_LINK, DMCA_EMAIL: dmcaEmail.length > 0 ? dmcaEmail : null, - BACKEND_URL: getKey("BACKEND_URL"), + BACKEND_URL: getKey("BACKEND_URL", BACKEND_URL), TMDB_READ_API_KEY: getKey("TMDB_READ_API_KEY"), PROXY_URLS: getKey("CORS_PROXY_URL") .split(",") diff --git a/src/setup/constants.ts b/src/setup/constants.ts index e688eeb5..27a9792b 100644 --- a/src/setup/constants.ts +++ b/src/setup/constants.ts @@ -3,3 +3,4 @@ export const DISCORD_LINK = "https://discord.movie-web.app"; export const GITHUB_LINK = "https://github.com/movie-web/movie-web"; export const DONATION_LINK = "https://ko-fi.com/movieweb"; export const GA_ID = "G-44YVXRL61C"; +export const BACKEND_URL = "https://backend.movie-web.app"; diff --git a/vite.config.ts b/vite.config.ts index f8934b21..0b9ac678 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -39,7 +39,7 @@ export default defineConfig(({ mode }) => { } }), VitePWA({ - disable: env.VITE_PWA_ENABLED !== "yes", + disable: env.VITE_PWA_ENABLED !== "true", registerType: "autoUpdate", workbox: { maximumFileSizeToCacheInBytes: 4000000, // 4mb