From 5e6ec8562fe828934ef835490cee405653b06d3a Mon Sep 17 00:00:00 2001 From: Ansuel Smith Date: Thu, 16 Jan 2020 00:30:30 +0100 Subject: luci-base: remove hardcoded cgi-bin path Currently LuCI can be loaded only when placed in the root of the server as the cgi-bin path are hardcoded. Change the index.html to load the cgi-bin path from the current level. Also add a new entry in the env Object to make the cgi_base path easily accessible. This variable will be based on the position of /cgi-bin/luci. Signed-off-by: Ansuel Smith --- modules/luci-base/htdocs/luci-static/resources/luci.js | 2 ++ 1 file changed, 2 insertions(+) (limited to 'modules/luci-base/htdocs/luci-static/resources/luci.js') diff --git a/modules/luci-base/htdocs/luci-static/resources/luci.js b/modules/luci-base/htdocs/luci-static/resources/luci.js index 808ab0c5cb..ef9640e915 100644 --- a/modules/luci-base/htdocs/luci-static/resources/luci.js +++ b/modules/luci-base/htdocs/luci-static/resources/luci.js @@ -1192,6 +1192,8 @@ if (env.base_url == null) this.error('InternalError', 'Cannot find url of luci.js'); + env.cgi_base = env.scriptname.replace(/\/[^\/]+$/, ''); + Object.assign(this.env, env); document.addEventListener('poll-start', function(ev) { -- cgit v1.2.3