mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 02:31:45 +00:00
feat: apply suggestion
This commit is contained in:
18
index.js
18
index.js
@ -258,15 +258,6 @@ function createMainWindow() {
|
||||
}
|
||||
|
||||
app.once("browser-window-created", (event, win) => {
|
||||
electron.session.defaultSession.webRequest.onHeadersReceived((details, callback) => {
|
||||
callback({
|
||||
responseHeaders: {
|
||||
...details.responseHeaders,
|
||||
"Content-Security-Policy": ["default-src 'self' music.youtube.com youtube.com accounts.google.com google.com"]
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
if (config.get("options.overrideUserAgent")) {
|
||||
// User agents are from https://developers.whatismybrowser.com/useragents/explore/
|
||||
const originalUserAgent = win.webContents.userAgent;
|
||||
@ -506,13 +497,12 @@ function removeContentSecurityPolicy(
|
||||
|
||||
// Custom listener to tweak the content security policy
|
||||
session.webRequest.onHeadersReceived(function (details, callback) {
|
||||
if (
|
||||
!details.responseHeaders["content-security-policy-report-only"] &&
|
||||
!details.responseHeaders["content-security-policy"]
|
||||
)
|
||||
return callback({ cancel: false });
|
||||
details.responseHeaders ??= {}
|
||||
|
||||
// Remove the content security policy
|
||||
delete details.responseHeaders["content-security-policy-report-only"];
|
||||
delete details.responseHeaders["content-security-policy"];
|
||||
|
||||
callback({ cancel: false, responseHeaders: details.responseHeaders });
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user