luci-base: make rpc webserver path configurable 3517/head
authorAnsuel Smith <ansuelsmth@gmail.com>
Thu, 16 Jan 2020 14:16:09 +0000 (15:16 +0100)
committerAnsuel Smith <ansuelsmth@gmail.com>
Thu, 16 Jan 2020 14:16:09 +0000 (15:16 +0100)
Currently the ubus path that provide the webserver is hardcoded to be /ubus.
Change this to make it configurable from the luci config file.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
modules/luci-base/htdocs/luci-static/resources/luci.js
modules/luci-base/luasrc/view/header.htm
modules/luci-base/root/etc/config/luci

index 808ab0c5cb2a3e25020539125fde4ba190890547..69e1929945f6debeb0a56a8f80f5d1bab0c5573a 100644 (file)
                        if (rpcBaseURL == null) {
                                var rpcFallbackURL = this.url('admin/ubus');
 
-                               rpcBaseURL = Request.get('/ubus/').then(function(res) {
-                                       return (rpcBaseURL = (res.status == 400) ? '/ubus/' : rpcFallbackURL);
+                               rpcBaseURL = Request.get(this.env.ubuspath).then(function(res) {
+                                       return (rpcBaseURL = (res.status == 400) ? L.env.ubuspath : rpcFallbackURL);
                                }, function() {
                                        return (rpcBaseURL = rpcFallbackURL);
                                }).then(function(url) {
index 9cdedde5c2bc08bfbbf1a922c7e60e6193409c4b..6f7f0e48e7e421d4f6605f9cdd725400b2a677f0 100644 (file)
@@ -24,6 +24,7 @@
                requestpath    = luci.dispatcher.context.requestpath,
                dispatchpath   = luci.dispatcher.context.path,
                pollinterval   = luci.config.main.pollinterval or 5,
+               ubuspath       = luci.config.main.ubuspath or '/ubus',
                sessionid      = luci.dispatcher.context.authsession,
                apply_rollback = math.max(applyconf and applyconf.rollback or 30, 30),
                apply_holdoff  = math.max(applyconf and applyconf.holdoff or 4, 1),
index 82c2230e55ad9294987c758fa4b141652d1fbeca..91a019387304726ed1ee3db76e4423cab9a465c8 100644 (file)
@@ -2,6 +2,7 @@ config core main
        option lang auto
        option mediaurlbase /luci-static/bootstrap
        option resourcebase /luci-static/resources
+       option ubuspath /ubus
        
 config extern flash_keep
        option uci              "/etc/config/"