This page tells you (a person or an AI assistant) everything needed to publish a website on DrLau Sites and, optionally, collect students' names and scores.
https://drlau.duckdns.orghttps://drlau.duckdns.org/manual.mdA private host for small static websites: practice tests, quizzes, notes, demos, anything made of HTML, CSS, JavaScript and images. Only the owner publishes. Anyone with a site's link can open it. There is no public list of sites; each link ends in a random code so it cannot be guessed.
drl_. The owner gives it to you separately.Authorization: Bearer header, ideally from an environment variable:export DRLAU_TOKEN='drl_...'
Choose a readable name: 1-50 characters, lowercase letters a-z, digits 0-9 and -, not starting or ending with -. The server adds a random 6-character code to it. Optional title is what the owner sees in the console.
A single HTML file:
curl -sS -X POST "https://drlau.duckdns.org/api/sites?name=algebra-quiz-1&title=Algebra%20quiz%201" \
-H "Authorization: Bearer $DRLAU_TOKEN" \
-H "Content-Type: text/html" \
--data-binary @index.html
A folder (zip it first; index.html must be at the top of the zip or inside one single top folder):
cd my-site && zip -r ../my-site.zip . && cd ..
curl -sS -X POST "https://drlau.duckdns.org/api/sites?name=algebra-quiz-1" \
-H "Authorization: Bearer $DRLAU_TOKEN" \
-H "Content-Type: application/zip" \
--data-binary @my-site.zip
Answer (HTTP 201):
{"name":"algebra-quiz-1-k7f3qz","title":"Algebra quiz 1","url":"https://drlau.duckdns.org/algebra-quiz-1-k7f3qz/", ...}
Give the owner the url. Keep the full name: you need it to update or delete the site.
Replace an existing site's content (same link, same scores; title kept unless you send one):
curl -sS -X PUT "https://drlau.duckdns.org/api/sites/algebra-quiz-1-k7f3qz" \
-H "Authorization: Bearer $DRLAU_TOKEN" \
-H "Content-Type: text/html" \
--data-binary @index.html
List all sites (name, title, url, size, dates, number of score attempts):
curl -sS "https://drlau.duckdns.org/api/sites" -H "Authorization: Bearer $DRLAU_TOKEN"
One site:
curl -sS "https://drlau.duckdns.org/api/sites/algebra-quiz-1-k7f3qz" -H "Authorization: Bearer $DRLAU_TOKEN"
Delete a site and all its scores (cannot be undone; only do this when the owner asks):
curl -sS -X DELETE "https://drlau.duckdns.org/api/sites/algebra-quiz-1-k7f3qz" -H "Authorization: Bearer $DRLAU_TOKEN"
img/a.png, ./questions.json), never paths starting with /.<meta name="viewport" content="width=device-width, initial-scale=1">, use readable font sizes and large tap targets.localStorage, sessionStorage, indexedDB or cookies; they are blocked and throw errors. Keep state in JavaScript variables.fetch() of the site's own files (e.g. fetch("questions.json")) works.https://cdn.jsdelivr.net/...) work.index.html for quizzes; it is the simplest to publish and update.Only for sites where the owner wants results. Add this script:
<script src="https://drlau.duckdns.org/score.js"></script>
Then, exactly once, when the student finishes, call:
DrLau.submitScore({ name: studentName, score: correct, total: questions.length,
details: { answers: answers } }) // details is optional, max 8 KB
.then(function (r) {
if (r.ok) { /* tell the student their result was sent */ }
else { /* show r.error and offer a "Try sending again" button */ }
});
Requirements for a page that reports scores:
score and total are numbers with 0 <= score <= total and total > 0.The owner sees results in the console, and can download them:
curl -sS "https://drlau.duckdns.org/api/sites/algebra-quiz-1-k7f3qz/scores" -H "Authorization: Bearer $DRLAU_TOKEN"
curl -sS "https://drlau.duckdns.org/api/sites/algebra-quiz-1-k7f3qz/scores?format=csv" -H "Authorization: Bearer $DRLAU_TOKEN" -o scores.csv
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Example quiz</title>
<style>
body { font-family: system-ui, sans-serif; max-width: 640px; margin: 0 auto; padding: 16px; font-size: 18px; }
button, input { font-size: 18px; padding: 12px 16px; width: 100%; box-sizing: border-box; margin: 6px 0; }
.hidden { display: none; }
</style>
<script src="https://drlau.duckdns.org/score.js"></script>
</head>
<body>
<h1>Example quiz</h1>
<div id="start">
<label for="name">Your name</label>
<input id="name" maxlength="60" autocomplete="name">
<button id="begin">Start</button>
</div>
<form id="quiz" class="hidden"></form>
<div id="result" class="hidden"></div>
<script>
var questions = [
{ q: "2 + 3 = ?", options: ["4", "5", "6"], answer: 1 },
{ q: "10 / 2 = ?", options: ["5", "2", "20"], answer: 0 },
{ q: "3 x 3 = ?", options: ["6", "9", "12"], answer: 1 }
];
var studentName = "";
document.getElementById("begin").onclick = function () {
studentName = document.getElementById("name").value.trim();
if (!studentName) { alertBox("Please type your name."); return; }
document.getElementById("start").classList.add("hidden");
var form = document.getElementById("quiz");
questions.forEach(function (item, i) {
var html = "<p><b>" + (i + 1) + ". " + item.q + "</b></p>";
item.options.forEach(function (o, j) {
html += '<label><input type="radio" name="q' + i + '" value="' + j + '" style="width:auto"> ' + o + "</label><br>";
});
form.insertAdjacentHTML("beforeend", html);
});
form.insertAdjacentHTML("beforeend", '<button id="submit" type="submit">Submit</button>');
form.classList.remove("hidden");
};
function alertBox(msg) { var r = document.getElementById("result"); r.textContent = msg; r.classList.remove("hidden"); }
document.getElementById("quiz").onsubmit = function (e) {
e.preventDefault();
document.getElementById("submit").disabled = true;
var correct = 0, answers = {};
questions.forEach(function (item, i) {
var picked = document.querySelector('input[name="q' + i + '"]:checked');
answers["q" + (i + 1)] = picked ? item.options[picked.value] : null;
if (picked && Number(picked.value) === item.answer) correct++;
});
alertBox("You scored " + correct + " / " + questions.length + ". Sending your result...");
DrLau.submitScore({ name: studentName, score: correct, total: questions.length, details: answers })
.then(function (r) {
alertBox("You scored " + correct + " / " + questions.length + ". " +
(r.ok ? "Your result was sent." : "Sending failed: " + r.error));
});
};
</script>
</body>
</html>
Every error is JSON: {"error": "plain explanation"}.
400 — bad name, wrong content type (use text/html or application/zip), unsafe or invalid zip, missing index.html, too large, or invalid score data. Read the message, fix, retry.401 — missing or wrong token. Ask the owner for the current token; do not guess.404 — no site with that name (check the full name including the random code).409 — the site already has 5,000 results (the maximum). Publish a new site for a new round.429 — too many score submissions in a minute; wait and retry.5xx — server problem; retry once later, then tell the owner.