mirror of
https://github.com/NoCrypt/migu.git
synced 2026-04-21 00:22:08 +00:00
fix: process leak
This commit is contained in:
parent
389549d93d
commit
34de2bd295
3 changed files with 11 additions and 27 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "Miru",
|
"name": "Miru",
|
||||||
"version": "3.3.1",
|
"version": "3.3.2",
|
||||||
"author": "ThaUnknown_ <ThaUnknown@users.noreply.github.com>",
|
"author": "ThaUnknown_ <ThaUnknown@users.noreply.github.com>",
|
||||||
"description": "Stream anime torrents, real-time with no waiting for downloads.",
|
"description": "Stream anime torrents, real-time with no waiting for downloads.",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
|
|
|
||||||
28
src/index.js
28
src/index.js
|
|
@ -97,6 +97,15 @@ ipcMain.on('devtools', () => {
|
||||||
|
|
||||||
function createWindow () {
|
function createWindow () {
|
||||||
// Create the browser window.
|
// Create the browser window.
|
||||||
|
webtorrentWindow = new BrowserWindow({
|
||||||
|
show: false,
|
||||||
|
webPreferences: {
|
||||||
|
nodeIntegration: true,
|
||||||
|
contextIsolation: false,
|
||||||
|
enableRemoteModule: true,
|
||||||
|
backgroundThrottling: false
|
||||||
|
}
|
||||||
|
})
|
||||||
mainWindow = new BrowserWindow({
|
mainWindow = new BrowserWindow({
|
||||||
width: 1600,
|
width: 1600,
|
||||||
height: 900,
|
height: 900,
|
||||||
|
|
@ -111,15 +120,6 @@ function createWindow () {
|
||||||
icon: path.join(__dirname, '/renderer/public/logo.ico'),
|
icon: path.join(__dirname, '/renderer/public/logo.ico'),
|
||||||
show: false
|
show: false
|
||||||
})
|
})
|
||||||
webtorrentWindow = new BrowserWindow({
|
|
||||||
show: false,
|
|
||||||
webPreferences: {
|
|
||||||
nodeIntegration: true,
|
|
||||||
contextIsolation: false,
|
|
||||||
enableRemoteModule: true,
|
|
||||||
backgroundThrottling: false
|
|
||||||
}
|
|
||||||
})
|
|
||||||
mainWindow.setMenuBarVisibility(false)
|
mainWindow.setMenuBarVisibility(false)
|
||||||
|
|
||||||
protocol.registerHttpProtocol('miru', (req, cb) => {
|
protocol.registerHttpProtocol('miru', (req, cb) => {
|
||||||
|
|
@ -141,8 +141,6 @@ function createWindow () {
|
||||||
callback(headers)
|
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 ') {
|
if (process.env.NODE_ENV !== 'development ') {
|
||||||
// Load production build
|
// Load production build
|
||||||
webtorrentWindow.loadFile(path.join(__dirname, '/renderer/dist/webtorrent.html'))
|
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
|
// in an array if your app supports multi windows, this is the time
|
||||||
// when you should delete the corresponding element.
|
// when you should delete the corresponding element.
|
||||||
mainWindow = null
|
mainWindow = null
|
||||||
|
app.quit()
|
||||||
})
|
})
|
||||||
|
|
||||||
let crashcount = 0
|
let crashcount = 0
|
||||||
|
|
@ -196,13 +195,6 @@ function createWindow () {
|
||||||
// Some APIs can only be used after this event occurs.
|
// Some APIs can only be used after this event occurs.
|
||||||
app.on('ready', createWindow)
|
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', () => {
|
app.on('activate', () => {
|
||||||
// On macOS it's common to re-create a window in the app when the
|
// 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.
|
// dock icon is clicked and there are no other windows open.
|
||||||
|
|
|
||||||
|
|
@ -147,14 +147,6 @@ async function resolveTitle (name) {
|
||||||
|
|
||||||
function getParseObjTitle (obj) {
|
function getParseObjTitle (obj) {
|
||||||
let title = obj.anime_title
|
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_year) title += ` ${obj.anime_year}`
|
||||||
if (obj.anime_season > 1) title += ' S' + obj.anime_season
|
if (obj.anime_season > 1) title += ' S' + obj.anime_season
|
||||||
return title
|
return title
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue