-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.js
59 lines (53 loc) · 1.2 KB
/
main.js
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
const { app, BrowserWindow, screen, Menu } = require("electron");
const path = require("path");
const mkdir = require("mkdirplz");
const config = require("./config.json");
const util = require("util");
require("electron-reload")(__dirname);
require("./lbry");
async function createWindow (width, height)
{
try
{
await mkdir(path.join(__dirname, config.lbry.space));
await mkdir(path.join(__dirname, config.lbry.inbox));
await mkdir(path.join(__dirname, config.lbry.tmp));
}
catch {}
// Menu.setApplicationMenu(null);
const win = new BrowserWindow({
width,
height,
icon: path.join(__dirname, "/app/logo.png"),
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
enableRemoteModule: true,
allowEval: false
}
});
win.loadFile("./app/index.html");
}
app.whenReady().then(() =>
{
const { width, height } = screen.getPrimaryDisplay().workAreaSize;
createWindow(width, height);
app.on("activate", () =>
{
if (BrowserWindow.getAllWindows().length === 0)
{
createWindow();
}
});
});
app.on("window-all-closed", () =>
{
if (process.platform !== "darwin")
{
app.quit();
}
});
log = function (obj)
{
console.log(util.inspect(obj, false, null, true));
};