Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

feat: bounties API, go page, login cleanup

nirholase7148f83321b
diff --git a/api/bounties.js b/api/bounties.js
new file mode 100644
index 000000000..14dfe5b99
--- /dev/null
+++ b/api/bounties.js
@@ -0,0 +1,132 @@
+import { sql } from './_lib/db.js';
+import { cors, json, error, readJson, wrap, method } from './_lib/http.js';
+import { getSessionUser } from './_lib/auth.js';
+
+const SOL_USD_FALLBACK = 160;
+
+export default wrap(async (req, res) => {
+ if (cors(req, res)) return;
+
+ if (req.method === 'GET') {
+ const url = new URL(req.url, 'http://localhost');
+ const tab = url.searchParams.get('tab') || 'trending';
+ const limit = Math.min(parseInt(url.searchParams.get('limit') || '30', 10), 50);
+ const offset = Math.max(parseInt(url.searchParams.get('offset') || '0', 10), 0);
+
+ if (tab === 'feed') {
+ // Mixed feed: interleave recent submissions and open bounties
+ const [bounties, submissions] = await Promise.all([
+ sql`
+ SELECT b.id, b.user_id, b.username, b.title, b.description,
+ b.coin_symbol, b.coin_mint, b.reward_sol, b.reward_tokens,
+ b.reward_usd, b.status, b.expires_at, b.submission_count,
+ b.created_at, 'bounty' AS _type
+ FROM bounties b
+ WHERE b.deleted_at IS NULL AND b.status != 'closed'
+ ORDER BY b.submission_count DESC, b.reward_usd DESC NULLS LAST, b.created_at DESC
+ LIMIT ${Math.ceil(limit / 2)}
+ `,
+ sql`
+ SELECT bs.id, bs.bounty_id, bs.user_id, bs.username,
+ bs.content, bs.media_url, bs.media_type, bs.status,
+ bs.created_at,
+ b.title AS bounty_title, b.coin_symbol, b.coin_mint,
+ 'submission' AS _type
+ FROM bounty_submissions bs
+ JOIN bounties b ON bs.bounty_id = b.id
+ WHERE bs.status != 'rejected' AND b.deleted_at IS NULL
+ ORDER BY bs.created_at DESC
+ LIMIT ${Math.ceil(limit / 2)}
+ `,
+ ]);
+ // Interleave: for each bounty insert up to 2 of its submissions
+ const subsByBounty = {};
+ for (const s of submissions) {
+ if (!subsByBounty[s.bounty_id]) subsByBounty[s.bounty_id] = [];
+ subsByBounty[s.bounty_id].push(s);
+ }
+ const feed = [];
+ for (const b of bounties) {
+ feed.push(b);
+ const subs = subsByBounty[b.id] || [];
+ for (const s of subs.slice(0, 2)) feed.push(s);
+ }
+ return json(res, 200, { feed, tab });
+ }
+
+ if (tab === 'submissions') {
+ const rows = await sql`
+ SELECT bs.id, bs.bounty_id, bs.user_id, bs.username,
+ bs.content, bs.media_url, bs.media_type, bs.status,
+ bs.reward_sol, bs.created_at,
+ b.title AS bounty_title, b.coin_symbol, b.coin_mint
+ FROM bounty_submissions bs
+ JOIN bounties b ON bs.bounty_id = b.id
+ WHERE bs.status != 'rejected' AND b.deleted_at IS NULL
+ ORDER BY bs.created_at DESC
+ LIMIT ${limit} OFFSET ${offset}
+ `;
+ return json(res, 200, { submissions: rows, tab });
+ }
+
+ if (tab === 'open') {
+ const rows = await sql`
+ SELECT b.id, b.user_id, b.username, b.title, b.description,
+ b.coin_symbol, b.coin_mint, b.reward_sol, b.reward_tokens,
+ b.reward_usd, b.status, b.expires_at, b.submission_count, b.created_at
+ FROM bounties b
+ WHERE b.deleted_at IS NULL AND b.status = 'open'
+ AND (b.expires_at IS NULL OR b.expires_at > NOW())
+ ORDER BY b.reward_usd DESC NULLS LAST, b.created_at DESC
+ LIMIT ${limit} OFFSET ${offset}
+ `;
+ return json(res, 200, { bounties: rows, tab });
+ }
+
+ // trending (default)
+ const rows = await sql`
+ SELECT b.id, b.user_id, b.username, b.title, b.description,
+ b.coin_symbol, b.coin_mint, b.reward_sol, b.reward_tokens,
+ b.reward_usd, b.status, b.expires_at, b.submission_count, b.created_at
+ FROM bounties b
+ WHERE b.deleted_at IS NULL
+ ORDER BY b.submission_count DESC, b.reward_usd DESC NULLS LAST, b.created_at DESC
+ LIMIT ${limit} OFFSET ${offset}
+ `;
+ return json(res, 200, { bounties: rows, tab });
+ }
+
+ if (req.method === 'POST') {
+ let user;
+ try { user = await getSessionUser(req); } catch {
+ return error(res, 401, 'unauthorized', 'sign in to post a bounty');
+ }
+
+ const body = await readJson(req);
+ const { title, description, reward_sol, reward_tokens, coin_symbol, coin_mint, expires_in_days } = body;
+
+ if (!title?.trim()) return error(res, 400, 'bad_request', 'title is required');
+ if (!reward_sol && !reward_tokens) return error(res, 400, 'bad_request', 'set a reward (SOL or tokens)');
+
+ const rewardSol = reward_sol ? parseFloat(reward_sol) : null;
+ const rewardUsd = rewardSol ? parseFloat((rewardSol * SOL_USD_FALLBACK).toFixed(2)) : null;
+ const days = Math.min(parseInt(expires_in_days || '7', 10), 30);
+ const expiresAt = new Date(Date.now() + days * 86400000).toISOString();
+ const username = user.display_name || user.email?.split('@')[0] || 'anon';
+ const symbol = coin_symbol?.trim() || '$THREE';
+ const mint = coin_mint?.trim() || 'FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump';
+
+ const [bounty] = await sql`
+ INSERT INTO bounties
+ (user_id, username, title, description, reward_sol, reward_tokens, reward_usd, coin_symbol, coin_mint, expires_at)
+ VALUES
+ (${user.id}, ${username}, ${title.trim()}, ${description?.trim() || null},
+ ${rewardSol}, ${reward_tokens ? BigInt(reward_tokens) : null}, ${rewardUsd},
+ ${symbol}, ${mint}, ${expiresAt})
+ RETURNING *
+ `;
+ return json(res, 201, { bounty });
+ }
+
+ if (!method(req, res, ['GET', 'POST'])) return;
+});
diff --git a/api/bounties/[id].js b/api/bounties/[id].js
new file mode 100644
index 000000000..08f6bddc9
--- /dev/null
+++ b/api/bounties/[id].js
@@ -0,0 +1,32 @@
+import { sql } from '../_lib/db.js';
+import { cors, json, error, wrap, method } from '../_lib/http.js';
+
+export default wrap(async (req, res) => {
+ if (cors(req, res)) return;
+ if (!method(req, res, ['GET'])) return;
+
+ const id = req.query?.id || req.url?.split('/').pop()?.split('?')[0];
+ if (!id) return error(res, 400, 'bad_request', 'bounty id required');
+
+ const [bounty] = await sql`
+ SELECT b.*,
+ COALESCE(
+ json_agg(
+ json_build_object(
+ 'id', bs.id, 'user_id', bs.user_id, 'username', bs.username,
+ 'content', bs.content, 'media_url', bs.media_url,
+ 'media_type', bs.media_type, 'status', bs.status,
+ 'reward_sol', bs.reward_sol, 'created_at', bs.created_at
+ ) ORDER BY bs.created_at DESC
+ ) FILTER (WHERE bs.id IS NOT NULL),
+ '[]'
+ ) AS submissions
+ FROM bounties b
+ LEFT JOIN bounty_submissions bs ON bs.bounty_id = b.id AND bs.status != 'rejected'
+ WHERE b.id = ${id} AND b.deleted_at IS NULL
+ GROUP BY b.id
+ `;
+
+ if (!bounty) return error(res, 404, 'not_found', 'bounty not found');
+ return json(res, 200, { bounty });
+});
diff --git a/api/bounties/[id]/resolve.js b/api/bounties/[id]/resolve.js
new file mode 100644
index 000000000..642f1717d
--- /dev/null
+++ b/api/bounties/[id]/resolve.js
@@ -0,0 +1,52 @@
+import { sql } from '../../_lib/db.js';
+import { cors, json, error, readJson, wrap, method } from '../../_lib/http.js';
+import { getSessionUser } from '../../_lib/auth.js';
+
+export default wrap(async (req, res) => {
+ if (cors(req, res)) return;
+ if (!method(req, res, ['POST'])) return;
+
+ let user;
+ try { user = await getSessionUser(req); } catch {
+ return error(res, 401, 'unauthorized', 'sign in required');
+ }
+
+ const id = req.query?.id;
+ if (!id) return error(res, 400, 'bad_request', 'bounty id required');
+
+ const [bounty] = await sql`
+ SELECT id, user_id, status, reward_sol FROM bounties
+ WHERE id = ${id} AND deleted_at IS NULL
+ `;
+ if (!bounty) return error(res, 404, 'not_found', 'bounty not found');
+ if (bounty.user_id !== user.id) return error(res, 403, 'forbidden', 'only the bounty poster can resolve');
+ if (bounty.status === 'closed') return error(res, 409, 'already_closed', 'bounty already resolved');
+
+ const body = await readJson(req);
+ const { submission_id, tx_hash } = body;
+ if (!submission_id) return error(res, 400, 'bad_request', 'submission_id required');
+
+ const [submission] = await sql`
+ SELECT id FROM bounty_submissions WHERE id = ${submission_id} AND bounty_id = ${id}
+ `;
+ if (!submission) return error(res, 404, 'not_found', 'submission not found on this bounty');
+
+ await sql`
+ UPDATE bounty_submissions SET status = 'rejected'
+ WHERE bounty_id = ${id} AND id != ${submission_id}
+ `;
+
+ const [winner] = await sql`
+ UPDATE bounty_submissions
+ SET status = 'accepted', reward_sol = ${bounty.reward_sol || null}, tx_hash = ${tx_hash?.trim() || null}
+ WHERE id = ${submission_id}
+ RETURNING *
+ `;
+
+ await sql`
+ UPDATE bounties SET status = 'closed', winner_submission_id = ${submission_id}
+ WHERE id = ${id}
+ `;
+
+ return json(res, 200, { winner });
+});
diff --git a/api/bounties/[id]/submissions.js b/api/bounties/[id]/submissions.js
new file mode 100644
index 000000000..71160c16d
--- /dev/null
+++ b/api/bounties/[id]/submissions.js
@@ -0,0 +1,68 @@
+import { sql } from '../../_lib/db.js';
+import { cors, json, error, readJson, wrap, method } from '../../_lib/http.js';
+import { getSessionUser } from '../../_lib/auth.js';
+
+export default wrap(async (req, res) => {
+ if (cors(req, res)) return;
+
+ const id = req.query?.id;
+ if (!id) return error(res, 400, 'bad_request', 'bounty id required');
+
+ if (req.method === 'GET') {
+ const url = new URL(req.url, 'http://localhost');
+ const limit = Math.min(parseInt(url.searchParams.get('limit') || '20', 10), 50);
+ const offset = Math.max(parseInt(url.searchParams.get('offset') || '0', 10), 0);
+
+ const rows = await sql`
+ SELECT id, bounty_id, user_id, username, content, media_url, media_type,
+ status, reward_sol, tx_hash, created_at
+ FROM bounty_submissions
+ WHERE bounty_id = ${id} AND status != 'rejected'
+ ORDER BY created_at DESC
+ LIMIT ${limit} OFFSET ${offset}
+ `;
+ return json(res, 200, { submissions: rows });
+ }
+
+ if (req.method === 'POST') {
+ let user;
+ try { user = await getSessionUser(req); } catch {
+ return error(res, 401, 'unauthorized', 'sign in to submit');
+ }
+
+ const [bounty] = await sql`
+ SELECT id, status, expires_at FROM bounties
+ WHERE id = ${id} AND deleted_at IS NULL
+ `;
+ if (!bounty) return error(res, 404, 'not_found', 'bounty not found');
+ if (bounty.status === 'closed') return error(res, 409, 'bounty_closed', 'bounty is closed');
+ if (bounty.expires_at && new Date(bounty.expires_at) < new Date()) {
+ return error(res, 409, 'bounty_expired', 'bounty has expired');
+ }
+
+ const body = await readJson(req);
+ const { content, media_url, media_type } = body;
+ if (!content?.trim() && !media_url?.trim()) {
+ return error(res, 400, 'bad_request', 'provide a description or media URL');
+ }
+
+ const validTypes = ['image', 'video', 'link'];
+ const mtype = media_type && validTypes.includes(media_type) ? media_type : (media_url ? 'link' : null);
+ const username = user.display_name || user.email?.split('@')[0] || 'anon';
+
+ const [submission] = await sql`
+ INSERT INTO bounty_submissions (bounty_id, user_id, username, content, media_url, media_type)
+ VALUES (${id}, ${user.id}, ${username}, ${content?.trim() || null}, ${media_url?.trim() || null}, ${mtype})
+ RETURNING *
+ `;
+
+ await sql`
+ UPDATE bounties SET submission_count = submission_count + 1, status = 'resolving'
+ WHERE id = ${id}
+ `;
+
+ return json(res, 201, { submission });
+ }
+
+ if (!method(req, res, ['GET', 'POST'])) return;
+});
diff --git a/pages/go.html b/pages/go.html
new file mode 100644
index 000000000..b94a1dece
--- /dev/null
+++ b/pages/go.html
@@ -0,0 +1,441 @@
+<!doctype html>
+<html lang="en">
+<head>
+ <meta charset="utf-8" />
+ <title>GO · Bounties · three.ws</title>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
+ <meta name="description" content="Post bounties, submit proof, earn rewards. The three.ws bounty board powered by $THREE." />
+ <meta name="theme-color" content="#0a0a0f" />
+ <meta property="og:type" content="website" />
+ <meta property="og:site_name" content="three.ws" />
+ <meta property="og:title" content="GO · Bounties · three.ws" />
+ <meta property="og:description" content="Post bounties, submit proof, earn rewards on-chain." />
+ <meta property="og:url" content="https://three.ws/go" />
+ <meta name="twitter:card" content="summary_large_image" />
+ <style>
+ * { margin: 0; padding: 0; box-sizing: border-box; }
+ :root {
+ --bg: #0a0a0f;
+ --surface: #111118;
+ --panel: rgba(255,255,255,0.04);
+ --panel-hover: rgba(255,255,255,0.07);
+ --border: rgba(255,255,255,0.08);
+ --text: #f0f0f8;
+ --muted: rgba(240,240,248,0.5);
+ --muted-2: rgba(240,240,248,0.32);
+ --accent: #7c5cff;
+ --accent-glow: rgba(124,92,255,0.18);
+ --green: #22c55e;
+ --green-bg: rgba(34,197,94,0.12);
+ --amber: #f59e0b;
+ --amber-bg: rgba(245,158,11,0.12);
+ --blue: #3b82f6;
+ --blue-bg: rgba(59,130,246,0.12);
+ --sol: #9945ff;
+ --radius: 12px;
+ }
+ html, body { background: var(--bg); color: var(--text); min-height: 100vh; }
+ body {
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
+ -webkit-font-smoothing: antialiased;
+ background:
+ radial-gradient(900px 500px at 70% -5%, rgba(124,92,255,0.12), transparent 60%),
+ radial-gradient(700px 400px at 0% 30%, rgba(34,197,94,0.06), transparent 55%),
+ var(--bg);
+ }
+ a { color: inherit; text-decoration: none; }
+ button { cursor: pointer; border: none; background: none; color: inherit; font: inherit; }
+
+ /* ── Top bar ─────────────────────────────────────────── */
+ .topbar {
+ display: flex; align-items: center; justify-content: space-between; gap: 12px;
+ padding: 14px clamp(16px, 4vw, 40px);
+ position: sticky; top: 0; z-index: 20;
+ backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
+ background: linear-gradient(180deg, rgba(10,10,15,0.9) 70%, transparent);
+ border-bottom: 1px solid var(--border);
+ }
+ .brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 17px; letter-spacing: -0.5px; }
+ .brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
+ .brand .go-badge {
+ font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
+ background: var(--accent); color: #fff; padding: 2px 8px; border-radius: 5px;
+ text-transform: uppercase;
+ }
+ .topbar-right { display: flex; align-items: center; gap: 8px; }
+ .btn {
+ display: inline-flex; align-items: center; gap: 6px;
+ padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 600;
+ transition: opacity .15s, transform .1s;
+ }
+ .btn:active { transform: scale(0.97); }
+ .btn-primary { background: var(--accent); color: #fff; }
+ .btn-primary:hover { opacity: 0.88; }
+ .btn-ghost { background: var(--panel); color: var(--text); border: 1px solid var(--border); }
+ .btn-ghost:hover { background: var(--panel-hover); }
+ .btn-sm { padding: 6px 12px; font-size: 12px; }
+ #user-btn { display: none; }
+
+ /* ── Layout ──────────────────────────────────────────── */
+ .layout {
+ display: grid;
+ grid-template-columns: 1fr 300px;
+ gap: 0;
+ max-width: 1200px;
+ margin: 0 auto;
+ padding: 0 clamp(12px, 3vw, 32px) 80px;
+ align-items: start;
+ }
+ @media (max-width: 900px) { .layout { grid-template-columns: 1fr; } .sidebar { display: none; } }
+
+ /* ── Feed column ─────────────────────────────────────── */
+ .feed-col { border-right: 1px solid var(--border); min-height: 100vh; }
+
+ /* Tabs */
+ .tabs {
+ display: flex; gap: 0; border-bottom: 1px solid var(--border);
+ position: sticky; top: 57px; z-index: 10;
+ backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
+ background: rgba(10,10,15,0.85);
+ }
+ .tab-btn {
+ flex: 1; padding: 14px 0; font-size: 13px; font-weight: 600; color: var(--muted);
+ border-bottom: 2px solid transparent; transition: color .15s, border-color .15s;
+ text-align: center; letter-spacing: 0.02em;
+ }
+ .tab-btn.active { color: var(--text); border-bottom-color: var(--accent); }
+ .tab-btn:hover:not(.active) { color: var(--text); }
+
+ /* Feed */
+ #feed { padding: 0; }
+
+ /* ── Card ────────────────────────────────────────────── */
+ .card {
+ border-bottom: 1px solid var(--border);
+ padding: 18px 20px;
+ transition: background .12s;
+ }
+ .card:hover { background: var(--panel); }
+
+ .card-header { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
+ .badge {
+ display: inline-flex; align-items: center;
+ font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
+ padding: 3px 8px; border-radius: 5px; flex-shrink: 0; margin-top: 2px;
+ }
+ .badge-open { background: var(--green-bg); color: var(--green); }
+ .badge-resolving{ background: var(--amber-bg); color: var(--amber); }
+ .badge-closed { background: var(--panel); color: var(--muted); }
+ .badge-sub { background: var(--blue-bg); color: var(--blue); }
+
+ .card-meta { flex: 1; min-width: 0; }
+ .card-title { font-size: 14px; font-weight: 600; line-height: 1.4; margin-bottom: 4px; }
+ .card-desc { font-size: 13px; color: var(--muted); line-height: 1.5; margin-bottom: 8px;
+ display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
+
+ .card-footer { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
+ .poster { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
+ .poster-avatar {
+ width: 20px; height: 20px; border-radius: 50%;
+ background: linear-gradient(135deg, var(--accent), var(--green));
+ display: flex; align-items: center; justify-content: center;
+ font-size: 9px; font-weight: 700; color: #fff; flex-shrink: 0;
+ }
+ .reward {
+ display: flex; align-items: center; gap: 4px;
+ font-size: 13px; font-weight: 700; color: var(--green);
+ }
+ .reward-token { font-size: 11px; color: var(--muted); font-weight: 500; }
+ .time-left { font-size: 12px; color: var(--muted-2); }
+ .sub-count {
+ font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 3px;
+ }
+ .coin-tag {
+ display: inline-flex; align-items: center; gap: 4px;
+ font-size: 11px; color: var(--muted); background: var(--panel);
+ border: 1px solid var(--border); border-radius: 5px; padding: 2px 7px;
+ }
+
+ /* Submission card specific */
+ .sub-card { background: rgba(59,130,246,0.03); }
+ .sub-to { font-size: 11px; color: var(--muted-2); margin-bottom: 6px; }
+ .sub-to span { color: var(--blue); }
+ .sub-content { font-size: 13px; color: var(--muted); line-height: 1.5; margin-bottom: 8px;
+ display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
+ .sub-media {
+ width: 100%; max-height: 200px; object-fit: cover; border-radius: 8px;
+ background: var(--surface); margin-bottom: 8px; display: block;
+ }
+ .sub-actions { display: flex; gap: 6px; margin-top: 8px; }
+ .submit-btn {
+ margin-left: auto; font-size: 12px; font-weight: 600;
+ padding: 5px 12px; border-radius: 6px;
+ background: var(--accent); color: #fff; transition: opacity .15s;
+ }
+ .submit-btn:hover { opacity: 0.85; }
+ .resolve-btn {
+ font-size: 12px; font-weight: 600; padding: 5px 12px; border-radius: 6px;
+ background: var(--green-bg); color: var(--green); border: 1px solid rgba(34,197,94,0.2);
+ transition: background .15s;
+ }
+ .resolve-btn:hover { background: rgba(34,197,94,0.2); }
+
+ /* Empty + Loading */
+ .empty {
+ padding: 60px 20px; text-align: center; color: var(--muted);
+ display: flex; flex-direction: column; align-items: center; gap: 12px;
+ }
+ .empty-icon { font-size: 40px; opacity: 0.4; }
+ .empty h3 { font-size: 16px; color: var(--text); }
+ .empty p { font-size: 13px; max-width: 280px; line-height: 1.5; }
+ .skeleton {
+ background: linear-gradient(90deg, var(--panel) 25%, var(--panel-hover) 50%, var(--panel) 75%);
+ background-size: 200% 100%;
+ animation: shimmer 1.4s infinite;
+ border-radius: 6px;
+ }
+ @keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
+ .skel-block { height: 14px; margin-bottom: 8px; }
+ .skel-card { padding: 18px 20px; border-bottom: 1px solid var(--border); }
+
+ /* Load more */
+ .load-more-btn {
+ width: 100%; padding: 16px; text-align: center; font-size: 13px;
+ color: var(--muted); border-top: 1px solid var(--border);
+ transition: color .15s, background .15s;
+ }
+ .load-more-btn:hover { color: var(--text); background: var(--panel); }
+
+ /* ── Sidebar ─────────────────────────────────────────── */
+ .sidebar { padding: 24px 0 24px 24px; display: flex; flex-direction: column; gap: 24px; }
+ .sidebar-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
+ .sidebar-title {
+ font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
+ color: var(--muted); padding: 12px 14px 10px; border-bottom: 1px solid var(--border);
+ }
+ .leaderboard-row {
+ display: flex; align-items: center; gap: 10px;
+ padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13px;
+ }
+ .leaderboard-row:last-child { border-bottom: none; }
+ .rank { font-weight: 700; color: var(--muted-2); width: 16px; flex-shrink: 0; }
+ .rank.gold { color: #f59e0b; }
+ .rank.silver { color: #94a3b8; }
+ .rank.bronze { color: #b45309; }
+ .lb-info { flex: 1; min-width: 0; }
+ .lb-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
+ .lb-sub { font-size: 11px; color: var(--muted); }
+ .lb-amount { font-weight: 700; color: var(--green); font-size: 13px; flex-shrink: 0; }
+ .top-bounty-row {
+ display: flex; align-items: flex-start; gap: 8px;
+ padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13px;
+ }
+ .top-bounty-row:last-child { border-bottom: none; }
+ .tb-rank { font-weight: 700; color: var(--muted-2); width: 16px; flex-shrink: 0; padding-top: 1px; }
+ .tb-info { flex: 1; min-width: 0; }
+ .tb-title { font-weight: 600; font-size: 12px; line-height: 1.4; margin-bottom: 3px;
+ display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
+ .tb-meta { font-size: 11px; color: var(--muted); }
+ .tb-reward { font-weight: 700; color: var(--green); font-size: 13px; flex-shrink: 0; }
+
+ /* ── Create bounty modal ─────────────────────────────── */
+ .modal-overlay {
+ position: fixed; inset: 0; background: rgba(0,0,0,0.7); z-index: 100;
+ display: flex; align-items: center; justify-content: center;
+ backdrop-filter: blur(4px); padding: 20px;
+ opacity: 0; pointer-events: none; transition: opacity .2s;
+ }
+ .modal-overlay.open { opacity: 1; pointer-events: auto; }
+ .modal {
+ background: var(--surface); border: 1px solid var(--border);
+ border-radius: 16px; width: 100%; max-width: 520px;
+ max-height: 90vh; overflow-y: auto;
+ transform: translateY(12px); transition: transform .2s;
+ }
+ .modal-overlay.open .modal { transform: translateY(0); }
+ .modal-header {
+ display: flex; align-items: center; justify-content: space-between;
+ padding: 20px 22px 16px; border-bottom: 1px solid var(--border);
+ }
+ .modal-title { font-size: 16px; font-weight: 700; }
+ .modal-close { color: var(--muted); font-size: 18px; padding: 4px; border-radius: 6px; transition: color .12s; }
+ .modal-close:hover { color: var(--text); }
+ .modal-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 14px; }
+ .field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; letter-spacing: 0.03em; }
+ .field input, .field textarea, .field select {
+ width: 100%; background: var(--bg); border: 1px solid var(--border);
+ border-radius: 8px; color: var(--text); font: inherit; font-size: 14px;
+ padding: 10px 12px; outline: none; transition: border-color .15s;
+ resize: vertical;
+ }
+ .field input:focus, .field textarea:focus, .field select:focus {
+ border-color: var(--accent);
+ }
+ .field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
+ .modal-footer { padding: 14px 22px 20px; display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--border); }
+ .form-error { font-size: 12px; color: #f87171; background: rgba(248,113,113,0.1); border-radius: 6px; padding: 8px 12px; }
+
+ /* Resolve modal: submission picker */
+ .sub-pick-list { display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow-y: auto; }
+ .sub-pick {
+ border: 2px solid var(--border); border-radius: 8px; padding: 12px 14px;
+ cursor: pointer; transition: border-color .12s, background .12s;
+ }
+ .sub-pick:hover { border-color: var(--accent); background: var(--accent-glow); }
+ .sub-pick.selected { border-color: var(--accent); background: var(--accent-glow); }
+ .sub-pick-user { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
+ .sub-pick-content { font-size: 13px; }
+
+ /* Toast */
+ .toast {
+ position: fixed; bottom: 24px; right: 24px; z-index: 200;
+ background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
+ padding: 12px 18px; font-size: 13px; font-weight: 600;
+ transform: translateY(8px); opacity: 0; transition: all .2s;
+ pointer-events: none; box-shadow: 0 8px 32px rgba(0,0,0,0.4);
+ }
+ .toast.show { transform: translateY(0); opacity: 1; }
+ .toast.success { border-color: rgba(34,197,94,0.4); color: var(--green); }
+ .toast.fail { border-color: rgba(248,113,113,0.4); color: #f87171; }
+ </style>
+</head>
+<body>
+
+<!-- Top bar -->
+<header class="topbar">
+ <a href="/" class="brand">
+ <span class="dot"></span>
+ three.ws
+ <span class="go-badge">GO</span>
+ </a>
+ <div class="topbar-right">
+ <a href="/dashboard" class="btn btn-ghost btn-sm">Dashboard</a>
+ <button id="create-btn" class="btn btn-primary btn-sm">+ Post Bounty</button>
+ <button id="user-btn" class="btn btn-ghost btn-sm"></button>
+ </div>
+</header>
+
+<!-- Main layout -->
+<div class="layout">
+ <!-- Feed column -->
+ <div class="feed-col">
+ <nav class="tabs" role="tablist">
+ <button class="tab-btn active" data-tab="feed">Trending</button>
+ <button class="tab-btn" data-tab="open">Open</button>
+ <button class="tab-btn" data-tab="submissions">Submissions</button>
+ </nav>
+ <div id="feed"></div>
+ </div>
+
+ <!-- Sidebar -->
+ <aside class="sidebar">
+ <div class="sidebar-card">
+ <div class="sidebar-title">Highest Value · Open</div>
+ <div id="top-bounties"></div>
+ </div>
+ <div class="sidebar-card">
+ <div class="sidebar-title">Top Earners · 30d</div>
+ <div id="top-earners"></div>
+ </div>
+ <div class="sidebar-card">
+ <div class="sidebar-title">Top Spenders · 30d</div>
+ <div id="top-spenders"></div>
+ </div>
+ </aside>
+</div>
+
+<!-- Create bounty modal -->
+<div class="modal-overlay" id="create-modal" role="dialog" aria-modal="true">
+ <div class="modal">
+ <div class="modal-header">
+ <span class="modal-title">Post a Bounty</span>
+ <button class="modal-close" data-close="create-modal">✕</button>
+ </div>
+ <div class="modal-body">
+ <div id="create-error" class="form-error" style="display:none"></div>
+ <div class="field">
+ <label>Title *</label>
+ <input id="c-title" type="text" placeholder="What do you want people to do?" maxlength="200" />
+ </div>
+ <div class="field">
+ <label>Description</label>
+ <textarea id="c-desc" rows="3" placeholder="Describe the task, rules, and what counts as a valid submission…"></textarea>
+ </div>
+ <div class="field-row">
+ <div class="field">
+ <label>Reward (SOL)</label>
+ <input id="c-sol" type="number" min="0" step="0.01" placeholder="0.5" />
+ </div>
+ <div class="field">
+ <label>Expires in (days)</label>
+ <select id="c-days">
+ <option value="3">3 days</option>
+ <option value="7" selected>7 days</option>
+ <option value="14">14 days</option>
+ <option value="30">30 days</option>
+ </select>
+ </div>
+ </div>
+ </div>
+ <div class="modal-footer">
+ <button class="btn btn-ghost" data-close="create-modal">Cancel</button>
+ <button id="create-submit" class="btn btn-primary">Post Bounty</button>
+ </div>
+ </div>
+</div>
+
+<!-- Submit proof modal -->
+<div class="modal-overlay" id="submit-modal" role="dialog" aria-modal="true">
+ <div class="modal">
+ <div class="modal-header">
+ <span class="modal-title">Submit Proof</span>
+ <button class="modal-close" data-close="submit-modal">✕</button>
+ </div>
+ <div class="modal-body">
+ <div id="submit-error" class="form-error" style="display:none"></div>
+ <div id="submit-bounty-title" style="font-size:13px;color:var(--muted);margin-bottom:4px;"></div>
+ <div class="field">
+ <label>Description</label>
+ <textarea id="s-content" rows="3" placeholder="Describe what you did…"></textarea>
+ </div>
+ <div class="field">
+ <label>Media / Link URL</label>
+ <input id="s-url" type="url" placeholder="https://x.com/… or https://youtu.be/…" />
+ </div>
+ </div>
+ <div class="modal-footer">
+ <button class="btn btn-ghost" data-close="submit-modal">Cancel</button>
+ <button id="submit-proof-btn" class="btn btn-primary">Submit</button>
+ </div>
+ </div>
+</div>
+
+<!-- Resolve modal -->
+<div class="modal-overlay" id="resolve-modal" role="dialog" aria-modal="true">
+ <div class="modal">
+ <div class="modal-header">
+ <span class="modal-title">Pick a Winner</span>
+ <button class="modal-close" data-close="resolve-modal">✕</button>
+ </div>
+ <div class="modal-body">
+ <div id="resolve-error" class="form-error" style="display:none"></div>
+ <p style="font-size:13px;color:var(--muted);margin-bottom:12px;">Select the submission you want to reward. Mark their Solana tx hash once you've paid.</p>
+ <div id="resolve-subs" class="sub-pick-list"></div>
+ <div class="field" style="margin-top:12px;">
+ <label>Solana TX Hash (optional)</label>
+ <input id="r-tx" type="text" placeholder="Paste transaction signature after paying…" />
+ </div>
+ </div>
+ <div class="modal-footer">
+ <button class="btn btn-ghost" data-close="resolve-modal">Cancel</button>
+ <button id="resolve-submit" class="btn btn-primary">Confirm Winner</button>
+ </div>
+ </div>
+</div>
+
+<!-- Toast -->
+<div class="toast" id="toast"></div>
+
+<script type="module" src="/src/go.js"></script>
+</body>
+</html>
diff --git a/public/login.html b/public/login.html
index 0f8a15483..92c2be3c6 100644
--- a/public/login.html
+++ b/public/login.html
@@ -301,27 +301,11 @@
/* ── Privy section ── */
#privy-section { margin: 0 0 2px; }
- #privy-toggle-btn {
- width: 100%;
- margin-top: 0;
- padding: 11px 16px;
- background: #0e0e0e;
- border: 1px solid rgba(255,255,255,0.1);
- border-radius: 10px;
- color: #d0d0d0;
- font-size: 14px;
- font-weight: 500;
- cursor: pointer;
- display: flex;
- align-items: center;
- justify-content: center;
- gap: 9px;
- transition: background 0.12s, border-color 0.12s, color 0.12s;
- letter-spacing: -0.01em;
+ .privy-code-hint {
+ font-size: 13px;
+ color: #666;
+ margin: 0 0 10px;
}
- #privy-toggle-btn:hover { background: #161616; border-color: rgba(255,255,255,0.18); color: #fff; }
- #privy-toggle-btn svg { flex-shrink: 0; }
- #privy-expanded { margin-top: 8px; }
.privy-row { display: flex; gap: 8px; align-items: flex-start; }
.privy-row input { flex: 1; margin: 0; }
.privy-row-btn {
@@ -540,47 +524,42 @@
No wallet needed — sign in with your email below.
</p>
- <!-- Privy social / email-OTP login -->
+ <!-- Privy email-OTP + wallet login -->
<div id="privy-section">
- <button type="button" id="privy-toggle-btn">
- <svg width="18" height="18" viewBox="0 0 36 36" fill="none" aria-hidden="true"><rect width="36" height="36" rx="8" fill="#2563EB"/><path d="M18 8C12.477 8 8 12.477 8 18s4.477 10 10 10 10-4.477 10-10S23.523 8 18 8zm0 3a7 7 0 110 14A7 7 0 0118 11zm0 2a5 5 0 100 10A5 5 0 0018 13zm0 2a3 3 0 110 6 3 3 0 010-6z" fill="#fff" opacity=".9"/></svg>
- Continue with Privy
- </button>
- <div id="privy-expanded" hidden>
- <div id="privy-step-email">
- <div class="privy-row">
- <input id="privy-email-input" type="email" inputmode="email" placeholder="Email address" autocomplete="email" autocapitalize="none" />
- <button type="button" id="privy-send-btn" class="privy-row-btn">Send code</button>
- </div>
+ <div id="privy-step-email">
+ <div class="privy-row">
+ <input id="privy-email-input" type="email" inputmode="email" placeholder="Email address" autocomplete="email" autocapitalize="none" autofocus />
+ <button type="button" id="privy-send-btn" class="privy-row-btn">Send code</button>
</div>
- <div id="privy-step-code" hidden>
- <div class="privy-row">
- <input id="privy-code-input" type="text" inputmode="numeric" placeholder="6-digit code" maxlength="6" autocomplete="one-time-code" />
- <button type="button" id="privy-verify-btn" class="privy-row-btn">Verify</button>
- </div>
- </div>
- <div id="privy-wallet-wrap">
- <p class="privy-wallet-divider">or connect wallet</p>
- <div class="privy-chain-btns">
- <button type="button" id="privy-evm-btn" class="privy-chain-btn">
- <svg width="14" height="14" viewBox="0 0 32 32" fill="none" aria-hidden="true"><path d="M16 2L4 16.5 16 22l12-5.5L16 2z" fill="#627EEA" opacity=".6"/><path d="M16 2v12.5L4 16.5 16 2z" fill="#627EEA"/><path d="M16 22v8l12-11L16 22z" fill="#627EEA" opacity=".6"/><path d="M16 22L4 19l12 11V22z" fill="#627EEA"/><path d="M16 14.5v5.5L4 16.5l12-2z" fill="#627EEA" opacity=".2"/><path d="M28 16.5l-12 3.5v-5.5l12 2z" fill="#627EEA"/></svg>
- EVM
- </button>
- <button type="button" id="privy-solana-btn" class="privy-chain-btn">
- <svg width="14" height="14" viewBox="0 0 32 32" fill="none" aria-hidden="true"><path d="M6 22.5h20.3a.6.6 0 0 0 .4-.7l-2-3.5a.6.6 0 0 0-.5-.3H3.9a.6.6 0 0 0-.4.7l2 3.5c.1.2.3.3.5.3z" fill="#9945FF"/><path d="M6 13.5h20.3a.6.6 0 0 0 .4-.7l-2-3.5a.6.6 0 0 0-.5-.3H3.9a.6.6 0 0 0-.4.7l2 3.5c.1.2.3.3.5.3z" fill="#9945FF"/><path d="M26.3 18H6a.6.6 0 0 0-.5.3l-2 3.5a.6.6 0 0 0 .4.7h20.3c.2 0 .4-.1.5-.3l2-3.5a.6.6 0 0 0-.4-.7z" fill="#14F195"/></svg>
- Solana
- </button>
- </div>
- <p id="privy-wallet-status" hidden></p>
+ </div>
+ <div id="privy-step-code" hidden>
+ <p class="privy-code-hint">Code sent — check your inbox</p>
+ <div class="privy-row">
+ <input id="privy-code-input" type="text" inputmode="numeric" placeholder="6-digit code" maxlength="6" autocomplete="one-time-code" />
+ <button type="button" id="privy-verify-btn" class="privy-row-btn">Verify</button>
</div>
- <p id="privy-inline-err" hidden></p>
<button type="button" id="privy-back-btn" class="privy-back-link">← Back</button>
</div>
+ <div id="privy-wallet-wrap">
+ <p class="privy-wallet-divider">or connect wallet</p>
+ <div class="privy-chain-btns">
+ <button type="button" id="privy-evm-btn" class="privy-chain-btn">
+ <svg width="14" height="14" viewBox="0 0 32 32" fill="none" aria-hidden="true"><path d="M16 2L4 16.5 16 22l12-5.5L16 2z" fill="#627EEA" opacity=".6"/><path d="M16 2v12.5L4 16.5 16 2z" fill="#627EEA"/><path d="M16 22v8l12-11L16 22z" fill="#627EEA" opacity=".6"/><path d="M16 22L4 19l12 11V22z" fill="#627EEA"/><path d="M16 14.5v5.5L4 16.5l12-2z" fill="#627EEA" opacity=".2"/><path d="M28 16.5l-12 3.5v-5.5l12 2z" fill="#627EEA"/></svg>
+ EVM
+ </button>
+ <button type="button" id="privy-solana-btn" class="privy-chain-btn">
+ <svg width="14" height="14" viewBox="0 0 32 32" fill="none" aria-hidden="true"><path d="M6 22.5h20.3a.6.6 0 0 0 .4-.7l-2-3.5a.6.6 0 0 0-.5-.3H3.9a.6.6 0 0 0-.4.7l2 3.5c.1.2.3.3.5.3z" fill="#9945FF"/><path d="M6 13.5h20.3a.6.6 0 0 0 .4-.7l-2-3.5a.6.6 0 0 0-.5-.3H3.9a.6.6 0 0 0-.4.7l2 3.5c.1.2.3.3.5.3z" fill="#9945FF"/><path d="M26.3 18H6a.6.6 0 0 0-.5.3l-2 3.5a.6.6 0 0 0 .4.7h20.3c.2 0 .4-.1.5-.3l2-3.5a.6.6 0 0 0-.4-.7z" fill="#14F195"/></svg>
+ Solana
+ </button>
+ </div>
+ <p id="privy-wallet-status" hidden></p>
+ </div>
+ <p id="privy-inline-err" hidden></p>
</div>
<div class="or-divider" id="privy-or-divider">or</div>
<label for="email">Email or username</label>
- <input id="email" name="username" type="text" inputmode="email" autocapitalize="none" autocomplete="username email" autofocus required aria-describedby="email-err" />
+ <input id="email" name="username" type="text" inputmode="email" autocapitalize="none" autocomplete="username email" required aria-describedby="email-err" />
<p class="field-err" id="email-err" role="alert"></p>
<label for="password">Password</label>
diff --git a/scripts/migrate-bounties.sql b/scripts/migrate-bounties.sql
new file mode 100644
index 000000000..91ec032d9
--- /dev/null
+++ b/scripts/migrate-bounties.sql
@@ -0,0 +1,46 @@
+-- Bounty board tables for /go
+-- Run once against the Neon Postgres database:
+-- psql $DATABASE_URL -f scripts/migrate-bounties.sql
+
+CREATE TABLE IF NOT EXISTS bounties (
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
+ user_id UUID NOT NULL,
+ username TEXT,
+ title TEXT NOT NULL,
+ description TEXT,
+ coin_symbol TEXT NOT NULL DEFAULT '$THREE',
+ coin_mint TEXT NOT NULL DEFAULT 'FeMbDoX7R1Psc4GEcvJdsbNbZA3bfztcyDCatJVJpump',
+ reward_sol NUMERIC(18,9),
+ reward_tokens NUMERIC(30,0),
+ reward_usd NUMERIC(10,2),
+ status TEXT NOT NULL DEFAULT 'open' CHECK (status IN ('open','resolving','closed')),
+ expires_at TIMESTAMPTZ NOT NULL DEFAULT (NOW() + INTERVAL '7 days'),
+ submission_count INTEGER NOT NULL DEFAULT 0,
+ winner_submission_id UUID,
+ created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
+ deleted_at TIMESTAMPTZ
+);
+
+CREATE INDEX IF NOT EXISTS bounties_status_idx ON bounties(status) WHERE deleted_at IS NULL;
+CREATE INDEX IF NOT EXISTS bounties_user_idx ON bounties(user_id) WHERE deleted_at IS NULL;
+CREATE INDEX IF NOT EXISTS bounties_created_idx ON bounties(created_at DESC) WHERE deleted_at IS NULL;
+CREATE INDEX IF NOT EXISTS bounties_subs_idx ON bounties(submission_count DESC) WHERE deleted_at IS NULL;
+
+CREATE TABLE IF NOT EXISTS bounty_submissions (
+ id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
+ bounty_id UUID NOT NULL REFERENCES bounties(id) ON DELETE CASCADE,
+ user_id UUID NOT NULL,
+ username TEXT,
+ content TEXT,
+ media_url TEXT,
+ media_type TEXT CHECK (media_type IN ('image','video','link')),
+ status TEXT NOT NULL DEFAULT 'pending' CHECK (status IN ('pending','accepted','rejected')),
+ reward_sol NUMERIC(18,9),
+ tx_hash TEXT,
+ created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
+);
+
+CREATE INDEX IF NOT EXISTS bs_bounty_idx ON bounty_submissions(bounty_id);
+CREATE INDEX IF NOT EXISTS bs_user_idx ON bounty_submissions(user_id);
+CREATE INDEX IF NOT EXISTS bs_created_idx ON bounty_submissions(created_at DESC);
+CREATE INDEX IF NOT EXISTS bs_status_idx ON bounty_submissions(status);