From da5a80c46a8d725cce30d43cbb0cf83a625a93d9 Mon Sep 17 00:00:00 2001 From: booploops <49113086+booploops@users.noreply.github.com> Date: Fri, 10 Dec 2021 22:04:33 -0800 Subject: [PATCH] changed to wildcard for hls.js when intercepting --- resources/functions/cider-base.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/resources/functions/cider-base.js b/resources/functions/cider-base.js index 47b25153..6cc02a63 100644 --- a/resources/functions/cider-base.js +++ b/resources/functions/cider-base.js @@ -52,15 +52,22 @@ const CiderBase = { win = new BrowserWindow(options) } + // intercept "https://js-cdn.music.apple.com/hls.js/2.141.0/hls.js/hls.js" and redirect to local file "./apple-hls.js" instead win.webContents.session.webRequest.onBeforeRequest( { - urls: ["https://js-cdn.music.apple.com/hls.js/2.141.0/hls.js/hls.js"] + urls: ["https://*/*.js"] }, (details, callback) => { - callback({ - redirectURL: "http://localhost:9000/apple-hls.js" - }) + if (details.url.includes("hls.js")) { + callback({ + redirectURL: "http://localhost:9000/apple-hls.js" + }) + } else { + callback({ + cancel: false + }) + } } )