交付双端账号安全、外观设置和加密草稿
This commit is contained in:
1 parent
961fd68f49
commit
752ba88c5c
22 files changed
+896
-38
No files matched your search
+9
-1
@@ -1,4 +1,4 @@
|
||||
import { app, BrowserWindow, ipcMain, Notification, protocol, safeStorage, session } from 'electron'
|
||||
import { app, BrowserWindow, dialog, ipcMain, Notification, protocol, safeStorage, session } from 'electron'
|
||||
import { readFile } from 'node:fs/promises'
|
||||
import { join } from 'node:path'
|
||||
import { signChallenge, signMls } from './identity'
|
||||
@@ -72,6 +72,14 @@ async function start() {
|
||||
win.webContents.setWindowOpenHandler(() => ({ action: 'deny' }))
|
||||
win.webContents.on('will-navigate', (event) => event.preventDefault())
|
||||
win.webContents.on('will-attach-webview', (event) => event.preventDefault())
|
||||
win.webContents.on('will-prevent-unload', (event) => {
|
||||
const choice = dialog.showMessageBoxSync(win, {
|
||||
type: 'warning', title: 'XHChat', message: '还有草稿尚未保存。',
|
||||
detail: '留在应用中等待保存完成或重试。直接离开可能丢失未保存的文字。',
|
||||
buttons: ['继续保存', '离开并放弃未保存内容'], defaultId: 0, cancelId: 0,
|
||||
})
|
||||
if (choice === 1) event.preventDefault()
|
||||
})
|
||||
function trustedSender(event: Electron.IpcMainInvokeEvent) {
|
||||
const frame = event.senderFrame
|
||||
return !win.isDestroyed() && event.sender === win.webContents && frame && frame === win.webContents.mainFrame &&
|
||||
|
||||
Reference in new issue
Block a user