uploader/html/admin.html

50 lines
1.7 KiB
HTML
Raw Normal View History

2024-06-13 14:25:35 +02:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Admin Panel</title>
</head>
<body>
<h1>Admin Panel</h1>
<form id="adminForm">
<label for="maxSize">Max File Size:</label>
<input type="number" id="maxSize" name="maxSize" required>
<select id="sizeUnit" name="sizeUnit">
<option value="MB">MB</option>
<option value="GB">GB</option>
</select><br><br>
<label for="lifetime">Link Lifetime:</label>
<input type="number" id="lifetime" name="lifetime" required><br><br>
<button type="button" onclick="generateLink()">Generate</button>
</form>
<p id="uploadLink"></p>
<script>
async function generateLink() {
const maxSize = document.getElementById('maxSize').value;
const sizeUnit = document.getElementById('sizeUnit').value;
const lifetime = document.getElementById('lifetime').value;
const response = await fetch('/generate', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ maxSize, sizeUnit, lifetime })
});
if (response.ok) {
const data = await response.json();
document.getElementById('uploadLink').innerText = `Upload Link (copied to clipboard): ${data.uploadLink}`;
navigator.clipboard.writeText(data.uploadLink);
} else {
document.getElementById('uploadLink').innerText = 'Error generating link';
}
}
</script>
</body>
</html>