fix: Electron HTTP fix + stripped background fix

This commit is contained in:
LukeGus
2025-11-01 21:59:49 -05:00
parent 994d00e91f
commit a52a5217bf
11 changed files with 128 additions and 26 deletions

View File

@@ -64,6 +64,8 @@ function createWindow() {
contextIsolation: true,
webSecurity: true,
preload: path.join(__dirname, "preload.js"),
partition: "persist:termix",
allowRunningInsecureContent: false,
},
show: false,
});
@@ -123,6 +125,20 @@ function createWindow() {
delete headers["Content-Security-Policy"];
}
}
if (headers["set-cookie"]) {
headers["set-cookie"] = headers["set-cookie"].map((cookie) => {
let modified = cookie.replace(/;\s*SameSite=Strict/gi, "; SameSite=None");
modified = modified.replace(/;\s*SameSite=Lax/gi, "; SameSite=None");
if (!modified.includes("SameSite=")) {
modified += "; SameSite=None";
}
if (!modified.includes("Secure") && details.url.startsWith("https")) {
modified += "; Secure";
}
return modified;
});
}
}
callback({ responseHeaders: headers });