summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-base
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2019-07-08 17:39:24 +0200
committerJo-Philipp Wich <jo@mein.io>2019-07-08 17:39:24 +0200
commit006f7c7932a29cf0473f0b3c256eb3504001dd01 (patch)
tree2be1e02887c5df2091a5ea3f374afb6e97670b90 /modules/luci-base
parentacbc031a6d1a41fc0a40a4f175bc80a49affc251 (diff)
luci-base: use native ubus HTTP gateway if available
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.js15
1 files changed, 13 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 93ecbac15..1bb4673b0 100644
--- a/modules/luci-base/htdocs/luci-static/resources/luci.js
+++ b/modules/luci-base/htdocs/luci-static/resources/luci.js
@@ -579,7 +579,9 @@
Promise.all([
domReady,
this.require('ui'),
- this.require('form')
+ this.require('rpc'),
+ this.require('form'),
+ Request.get('/ubus/').catch(function() { return { status: 0 } })
]).then(this.setupDOM.bind(this)).catch(this.error);
originalCBIInit = window.cbi_init;
@@ -752,7 +754,16 @@
},
/* DOM setup */
- setupDOM: function(ev) {
+ setupDOM: function(res) {
+ var domEv = res[0],
+ uiClass = res[1],
+ rpcClass = res[2],
+ formClass = res[3],
+ ubusReply = res[4];
+
+ if (ubusReply.status == 400)
+ rpcClass.setBaseURL('/ubus/');
+
Request.addInterceptor(function(res) {
if (res.status != 403 || res.headers.get('X-LuCI-Login-Required') != 'yes')
return;