diff --git a/src/main/libs/misc/validateSender.ts b/src/main/libs/misc/validateSender.ts index 06cc186e..63502971 100644 --- a/src/main/libs/misc/validateSender.ts +++ b/src/main/libs/misc/validateSender.ts @@ -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; } diff --git a/src/renderer/stores/application.ts b/src/renderer/stores/application.ts index 7bebd0d8..51a78d10 100644 --- a/src/renderer/stores/application.ts +++ b/src/renderer/stores/application.ts @@ -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: () => ({