Commit 00fb510b authored by 神楽坂玲奈's avatar 神楽坂玲奈

fix

parent b7b2d8ac
...@@ -58,7 +58,7 @@ export class AppsService { ...@@ -58,7 +58,7 @@ export class AppsService {
maotama: Promise<ChildProcess>; maotama: Promise<ChildProcess>;
readonly tarPath = process.platform === 'win32' ? readonly tarPath = process.platform === 'win32' ?
path.join(process.env['NODE_ENV'] === 'production' ? process.resourcesPath : '', 'bin', 'bsdtar.exe') path.join(process.env['NODE_ENV'] === 'production' ? process.resourcesPath! : '', 'bin', 'bsdtar.exe')
: 'bsdtar'; : 'bsdtar';
constructor(private http: Http, private settingsService: SettingsService, private ref: ApplicationRef, constructor(private http: Http, private settingsService: SettingsService, private ref: ApplicationRef,
......
...@@ -3,13 +3,13 @@ ...@@ -3,13 +3,13 @@
// 处理提权 // 处理提权
function handleElevate() { function handleElevate() {
// for debug // for debug
if (process.argv[1] == '.') { if (process.argv[1] === '.') {
process.argv[1] = process.argv[2]; process.argv[1] = process.argv[2];
process.argv[2] = process.argv[3]; process.argv[2] = process.argv[3];
} }
if (process.argv[1] == '-e') { if (process.argv[1] === '-e') {
if (process.platform == 'darwin') { if (process.platform === 'darwin') {
require('electron').app.dock.hide(); require('electron').app.dock.hide();
} }
let elevate = JSON.parse(new Buffer(process.argv[2], 'base64').toString()); let elevate = JSON.parse(new Buffer(process.argv[2], 'base64').toString());
...@@ -28,7 +28,7 @@ if (handleElevate()) { ...@@ -28,7 +28,7 @@ if (handleElevate()) {
} }
const {ipcMain, app, shell, BrowserWindow, Menu, Tray} = require('electron'); const {ipcMain, app, shell, BrowserWindow, Menu, Tray} = require('electron');
const {autoUpdater} = require("electron-auto-updater"); const { autoUpdater } = require('electron-updater');
const isDev = require('electron-is-dev'); const isDev = require('electron-is-dev');
const child_process = require('child_process'); const child_process = require('child_process');
const path = require('path'); const path = require('path');
...@@ -114,14 +114,14 @@ function createAria2c() { ...@@ -114,14 +114,14 @@ function createAria2c() {
let aria2c_path; let aria2c_path;
switch (process.platform) { switch (process.platform) {
case 'win32': case 'win32':
if (process.env['NODE_ENV'] == 'production') { if (process.env['NODE_ENV'] === 'production') {
aria2c_path = path.join(process.resourcesPath, 'bin', 'aria2c.exe'); aria2c_path = path.join(process.resourcesPath, 'bin', 'aria2c.exe');
} else { } else {
aria2c_path = path.join('bin', 'aria2c.exe'); aria2c_path = path.join('bin', 'aria2c.exe');
} }
break; break;
case 'darwin': case 'darwin':
if (process.env['NODE_ENV'] == 'production') { if (process.env['NODE_ENV'] === 'production') {
aria2c_path = path.join(process.resourcesPath, 'bin', 'aria2c'); aria2c_path = path.join(process.resourcesPath, 'bin', 'aria2c');
} else { } else {
aria2c_path = path.join('bin', 'aria2c'); aria2c_path = path.join('bin', 'aria2c');
...@@ -142,9 +142,9 @@ function createWindow() { ...@@ -142,9 +142,9 @@ function createWindow() {
height: 640, height: 640,
minWidth: 1024, minWidth: 1024,
minHeight: 640, minHeight: 640,
frame: process.platform == 'darwin', frame: process.platform === 'darwin',
// transparent: process.platform != 'darwin', // transparent: process.platform != 'darwin',
titleBarStyle: process.platform == 'darwin' ? 'hidden' : null titleBarStyle: process.platform === 'darwin' ? 'hidden' : null
}); });
// and load the index.html of the app. // and load the index.html of the app.
...@@ -156,7 +156,7 @@ function createWindow() { ...@@ -156,7 +156,7 @@ function createWindow() {
}); });
// Open the DevTools. // Open the DevTools.
if (process.env['NODE_ENV'] == 'development') { if (process.env['NODE_ENV'] === 'development') {
mainWindow.webContents.openDevTools(); mainWindow.webContents.openDevTools();
} }
...@@ -171,7 +171,7 @@ function createWindow() { ...@@ -171,7 +171,7 @@ function createWindow() {
let tray; let tray;
function createTray() { function createTray() {
tray = new Tray(path.join(process.env['NODE_ENV'] == 'production' ? process.resourcesPath : app.getAppPath(), 'images', 'icon.ico')); tray = new Tray(path.join(process.env['NODE_ENV'] === 'production' ? process.resourcesPath : app.getAppPath(), 'images', 'icon.ico'));
tray.on('click', (event) => { tray.on('click', (event) => {
console.log(event); console.log(event);
if (event.metaKey) { if (event.metaKey) {
...@@ -202,10 +202,10 @@ function createTray() { ...@@ -202,10 +202,10 @@ function createTray() {
// Some APIs can only be used after this event occurs. // Some APIs can only be used after this event occurs.
app.on('ready', () => { app.on('ready', () => {
createWindow(); createWindow();
if (process.platform == 'win32') { if (process.platform === 'win32') {
createTray() createTray()
} }
if (process.env['NODE_ENV'] == 'production') { if (process.env['NODE_ENV'] === 'production') {
autoUpdater.checkForUpdates() autoUpdater.checkForUpdates()
} }
}); });
...@@ -232,7 +232,7 @@ app.on('activate', function () { ...@@ -232,7 +232,7 @@ app.on('activate', function () {
app.on('quit', () => { app.on('quit', () => {
// windows 在非 detach 模式下会自动退出子进程 // windows 在非 detach 模式下会自动退出子进程
if (process.platform != 'win32') { if (process.platform !== 'win32') {
aria2c.kill() aria2c.kill()
} }
}); });
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment