From 34de2bd29539c47cee021605b0efdffc5a45e6f7 Mon Sep 17 00:00:00 2001 From: ThaUnknown <6506529+ThaUnknown@users.noreply.github.com> Date: Fri, 2 Dec 2022 01:52:14 +0100 Subject: [PATCH] fix: process leak --- package.json | 2 +- src/index.js | 28 ++++++++++------------------ src/renderer/src/modules/anime.js | 8 -------- 3 files changed, 11 insertions(+), 27 deletions(-) diff --git a/package.json b/package.json index f5f6399..e1b2bd7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "Miru", - "version": "3.3.1", + "version": "3.3.2", "author": "ThaUnknown_ ", "description": "Stream anime torrents, real-time with no waiting for downloads.", "main": "src/index.js", diff --git a/src/index.js b/src/index.js index fd3f2ef..85bb8ba 100644 --- a/src/index.js +++ b/src/index.js @@ -97,6 +97,15 @@ ipcMain.on('devtools', () => { function createWindow () { // Create the browser window. + webtorrentWindow = new BrowserWindow({ + show: false, + webPreferences: { + nodeIntegration: true, + contextIsolation: false, + enableRemoteModule: true, + backgroundThrottling: false + } + }) mainWindow = new BrowserWindow({ width: 1600, height: 900, @@ -111,15 +120,6 @@ function createWindow () { icon: path.join(__dirname, '/renderer/public/logo.ico'), show: false }) - webtorrentWindow = new BrowserWindow({ - show: false, - webPreferences: { - nodeIntegration: true, - contextIsolation: false, - enableRemoteModule: true, - backgroundThrottling: false - } - }) mainWindow.setMenuBarVisibility(false) protocol.registerHttpProtocol('miru', (req, cb) => { @@ -141,8 +141,6 @@ function createWindow () { callback(headers) }) - // This block of code is intended for development purpose only. - // Delete this entire block of code when you are ready to package the application. if (process.env.NODE_ENV !== 'development ') { // Load production build webtorrentWindow.loadFile(path.join(__dirname, '/renderer/dist/webtorrent.html')) @@ -162,6 +160,7 @@ function createWindow () { // in an array if your app supports multi windows, this is the time // when you should delete the corresponding element. mainWindow = null + app.quit() }) let crashcount = 0 @@ -196,13 +195,6 @@ function createWindow () { // Some APIs can only be used after this event occurs. app.on('ready', createWindow) -// Quit when all windows are closed. -app.on('window-all-closed', () => { - // On macOS it is common for applications and their menu bar - // to stay active until the user quits explicitly with Cmd + Q - if (process.platform !== 'darwin') app.quit() -}) - app.on('activate', () => { // On macOS it's common to re-create a window in the app when the // dock icon is clicked and there are no other windows open. diff --git a/src/renderer/src/modules/anime.js b/src/renderer/src/modules/anime.js index 7dd7fa2..6473738 100644 --- a/src/renderer/src/modules/anime.js +++ b/src/renderer/src/modules/anime.js @@ -147,14 +147,6 @@ async function resolveTitle (name) { function getParseObjTitle (obj) { let title = obj.anime_title - - const match = title.match(/ S(\d{1,2})E(\d{1,2})v\d/) - if (match) { - obj.episode_number = match[2] - obj.anime_season = match[1] - obj.anime_title = title.replace(/ S(\d{1,2})E(\d{1,2})v\d/, '') - title = obj.anime_title - } if (obj.anime_year) title += ` ${obj.anime_year}` if (obj.anime_season > 1) title += ' S' + obj.anime_season return title