← Files uCozARCHIVED FILE
skills/ucoz-server-scripts-skill/templates/node/index.html
1.67 KB · Nov 30, 2026 · 07:43 UTC
<!doctype html>
<!-- domains/{domain}/app_node/{name}/index.html — served by lib/main.js (whitelist). Replace {name}.
Use absolute /apps/{name}/… URLs: /apps/{name} (no slash) also returns this page. -->
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Notes</title>
<style>body{font:16px/1.5 system-ui,sans-serif;max-width:560px;margin:40px auto;padding:0 16px}input{width:100%;padding:8px;box-sizing:border-box}</style>
</head>
<body>
<h1>Notes</h1>
<form id="f"><input id="t" maxlength="500" placeholder="New note (log in to the site first)" required></form>
<p id="msg" role="status"></p>
<ul id="list"></ul>
<script>
const BASE = '/apps/{name}/';
const list = document.getElementById('list'), msg = document.getElementById('msg');
async function load() {
const j = await (await fetch(BASE + 'api/items', { credentials: 'same-origin' })).json();
list.replaceChildren(...(j.items || []).map((it) => { const li = document.createElement('li'); li.textContent = it.text; return li; }));
}
document.getElementById('f').addEventListener('submit', async (e) => {
e.preventDefault();
const r = await fetch(BASE + 'api/items', { method: 'POST', credentials: 'same-origin',
headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ text: document.getElementById('t').value }) });
const j = await r.json();
msg.textContent = j.ok ? '' : (j.message || j.error);
if (j.ok) { e.target.reset(); load(); }
});
load().catch(() => { msg.textContent = 'Network error'; });
</script>
</body>
</html>
SHA-256: e2c86e42d36db95268a3d20d1e5141cfe6449067d367b829310a1a460e78fc7c