Codevault initial commit

This commit is contained in:
2026-08-16 16:23:14 +03:00
commit 6ee80f1c8f
47 changed files with 3177 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CodeVault - Get value</title>
<style>
body { font-family: sans-serif; max-width: 480px; margin: 4rem auto; }
input, button { font-size: 1rem; padding: 0.4rem; }
input { width: 100%; box-sizing: border-box; margin-bottom: 0.75rem; }
#result { margin-top: 1rem; padding: 0.75rem; border-radius: 4px; white-space: pre-wrap; word-break: break-all; }
#result.ok { background: #e6ffed; border: 1px solid #4caf50; }
#result.err { background: #ffecec; border: 1px solid #e53935; }
</style>
</head>
<body>
<h1>Get value by code</h1>
<input id="code" type="text" placeholder="Access code" autofocus>
<button id="submit">Get value</button>
<div id="result"></div>
<p><a href="/set">Set a value instead</a></p>
<script>
document.getElementById('submit').addEventListener('click', async () => {
const code = document.getElementById('code').value;
const result = document.getElementById('result');
result.className = '';
result.textContent = '';
const response = await fetch('/api/v1/getValue', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ code }),
});
if (response.ok) {
const data = await response.json();
result.className = 'ok';
result.textContent = data.value;
} else if (response.status === 404) {
result.className = 'err';
result.textContent = 'Not found';
} else {
result.className = 'err';
result.textContent = 'Error: ' + response.status;
}
});
</script>
</body>
</html>