Added auth mode status to health check endpoint.

- Introduced auth_mode in health check response
- Updated App.tsx to handle guest mode logic
This commit is contained in:
yangdx
2025-03-23 02:43:44 +08:00
parent d3b2cff182
commit a444edd9eb
3 changed files with 11 additions and 1 deletions

View File

@@ -417,6 +417,13 @@ def create_app(args):
# Get update flags status for all namespaces
update_status = await get_all_update_flags_status()
username = os.getenv("AUTH_USERNAME")
password = os.getenv("AUTH_PASSWORD")
if not (username and password):
auth_mode = "disabled"
else:
auth_mode = "enabled"
return {
"status": "healthy",
"working_directory": str(args.working_dir),
@@ -440,6 +447,7 @@ def create_app(args):
"update_status": update_status,
"core_version": core_version,
"api_version": __api_version__,
"auth_mode": auth_mode,
}
# Custom StaticFiles class to prevent caching of HTML files

View File

@@ -61,10 +61,11 @@ function App() {
try {
const status = await getAuthStatus();
if (status.core_version || status.api_version) {
const isGuestMode = status.auth_mode === 'disabled' || useAuthStore.getState().isGuestMode;
// Update version info while maintaining login state
useAuthStore.getState().login(
token,
useAuthStore.getState().isGuestMode,
isGuestMode,
status.core_version,
status.api_version
);

View File

@@ -44,6 +44,7 @@ export type LightragStatus = {
update_status?: Record<string, any>
core_version?: string
api_version?: string
auth_mode?: 'enabled' | 'disabled'
}
export type LightragDocumentsScanProgress = {