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>
This commit is contained in:
Ansuel Smith 2020-01-16 15:16:09 +01:00
parent 88b9d58a44
commit 529bde4408
No known key found for this signature in database
GPG key ID: AC001D09ADBFEAD7
3 changed files with 4 additions and 2 deletions

View file

@ -1508,8 +1508,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

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

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