- Personal accounts (admin/editor) with QR sign-up, phone pairing per account - Per-user AI API keys plus a paste-in starter message that bootstraps the AI chat - AI researches each item in depth, keeps research notes, files an honest run report - General-purpose wording; read-only share links; value indications toned down - Records and CDs: exact-pressing research via Discogs, record-specific fields - Web assets revalidate on every load so updates reach everyone
95 lines
5.3 KiB
HTML
95 lines
5.3 KiB
HTML
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>Join · IndexiPro</title>
|
|
<link rel="icon" href="/icons/favicon.svg" type="image/svg+xml">
|
|
<link rel="stylesheet" href="/styles.css">
|
|
<style>
|
|
.wrap { max-width: 460px; margin: 6vh auto; padding: 0 16px; }
|
|
.step { display: flex; gap: 14px; align-items: flex-start; margin-top: 18px; }
|
|
.num { flex: 0 0 34px; height: 34px; border-radius: 50%; background: var(--green-d); color: #04150b; display: grid; place-items: center; font-weight: 800; font-family: var(--mono); }
|
|
.big-btn { width: 100%; padding: 14px; font-size: 1.05rem; margin-top: 8px; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="wrap">
|
|
<div style="text-align:center">
|
|
<img src="/icons/logo.svg" alt="IndexiPro logo" width="96" height="96">
|
|
<div class="hero-word">Indexi<b>Pro</b></div>
|
|
<p class="muted" id="coll"> </p>
|
|
</div>
|
|
<div class="card" id="box"><p class="muted">Checking your code…</p></div>
|
|
</div>
|
|
<script type="module">
|
|
import { api, esc, toast } from '/common.js';
|
|
const code = location.pathname.split('/').pop();
|
|
const box = document.getElementById('box');
|
|
const android = /android/i.test(navigator.userAgent);
|
|
try {
|
|
const [inv, info] = await Promise.all([api(`/invite/${code}`), api('/info')]);
|
|
document.getElementById('coll').textContent = `You're invited to help catalogue “${inv.name}”`;
|
|
const joinUrl = location.href.split('?')[0];
|
|
const appLink = `indexipro://pair?url=${encodeURIComponent(joinUrl)}`;
|
|
const androidBlock = android && info.app.available ? `
|
|
<h2>Use the Android app (recommended)</h2>
|
|
<div class="step"><div class="num">1</div><div style="flex:1">Install the app.
|
|
<a class="btn primary big-btn" href="/download/indexipro.apk">⇩ Download IndexiPro app</a>
|
|
<div class="small muted" style="margin-top:6px">Open the downloaded file. If Android asks, allow your browser to install apps.</div></div></div>
|
|
<div class="step"><div class="num">2</div><div style="flex:1">Come back to this page and tap:
|
|
<a class="btn big-btn" href="${appLink}">Open in the app</a>
|
|
<div class="small muted" style="margin-top:6px">…or scan the QR code again from inside the app.</div></div></div>
|
|
<hr style="border:none;border-top:1px solid var(--line);margin:24px 0">
|
|
<h2>…or just use this browser</h2>` : '<h2>Join</h2>';
|
|
if (inv.personal) {
|
|
// "Pair my phone" code from someone's own account page.
|
|
document.getElementById('coll').textContent = `Sign in as ${inv.person} on this device`;
|
|
box.innerHTML = `${androidBlock.replace('<h2>Join</h2>', '')}
|
|
<button class="btn ${android && info.app.available ? '' : 'primary'} big-btn" id="me">Continue in the browser as ${esc(inv.person)}</button>`;
|
|
document.getElementById('me').onclick = async () => {
|
|
try { await api('/pair', { json: { code, kind: 'web' } }); location.href = '/capture'; } catch (err) { toast(err.message, true); }
|
|
};
|
|
return;
|
|
}
|
|
box.innerHTML = `${androidBlock}
|
|
<form id="f" class="grid">
|
|
<div id="newfields" class="grid">
|
|
<label class="f"><span>Your name</span><input name="name" placeholder="e.g. Sam" autocomplete="given-name" maxlength="40"></label>
|
|
<label class="f"><span>Choose a password (min. 6 characters)</span><input name="password" type="password" autocomplete="new-password"></label>
|
|
</div>
|
|
<div id="oldfields" class="grid hidden">
|
|
<label class="f"><span>Username</span><input name="username" autocomplete="username" autocapitalize="none"></label>
|
|
<label class="f"><span>Password</span><input name="oldpassword" type="password" autocomplete="current-password"></label>
|
|
</div>
|
|
<button class="btn ${android && info.app.available ? '' : 'primary'} big-btn" id="go">Create my account</button>
|
|
<a href="#" id="toggle" class="small" style="text-align:center">I already have an account</a>
|
|
</form>`;
|
|
let existing = false;
|
|
document.getElementById('toggle').onclick = (e) => {
|
|
e.preventDefault();
|
|
existing = !existing;
|
|
document.getElementById('newfields').classList.toggle('hidden', existing);
|
|
document.getElementById('oldfields').classList.toggle('hidden', !existing);
|
|
document.getElementById('go').textContent = existing ? 'Sign in' : 'Create my account';
|
|
e.target.textContent = existing ? 'I\'m new here' : 'I already have an account';
|
|
};
|
|
document.getElementById('f').onsubmit = async (e) => {
|
|
e.preventDefault();
|
|
const f = e.target;
|
|
const body = existing
|
|
? { code, kind: 'web', username: f.username.value, password: f.oldpassword.value }
|
|
: { code, kind: 'web', name: f.name.value, password: f.password.value };
|
|
try {
|
|
const r = await api('/pair', { json: body });
|
|
if (r.created) alert(`Welcome! Your username is "${r.username}". Remember it with your password to sign in on other devices.`);
|
|
location.href = '/capture';
|
|
} catch (err) { toast(err.message, true); }
|
|
};
|
|
} catch (e) {
|
|
box.innerHTML = `<div class="empty"><div class="big">⌛</div>${esc(e.message)}</div>`;
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|