Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue/5753 #615

Merged
merged 2 commits into from
Feb 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions app/src/main/electron/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import registerGlobalShortcut from './functions/registerGlobalShortcut';
import checkUpdate from './functions/checkUpdate';
import MainRouter from '../mainRouter.build';
import createLogger from './functions/createLogger';
import isValidAsarFile from './modifyValidator';

const logger = createLogger('electron/index.ts');

Expand Down Expand Up @@ -128,18 +127,6 @@ if (!app.requestSingleInstanceLock()) {
mainRouter.selectHardware(autoOpenHardwareId);
}, 1000);
}

setTimeout(async () => {
try {
const result = await isValidAsarFile();
if (!result) {
mainWindow?.webContents.send('invalidAsarFile');
}
} catch (e) {
console.log(e);
mainWindow?.webContents.send('invalidAsarFile');
}
}, 2000);
});

ipcMain.on('hardwareForceClose', () => {
Expand Down
15 changes: 13 additions & 2 deletions app/src/main/mainRouter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import directoryPaths from './core/directoryPaths';
import BaseScanner from './core/baseScanner';
import BaseConnector from './core/baseConnector';
import SerialConnector from './core/serial/connector';
import isValidAsarFile from './electron/modifyValidator';

const nativeNodeRequire = require('./nativeNodeRequire.js');
const logger = createLogger('core/mainRouter.ts');
Expand Down Expand Up @@ -239,7 +240,7 @@ class MainRouter {
if (connector) {
logger.info(
`[Device Info] ${config.id} | ${
config?.name?.ko || config?.name?.en || 'noname'
config?.name?.ko || config?.name?.en || 'noname'
}`
);
this.connector = connector;
Expand Down Expand Up @@ -536,11 +537,21 @@ class MainRouter {
this.flasher.kill();
this.config && this.startScan(this.config);
});
ipcMain.handle('isValidAsarFile', async (event) => {
try {
const result = await isValidAsarFile();
console.log("isValidAsarFile : ", result);
return result;
} catch (e) {
console.log(e);
return false;
}
})
ipcMain.on('getSharedObject', (e) => {
e.returnValue = global.sharedObject;
});
ipcMain.on('canShowCustomButton', (e) => {
if(this.hwModule && this.hwModule.canShowCustomButton) {
if (this.hwModule && this.hwModule.canShowCustomButton) {
e.returnValue = this.hwModule.canShowCustomButton();
} else {
e.returnValue = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ class IpcRendererWatchComponent extends React.PureComponent<IProps> {
ipcRenderer.removeAllListeners('portListScanned');
ipcRenderer.removeAllListeners('cloudMode');
ipcRenderer.removeAllListeners('socketConnected');
ipcRenderer.removeAllListeners('invalidAsarFile');

ipcRenderer.on('invalidAsarFile', () => {
props.invalidateBuild();
});
ipcRenderer.invoke('isValidAsarFile').then((result: boolean) => {
if(!result){
props.invalidateBuild();
}
})

ipcRenderer.on('console', (event, ...args: any[]) => {
console.log(...args);
Expand Down