Skip to content

A full-featured download manager.

refactor: protocol manager init

Dr_rOote5241d09d70d
diff --git a/src/main/Application.js b/src/main/Application.js
index 1fccfb3d..fdf79306 100644
--- a/src/main/Application.js
+++ b/src/main/Application.js
@@ -423,10 +423,6 @@ export default class Application extends EventEmitter {
}
initProtocolManager () {
- if (is.dev() || is.mas()) {
- return
- }
-
const protocols = this.configManager.getUserConfig('protocols', {})
this.protocolManager = new ProtocolManager({
protocols
@@ -434,10 +430,6 @@ export default class Application extends EventEmitter {
}
handleProtocol (url) {
- if (is.dev() || is.mas()) {
- return
- }
-
this.show()
this.protocolManager.handle(url)
diff --git a/src/main/core/ProtocolManager.js b/src/main/core/ProtocolManager.js
index da900def..6cd2bbfe 100644
--- a/src/main/core/ProtocolManager.js
+++ b/src/main/core/ProtocolManager.js
@@ -1,5 +1,6 @@
import { EventEmitter } from 'events'
import { app } from 'electron'
+import is from 'electron-is'
import { parse } from 'querystring'
import logger from './Logger'
@@ -28,6 +29,10 @@ export default class ProtocolManager extends EventEmitter {
}
setup (protocols) {
+ if (is.dev() || is.mas()) {
+ return
+ }
+
Object.keys(protocols).forEach((protocol) => {
const enabled = protocols[protocol]
if (enabled) {