A full-featured download manager.
refactor: engine rpc config
Dr_rOote470ed00d64c
diff --git a/src/renderer/api/Api.js b/src/renderer/api/Api.jsindex 0297a709..db6b2fbe 100644--- a/src/renderer/api/Api.js+++ b/src/renderer/api/Api.js@@ -10,7 +10,7 @@ import {changeKeysToCamelCase,changeKeysToKebabCase} from '@shared/utils'-import { EMPTY_STRING } from '@shared/constants'+import { EMPTY_STRING, ENGINE_RPC_HOST } from '@shared/constants'const application = remote.getGlobal('application')@@ -55,7 +55,7 @@ export default class Api {rpcListenPort: port,rpcSecret: secret} = this.config- const host = '127.0.0.1'+ const host = ENGINE_RPC_HOSTthis.client = new Aria2({host,port,diff --git a/src/shared/constants.js b/src/shared/constants.jsindex 21a4ad9d..c5d57e2a 100644--- a/src/shared/constants.js+++ b/src/shared/constants.js@@ -8,6 +8,9 @@ export const APP_RUN_MODE = {MENU_BAR: 2}+export const ENGINE_RPC_HOST = '127.0.0.1'+export const ENGINE_RPC_PORT = 16800+/*** @see https://github.com/ngosang/trackerslist*/diff --git a/src/shared/utils.js b/src/shared/utils.jsindex 5e888671..3ee0e26e 100644--- a/src/shared/utils.js+++ b/src/shared/utils.js@@ -13,6 +13,7 @@ import {} from 'lodash'import { resolve } from 'path'import { userKeys, systemKeys, needRestartKeys } from './configKeys'+import { ENGINE_RPC_HOST } from '@shared/constants'export function bytesToSize (bytes) {const b = parseInt(bytes, 10)@@ -563,7 +564,7 @@ export function formatOptionsForEngine (options) {export function buildRpcUrl (options) {const { port, secret } = options- let result = `127.0.0.1:${port}/jsonrpc`+ let result = `${ENGINE_RPC_HOST}:${port}/jsonrpc`if (secret) {result = `token:${secret}@${result}`}