From 86199cca059528bda91d14aa6d7b1feacd181268 Mon Sep 17 00:00:00 2001 From: MaysWind Date: Mon, 1 Aug 2016 22:18:00 +0800 Subject: [PATCH] fix getting default rpc host error when access AriaNg by opening file directly --- src/scripts/config/constants.js | 1 + src/scripts/services/ariaNgSettingService.js | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/scripts/config/constants.js b/src/scripts/config/constants.js index 23b506e..0402fbc 100644 --- a/src/scripts/config/constants.js +++ b/src/scripts/config/constants.js @@ -9,6 +9,7 @@ languagePath: '/langs', languageFileExtension: '.json', defaultLanguage: 'en', + defaultHost: 'localhost', globalStatStorageCapacity: 120, taskStatStorageCapacity: 300, lazySaveTimeout: 500, diff --git a/src/scripts/services/ariaNgSettingService.js b/src/scripts/services/ariaNgSettingService.js index 53e7646..bcebe95 100644 --- a/src/scripts/services/ariaNgSettingService.js +++ b/src/scripts/services/ariaNgSettingService.js @@ -32,7 +32,13 @@ }; var getDefaultRpcHost = function () { - return $location.$$host; + var currentHost = $location.$$host; + + if (currentHost) { + return currentHost; + } + + return ariaNgConstants.defaultHost; }; var setOptions = function (options) {