luci-base: make rpc webserver path configurable

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 529bde4408)
This commit is contained in:
Ansuel Smith 2020-01-16 15:16:09 +01:00 committed by Jo-Philipp Wich
parent e28f94bf01
commit 14a81ccb63
3 changed files with 4 additions and 2 deletions

View file

@ -2536,8 +2536,8 @@
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) {

View 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),

View 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/"