This commit is contained in:
vxclutch
2026-06-02 14:53:21 -04:00
parent ec19585e9b
commit 459fe380db
2 changed files with 27 additions and 67 deletions

View File

@@ -24,10 +24,11 @@
<script>
const tokenInput = document.getElementById('tokenInput');
const submitBtn = document.getElementById('submitBtn');
const status = document.getElementById('status');
submitBtn.addEventListener('click', async () => {
const token = tokenInput.value.trim();
if (!token) {
status.textContent = 'Please enter a token.';
return;
@@ -41,6 +42,7 @@
},
body: JSON.stringify({ token })
});
if (!response.ok) {
status.textContent = 'Download failed.';
return;
@@ -48,19 +50,19 @@
const blob = await response.blob();
const url = window.URL.createObjectURL(blob);
a.href = url;
const a = document.createElement('a');
a.href = url;
const disposition = response.headers.get('Content-Disposition');
let filename = 'download.bin';
if (disposition && disposition.includes('filename=')) {
filename = disposition
.split('filename=')[1]
.replace(/"/g, '');
}
a.download = filename;
a.download = filename;
document.body.appendChild(a);
a.click();
a.remove();