luci-base: make rpc webserver path configurable
authorAnsuel Smith <ansuelsmth@gmail.com>
Thu, 16 Jan 2020 14:16:09 +0000 (15:16 +0100)
committerJo-Philipp Wich <jo@mein.io>
Thu, 7 May 2020 17:40:49 +0000 (19:40 +0200)
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>
(backported from commit 529bde44081d0bc07a064e9dfb1f0b3f35e61061)

modules/luci-base/htdocs/luci-static/resources/luci.js
modules/luci-base/luasrc/view/header.htm
modules/luci-base/root/etc/config/luci

index d890b3a78c0286f85888cacebae52f9af66d1382..6c9bec8b62ee77fc26ad413789d9d0d90d770aaa 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 387c76f8f887c2ab44a01f588a99e6fe71464f24..f0f69f2003a9523588fda505027ad6e4976a31dd 100644 (file)
@@ -26,6 +26,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 c0f2599cc15e8fce2a97508a789db7212cb0117c..daa4a5b7c931022942302352b9d4bc3a4c4abd75 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/"