diff options
Diffstat (limited to 'modules/luci-base/htdocs/luci-static/resources')
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/fs.js | 4 | ||||
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/luci.js | 2 | ||||
-rw-r--r-- | modules/luci-base/htdocs/luci-static/resources/ui.js | 4 |
3 files changed, 6 insertions, 4 deletions
diff --git a/modules/luci-base/htdocs/luci-static/resources/fs.js b/modules/luci-base/htdocs/luci-static/resources/fs.js index e1bf4f874..d32b20f2f 100644 --- a/modules/luci-base/htdocs/luci-static/resources/fs.js +++ b/modules/luci-base/htdocs/luci-static/resources/fs.js @@ -342,7 +342,7 @@ var FileSystem = L.Class.extend(/** @lends LuCI.fs.prototype */ { var postdata = 'sessionid=%s&path=%s' .format(encodeURIComponent(L.env.sessionid), encodeURIComponent(path)); - return L.Request.post('/cgi-bin/cgi-download', postdata, { + return L.Request.post(L.env.cgi_base + '/cgi-download', postdata, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }).then(handleCgiIoReply); }, @@ -385,7 +385,7 @@ var FileSystem = L.Class.extend(/** @lends LuCI.fs.prototype */ { var postdata = 'sessionid=%s&command=%s' .format(encodeURIComponent(L.env.sessionid), encodeURIComponent(cmdstr)); - return L.Request.post('/cgi-bin/cgi-exec', postdata, { + return L.Request.post(L.env.cgi_base + '/cgi-exec', postdata, { headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }).then(handleCgiIoReply); } diff --git a/modules/luci-base/htdocs/luci-static/resources/luci.js b/modules/luci-base/htdocs/luci-static/resources/luci.js index 808ab0c5c..ef9640e91 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) { diff --git a/modules/luci-base/htdocs/luci-static/resources/ui.js b/modules/luci-base/htdocs/luci-static/resources/ui.js index 5fa75c3f6..774d4a665 100644 --- a/modules/luci-base/htdocs/luci-static/resources/ui.js +++ b/modules/luci-base/htdocs/luci-static/resources/ui.js @@ -1702,7 +1702,7 @@ var UIFileUpload = UIElement.extend({ data.append('filename', path + '/' + filename); data.append('filedata', fileinput.files[0]); - return L.Request.post('/cgi-bin/cgi-upload', data, { + return L.Request.post(L.env.cgi_base + '/cgi-upload', data, { progress: L.bind(function(btn, ev) { btn.firstChild.data = '%.2f%%'.format((ev.loaded / ev.total) * 100); }, this, ev.target) @@ -2397,7 +2397,7 @@ return L.Class.extend({ var filename = input.files[0].name; - L.Request.post('/cgi-bin/cgi-upload', data, { + L.Request.post(L.env.cgi_base + '/cgi-upload', data, { timeout: 0, progress: function(pev) { var percent = (pev.loaded / pev.total) * 100; |