Fix Jellyfin Login (#76)

This commit is contained in:
2026-05-20 00:46:11 -07:00
committed by GitHub
parent 799cce6991
commit a54f03f0cd
31 changed files with 1087 additions and 148 deletions
+13
View File
@@ -4,6 +4,19 @@ export interface ElectronNetFetchLike {
fetch: (url: string, init?: Record<string, unknown>) => Promise<FetchResponseLike>;
}
export type GlobalFetchLike = (url: string, init?: RequestInit) => Promise<FetchResponseLike>;
export function createElectronNetFetch(net: ElectronNetFetchLike): FetchLike {
return (url, init) => net.fetch(url, init);
}
function getGlobalFetch(): GlobalFetchLike {
if (typeof globalThis.fetch !== 'function') {
throw new Error('Global fetch is not available for updater requests.');
}
return globalThis.fetch.bind(globalThis) as GlobalFetchLike;
}
export function createGlobalFetch(fetchImpl?: GlobalFetchLike): FetchLike {
return (url, init) => (fetchImpl ?? getGlobalFetch())(url, init as RequestInit);
}