Skip to content

Commit

Permalink
Push Security Items to another PR
Browse files Browse the repository at this point in the history
  • Loading branch information
KenCorma committed Oct 31, 2024
1 parent d4926f7 commit 133845c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 21 deletions.
1 change: 0 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="Content-Security-Policy" content="script-src 'self'" />
<title>ComfyUI</title>
</head>
<body>
Expand Down
21 changes: 1 addition & 20 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
IPCChannel,
SENTRY_URL_ENDPOINT,
} from './constants';
import { app, BrowserWindow, session, dialog, screen, ipcMain, Menu, MenuItem, shell } from 'electron';
import { app, BrowserWindow, dialog, screen, ipcMain, Menu, MenuItem, shell } from 'electron';
import log from 'electron-log/main';
import * as Sentry from '@sentry/electron/main';
import Store from 'electron-store';
Expand Down Expand Up @@ -246,12 +246,6 @@ async function loadRendererIntoMainWindow(): Promise<void> {
} else {
mainWindow.loadFile(path.join(__dirname, `../renderer/index.html`));
}

session.defaultSession.setPermissionRequestHandler((webContents, permission, callback) => {
// At this time Prevent all unknown permission requests
if (permission == 'unknown') callback(false);
callback(true);
});
}

function restartApp({ customMessage, delay }: { customMessage?: string; delay?: number } = {}): void {
Expand Down Expand Up @@ -388,19 +382,6 @@ export const createWindow = async (userResourcesPath?: string): Promise<BrowserW
mainWindow.on('resize', updateBounds);
mainWindow.on('move', updateBounds);

// Prevent URL hijacking
mainWindow.webContents.on('will-navigate', (event, newURL) => {
const approvedHosts: Array<string> = [
`http://${host}:${port}`,
process.env.VITE_DEV_SERVER_URL as string,
'/renderer/index.html',
];
const approved = approvedHosts.filter((e) => newURL.endsWith(e));
if (!approved.length) {
event.preventDefault();
}
});

mainWindow.on('close', (e: Electron.Event) => {
// Mac Only Behavior
if (process.platform === 'darwin') {
Expand Down

0 comments on commit 133845c

Please sign in to comment.