summaryrefslogtreecommitdiffhomepage
path: root/modules
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2020-01-16 15:36:05 +0100
committerGitHub <noreply@github.com>2020-01-16 15:36:05 +0100
commitb65588ebc65d39ed978902c87cfb1b43773cb0a0 (patch)
treeef6faeca6b369cf38c9b5640b753a5f4294e624f /modules
parentf545b29aaf6c63a74321a1e5e4655e71330b33b3 (diff)
parent5e6ec8562fe828934ef835490cee405653b06d3a (diff)
Merge pull request #3511 from Ansuel/no-hard
luci-base: remove hardcoded cgi-bin path
Diffstat (limited to 'modules')
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/fs.js4
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/luci.js2
-rw-r--r--modules/luci-base/htdocs/luci-static/resources/ui.js4
-rw-r--r--modules/luci-base/root/www/index.html4
-rw-r--r--modules/luci-mod-system/htdocs/luci-static/resources/view/system/flash.js4
5 files changed, 10 insertions, 8 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 69e192994..3a8c6b4b1 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;
diff --git a/modules/luci-base/root/www/index.html b/modules/luci-base/root/www/index.html
index 6899820a4..35c0ea0d3 100644
--- a/modules/luci-base/root/www/index.html
+++ b/modules/luci-base/root/www/index.html
@@ -3,9 +3,9 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
-<meta http-equiv="refresh" content="0; URL=/cgi-bin/luci/" />
+<meta http-equiv="refresh" content="0; URL=cgi-bin/luci/" />
</head>
<body style="background-color: white">
-<a style="color: black; font-family: arial, helvetica, sans-serif;" href="/cgi-bin/luci/">LuCI - Lua Configuration Interface</a>
+<a style="color: black; font-family: arial, helvetica, sans-serif;" href="cgi-bin/luci/">LuCI - Lua Configuration Interface</a>
</body>
</html>
diff --git a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/flash.js b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/flash.js
index 05e1434f1..b1cc4d1a6 100644
--- a/modules/luci-mod-system/htdocs/luci-static/resources/view/system/flash.js
+++ b/modules/luci-mod-system/htdocs/luci-static/resources/view/system/flash.js
@@ -76,7 +76,7 @@ return L.view.extend({
handleBackup: function(ev) {
var form = E('form', {
method: 'post',
- action: '/cgi-bin/cgi-backup',
+ action: L.env.cgi_base + '/cgi-backup',
enctype: 'application/x-www-form-urlencoded'
}, E('input', { type: 'hidden', name: 'sessionid', value: rpc.getSessionID() }));
@@ -169,7 +169,7 @@ return L.view.extend({
var mtdblock = L.dom.parent(ev.target, '.cbi-section').querySelector('[data-name="mtdselect"] select').value;
var form = E('form', {
'method': 'post',
- 'action': '/cgi-bin/cgi-download',
+ 'action': L.env.cgi_base + '/cgi-download',
'enctype': 'application/x-www-form-urlencoded'
}, [
E('input', { 'type': 'hidden', 'name': 'sessionid', 'value': rpc.getSessionID() }),