Fix linting
This commit is contained in:
@@ -439,7 +439,7 @@ def create_app(args):
|
|||||||
},
|
},
|
||||||
"update_status": update_status,
|
"update_status": update_status,
|
||||||
"core_version": core_version,
|
"core_version": core_version,
|
||||||
"api_version": __api_version__
|
"api_version": __api_version__,
|
||||||
}
|
}
|
||||||
|
|
||||||
# Custom StaticFiles class to prevent caching of HTML files
|
# Custom StaticFiles class to prevent caching of HTML files
|
||||||
|
@@ -29,15 +29,15 @@ function App() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// Only execute if health check is enabled
|
// Only execute if health check is enabled
|
||||||
if (!enableHealthCheck) return;
|
if (!enableHealthCheck) return;
|
||||||
|
|
||||||
// Health check function
|
// Health check function
|
||||||
const performHealthCheck = async () => {
|
const performHealthCheck = async () => {
|
||||||
await useBackendState.getState().check();
|
await useBackendState.getState().check();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Execute immediately
|
// Execute immediately
|
||||||
performHealthCheck();
|
performHealthCheck();
|
||||||
|
|
||||||
// Set interval for periodic execution
|
// Set interval for periodic execution
|
||||||
const interval = setInterval(performHealthCheck, healthCheckInterval * 1000);
|
const interval = setInterval(performHealthCheck, healthCheckInterval * 1000);
|
||||||
return () => clearInterval(interval);
|
return () => clearInterval(interval);
|
||||||
@@ -49,26 +49,26 @@ function App() {
|
|||||||
// Prevent duplicate calls in Vite dev mode
|
// Prevent duplicate calls in Vite dev mode
|
||||||
if (versionCheckRef.current) return;
|
if (versionCheckRef.current) return;
|
||||||
versionCheckRef.current = true;
|
versionCheckRef.current = true;
|
||||||
|
|
||||||
// Check if version info was already obtained in login page
|
// Check if version info was already obtained in login page
|
||||||
const versionCheckedFromLogin = sessionStorage.getItem('VERSION_CHECKED_FROM_LOGIN') === 'true';
|
const versionCheckedFromLogin = sessionStorage.getItem('VERSION_CHECKED_FROM_LOGIN') === 'true';
|
||||||
if (versionCheckedFromLogin) return;
|
if (versionCheckedFromLogin) return;
|
||||||
|
|
||||||
// Get version info
|
// Get version info
|
||||||
const token = localStorage.getItem('LIGHTRAG-API-TOKEN');
|
const token = localStorage.getItem('LIGHTRAG-API-TOKEN');
|
||||||
if (!token) return;
|
if (!token) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const status = await getAuthStatus();
|
const status = await getAuthStatus();
|
||||||
if (status.core_version || status.api_version) {
|
if (status.core_version || status.api_version) {
|
||||||
// Update version info while maintaining login state
|
// Update version info while maintaining login state
|
||||||
useAuthStore.getState().login(
|
useAuthStore.getState().login(
|
||||||
token,
|
token,
|
||||||
useAuthStore.getState().isGuestMode,
|
useAuthStore.getState().isGuestMode,
|
||||||
status.core_version,
|
status.core_version,
|
||||||
status.api_version
|
status.api_version
|
||||||
);
|
);
|
||||||
|
|
||||||
// Set flag to indicate version info has been checked
|
// Set flag to indicate version info has been checked
|
||||||
sessionStorage.setItem('VERSION_CHECKED_FROM_LOGIN', 'true');
|
sessionStorage.setItem('VERSION_CHECKED_FROM_LOGIN', 'true');
|
||||||
}
|
}
|
||||||
@@ -76,7 +76,7 @@ function App() {
|
|||||||
console.error('Failed to get version info:', error);
|
console.error('Failed to get version info:', error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Execute version check
|
// Execute version check
|
||||||
checkVersion();
|
checkVersion();
|
||||||
}, []); // Empty dependency array ensures it only runs once on mount
|
}, []); // Empty dependency array ensures it only runs once on mount
|
||||||
|
@@ -35,7 +35,7 @@ const LoginPage = () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
authCheckRef.current = true;
|
authCheckRef.current = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// If already authenticated, redirect to home
|
// If already authenticated, redirect to home
|
||||||
if (isAuthenticated) {
|
if (isAuthenticated) {
|
||||||
@@ -45,13 +45,13 @@ const LoginPage = () => {
|
|||||||
|
|
||||||
// Check auth status
|
// Check auth status
|
||||||
const status = await getAuthStatus()
|
const status = await getAuthStatus()
|
||||||
|
|
||||||
// Set checkingAuth to false immediately after getAuthStatus
|
// Set checkingAuth to false immediately after getAuthStatus
|
||||||
// This allows the login page to render while other processing continues
|
// This allows the login page to render while other processing continues
|
||||||
if (isMounted) {
|
if (isMounted) {
|
||||||
setCheckingAuth(false);
|
setCheckingAuth(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set session flag for version check to avoid duplicate checks in App component
|
// Set session flag for version check to avoid duplicate checks in App component
|
||||||
if (isMounted && (status.core_version || status.api_version)) {
|
if (isMounted && (status.core_version || status.api_version)) {
|
||||||
sessionStorage.setItem('VERSION_CHECKED_FROM_LOGIN', 'true');
|
sessionStorage.setItem('VERSION_CHECKED_FROM_LOGIN', 'true');
|
||||||
@@ -107,7 +107,7 @@ const LoginPage = () => {
|
|||||||
// Check authentication mode
|
// Check authentication mode
|
||||||
const isGuestMode = response.auth_mode === 'disabled'
|
const isGuestMode = response.auth_mode === 'disabled'
|
||||||
login(response.access_token, isGuestMode, response.core_version, response.api_version)
|
login(response.access_token, isGuestMode, response.core_version, response.api_version)
|
||||||
|
|
||||||
// Set session flag for version check
|
// Set session flag for version check
|
||||||
if (response.core_version || response.api_version) {
|
if (response.core_version || response.api_version) {
|
||||||
sessionStorage.setItem('VERSION_CHECKED_FROM_LOGIN', 'true');
|
sessionStorage.setItem('VERSION_CHECKED_FROM_LOGIN', 'true');
|
||||||
|
@@ -43,7 +43,7 @@ const useBackendStateStoreBase = create<BackendState>()((set) => ({
|
|||||||
health.api_version || null
|
health.api_version || null
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
set({
|
set({
|
||||||
health: true,
|
health: true,
|
||||||
message: null,
|
message: null,
|
||||||
|
Reference in New Issue
Block a user