Files
shumai/packages/webui/hooks/use-archive-config.ts
T
Yiling-J ba3c6dbfee feat(storage): add archive storage support for assets (#514)
* 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
2026-11-03 20:31:56 +08:00

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,
}
}