From 8b8b1edf3bf571bdc8812da9381753c8a0508614 Mon Sep 17 00:00:00 2001
From: AkiraFukushima
Date: Thu, 11 May 2023 01:15:14 +0900
Subject: [PATCH] Change webSecurity for BrowserWindow to prevent CORS
---
src/main/index.ts | 28 ++++++++++++----------------
1 file changed, 12 insertions(+), 16 deletions(-)
diff --git a/src/main/index.ts b/src/main/index.ts
index 07856ec8f5..6e94951e90 100644
--- a/src/main/index.ts
+++ b/src/main/index.ts
@@ -302,6 +302,8 @@ async function createWindow() {
webPreferences: {
nodeIntegration: false,
contextIsolation: false,
+ // To prevent CORS in renderer process.
+ webSecurity: false,
preload: path.resolve(__dirname, './preload.js'),
spellcheck: spellcheck
}
@@ -790,22 +792,16 @@ ipcMain.handle('list-fonts', async (_: IpcMainInvokeEvent) => {
})
// Settings
-ipcMain.handle(
- 'get-account-setting',
- async (_: IpcMainInvokeEvent, accountId: number): Promise => {
- const setting = await getSetting(db, accountId)
- return setting
- }
-)
-
-ipcMain.handle(
- 'update-account-setting',
- async (_: IpcMainInvokeEvent, setting: Setting): Promise => {
- console.log(setting)
- const res = await createOrUpdateSetting(db, setting)
- return res
- }
-)
+ipcMain.handle('get-account-setting', async (_: IpcMainInvokeEvent, accountId: number): Promise => {
+ const setting = await getSetting(db, accountId)
+ return setting
+})
+
+ipcMain.handle('update-account-setting', async (_: IpcMainInvokeEvent, setting: Setting): Promise => {
+ console.log(setting)
+ const res = await createOrUpdateSetting(db, setting)
+ return res
+})
// Cache
ipcMain.handle('get-cache-hashtags', async (_: IpcMainInvokeEvent) => {