summaryrefslogtreecommitdiff
path: root/templates/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'templates/index.html')
-rw-r--r--templates/index.html22
1 files changed, 21 insertions, 1 deletions
diff --git a/templates/index.html b/templates/index.html
index c06b6ec..7c77e8e 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -3,6 +3,7 @@
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Box</title>
+ <script src="{{.ProxyPrefix}}/static/htmx.min.js"></script>
<script>
function upload() {
let resourceId = "";
@@ -29,7 +30,7 @@
document.getElementById("progress").innerHTML = "Error: unknown";
}
} else {
- document.getElementById("progress").innerHTML = "Done: <a href=\"{{.ProxyPrefix}}/" + resourceId + "\">" + resourceId + "</a>";
+ document.getElementById("progress").innerHTML = "Done: <a href=\"{{.ProxyPrefix}}/" + resourceId + "\">" + resourceId + "</a>";
}
}
if (xhr.readyState === xhr.HEADERS_RECEIVED) {
@@ -48,9 +49,28 @@
}
xhr.send(f);
}
+
+ function gettoken() {
+ token = document.getElementById("token");
+ if (token == null) {
+ token = "";
+ } else {
+ token = token.value;
+ }
+ return token;
+ }
</script>
+ <meta name="htmx-config" content='{
+ "responseHandling":[
+ {"code":"200", "swap": true},
+ {"code":"401", "swap": true}
+ ]
+ }'
+ />
</head>
<body>
+ <button hx-get="/getindex" hx-headers='js:{"X-Token": gettoken()}' hx-target="#index">list</button>
+ <div id="index"></div>
<pre>
_
| |__ _____ __