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

Merge pull request #982 from bagusindrayana/fix_undefined_send

fix : Cannot read properties of undefined (reading 'send') in mac os
This commit is contained in:
2025-04-28 09:51:27 +02:00
committed by GitHub
4 changed files with 1514 additions and 470 deletions

4
.github/FUNDING.yml vendored
View File

@@ -1,6 +1,6 @@
# These are supported funding model platforms
github: [antares-sql,fabio286]
github: # [antares-sql,fabio286]
patreon: #fabio286
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
@@ -9,4 +9,4 @@ community_bridge: # Replace with a single Community Bridge project-name e.g., cl
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: ['https://paypal.me/fabiodistasio']
custom: # ['https://paypal.me/fabiodistasio']

1961
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -214,5 +214,8 @@
"vue-eslint-parser": "~8.3.0",
"webpack-dev-server": "~4.11.1",
"xvfb-maybe": "~0.2.1"
},
"optionalDependencies": {
"dmg-license": "~1.0.11"
}
}

View File

@@ -3,7 +3,13 @@ export type LoggerLevel = 'query' | 'error'
export const ipcLogger = ({ content, cUid, level }: {content: string; cUid: string; level: LoggerLevel}) => {
if (level === 'error') {
if (process.type !== undefined) {
const mainWindow = require('electron').webContents.fromId(1);
const contents = require('electron').webContents.getAllWebContents();
let mainWindow = require('electron').webContents.fromId(1);
contents.forEach(content => {
if (content.send && mainWindow === undefined) {
mainWindow = content;
}
});
mainWindow.send('non-blocking-exception', { cUid, message: content, date: new Date() });
}
if (process.env.NODE_ENV === 'development' && process.type === 'browser') console.log(content);
@@ -12,7 +18,13 @@ export const ipcLogger = ({ content, cUid, level }: {content: string; cUid: stri
// Remove comments, newlines and multiple spaces
const escapedSql = content.replace(/(\/\*(.|[\r\n])*?\*\/)|(--(.*|[\r\n]))/gm, '').replace(/\s\s+/g, ' ');
if (process.type !== undefined) {
const mainWindow = require('electron').webContents.fromId(1);
const contents = require('electron').webContents.getAllWebContents();
let mainWindow = require('electron').webContents.fromId(1);
contents.forEach(content => {
if (content.send && mainWindow === undefined) {
mainWindow = content;
}
});
mainWindow.send('query-log', { cUid, sql: escapedSql, date: new Date() });
}
if (process.env.NODE_ENV === 'development' && process.type === 'browser') console.log(escapedSql);