Add title support for webui
This commit is contained in:
@@ -3,6 +3,7 @@ import { backendBaseUrl } from '@/lib/constants'
|
||||
import { errorMessage } from '@/lib/utils'
|
||||
import { useSettingsStore } from '@/stores/settings'
|
||||
import { navigationService } from '@/services/navigation'
|
||||
import { useAuthStore } from '@/stores/state'
|
||||
|
||||
// Types
|
||||
export type LightragNodeType = {
|
||||
@@ -46,6 +47,8 @@ export type LightragStatus = {
|
||||
api_version?: string
|
||||
auth_mode?: 'enabled' | 'disabled'
|
||||
pipeline_busy: boolean
|
||||
webui_title?: string
|
||||
webui_description?: string
|
||||
}
|
||||
|
||||
export type LightragDocumentsScanProgress = {
|
||||
@@ -140,6 +143,8 @@ export type AuthStatusResponse = {
|
||||
message?: string
|
||||
core_version?: string
|
||||
api_version?: string
|
||||
webui_title?: string
|
||||
webui_description?: string
|
||||
}
|
||||
|
||||
export type PipelineStatusResponse = {
|
||||
@@ -163,6 +168,8 @@ export type LoginResponse = {
|
||||
message?: string // Optional message
|
||||
core_version?: string
|
||||
api_version?: string
|
||||
webui_title?: string
|
||||
webui_description?: string
|
||||
}
|
||||
|
||||
export const InvalidApiKeyError = 'Invalid API Key'
|
||||
@@ -419,12 +426,26 @@ export const getAuthStatus = async (): Promise<AuthStatusResponse> => {
|
||||
// For unconfigured auth, ensure we have an access token
|
||||
if (!response.data.auth_configured) {
|
||||
if (response.data.access_token && typeof response.data.access_token === 'string') {
|
||||
// Update custom title if available
|
||||
if (response.data.webui_title || response.data.webui_description) {
|
||||
useAuthStore.getState().setCustomTitle(
|
||||
response.data.webui_title || null,
|
||||
response.data.webui_description || null
|
||||
);
|
||||
}
|
||||
return response.data;
|
||||
} else {
|
||||
console.warn('Auth not configured but no valid access token provided');
|
||||
}
|
||||
} else {
|
||||
// For configured auth, just return the data
|
||||
// Update custom title if available
|
||||
if (response.data.webui_title || response.data.webui_description) {
|
||||
useAuthStore.getState().setCustomTitle(
|
||||
response.data.webui_title || null,
|
||||
response.data.webui_description || null
|
||||
);
|
||||
}
|
||||
return response.data;
|
||||
}
|
||||
}
|
||||
@@ -463,5 +484,13 @@ export const loginToServer = async (username: string, password: string): Promise
|
||||
}
|
||||
});
|
||||
|
||||
// Update custom title if available
|
||||
if (response.data.webui_title || response.data.webui_description) {
|
||||
useAuthStore.getState().setCustomTitle(
|
||||
response.data.webui_title || null,
|
||||
response.data.webui_description || null
|
||||
);
|
||||
}
|
||||
|
||||
return response.data;
|
||||
}
|
||||
|
Reference in New Issue
Block a user