1
0
mirror of https://github.com/jiahaog/Nativefier synced 2024-06-22 07:16:34 +02:00

Use userAgentFallback for userAgent injection (PR #1316)

Per the suggestion of @fireflinchdev , this seems to alleviate our issues with things like nuking service workers for WhatsApp. The core reason being those service workers were getting the original userAgent, and not the override (if specified). This PR should fix that.

So it should resolve #1312 #719 and hopefully a few future issues as this seems to come up frequently.
This commit is contained in:
Adam Weeden 2021-11-29 16:53:12 -05:00 committed by GitHub
parent b9c5e2b464
commit 5f02f14626
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 9 deletions

View File

@ -171,10 +171,6 @@ export function setupNativefierWindow(
options: WindowOptions,
window: BrowserWindow,
): void {
if (options.userAgent) {
window.webContents.userAgent = options.userAgent;
}
if (options.proxyRules) {
setProxyRules(window, options.proxyRules);
}

View File

@ -59,11 +59,15 @@ if (appArgs.portable) {
}
if (!appArgs.userAgentHonest) {
app.userAgentFallback = removeUserAgentSpecifics(
app.userAgentFallback,
app.getName(),
app.getVersion(),
);
if (appArgs.userAgent) {
app.userAgentFallback = appArgs.userAgent;
} else {
app.userAgentFallback = removeUserAgentSpecifics(
app.userAgentFallback,
app.getName(),
app.getVersion(),
);
}
}
// Take in a URL on the command line as an override