1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-06-05 21:59:22 +02:00

perf(core): improved app security, fixes #666

This commit is contained in:
2023-09-13 17:21:08 +00:00
parent 0de5ef8a98
commit 13592425af
14 changed files with 203 additions and 14 deletions

View File

@ -0,0 +1,11 @@
import { WebFrameMain } from 'electron';
import * as path from 'path';
const isDevelopment = process.env.NODE_ENV !== 'production';
const indexPath = path.resolve(__dirname, 'index.html').split(path.sep).join('/');
export function validateSender (frame: WebFrameMain) {
const frameUrl = new URL(frame.url);
if ((isDevelopment && frameUrl.host === 'localhost:9080') || frameUrl.href.replace('file:///', '').replace('file://localhost', '') === indexPath) return true;
return false;
}