aboutsummarylogtreecommitdiffstats
path: root/index.js.in
blob: bd92bc30583637f8a1454650743c00932c6fcef7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const { app, BrowserWindow } = require("electron");
const path = require("path");

app.whenReady().then(() => {
	const mainWindow = new BrowserWindow({
		autoHideMenuBar: true,
		backgroundColor: "#161512",
		webPreferences: {
			preload: path.join(app.getAppPath(), "preload.js"),
			sandbox: false,
		},
	});
	mainWindow.loadFile("www/index.html");
	mainWindow.webContents.session.webRequest.onBeforeSendHeaders(
		{urls: ["https://lichess.org/*", "wss://socket.lichess.org/*"]},
		(details, callback) => {
			details.requestHeaders.Origin = "https://lichess.org";
			details.requestHeaders["User-Agent"] += " Lichobile/%VERSION%";
			callback({requestHeaders: details.requestHeaders});
		},
	);
});

app.on("window-all-closed", () => {
	app.quit();
});