From 9e3c173d3970c5cab29f879be96447c34ac5ae7e Mon Sep 17 00:00:00 2001 From: 4Oranges Date: Fri, 22 Dec 2017 01:36:30 +0800 Subject: [PATCH] support connection config in uri --- js/init.js | 9 +++++++-- js/services/rpc/rpc.js | 9 +++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/js/init.js b/js/init.js index ce964e7..c76a36d 100644 --- a/js/init.js +++ b/js/init.js @@ -27,7 +27,7 @@ function mergeTranslation(translation, base) { return translation; } -webui.config(['$translateProvider', function ($translateProvider) { +webui.config(function ($translateProvider, $locationProvider) { $translateProvider .translations('en_US', translations.en_US) .translations('nl_NL', mergeTranslation(translations.nl_NL, translations.en_US)) @@ -44,7 +44,12 @@ webui.config(['$translateProvider', function ($translateProvider) { .translations('cs_CZ', mergeTranslation(translations.cs_CZ, translations.en_US)) .useSanitizeValueStrategy('escapeParameters') .determinePreferredLanguage(); -}]); + + $locationProvider.html5Mode({ + enabled: true, + requireBase: false + }); +}); $(function() { if (!String.prototype.startsWith) { diff --git a/js/services/rpc/rpc.js b/js/services/rpc/rpc.js index 8b57c3b..3083b07 100644 --- a/js/services/rpc/rpc.js +++ b/js/services/rpc/rpc.js @@ -19,6 +19,15 @@ function(syscall, globalTimeout, alerts, utils, rootScope, uri, authconf, filter // try at the start, so that it is presistant even when default authconf works if(cookieConf) configurations.unshift(cookieConf); + if (uri.search().host) { + configurations.unshift(uri.search()); + configurations[0].auth = { + token: configurations[0].token, + user: configurations[0].username, + pass: configurations[0].password + }; + } + if (['http', 'https'].indexOf(uri.protocol()) != -1 && uri.host() != 'localhost') { configurations.push({ host: uri.host(),