From 5b32a4415c9776dd6cae859c8d718b5e68f01d81 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Sun, 10 May 2020 16:51:20 +0200 Subject: Move webbox to root to make index --- plugins/webbox/html/index.html | 9 +++++---- plugins/webbox/html/webbox.js | 33 ++++++++++++++++++++------------- 2 files changed, 25 insertions(+), 17 deletions(-) (limited to 'plugins/webbox/html') diff --git a/plugins/webbox/html/index.html b/plugins/webbox/html/index.html index e9ea819..cc1cf12 100644 --- a/plugins/webbox/html/index.html +++ b/plugins/webbox/html/index.html @@ -4,22 +4,23 @@ Webbox - - + + +
- +
Webbox
- +
diff --git a/plugins/webbox/html/webbox.js b/plugins/webbox/html/webbox.js index 9a38051..602f76d 100644 --- a/plugins/webbox/html/webbox.js +++ b/plugins/webbox/html/webbox.js @@ -4,6 +4,13 @@ var numberOfSelectedRows = 0; var username = "notaname"; var password = "password"; +function relativePath(path) { + if (path.startsWith("/")) + return path.substr(1); + else + return path; +} + function clearContents() { var result = ""; // empty list @@ -35,9 +42,9 @@ function loadContents(dir) { for (var i = 0; i < listElements.length; i++) { var type = listElements[i].getAttribute("type"); if (type == "file") { - type = ""; + type = ""; } else if (type == "dir") { - type = ""; + type = ""; } else { type = ""; } @@ -57,7 +64,7 @@ function loadContents(dir) { } - xhr.open("GET", "bin" + dir + "?command=list", true); + xhr.open("GET", relativePath(dir) + "?command=list", true); xhr.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password)); xhr.send(); } @@ -329,7 +336,7 @@ function initMainpage() { initMainpage2(); } - xhrTitle.open("GET", "bin?command=server-info", true); + xhrTitle.open("GET", "?command=server-info", true); xhrTitle.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password)); xhrTitle.send(); @@ -350,7 +357,7 @@ function initMainpage2() { document.getElementsByClassName("footer")[0].innerHTML = xhrFooter.responseText; } - xhrFooter.open("GET", "bin?command=version", true); + xhrFooter.open("GET", "?command=version", true); xhrFooter.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password)); xhrFooter.send(); @@ -431,7 +438,7 @@ function download(filename) { filesElement.appendChild(fileElement); } - xhr.open("POST", "bin" + currentDir + "?command=download-zip", true); + xhr.open("POST", relativePath(currentDir) + "?command=download-zip", true); xhr.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password)); xhr.setRequestHeader("Content-type", "text/xml"); xhr.responseType = 'blob'; @@ -458,7 +465,7 @@ function download(filename) { dir += "/" } progressOn(); - xhr.open("GET", "bin" + dir + filename, true); + xhr.open("GET", relativePath(dir) + filename, true); xhr.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password)); xhr.responseType = 'blob'; xhr.send(); @@ -493,7 +500,7 @@ function createDir() { dirElement.appendChild(document.createTextNode(document.getElementById("newdir").value)); - xhr.open("POST", "bin" + currentDir + "?command=newdir", true); + xhr.open("POST", relativePath(currentDir) + "?command=newdir", true); xhr.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password)); xhr.setRequestHeader("Content-type", "text/xml"); xhr.send(xmlDocument); @@ -557,7 +564,7 @@ function onUploadFile() { formData.append("uploadfile", uploadfile.files[i]); } - xhr.open("POST", "bin" + currentDir + "?command=upload", true); + xhr.open("POST", relativePath(currentDir) + "?command=upload", true); xhr.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password)); xhr.send(formData); } @@ -607,7 +614,7 @@ function deleteItems() { filesElement.appendChild(fileElement); } - xhr.open("POST", "bin" + currentDir + "?command=delete", true); + xhr.open("POST", relativePath(currentDir) + "?command=delete", true); xhr.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password)); xhr.setRequestHeader("Content-type", "text/xml"); xhr.send(xmlDocument); @@ -672,7 +679,7 @@ function move() { filesElement.appendChild(fileElement); } - xhr.open("POST", "bin" + currentDir + "?command=move", true); + xhr.open("POST", relativePath(currentDir) + "?command=move", true); xhr.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password)); xhr.setRequestHeader("Content-type", "text/xml"); xhr.send(xmlDocument); @@ -736,7 +743,7 @@ function rename() { newnameElement.appendChild(document.createTextNode(document.getElementById("renamenew").value)); filesElement.appendChild(newnameElement); - xhr.open("POST", "bin" + currentDir + "?command=rename", true); + xhr.open("POST", relativePath(currentDir) + "?command=rename", true); xhr.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password)); xhr.setRequestHeader("Content-type", "text/xml"); xhr.send(xmlDocument); @@ -784,7 +791,7 @@ function info() { filesElement.appendChild(fileElement); } - xhr.open("POST", "bin" + currentDir + "?command=info", true); + xhr.open("POST", relativePath(currentDir) + "?command=info", true); xhr.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password)); xhr.setRequestHeader("Content-type", "text/xml"); xhr.send(xmlDocument); -- cgit v1.2.3