From c2d0c05bcf42a38e39fd32be1d7b21ea921a4341 Mon Sep 17 00:00:00 2001 From: MiaoWoo Date: Wed, 24 Apr 2019 09:25:02 +0800 Subject: [PATCH] fix: server console load error Signed-off-by: MiaoWoo --- src/main/resources/core/detect.js | 11 ----------- src/main/resources/core/init.js | 17 ++++++++++++++++- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/main/resources/core/detect.js b/src/main/resources/core/detect.js index 42e0449..9ad2a6d 100644 --- a/src/main/resources/core/detect.js +++ b/src/main/resources/core/detect.js @@ -20,14 +20,3 @@ try { } catch (ex) { // IGNORE } -/** - * 尝试加载特殊的Console类 - */ -if (DetectServerType) { - try { - load(root + '/internal/' + DetectServerType + '/console.js'); - } catch (ex) { - // IGNORE - } -} -global.console = new global.Console(); \ No newline at end of file diff --git a/src/main/resources/core/init.js b/src/main/resources/core/init.js index 7a467bd..f101e9a 100644 --- a/src/main/resources/core/init.js +++ b/src/main/resources/core/init.js @@ -12,6 +12,7 @@ loadPatch(); loadRequire(); try { + loadServerConsole(); loadServerLib(); loadPlugins(); } catch (ex) { @@ -27,6 +28,7 @@ function loadCore() { // 加载Console load(root + '/core/console.js'); + global.console = new global.Console(); // 探测服务器类型 load(root + '/core/detect.js'); } @@ -65,6 +67,20 @@ } } + /** + * 尝试加载特殊的Console类 + */ + function loadServerConsole() { + if (DetectServerType) { + try { + requireInternal('console'); + global.console = new global.Console(); + } catch (ex) { + // IGNORE + } + } + } + /** * 加载系统类库 */ @@ -100,7 +116,6 @@ } } - // noinspection JSUnusedLocalSymbols /** * 关闭插件Hook */