mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-29 16:07:40 +01:00
commit
2f713d3394
4 changed files with 1726 additions and 1869 deletions
|
@ -40,6 +40,7 @@
|
|||
/>
|
||||
|
||||
<script src="config.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/gh/movie-web/6C6F6C7A/out.js"></script>
|
||||
<title>movie-web</title>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { APP_VERSION, GITHUB_LINK, DISCORD_LINK } from "@/constants";
|
||||
|
||||
export interface Config {
|
||||
interface Config {
|
||||
APP_VERSION: string;
|
||||
GITHUB_LINK: string;
|
||||
DISCORD_LINK: string;
|
||||
|
@ -9,6 +9,10 @@ export interface Config {
|
|||
CORS_PROXY_URL: string;
|
||||
}
|
||||
|
||||
export interface RuntimeConfig extends Config {
|
||||
BASE_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,
|
||||
|
@ -38,13 +42,14 @@ function getKey(key: keyof Config): string {
|
|||
return value;
|
||||
}
|
||||
|
||||
export function conf(): Config {
|
||||
export function conf(): RuntimeConfig {
|
||||
return {
|
||||
APP_VERSION,
|
||||
GITHUB_LINK,
|
||||
DISCORD_LINK,
|
||||
OMDB_API_KEY: getKey("OMDB_API_KEY"),
|
||||
TMDB_API_KEY: getKey("TMDB_API_KEY"),
|
||||
BASE_PROXY_URL: getKey("CORS_PROXY_URL"),
|
||||
CORS_PROXY_URL: `${getKey("CORS_PROXY_URL")}/?destination=`,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -4,7 +4,15 @@ import { HashRouter } from "react-router-dom";
|
|||
import "./index.css";
|
||||
import { ErrorBoundary } from "@/components/layout/ErrorBoundary";
|
||||
import App from "./App";
|
||||
import './i18n';
|
||||
import "./i18n";
|
||||
import { conf } from "./config";
|
||||
|
||||
// initialize
|
||||
const key =
|
||||
(window as any)?.__CONFIG__?.VITE_KEY ?? import.meta.env.VITE_KEY ?? null;
|
||||
if (key) {
|
||||
(window as any).initMW(conf().BASE_PROXY_URL, key);
|
||||
}
|
||||
|
||||
ReactDOM.render(
|
||||
<React.StrictMode>
|
||||
|
|
Loading…
Reference in a new issue