Version 0.2.0

Changes:
- forbid to overwrite secrets of other users
- add some logs of success
- add validation on code (length 50)
- use same limiter for POST requests
This commit is contained in:
2026-08-17 21:13:15 +00:03
parent 6ee80f1c8f
commit 1ccf40396f
16 changed files with 184 additions and 38 deletions

View File

@@ -4,7 +4,7 @@
<meta charset="UTF-8">
<title>CodeVault - Get value</title>
<style>
body { font-family: sans-serif; max-width: 480px; margin: 4rem auto; }
body { font-family: sans-serif; max-width: 880px; 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; }
@@ -14,7 +14,11 @@
</head>
<body>
<h1>Get value by code</h1>
<input id="code" type="text" placeholder="Access code" autofocus>
<input id="code" type="text" placeholder="Access code" maxlength="50" autofocus>
<label style="display:block; margin-bottom:0.75rem; font-size:0.9rem;">
<input id="formatted" type="checkbox" style="width:auto; margin:0 0.4rem 0 0; vertical-align:middle;">
Get with HTML formatting if present
</label>
<button id="submit">Get value</button>
<div id="result"></div>
<p><a href="/set">Set a value instead</a></p>
@@ -34,7 +38,11 @@ document.getElementById('submit').addEventListener('click', async () => {
if (response.ok) {
const data = await response.json();
result.className = 'ok';
result.textContent = data.value;
if (document.getElementById('formatted').checked) {
result.innerHTML = data.value;
} else {
result.textContent = data.value;
}
} else if (response.status === 404) {
result.className = 'err';
result.textContent = 'Not found';