changed to wildcard for hls.js when intercepting
This commit is contained in:
parent
f92b5ac293
commit
da5a80c46a
1 changed files with 11 additions and 4 deletions
|
@ -52,15 +52,22 @@ const CiderBase = {
|
||||||
win = new BrowserWindow(options)
|
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
|
// 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(
|
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) => {
|
(details, callback) => {
|
||||||
|
if (details.url.includes("hls.js")) {
|
||||||
callback({
|
callback({
|
||||||
redirectURL: "http://localhost:9000/apple-hls.js"
|
redirectURL: "http://localhost:9000/apple-hls.js"
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
callback({
|
||||||
|
cancel: false
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue