pass headers to app

This commit is contained in:
Pas 2026-03-02 17:19:37 -07:00
parent 3507db4050
commit c9c40a12e6
2 changed files with 9 additions and 0 deletions

View file

@ -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 () => {
@ -97,6 +98,11 @@ export function DownloadView({ id }: { id: string }) {
}
}
const headers = {
...(source?.headers ?? {}),
...(source?.preferredHeaders ?? {}),
};
window.desktopApi?.startDownload({
url: downloadUrl,
title,
@ -104,6 +110,7 @@ export function DownloadView({ id }: { id: string }) {
subtitleText,
duration,
type: sourceType,
headers,
});
if (window.desktopApi?.openOffline) {
@ -118,6 +125,7 @@ export function DownloadView({ id }: { id: string }) {
captionList,
duration,
router,
source,
sourceType,
t,
]);

View file

@ -10,6 +10,7 @@ declare global {
subtitleText?: string;
duration?: number;
type?: string;
headers?: Record<string, string>;
}): void;
openOffline(): void;
};