mirror of
https://github.com/smartfrigde/armcord.git
synced 2024-08-14 23:56:58 +00:00
feat: improve useragent generation
This commit is contained in:
parent
2eece1ca39
commit
dc607615f6
1 changed files with 5 additions and 6 deletions
|
@ -20,7 +20,6 @@ import {forceQuit, setForceQuit} from "../common/forceQuit.js";
|
||||||
export let mainWindows: BrowserWindow[] = [];
|
export let mainWindows: BrowserWindow[] = [];
|
||||||
export let inviteWindow: BrowserWindow;
|
export let inviteWindow: BrowserWindow;
|
||||||
|
|
||||||
let osType = os.type();
|
|
||||||
contextMenu({
|
contextMenu({
|
||||||
showSaveImageAs: true,
|
showSaveImageAs: true,
|
||||||
showCopyImageAddress: true,
|
showCopyImageAddress: true,
|
||||||
|
@ -66,11 +65,11 @@ function doAfterDefiningTheWindow(passedWindow: BrowserWindow): void {
|
||||||
passedWindow.webContents.userAgent =
|
passedWindow.webContents.userAgent =
|
||||||
"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.149 Mobile Safari/537.36";
|
"Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.5005.149 Mobile Safari/537.36";
|
||||||
} else {
|
} else {
|
||||||
// A little sloppy but it works :p
|
var osType = process.platform === "darwin" ? "Macintosh" : process.platform === "win32" ? "Windows" : "Linux";
|
||||||
if (osType == "Windows_NT") {
|
if (osType === "Linux") osType = "X11; " + osType;
|
||||||
osType = `Windows ${os.release().split(".")[0]} (${os.release()})`;
|
const chromeVersion = process.versions.chrome;
|
||||||
}
|
const userAgent = `Mozilla/5.0 (${osType} ${os.arch()}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${chromeVersion} Safari/537.36`;
|
||||||
passedWindow.webContents.userAgent = `Mozilla/5.0 (X11; ${osType} ${os.arch()}) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36`; //fake useragent for screenshare to work
|
passedWindow.webContents.userAgent = userAgent;
|
||||||
}
|
}
|
||||||
if (mainWindows.length === 1) {
|
if (mainWindows.length === 1) {
|
||||||
app.on("second-instance", (_event, _commandLine, _workingDirectory, additionalData) => {
|
app.on("second-instance", (_event, _commandLine, _workingDirectory, additionalData) => {
|
||||||
|
|
Loading…
Reference in a new issue