mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-20 14:37:43 +01:00
Update config: add defaults to config.js, set backend URL as default, use true/false in vite
This commit is contained in:
parent
eda135d07b
commit
00ae1576bf
5 changed files with 44 additions and 28 deletions
44
package.json
44
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",
|
||||
|
|
|
@ -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-<id>" and "movie-<id>"
|
||||
VITE_DISALLOWED_IDS: ""
|
||||
};
|
||||
|
|
|
@ -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(",")
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue