Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ Playing never needs an account. In the online edition, an account unlocks Play T
- **The username is private:** it's only for logging in. Other players only ever see your picked colour-and-animal name.
- **Passwords are hashed** (scrypt), and logins are kept in secure, HttpOnly cookies.
- **Delete your account any time** from the account screen. It's removed straight away, and your worlds on the device stay.
- **Signing up:** players agree to the [Terms of Use](terms.html) and [Privacy Policy](privacy.html), and the version they agreed to is recorded. The game asks for a birth year only to decide whether a grown-up must help. The year never leaves the device, and players under 13 need a parent or guardian to confirm.
- Kids: ask a grown-up to help you make one.

## ⚔️ Adventure mode (for older players)
Expand Down
2 changes: 2 additions & 0 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ The game stays public on our own site, and the GitHub Pages copy is retired late
- [x] The relay only accepts our own site
- [x] **Accounts** (register / log in / log out / delete) with our own Postgres database: a private username and a password only. Playing the game needs no account.
- [x] Play Together requires a login (the relay checks it)
- [x] Privacy Policy and Terms of Use pages; sign-up records agreement, with a grown-up step for under-13s
- [ ] Optional parent email for verifiable parental consent, if legal review asks for it
- [ ] Cloud saves across devices; classroom mode and a teacher dashboard

## ⚔️ Adventure track (opt-in, for older players)
Expand Down
14 changes: 12 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ <h1>MiniCrafter</h1>
</details>
<p class="note touch-only">Touch: left stick walks, drag to look, tap to place or flip, hold to mine or attack. Holding a bow or shield? Hold to draw or block.</p>
<p class="note">Your world is saved automatically in this browser. <span id="offline-note"></span> <span id="game-version"></span></p>
<p class="note legal-links"><a href="privacy.html" target="_blank" rel="noopener">Privacy Policy</a> · <a href="terms.html" target="_blank" rel="noopener">Terms of Use</a></p>
</div>
</div>
</div>
Expand Down Expand Up @@ -200,10 +201,19 @@ <h2>👤 Your account</h2>
<form id="acc-form" autocomplete="on">
<label>Username<input id="acc-user" type="text" autocomplete="username" autocapitalize="none" spellcheck="false" maxlength="20" required></label>
<label>Password<input id="acc-pass" type="password" autocomplete="current-password" maxlength="200" required></label>
<label id="acc-pass2-row" class="hidden">Password again<input id="acc-pass2" type="password" autocomplete="new-password" maxlength="200"></label>
<div id="acc-new-extra" class="hidden">
<label>Password again<input id="acc-pass2" type="password" autocomplete="new-password" maxlength="200"></label>
<label><span>What year were you born? <span class="hint">(we don't keep it)</span></span><select id="acc-year"><option value="">Choose a year…</option></select></label>
<div id="acc-grownup" class="acc-grownup hidden">
<p><b>👨‍👩‍👧 Grown-up step.</b> Players under 13 need a parent or guardian to set up an account. Grown-up: please read the <a href="privacy.html" target="_blank" rel="noopener">Privacy Policy</a> and <a href="terms.html" target="_blank" rel="noopener">Terms of Use</a>.</p>
<label class="check"><input id="acc-parent" type="checkbox"> I'm this player's parent or guardian, and I agree for them.</label>
<label><span>Grown-up check: what is <b id="acc-q"></b>?</span><input id="acc-a" type="text" inputmode="numeric" maxlength="4" autocomplete="off"></label>
</div>
<label class="check"><input id="acc-agree" type="checkbox"> I agree to the <a href="terms.html" target="_blank" rel="noopener">Terms of Use</a> and the <a href="privacy.html" target="_blank" rel="noopener">Privacy Policy</a>.</label>
</div>
<button id="acc-submit" class="primary" type="submit">Log in</button>
</form>
<p class="note acc-privacy">🛡️ <b>Make up a username, don't use your real name.</b> Your username is private: other players only see your colour-and-animal name. We don't ask for an email address or anything else about you. Kids: ask a grown-up to help you.</p>
<p class="note acc-privacy">🛡️ <b>Make up a username, don't use your real name.</b> Your username is private: other players only see your colour-and-animal name. We don't ask for an email address or anything else about you. Kids: ask a grown-up to help you. <a href="privacy.html" target="_blank" rel="noopener">Privacy</a> · <a href="terms.html" target="_blank" rel="noopener">Terms</a></p>
</div>
<div id="acc-in" class="hidden">
<p>You're logged in as <b id="acc-name"></b>.</p>
Expand Down
27 changes: 27 additions & 0 deletions legal.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* Privacy Policy and Terms of Use pages */
* { box-sizing: border-box; }
html { background: #0b1026; }
body { margin: 0; color: #e8ecf4; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; line-height: 1.6; background: linear-gradient(180deg, #13203f 0%, #0b1026 320px); }
.legal { max-width: 760px; margin: 0 auto; padding: 24px max(16px, env(safe-area-inset-left)) 48px; }
.back { display: inline-block; margin-bottom: 12px; color: #9cc3ff; text-decoration: none; font-weight: 600; }
.back:hover { text-decoration: underline; }
h1 { margin: 0; font-size: 2rem; color: #9be06a; text-shadow: 2px 2px 0 #2b5a1e; }
h2 { margin: 28px 0 8px; font-size: 1.2rem; color: #ffe27a; }
.meta { margin: 4px 0 18px; color: #9aa3b5; font-size: .9rem; }
a { color: #9cc3ff; }
ul { padding-left: 1.2em; }
li { margin: 4px 0; }
.kids { padding: 4px 18px 10px; border-radius: 12px; background: rgba(102, 176, 67, .12); border: 2px solid rgba(102, 176, 67, .55); }
.kids h2 { color: #9be06a; }
table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: .92rem; }
th, td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid #2c3446; }
th { color: #cfd6e4; background: rgba(255, 255, 255, .04); }
.foot { margin-top: 32px; padding-top: 14px; border-top: 1px solid #2c3446; color: #9aa3b5; }
@media (max-width: 560px) {
h1 { font-size: 1.6rem; }
table, tr, td, th { display: block; }
tr { margin-bottom: 10px; border: 1px solid #2c3446; border-radius: 8px; }
th { display: none; }
td { border: 0; padding: 4px 10px; }
td:first-child { font-weight: 600; padding-top: 8px; }
}
107 changes: 107 additions & 0 deletions privacy.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
<title>Privacy Policy · MiniCrafter</title>
<meta name="description" content="How MiniCrafter looks after your privacy. Written for kids and grown-ups.">
<link rel="icon" type="image/png" sizes="32x32" href="icons/favicon-32.png">
<link rel="stylesheet" href="legal.css">
</head>
<body>
<main class="legal">
<a class="back" href="./">← Back to the game</a>
<h1>🛡️ Privacy Policy</h1>
<p class="meta">Version 2026-11-10 · Last updated 10 November 2026</p>

<section class="kids">
<h2>🧒 The short version (for kids)</h2>
<ul>
<li><b>We don't know who you are.</b> We never ask for your real name, email, address, phone number, school or photos.</li>
<li><b>Your worlds stay on your device</b> unless you choose to play online.</li>
<li><b>If you make an account,</b> we keep only a made-up username and your password (scrambled so nobody can read it). Never use your real name as your username!</li>
<li><b>No ads, no tracking, nothing to buy.</b> We never sell anything about you.</li>
<li><b>In Play Together</b> other players only see a colour-and-animal name like "Blue Fox". There's no chat, just emoji.</li>
<li><b>You can delete your account</b> any time, and it's gone straight away.</li>
<li>Under 13? <b>Ask a grown-up</b> to help you make an account.</li>
</ul>
</section>

<h2>1. Who we are</h2>
<p>MiniCrafter is made by <b>Dynamic Web Lab FZE LLC</b>, a Free Zone Establishment licensed by Sharjah Publishing City Free Zone Authority (License No. 4426361.01), Business Centre, Sharjah Publishing City Free Zone, Sharjah, United Arab Emirates. We are responsible for the information described here.</p>
<p>Questions or requests about privacy: <a href="mailto:info@dynamicweblab.com">info@dynamicweblab.com</a>.</p>

<h2>2. Two ways to play</h2>
<ul>
<li><b>Free edition and playing without an account:</b> everything happens in your browser. We receive nothing about you or your game.</li>
<li><b>Online edition with an account:</b> adds features that need our server, such as Play Together. Only then do we keep the small amount of information below.</li>
</ul>

<h2>3. What is stored on your device</h2>
<p>The game saves these in your browser's storage on your device, so it can work offline. We can't see them.</p>
<ul>
<li>Your worlds, quest stars, settings and hotbar.</li>
<li>Your Play Together colour-and-animal name.</li>
<li>For Adventure mode, a note that the grown-up check was passed, which is cleared when the browser is closed.</li>
<li>A copy of the game's files, so it works without internet.</li>
</ul>
<p>You can remove all of this by clearing the site's data in your browser settings.</p>

<h2>4. What we keep if you make an account</h2>
<table>
<tr><th>Information</th><th>Why</th><th>How long</th></tr>
<tr><td>Your username (private, never shown to other players)</td><td>So you can log in</td><td>Until you delete your account</td></tr>
<tr><td>Your password, stored only as a scrambled "hash" (scrypt) that can't be turned back into the password</td><td>To check it's really you</td><td>Until you delete your account</td></tr>
<tr><td>Login sessions: a random code in a secure cookie on your device, and a scrambled copy on our server</td><td>To keep you logged in</td><td>30 days, or until you log out</td></tr>
<tr><td>When your account was made and last used</td><td>To keep the service working and safe</td><td>Until you delete your account</td></tr>
<tr><td>That you agreed to these rules, which version, when, and (for players under 13) that a grown-up confirmed</td><td>To show the right people agreed</td><td>Until you delete your account</td></tr>
</table>
<p><b>We don't keep your birth year.</b> We ask for it when you sign up only to decide whether a grown-up needs to help, and then we throw it away.</p>
<p>We do <b>not</b> collect: email addresses, real names, birthdays, addresses, phone numbers, photos, voice, location, contacts, or anything for advertising.</p>

<h2>5. Play Together</h2>
<ul>
<li>Players connect through our server, never directly to each other, so your internet address isn't shared with other players.</li>
<li>Rooms exist only while the game is running. We don't record or store what happens in a room.</li>
<li>Other players see only your colour-and-animal name, your character and the emoji you send. Your username stays private.</li>
<li>The host lets each player in and can remove players.</li>
</ul>

<h2>6. Keeping things safe</h2>
<ul>
<li>To stop people guessing passwords or flooding the service, our server briefly remembers internet addresses <b>in memory only, for up to one hour</b>. They are never written to disk.</li>
<li>We switch off request logs for the game. Technical error logs may briefly contain an internet address while we fix a problem.</li>
<li>Our account database is backed up every night in encrypted cloud storage. Backups are kept for up to 30 days, so a deleted account fully disappears from backups within 30 days.</li>
</ul>

<h2>7. Services that help us run MiniCrafter</h2>
<p>We don't sell or share your information for advertising, ever. These providers process data only to run the service for us:</p>
<ul>
<li><b>Cloudflare</b> delivers the website and protects it from attacks. It handles internet addresses and may set a short-lived security cookie.</li>
<li><b>Our hosting provider</b> runs the servers where the game and accounts live.</li>
<li><b>Microsoft Azure</b> stores our encrypted nightly backups.</li>
<li><b>GitHub</b> hosts the free edition, if you play that version.</li>
</ul>
<p>These providers may be located outside your country. We use them with protections required by law.</p>

<h2>8. Children</h2>
<ul>
<li>MiniCrafter is made for children, so we collect as little as possible and never use anything for advertising or profiling.</li>
<li>Players under 13 can make an account only with a parent or guardian, who confirms when the account is made.</li>
<li>Grown-ups can ask us to see or delete a child's account at <a href="mailto:info@dynamicweblab.com">info@dynamicweblab.com</a>. Please include the username.</li>
</ul>

<h2>9. Your rights</h2>
<ul>
<li><b>Delete:</b> open the 👤 account screen in the game, choose "Delete my account" and enter your password. Your account, sessions and agreement record are deleted straight away.</li>
<li><b>See, correct or ask questions:</b> email <a href="mailto:info@dynamicweblab.com">info@dynamicweblab.com</a>. Depending on where you live (for example the UAE, the EU, the UK or the US), you may have more rights. We'll help with all of them.</li>
<li>You can also complain to your local data protection authority.</li>
</ul>

<h2>10. Changes</h2>
<p>If we change this policy, we'll update the date at the top. If a change is important, we'll show a notice in the game before it applies.</p>

<p class="foot"><a href="terms.html">Terms of Use</a> · <a href="./">Back to the game</a></p>
</main>
</body>
</html>
26 changes: 20 additions & 6 deletions server/accounts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
// picked colour-and-animal name from Play Together.
// - Passwords are hashed with scrypt; sessions are random tokens stored only as SHA-256 hashes,
// sent as HttpOnly, Secure, SameSite=Lax cookies.
// - At sign-up the player agrees to the Terms / Privacy Policy (version recorded), and players
// under 13 need a grown-up to confirm. The birth year itself never reaches the server.
// - Deleting an account deletes everything about it straight away.
//
// Storage: Postgres when DATABASE_URL is set (production), otherwise in memory (development, tests).
Expand All @@ -20,6 +22,8 @@ const SESSION_DAYS = 30;
const MAX_BODY = 4096;
const USERNAME = /^[a-z0-9_]{3,20}$/;
const COOKIE = 'mc_session';
/** Must match TERMS_VERSION in src/account.js and the version on privacy.html / terms.html. */
export const TERMS_VERSION = '2026-11-10';

// ---------- passwords ----------
const SCRYPT = { N: 16384, r: 8, p: 1, maxmem: 64 * 1024 * 1024 };
Expand All @@ -40,9 +44,9 @@ const sha = (t) => crypto.createHash('sha256').update(t).digest('hex');
export class MemoryStore {
constructor() { this.users = new Map(); this.byName = new Map(); this.sessions = new Map(); this.next = 1; }
async init() {}
async createUser(username, hash) {
async createUser(username, hash, consent = {}) {
if (this.byName.has(username)) return null;
const u = { id: this.next++, username, pass_hash: hash, created_at: new Date() };
const u = { id: this.next++, username, pass_hash: hash, created_at: new Date(), terms_version: consent.terms || null, agreed_at: new Date(), grownup_confirmed: !!consent.grownup };
this.users.set(u.id, u); this.byName.set(username, u);
return u;
}
Expand Down Expand Up @@ -81,11 +85,17 @@ export class PgStore {
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
expires_at TIMESTAMPTZ NOT NULL
);
CREATE INDEX IF NOT EXISTS sessions_user ON sessions(user_id);`);
CREATE INDEX IF NOT EXISTS sessions_user ON sessions(user_id);
-- Consent record: which Terms / Privacy Policy version was agreed, when, and (under 13) that a grown-up confirmed.
ALTER TABLE users ADD COLUMN IF NOT EXISTS terms_version TEXT;
ALTER TABLE users ADD COLUMN IF NOT EXISTS agreed_at TIMESTAMPTZ;
ALTER TABLE users ADD COLUMN IF NOT EXISTS grownup_confirmed BOOLEAN NOT NULL DEFAULT false;`);
setInterval(() => this.pool.query('DELETE FROM sessions WHERE expires_at < now()').catch(() => {}), 3600_000).unref();
}
async createUser(username, hash) {
const r = await this.pool.query('INSERT INTO users (username, pass_hash) VALUES ($1, $2) ON CONFLICT (username) DO NOTHING RETURNING id, username', [username, hash]);
async createUser(username, hash, consent = {}) {
const r = await this.pool.query(
'INSERT INTO users (username, pass_hash, terms_version, agreed_at, grownup_confirmed) VALUES ($1, $2, $3, now(), $4) ON CONFLICT (username) DO NOTHING RETURNING id, username',
[username, hash, consent.terms || null, !!consent.grownup]);
return r.rows[0] || null;
}
async userByName(username) { return (await this.pool.query('SELECT id, username, pass_hash FROM users WHERE username = $1', [username])).rows[0] || null; }
Expand Down Expand Up @@ -171,8 +181,12 @@ export function createAccounts(o) {
if (route === 'register') {
if (!USERNAME.test(username)) return json(res, 400, { error: 'bad-username' }), true;
if (password.length < 8 || password.length > 200) return json(res, 400, { error: 'bad-password' }), true;
// Agreeing to the current Terms / Privacy Policy is required; players under 13 need a grown-up.
if (body.agree !== true || body.terms !== TERMS_VERSION) return json(res, 400, { error: 'terms' }), true;
if (body.under13 === true && body.grownup !== true) return json(res, 400, { error: 'grownup' }), true;
if (!regLimit.hit(ip)) return json(res, 429, { error: 'slow-down' }), true;
const user = await store.createUser(username, await hashPassword(password));
const consent = { terms: TERMS_VERSION, grownup: body.under13 === true && body.grownup === true };
const user = await store.createUser(username, await hashPassword(password), consent);
if (!user) return json(res, 409, { error: 'taken' }), true;
return startSession(res, user, 201), true;
}
Expand Down
2 changes: 1 addition & 1 deletion server/dev.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { attachRelay } from './rooms.mjs';

const ROOT = fileURLToPath(new URL('..', import.meta.url));
const TYPES = { '.html': 'text/html', '.js': 'text/javascript', '.mjs': 'text/javascript', '.css': 'text/css', '.json': 'application/json', '.webmanifest': 'application/manifest+json', '.png': 'image/png', '.jpg': 'image/jpeg', '.svg': 'image/svg+xml' };
const SERVE = ['index.html', 'style.css', 'sw.js', 'manifest.webmanifest', 'icons', 'src', 'vendor'];
const SERVE = ['index.html', 'style.css', 'privacy.html', 'terms.html', 'legal.css', 'sw.js', 'manifest.webmanifest', 'icons', 'src', 'vendor'];

/** Starts the dev server. Returns { server, port, url }. */
export async function startDevServer(port = 8770) {
Expand Down
Loading
Loading