summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
authorJulian Hurst <julian.hurst@digdash.com>2025-01-23 11:45:36 +0100
committerJulian Hurst <julian.hurst@digdash.com>2025-01-23 11:45:36 +0100
commitb23201e4ea65403625b80573907d270b9055dafc (patch)
treedb7a65b2321304de48824634337e09bca2754cdd /templates
parent55c77601fdbf39e9aa98185f6dfeaddfecc35fbf (diff)
downloadbox-b23201e4ea65403625b80573907d270b9055dafc.tar.gz
Return resource ID and allow getting resources
Diffstat (limited to 'templates')
-rw-r--r--templates/index.html6
1 files changed, 6 insertions, 0 deletions
diff --git a/templates/index.html b/templates/index.html
index bafd7eb..c487165 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -5,6 +5,7 @@
<title>box</title>
<script>
function upload() {
+ let resourceId = "";
token = document.getElementById("token");
if (token == null) {
token = "";
@@ -27,8 +28,13 @@
} else {
document.getElementById("progress").innerHTML = "Error: unknown";
}
+ } else {
+ document.getElementById("progress").innerHTML = "Done: " + resourceId;
}
}
+ if (xhr.readyState === xhr.HEADERS_RECEIVED) {
+ resourceId = xhr.getResponseHeader("X-Resource-ID");
+ }
}
xhr.open("POST", "/" + f.name, true);
xhr.setRequestHeader("X-Upload-Token", token)