This commit is contained in:
MathieuG-P
2022-05-13 17:38:20 +02:00
parent 7218c36cf4
commit 29cb5f45af
32 changed files with 278 additions and 27 deletions
+4 -2
View File
@@ -42,8 +42,10 @@ ipcMain.on('bs-download.start', async (event, args: InitDownloadInfoInterface) =
console.log(out);
if(out[0] === "[Progress]"){ event.reply('bs-download.progress', out[1]); }
else if(out[0] === "[Password]" || out[0].includes('[Password]')){ event.reply('bs-download.ask-password'); }
else if(out[0] === "[any]"){ event.reply('bs-download.progress', out); }
else if(out[0] === "[Password]"){ event.reply('bs-download.ask-password'); }
else if(out[0] === "[2FA]"){ event.reply('bs-download.ask-2fa'); }
else if(out[0] === "[Guard]"){ event.reply('bs-download.ask-guard'); }
else if(out[0] === "[Error]"){ event.reply('bs-download.error', out); }
});
+2 -1
View File
@@ -1 +1,2 @@
import './bs-download-ipcs';
import './bs-download-ipcs';
import './window-controls-ipcs';
+19
View File
@@ -0,0 +1,19 @@
import { ipcMain } from 'electron';
import { getMainWindow } from '../main';
ipcMain.on('window.close', () => {
getMainWindow()?.close();
});
ipcMain.on('window.maximize', () => {
getMainWindow()?.maximize();
});
ipcMain.on('window.minimize', () => {
getMainWindow()?.minimize();
});
ipcMain.on('window.reset', () => {
console.log('aaaaaa');
getMainWindow()?.restore();
});
+10
View File
@@ -26,6 +26,10 @@ export default class AppUpdater {
let mainWindow: BrowserWindow | null = null;
export function getMainWindow(): BrowserWindow | null{
return mainWindow;
}
ipcMain.on('ipc-example', async (event, arg) => {
const msgTemplate = (pingPong: string) => `IPC test: ${pingPong}`;
console.log(msgTemplate(arg));
@@ -74,6 +78,10 @@ const createWindow = async () => {
show: false,
width: 1024,
height: 728,
minWidth: 800,
minHeight: 500,
frame: false,
titleBarOverlay: false,
icon: getAssetPath('icon.png'),
webPreferences: {
preload: app.isPackaged
@@ -82,6 +90,8 @@ const createWindow = async () => {
},
});
mainWindow.loadURL(resolveHtmlPath('index.html'));
mainWindow.on('ready-to-show', () => {
+1 -1
View File
@@ -1,6 +1,6 @@
import { contextBridge, ipcRenderer, IpcRendererEvent } from 'electron';
export type Channels = 'bs-download.start'|'bs-download.send-input';
export type Channels = 'bs-download.start'|'bs-download.send-input'|'window.close'|'window.maximize'|'window.minimize'|'window.reset';
export type ReplyChannels = 'bs-download.ask-password';