Files
Kakubovna/app/forms/download.html
2023-06-12 10:02:02 +02:00

103 lines
3.4 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Kakubovna: Download</title>
<link rel="stylesheet" href="/css/style-light.css">
<link href="https://fonts.googleapis.com/css2?family=Geologica:wght@800&display=swap" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="view-container">
<div class="view-nav hidden">
<div class="button primary">
<p>Download all as zip</p>
</div>
<div class="spacer"></div>
<div class="link-box">
<div class="text-link">
<input type="text" readonly="readonly" value="https://test.org">
</div>
<div class="button-copy" onclick="copyToClipboard(this);">
<svg xmlns="http://www.w3.org/2000/svg" class="copy" viewBox="0 0 512 512">
<rect x="128" y="128" width="336" height="336" rx="57" ry="57" fill="none" stroke="currentColor"
stroke-linejoin="round" stroke-width="32" />
<path d="M383.5 128l.5-24a56.16 56.16 0 00-56-56H112a64.19 64.19 0 00-64 64v216a56.16 56.16 0 0056 56h24"
fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32" />
</svg>
<svg xmlns="http://www.w3.org/2000/svg" class="checkmark hidden" viewBox="0 0 512 512">
<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="32"
d="M416 128L192 384l-96-96" />
</svg>
</div>
</div>
</div>
<div class="container">
<div class="file-view">
<div class="file-container"></div>
</div>
</div>
</div>
</div>
<script src="/js/download.js"></script>
<script>
if (navigator.clipboard == undefined) { document.getElementsByClassName("copy")[0].outerHTML = ''; }
function test(el) {
el.innerHTML = "test";
}
var hash = "";
var adminHash = "";
handleUrl();
function handleUrl() {
console.log(document.location.pathname.split("/", 4));
path = document.location.pathname.split("/", 4)
if (path[2] !== undefined && path[2].length > 10 && path[2] === path[2].toUpperCase()) {
hash = path[2];
loadPage(hash);
if (path[3] !== undefined && path[3].length == 10 && path[3] === path[3].toUpperCase()) {
adminHash = path[3];
console.log("Admin is here!");
}
}
}
codeInput = document.getElementById("code");
statusText = document.getElementById("status");
function checkUpload() {
if (!(codeInput.value.length > 10 && codeInput.value === codeInput.value.toUpperCase())) {
statusText.innerHTML = 'Wrong Code';
return;
}
fetch('/api/download/' + codeInput.value)
.then(
response => response.json()
).then(jsonResponse => {
console.log(jsonResponse);
if (jsonResponse.code == 404) {
statusText.innerHTML = 'Not Found';
} else if (jsonResponse.code == 200) {
statusText.innerHTML = 'Found';
window.location.href = document.location.protocol + "//" + document.location.host + "/download/" + codeInput.value
} else {
statusText.innerHTML = 'Error';
}
});
};
</script>
</body>
</html>