mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-24 23:39:25 +00:00
* feat(storage): add archive storage support for assets * fix(webui): show archive icon in front of file name in breadcrumb bar * fix(webui): display archive icon in breadcrumbs when restoring * refactor(transcode): simplify restore asset workflow to single while loop * docs(configuration): add archive storage documentation and readme entries * fix(webui): show archive icon in front of version names and prevent version card overflow * fix(webui): fix overflow in manage versions dialog scroll area * fix(webui): prevent manage versions dialog overflow on long file names * docs(configuration): fix archive storage environment variables and defaults * fix(storage): address code review findings for archive storage
31 lines
784 B
TypeScript
31 lines
784 B
TypeScript
import { useQuery } from '@tanstack/react-query'
|
|
import { client } from '@/ui/api/client'
|
|
|
|
export interface ArchiveConfig {
|
|
archiveStorageEnabled: boolean
|
|
isLoading: boolean
|
|
}
|
|
|
|
export function useArchiveConfig(): ArchiveConfig {
|
|
const { data, isLoading } = useQuery({
|
|
queryKey: ['signup-info'],
|
|
queryFn: async () => {
|
|
const res = await client.api['signup-info'].$get()
|
|
if (!res.ok) {
|
|
return { initialized: true, demoMode: false, archiveStorageEnabled: false }
|
|
}
|
|
return (await res.json()) as {
|
|
initialized?: boolean
|
|
demoMode?: boolean
|
|
archiveStorageEnabled?: boolean
|
|
}
|
|
},
|
|
staleTime: 5 * 60 * 1000,
|
|
})
|
|
|
|
return {
|
|
archiveStorageEnabled: Boolean(data?.archiveStorageEnabled),
|
|
isLoading,
|
|
}
|
|
}
|