mirror of
https://github.com/iib0011/omni-tools.git
synced 2025-11-08 17:46:45 +05:30
feat: support BASE_URL
This commit is contained in:
parent
234fc8090b
commit
614125002c
11 changed files with 29 additions and 23 deletions
|
|
@ -8,7 +8,6 @@
|
||||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
|
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
|
||||||
<meta name="apple-mobile-web-app-title" content="OmniTools" />
|
<meta name="apple-mobile-web-app-title" content="OmniTools" />
|
||||||
<link rel="manifest" href="/site.webmanifest" />
|
<link rel="manifest" href="/site.webmanifest" />
|
||||||
<link href="/assets/fonts/quicksand/quick-sand.css" rel="stylesheet" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>OmniTools</title>
|
<title>OmniTools</title>
|
||||||
</head>
|
</head>
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 140 KiB After Width: | Height: | Size: 140 KiB |
|
Before Width: | Height: | Size: 2 KiB After Width: | Height: | Size: 2 KiB |
|
|
@ -59,7 +59,7 @@ function App() {
|
||||||
>
|
>
|
||||||
<CustomSnackBarProvider>
|
<CustomSnackBarProvider>
|
||||||
<UserTypeFilterProvider>
|
<UserTypeFilterProvider>
|
||||||
<BrowserRouter>
|
<BrowserRouter basename={import.meta.env.BASE_URL}>
|
||||||
<Navbar
|
<Navbar
|
||||||
mode={mode}
|
mode={mode}
|
||||||
onChangeMode={() => {
|
onChangeMode={() => {
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,9 @@ i18n
|
||||||
escapeValue: false // react already safes from xss => https://www.i18next.com/translation-function/interpolation#unescape
|
escapeValue: false // react already safes from xss => https://www.i18next.com/translation-function/interpolation#unescape
|
||||||
},
|
},
|
||||||
backend: {
|
backend: {
|
||||||
loadPath: '/locales/{{lng}}/{{ns}}.json'
|
loadPath: `${
|
||||||
|
(import.meta as any).env.BASE_URL?.replace(/\/$/, '') || ''
|
||||||
|
}/locales/{{lng}}/{{ns}}.json`
|
||||||
},
|
},
|
||||||
detection: {
|
detection: {
|
||||||
lookupLocalStorage: 'lang',
|
lookupLocalStorage: 'lang',
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import { createRoot } from 'react-dom/client';
|
import { createRoot } from 'react-dom/client';
|
||||||
import 'tailwindcss/tailwind.css';
|
import 'tailwindcss/tailwind.css';
|
||||||
|
import 'assets/fonts/quicksand/quick-sand.css';
|
||||||
import App from 'components/App';
|
import App from 'components/App';
|
||||||
|
|
||||||
const container = document.getElementById('root') as HTMLDivElement;
|
const container = document.getElementById('root') as HTMLDivElement;
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,8 @@ import Categories from './Categories';
|
||||||
import { Helmet } from 'react-helmet';
|
import { Helmet } from 'react-helmet';
|
||||||
import { useUserTypeFilter } from 'providers/UserTypeFilterProvider';
|
import { useUserTypeFilter } from 'providers/UserTypeFilterProvider';
|
||||||
import UserTypeFilter from '@components/UserTypeFilter';
|
import UserTypeFilter from '@components/UserTypeFilter';
|
||||||
|
import backgroundDark from 'assets/background-dark.png';
|
||||||
|
import backgroundLight from 'assets/background.svg';
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
|
@ -16,10 +18,8 @@ export default function Home() {
|
||||||
lg: 5
|
lg: 5
|
||||||
}}
|
}}
|
||||||
sx={{
|
sx={{
|
||||||
background: `url(/assets/${
|
background: `url(${
|
||||||
theme.palette.mode === 'dark'
|
theme.palette.mode === 'dark' ? backgroundDark : backgroundLight
|
||||||
? 'background-dark.png'
|
|
||||||
: 'background.svg'
|
|
||||||
})`,
|
})`,
|
||||||
backgroundColor: 'background.default'
|
backgroundColor: 'background.default'
|
||||||
}}
|
}}
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,26 @@
|
||||||
/// <reference types="vitest" />
|
/// <reference types="vitest" />
|
||||||
import { defineConfig } from 'vite';
|
import { defineConfig, loadEnv } from 'vite';
|
||||||
import react from '@vitejs/plugin-react-swc';
|
import react from '@vitejs/plugin-react-swc';
|
||||||
import tsconfigPaths from 'vite-tsconfig-paths';
|
import tsconfigPaths from 'vite-tsconfig-paths';
|
||||||
|
|
||||||
// https://vitejs.dev/config https://vitest.dev/config
|
// https://vitejs.dev/config https://vitest.dev/config
|
||||||
export default defineConfig({
|
export default defineConfig(({ mode }) => {
|
||||||
plugins: [react(), tsconfigPaths()],
|
const env = loadEnv(mode, process.cwd(), '');
|
||||||
define: {
|
return {
|
||||||
'process.env': {}
|
base: env.BASE_URL || '/',
|
||||||
},
|
plugins: [react(), tsconfigPaths()],
|
||||||
optimizeDeps: {
|
define: {
|
||||||
exclude: ['@ffmpeg/ffmpeg', '@ffmpeg/util']
|
'process.env': {}
|
||||||
},
|
},
|
||||||
test: {
|
optimizeDeps: {
|
||||||
globals: true,
|
exclude: ['@ffmpeg/ffmpeg', '@ffmpeg/util']
|
||||||
environment: 'happy-dom',
|
},
|
||||||
setupFiles: '.vitest/setup',
|
test: {
|
||||||
include: ['**/*.test.{ts,tsx}']
|
globals: true,
|
||||||
},
|
environment: 'happy-dom',
|
||||||
worker: { format: 'es' }
|
setupFiles: '.vitest/setup',
|
||||||
|
include: ['**/*.test.{ts,tsx}']
|
||||||
|
},
|
||||||
|
worker: { format: 'es' }
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue