From 9c25e8cfc2e5e920cec6234f1282aa644fffe234 Mon Sep 17 00:00:00 2001 From: John Corser Date: Thu, 2 Jan 2025 11:36:34 -0500 Subject: [PATCH] remove dependency on crypto.subtle --- src/lib/jellyfin-api.ts | 6 +++--- src/lib/utils.ts | 16 ---------------- 2 files changed, 3 insertions(+), 19 deletions(-) diff --git a/src/lib/jellyfin-api.ts b/src/lib/jellyfin-api.ts index 452494f..0a2fa4d 100644 --- a/src/lib/jellyfin-api.ts +++ b/src/lib/jellyfin-api.ts @@ -1,5 +1,5 @@ import { Api, Jellyfin } from "@jellyfin/sdk"; -import { generateFingerprint } from "./utils"; +import { generateGuid } from "./utils"; import { getCacheValue, JELLYFIN_AUTH_TOKEN_CACHE_KEY, @@ -46,7 +46,7 @@ export const authenticateByAuthToken = async ( }, deviceInfo: { name: "Jellyfin-Wrapped", - id: await generateFingerprint(), + id: await generateGuid(), }, }); api = jellyfin.createApi(serverUrl, jellyfinApiKey); @@ -69,7 +69,7 @@ export const authenticateByUserName = async ( }, deviceInfo: { name: "Jellyfin-Wrapped", - id: await generateFingerprint(), + id: await generateGuid(), }, }); console.log("Connecting to server...", { serverUrl, username }); diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 3ad1a36..6a25e59 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -26,19 +26,3 @@ export const generateGuid = () => { }); }; -export async function generateFingerprint() { - const components = [ - navigator.userAgent, - navigator.language, - screen.width, - screen.height, - new Date().getTimezoneOffset(), - ]; - - // Create a hash of the components - const text = components.join("|"); - const msgBuffer = new TextEncoder().encode(text); - const hashBuffer = await crypto.subtle.digest("SHA-256", msgBuffer); - const hashArray = Array.from(new Uint8Array(hashBuffer)); - return hashArray.map((b) => b.toString(16).padStart(2, "0")).join(""); -}