MCPcopy Index your code
hub / github.com/PeerViewer/codebase / createWindow

Function createWindow

src/main.js:24–63  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

22}
23
24const createWindow = () => {
25 // Create the browser window.
26 const mainWindow = new BrowserWindow({
27 width: 1350,
28 height: 780,
29 webPreferences: {
30 preload: MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY,
31 nodeIntegration: true,
32 contextIsolation: false,
33 devTools: false // enable chrome developer tools (when pressing ctrl-shift-i)
34 },
35 });
36
37 // app.dock.hide(); // Only works/necessary on mac?
38 mainWindow.setMenuBarVisibility(false); // Only Windows and Linux
39
40 // and load the index.html of the app.
41 mainWindow.loadURL(MAIN_WINDOW_WEBPACK_ENTRY);
42
43 // Open the DevTools at startup instead of requiring CTRL-ALT-i to be pressed:
44 // mainWindow.webContents.openDevTools();
45
46 // Allow iframe'ing lnbits
47 const { session } = require('electron')
48 session.defaultSession.webRequest.onHeadersReceived((details, callback) => {
49 callback({
50 responseHeaders: {
51 ...details.responseHeaders,
52 'Content-Security-Policy': ["default-src 'self' 'unsafe-inline' data:; script-src 'self' 'unsafe-eval' 'unsafe-inline' data:; frame-src 'self' https://legend.lnbits.com"]
53 }
54 })
55 });
56
57 // Open target="_blank" links in external browser window
58 mainWindow.webContents.setWindowOpenHandler(({ url }) => {
59 shell.openExternal(url);
60 return { action: 'deny' };
61 });
62
63};
64
65// This method will be called when Electron has finished
66// initialization and is ready to create browser windows.

Callers 1

main.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected