mirror of https://github.com/Fabio286/antares.git
perf: improved ipc validation on Linux
This commit is contained in:
parent
13592425af
commit
9de5f67d18
|
@ -2,10 +2,14 @@ import { WebFrameMain } from 'electron';
|
|||
import * as path from 'path';
|
||||
|
||||
const isDevelopment = process.env.NODE_ENV !== 'production';
|
||||
const isWindows = process.platform === 'win32';
|
||||
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;
|
||||
const prefix = isWindows ? 'file:///' : 'file://';
|
||||
const framePath = frameUrl.href.replace(prefix, '');
|
||||
|
||||
if ((isDevelopment && frameUrl.host === 'localhost:9080') || framePath === indexPath) return true;
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ import * as Store from 'electron-store';
|
|||
import { defineStore } from 'pinia';
|
||||
|
||||
const persistentStore = new Store({ name: 'settings' });
|
||||
export type UpdateStatus = 'noupdate' | 'available' | 'checking' | 'nocheck' | 'downloading' | 'downloaded' | 'disabled';
|
||||
export type UpdateStatus = 'noupdate' | 'available' | 'checking' | 'nocheck' | 'downloading' | 'downloaded' | 'disabled' | 'link';
|
||||
|
||||
export const useApplicationStore = defineStore('application', {
|
||||
state: () => ({
|
||||
|
|
Loading…
Reference in New Issue