Change to hash routing, webuiInitialize controls project prefix
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,14 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8" />
|
|
||||||
<link rel="icon" type="image/svg+xml" href="./logo.png" />
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
<title>Lightrag</title>
|
|
||||||
<script type="module" crossorigin src="./assets/index-CJz72b6Q.js"></script>
|
|
||||||
<link rel="stylesheet" crossorigin href="./assets/index-CH-3l4_Z.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="root"></div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Binary file not shown.
Before Width: | Height: | Size: 155 KiB |
@@ -2,7 +2,7 @@
|
|||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<link rel="icon" type="image/svg+xml" href="/logo.png" />
|
<link rel="icon" type="image/svg+xml" href="logo.png" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title>Lightrag</title>
|
<title>Lightrag</title>
|
||||||
</head>
|
</head>
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { BrowserRouter, Routes, Route, Navigate } from 'react-router-dom'
|
import { HashRouter as Router, Routes, Route } from 'react-router-dom'
|
||||||
// import { useAuthStore } from '@/stores/state'
|
// import { useAuthStore } from '@/stores/state'
|
||||||
import { Toaster } from 'sonner'
|
import { Toaster } from 'sonner'
|
||||||
import App from './App'
|
import App from './App'
|
||||||
@@ -22,7 +22,7 @@ const ProtectedRoute = ({ children }: ProtectedRouteProps) => {
|
|||||||
const AppRouter = () => {
|
const AppRouter = () => {
|
||||||
return (
|
return (
|
||||||
<ThemeProvider>
|
<ThemeProvider>
|
||||||
<BrowserRouter>
|
<Router>
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route path="/login" element={<LoginPage />} />
|
<Route path="/login" element={<LoginPage />} />
|
||||||
<Route
|
<Route
|
||||||
@@ -35,7 +35,7 @@ const AppRouter = () => {
|
|||||||
/>
|
/>
|
||||||
</Routes>
|
</Routes>
|
||||||
<Toaster position="top-center" />
|
<Toaster position="top-center" />
|
||||||
</BrowserRouter>
|
</Router>
|
||||||
</ThemeProvider>
|
</ThemeProvider>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import axios, { AxiosError } from 'axios'
|
import axios, { AxiosError } from 'axios'
|
||||||
import { backendBaseUrl } from '@/lib/constants'
|
import { backendBaseUrl, webuiPrefix } from '@/lib/constants'
|
||||||
import { errorMessage } from '@/lib/utils'
|
import { errorMessage } from '@/lib/utils'
|
||||||
import { useSettingsStore } from '@/stores/settings'
|
import { useSettingsStore } from '@/stores/settings'
|
||||||
import { useAuthStore } from '@/stores/state'
|
import { useAuthStore } from '@/stores/state'
|
||||||
@@ -169,8 +169,8 @@ axiosInstance.interceptors.response.use(
|
|||||||
sessionStorage.clear();
|
sessionStorage.clear();
|
||||||
useAuthStore.getState().logout();
|
useAuthStore.getState().logout();
|
||||||
|
|
||||||
if (window.location.pathname !== '/login') {
|
if (window.location.pathname !== `${webuiPrefix}/#/login`) {
|
||||||
window.location.href = '/login';
|
window.location.href = `${webuiPrefix}/#/login`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Promise.reject(error);
|
return Promise.reject(error);
|
||||||
|
@@ -51,7 +51,7 @@ const LoginPage = () => {
|
|||||||
<CardHeader className="flex items-center justify-center space-y-2 pb-8 pt-6">
|
<CardHeader className="flex items-center justify-center space-y-2 pb-8 pt-6">
|
||||||
<div className="flex flex-col items-center space-y-4">
|
<div className="flex flex-col items-center space-y-4">
|
||||||
<div className="flex items-center gap-3">
|
<div className="flex items-center gap-3">
|
||||||
<img src="/logo.png" alt="LightRAG Logo" className="h-12 w-12" />
|
<img src="logo.png" alt="LightRAG Logo" className="h-12 w-12" />
|
||||||
<ZapIcon className="size-10 text-emerald-400" aria-hidden="true" />
|
<ZapIcon className="size-10 text-emerald-400" aria-hidden="true" />
|
||||||
</div>
|
</div>
|
||||||
<div className="text-center space-y-2">
|
<div className="text-center space-y-2">
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
import { ButtonVariantType } from '@/components/ui/Button'
|
import { ButtonVariantType } from '@/components/ui/Button'
|
||||||
|
|
||||||
export const backendBaseUrl = ''
|
export const backendBaseUrl = 'http://localhost:9621/'
|
||||||
|
export const webuiPrefix = '/webui'
|
||||||
|
|
||||||
export const controlButtonVariant: ButtonVariantType = 'ghost'
|
export const controlButtonVariant: ButtonVariantType = 'ghost'
|
||||||
|
|
||||||
|
@@ -26,5 +26,5 @@
|
|||||||
"@/*": ["./src/*"]
|
"@/*": ["./src/*"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"include": ["src", "vite.config.ts"]
|
"include": ["src", "vite.config.ts", "src/vite-env.d.ts"]
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import { defineConfig } from 'vite'
|
import { defineConfig } from 'vite'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
import { webuiPrefix } from '@/lib/constants'
|
||||||
import react from '@vitejs/plugin-react-swc'
|
import react from '@vitejs/plugin-react-swc'
|
||||||
import tailwindcss from '@tailwindcss/vite'
|
import tailwindcss from '@tailwindcss/vite'
|
||||||
|
|
||||||
@@ -12,7 +12,8 @@ export default defineConfig({
|
|||||||
'@': path.resolve(__dirname, './src')
|
'@': path.resolve(__dirname, './src')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
base: './',
|
// base: import.meta.env.VITE_BASE_URL || '/webui/',
|
||||||
|
base: webuiPrefix,
|
||||||
build: {
|
build: {
|
||||||
outDir: path.resolve(__dirname, '../lightrag/api/webui'),
|
outDir: path.resolve(__dirname, '../lightrag/api/webui'),
|
||||||
emptyOutDir: true
|
emptyOutDir: true
|
||||||
|
Reference in New Issue
Block a user