Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/components/player/atoms/settings/Downloads.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export function DownloadView({ id }: { id: string }) {
const captionList = usePlayerStore((s) => s.captionList);
const meta = usePlayerStore((s) => s.meta);
const duration = usePlayerStore((s) => s.progress.duration);
const source = usePlayerStore((s) => s.source);
const isDesktopApp = useIsDesktopApp();

const startOfflineDownload = useCallback(async () => {
Expand All @@ -97,13 +98,19 @@ export function DownloadView({ id }: { id: string }) {
}
}

const headers = {
...(source?.headers ?? {}),
...(source?.preferredHeaders ?? {}),
};

window.desktopApi?.startDownload({
url: downloadUrl,
title,
poster,
subtitleText,
duration,
type: sourceType,
headers,
});

if (window.desktopApi?.openOffline) {
Expand All @@ -118,6 +125,7 @@ export function DownloadView({ id }: { id: string }) {
captionList,
duration,
router,
source,
sourceType,
t,
]);
Expand Down
1 change: 1 addition & 0 deletions src/hooks/useIsDesktopApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ declare global {
subtitleText?: string;
duration?: number;
type?: string;
headers?: Record<string, string>;
}): void;
openOffline(): void;
};
Expand Down
Loading