Implement configuration option in backend to enable or disable silent login functionality. Provides flexibility to control this authentication behavior through server settings. Requested by user self-hosting the project. Not all OIDC provider support prompt=none param.
33 lines
682 B
TypeScript
33 lines
682 B
TypeScript
import { fetchApi } from './fetchApi'
|
|
import { keys } from './queryKeys'
|
|
import { useQuery } from '@tanstack/react-query'
|
|
import { RecordingMode } from '@/features/recording'
|
|
|
|
export interface ApiConfig {
|
|
analytics?: {
|
|
id: string
|
|
host: string
|
|
}
|
|
support?: {
|
|
id: string
|
|
}
|
|
silence_livekit_debug_logs?: boolean
|
|
is_silent_login_enabled?: boolean
|
|
recording?: {
|
|
is_enabled?: boolean
|
|
available_modes?: RecordingMode[]
|
|
}
|
|
}
|
|
|
|
const fetchConfig = (): Promise<ApiConfig> => {
|
|
return fetchApi<ApiConfig>(`config/`)
|
|
}
|
|
|
|
export const useConfig = () => {
|
|
return useQuery({
|
|
queryKey: [keys.config],
|
|
queryFn: fetchConfig,
|
|
staleTime: Infinity,
|
|
})
|
|
}
|