summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2019-07-10 13:30:52 +0200
committerJo-Philipp Wich <jo@mein.io>2019-07-10 13:30:52 +0200
commit69e5488c139f249fcf785d4ba170a90ed0e7f33c (patch)
tree5e82b8065e129afef5dce1a72b71f5efe401c7b6 /modules/luci-base
parent1991b4ae64af79e3cd346d8383d3a586a16f6b80 (diff)
luci-base: luci.js: fix undefined "this" when /ubus/ is unavailable
Fixes: #2850 Fixes: 66dfe64ca ("luci-base: luci.js: cache determined RPC base url in session storage") Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base')
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/luci.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/luci.js b/modules/luci-base/htdocs/luci-static/resources/luci.js
index 3e40b304b6..1f883ab802 100644
--- a/modules/luci-base/htdocs/luci-static/resources/luci.js
+++ b/modules/luci-base/htdocs/luci-static/resources/luci.js
@@ -762,10 +762,12 @@
}
if (rpcBaseURL == null) {
+ var rpcFallbackURL = this.url('admin/ubus');
+
rpcBaseURL = Request.get('/ubus/').then(function(res) {
- return (rpcBaseURL = (res.status == 400) ? '/ubus/' : this.url('admin/ubus'));
+ return (rpcBaseURL = (res.status == 400) ? '/ubus/' : rpcFallbackURL);
}, function() {
- return (rpcBaseURL = L.url('admin/ubus'));
+ return (rpcBaseURL = rpcFallbackURL);
}).then(function(url) {
try {
window.sessionStorage.setItem('rpcBaseURL', url);