mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-06-03 21:00:09 +00:00
Add manual-import and download-access features
Introduce manual import workflow and download permission support. Adds a Prisma migration and schema field (users.download_access) to track per-user download access, and updates admin UI to toggle global and per-user download access. Implements new APIs: filesystem browse, manual-import endpoint, download-access settings, audiobook download-status, and on-demand download-token generation. Adds frontend components for manual import and related tests, plus documentation for the manual-import feature and the documentation-agent prompt. Key files: prisma/migrations/20260212000000_add_download_access_permission/migration.sql, prisma/schema.prisma, src/app/api/admin/filesystem/browse/route.ts, src/app/api/admin/manual-import/route.ts, src/app/api/admin/settings/download-access/route.ts, src/app/api/requests/[id]/download-token/route.ts, src/app/api/audiobooks/[asin]/download-status/route.ts, and updated admin users pages/components and permissions util.
This commit is contained in:
@@ -515,6 +515,25 @@ export function useEbookStatus(asin: string | null) {
|
||||
};
|
||||
}
|
||||
|
||||
interface DownloadStatus {
|
||||
downloadAvailable: boolean;
|
||||
requestId: string | null;
|
||||
}
|
||||
|
||||
export function useDownloadStatus(asin: string | null) {
|
||||
const { accessToken } = useAuth();
|
||||
|
||||
const endpoint = accessToken && asin ? `/api/audiobooks/${asin}/download-status` : null;
|
||||
|
||||
const { data, isLoading } = useSWR<DownloadStatus>(endpoint, fetcher);
|
||||
|
||||
return {
|
||||
downloadAvailable: data?.downloadAvailable ?? false,
|
||||
requestId: data?.requestId ?? null,
|
||||
isLoading,
|
||||
};
|
||||
}
|
||||
|
||||
export function useFetchEbookByAsin() {
|
||||
const { accessToken } = useAuth();
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
|
||||
Reference in New Issue
Block a user