an http based roguelike rpg about jelqing
Blame: src/ui.html
99524cf9f17c | atagen | 2026-10-10 10:53 UTC | 1 | <!DOCTYPE html> |
99524cf9f17c | atagen | 2026-10-10 10:53 UTC | 2 | <html> |
99524cf9f17c | atagen | 2026-10-10 10:53 UTC | 3 | <head> |
99524cf9f17c | atagen | 2026-10-10 10:53 UTC | 4 | <meta charset="utf-8"> |
99524cf9f17c | atagen | 2026-10-10 10:53 UTC | 5 | <title>jelqd</title> |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 6 | <style> |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 7 | .frame { border: 2px inset; background: #fff; height: 85vh; overflow: scroll; padding: 4px; } |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 8 | #log { white-space: pre-wrap; margin: 0; } |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 9 | pre, li, p, td, label { overflow-wrap: anywhere; } |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 10 | </style> |
99524cf9f17c | atagen | 2026-10-10 10:53 UTC | 11 | </head> |
99524cf9f17c | atagen | 2026-10-10 10:53 UTC | 12 | <body> |
99524cf9f17c | atagen | 2026-10-10 10:53 UTC | 13 | |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 14 | <h1>jelqd</h1> |
ef7d6dee5976 | atagen | 2026-10-10 13:23 UTC | 15 | <p>A roguelike played over HTTP. Pick a resource, pick a method, send it. The log on the right is everything the server has said to you. |
ef7d6dee5976 | atagen | 2026-10-10 13:23 UTC | 16 | Language <select id="locale"><option>en-GB</option><option>en-US</option><option>en-AU</option></select></p> |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 17 | |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 18 | <table width="100%" cellspacing="6"> |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 19 | <tr> |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 20 | <td width="45%" valign="top"> |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 21 | <div class="frame"> |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 22 | |
431c1bc8ded1 | atagen | 2026-10-10 13:20 UTC | 23 | <div id="alerts"></div> |
431c1bc8ded1 | atagen | 2026-10-10 13:20 UTC | 24 | |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 25 | <form id="form"> |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 26 | <h3>Method</h3> |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 27 | <div id="methods"></div> |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 28 | |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 29 | <h3>Request</h3> |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 30 | <table id="fields" cellpadding="2"></table> |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 31 | |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 32 | <p><input type="submit" id="send" value="Send" style="font-size: 1.3em"></p> |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 33 | |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 34 | <h3>Stats</h3> |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 35 | <table id="stats" border="1" cellspacing="0" cellpadding="3"></table> |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 36 | |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 37 | <h3>Resource</h3> |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 38 | <div id="targets"></div> |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 39 | </form> |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 40 | |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 41 | <p><small>Every request goes through <code>/ui/send</code>, which replays it inside the server, so the page can show redirects and send methods and headers that browsers refuse.</small></p> |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 42 | </div> |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 43 | </td> |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 44 | <td valign="top"> |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 45 | <div class="frame" id="frame"><pre id="log"></pre></div> |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 46 | </td> |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 47 | </tr> |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 48 | </table> |
99524cf9f17c | atagen | 2026-10-10 10:53 UTC | 49 | |
99524cf9f17c | atagen | 2026-10-10 10:53 UTC | 50 | <script> |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 51 | const REL = "https://jelq.dev/rels/"; |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 52 | const METHODS = ["JELQ", "GET", "HEAD", "POST", "PUT", "PATCH", "DELETE", "OPTIONS", "TRACE"]; |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 53 | const LUBES = ["", "application/baby-oil", "application/coconut-oil", "application/lotion", "application/vaseline", "text/plain; charset=spit", "image/jpeg"]; |
9683736a2c5e | atagen | 2026-10-10 13:15 UTC | 54 | const DEATHS = ["vascular-event", "caught", "banned", "degloved", "zip", "run-ended"]; |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 55 | const STATS = [ |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 56 | ["x-floor", "Floor"], |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 57 | ["x-self-reported-length", "Self-reported length"], |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 58 | ["x-girth", "Girth"], |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 59 | ["x-foreskin", "Foreskin"], |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 60 | ["x-eq", "EQ (aim for 50 to 70)"], |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 61 | ["x-stamina", "Stamina"], |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 62 | ["x-suspicion", "Suspicion"], |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 63 | ["x-shame", "Shame"], |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 64 | ["x-cash", "Cash"], |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 65 | ]; |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 66 | const QUIET = new Set(["link", "set-cookie", "server", "x-powered-by", "cache-control", "content-length", "content-type", "date"].concat(STATS.map(s => s[0]))); |
99524cf9f17c | atagen | 2026-10-10 10:53 UTC | 67 | |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 68 | const FIELDS = { |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 69 | seed: { label: "seed (unranked)", kind: "text" }, |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 70 | technique: { label: "technique", kind: "select" }, |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 71 | also: { label: "combo with", kind: "select" }, |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 72 | intensity: { label: "intensity, 1 to 10", kind: "number", value: "5" }, |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 73 | lube: { label: "Content-Type", header: "Content-Type", kind: "select" }, |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 74 | patch: { label: "body", kind: "textarea", value: '[{"op": "test", "path": "/length", "value": 6}]' }, |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 75 | range: { label: "Range", header: "Range", kind: "text", placeholder: "inches=0-2" }, |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 76 | ifMatch: { label: "If-Match", header: "If-Match", kind: "text" }, |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 77 | ifNoneMatch: { label: "If-None-Match", header: "If-None-Match", kind: "text" }, |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 78 | ifModifiedSince: { label: "If-Modified-Since", header: "If-Modified-Since", kind: "text", placeholder: "an HTTP-date" }, |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 79 | proxy: { label: "Proxy-Authorization", header: "Proxy-Authorization", kind: "text", placeholder: "Ruler 5.4" }, |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 80 | upgrade: { label: "Upgrade", header: "Upgrade", kind: "select", options: ["", "underhand", "overhand"] }, |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 81 | authorization: { label: "Authorization", header: "Authorization", kind: "text", placeholder: 'Excuse "homework"' }, |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 82 | extra: { label: "other headers, one per line", kind: "textarea", placeholder: "Expect: gains" }, |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 83 | }; |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 84 | const BY_TARGET = { |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 85 | "runs POST": ["seed"], |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 86 | "run PATCH": ["patch"], |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 87 | "length GET": ["range"], |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 88 | "length HEAD": ["range"], |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 89 | "foreskin DELETE": ["ifMatch"], |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 90 | "elder GET": ["proxy", "ifModifiedSince"], |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 91 | "grip GET": ["upgrade"], |
4b690ff501b8 | atagen | 2026-10-10 13:27 UTC | 92 | "diagnosis GET": ["authorization", "ifNoneMatch"], |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 93 | }; |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 94 | const GLOBALS = [ |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 95 | { key: "runs", name: "start a new run", path: "/runs", methods: ["POST"] }, |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 96 | { key: "global", name: "leaderboard", path: "/leaderboard", methods: ["GET", "HEAD", "OPTIONS"] }, |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 97 | { key: "global", name: "graveyard", path: "/graveyard", methods: ["GET", "HEAD", "OPTIONS"] }, |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 98 | { key: "global", name: "the 2009 forum thread", path: "/forum/threads/2009", methods: ["GET", "HEAD", "OPTIONS"] }, |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 99 | ]; |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 100 | |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 101 | let run = null; |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 102 | let linked = []; |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 103 | let techniques = []; |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 104 | let offered = []; |
4b690ff501b8 | atagen | 2026-10-10 13:27 UTC | 105 | let challenged = false; |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 106 | let target = "/runs"; |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 107 | let method = "POST"; |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 108 | const values = {}; |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 109 | |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 110 | const $ = id => document.getElementById(id); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 111 | |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 112 | function short(path) { |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 113 | return path.replace(/[0-9a-f]{32}/, id => id.slice(0, 6) + "…"); |
99524cf9f17c | atagen | 2026-10-10 10:53 UTC | 114 | } |
99524cf9f17c | atagen | 2026-10-10 10:53 UTC | 115 | |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 116 | function el(tag, props, ...children) { |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 117 | const node = Object.assign(document.createElement(tag), props || {}); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 118 | for (const child of children) node.append(child); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 119 | return node; |
99524cf9f17c | atagen | 2026-10-10 10:53 UTC | 120 | } |
99524cf9f17c | atagen | 2026-10-10 10:53 UTC | 121 | |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 122 | function titled(text) { |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 123 | return text.charAt(0).toUpperCase() + text.slice(1); |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 124 | } |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 125 | |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 126 | function technique(name) { |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 127 | return techniques.find(t => t.name === name); |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 128 | } |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 129 | |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 130 | function clashes(a, b) { |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 131 | const rules = [a.lubricant, b.lubricant]; |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 132 | return rules.includes("required") && rules.includes("forbidden"); |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 133 | } |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 134 | |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 135 | // The options a field can take right now, or null for free text. |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 136 | function options(name) { |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 137 | if (name === "technique") return techniques.map(t => t.name); |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 138 | if (name === "also") { |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 139 | const first = technique(fieldValue("technique")); |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 140 | if (!first || !first.lubricant) return [""]; |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 141 | const partners = techniques.filter(t => t.lubricant && t.name !== first.name && !clashes(first, t)); |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 142 | return [""].concat(partners.map(t => t.name)); |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 143 | } |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 144 | if (name === "lube") return lubeRule() === "required" ? LUBES.filter(Boolean) : LUBES; |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 145 | return FIELDS[name].options || null; |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 146 | } |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 147 | |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 148 | function raw(name) { |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 149 | return values[name] ?? FIELDS[name].value ?? ""; |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 150 | } |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 151 | |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 152 | function fieldValue(name) { |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 153 | const allowed = options(name); |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 154 | const value = raw(name); |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 155 | if (allowed && !allowed.includes(value)) return allowed[0] ?? ""; |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 156 | return value; |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 157 | } |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 158 | |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 159 | function lubeRule() { |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 160 | const picked = [technique(fieldValue("technique")), technique(fieldValue("also"))].filter(Boolean); |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 161 | if (!picked.length || !picked[0].lubricant) return "none"; |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 162 | for (const rule of ["forbidden", "required"]) { |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 163 | if (picked.some(t => t.lubricant === rule)) return rule; |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 164 | } |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 165 | return "optional"; |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 166 | } |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 167 | |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 168 | function allowedMethods(t) { |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 169 | return t.key === "run" && !techniques.length ? t.methods.filter(m => m !== "JELQ") : t.methods; |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 170 | } |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 171 | |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 172 | function targets() { |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 173 | return (run ? linked : []).concat(offered, GLOBALS); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 174 | } |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 175 | |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 176 | function current() { |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 177 | return targets().find(t => t.path === target) || GLOBALS[0]; |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 178 | } |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 179 | |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 180 | function chooseTarget(t) { |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 181 | const allowed = allowedMethods(t); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 182 | target = t.path; |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 183 | method = allowed.includes("JELQ") ? "JELQ" : allowed.find(m => m !== "HEAD" && m !== "OPTIONS") || allowed[0]; |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 184 | render(); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 185 | } |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 186 | |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 187 | function renderStats(headers) { |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 188 | const table = $("stats"); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 189 | table.replaceChildren(); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 190 | for (let i = 0; i < STATS.length; i += 2) { |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 191 | const row = el("tr"); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 192 | for (const [name, label] of STATS.slice(i, i + 2)) { |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 193 | const value = headers ? headers[name] : undefined; |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 194 | row.append(el("th", { align: "left", textContent: label }), el("td", { textContent: value === undefined ? "—" : value })); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 195 | } |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 196 | table.append(row); |
99524cf9f17c | atagen | 2026-10-10 10:53 UTC | 197 | } |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 198 | } |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 199 | |
431c1bc8ded1 | atagen | 2026-10-10 13:20 UTC | 200 | function renderAlerts(list) { |
431c1bc8ded1 | atagen | 2026-10-10 13:20 UTC | 201 | const box = $("alerts"); |
431c1bc8ded1 | atagen | 2026-10-10 13:20 UTC | 202 | box.replaceChildren(); |
431c1bc8ded1 | atagen | 2026-10-10 13:20 UTC | 203 | const alerts = []; |
431c1bc8ded1 | atagen | 2026-10-10 13:20 UTC | 204 | for (const [name, value] of list || []) { |
ef7d6dee5976 | atagen | 2026-10-10 13:23 UTC | 205 | if (name === "via") alerts.push(titled(value.split(" ").pop()) + " is at the door."); |
ef7d6dee5976 | atagen | 2026-10-10 13:23 UTC | 206 | if (name === "x-observed-by") alerts.push((value === "cat" ? "The cat" : titled(value)) + " is watching."); |
431c1bc8ded1 | atagen | 2026-10-10 13:20 UTC | 207 | if (name === "warning") { |
431c1bc8ded1 | atagen | 2026-10-10 13:20 UTC | 208 | const text = (value.match(/"([^"]*)"/) || [, value])[1]; |
ef7d6dee5976 | atagen | 2026-10-10 13:23 UTC | 209 | alerts.push(titled(text) + "."); |
431c1bc8ded1 | atagen | 2026-10-10 13:20 UTC | 210 | } |
431c1bc8ded1 | atagen | 2026-10-10 13:20 UTC | 211 | } |
431c1bc8ded1 | atagen | 2026-10-10 13:20 UTC | 212 | for (const alert of alerts) box.append(el("h2", { textContent: alert })); |
431c1bc8ded1 | atagen | 2026-10-10 13:20 UTC | 213 | } |
431c1bc8ded1 | atagen | 2026-10-10 13:20 UTC | 214 | |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 215 | function renderTargets() { |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 216 | const box = $("targets"); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 217 | box.replaceChildren(); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 218 | for (const t of targets()) { |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 219 | const radio = el("input", { type: "radio", name: "target", checked: t.path === target, onchange: () => chooseTarget(t) }); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 220 | box.append(el("label", {}, radio, " " + t.name + " ", el("small", { textContent: short(t.path) })), el("br")); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 221 | } |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 222 | } |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 223 | |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 224 | function renderMethods() { |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 225 | const box = $("methods"); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 226 | box.replaceChildren(); |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 227 | const allowed = allowedMethods(current()); |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 228 | for (const m of METHODS.filter(m => allowed.includes(m))) { |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 229 | const radio = el("input", { type: "radio", name: "method", checked: m === method, onchange: () => { method = m; render(); } }); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 230 | const label = el("label", {}, radio, " "); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 231 | label.append(m === "JELQ" ? el("big", {}, el("b", { textContent: "JELQ" })) : m); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 232 | box.append(label, " "); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 233 | } |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 234 | } |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 235 | |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 236 | function fieldNames() { |
4b690ff501b8 | atagen | 2026-10-10 13:27 UTC | 237 | const t = current(); |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 238 | const key = t.key + " " + method; |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 239 | let names = BY_TARGET[key] || []; |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 240 | if (key === "run JELQ") { |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 241 | const chosen = technique(fieldValue("technique")); |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 242 | names = ["technique"]; |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 243 | if (options("also").length > 1) names.push("also"); |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 244 | if (chosen && chosen.lubricant) names.push("intensity"); |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 245 | if (["required", "optional"].includes(lubeRule())) names.push("lube"); |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 246 | } |
4b690ff501b8 | atagen | 2026-10-10 13:27 UTC | 247 | const scoped = run && !["runs", "global"].includes(t.key); |
4b690ff501b8 | atagen | 2026-10-10 13:27 UTC | 248 | const asked = challenged && scoped && !names.includes("authorization"); |
4b690ff501b8 | atagen | 2026-10-10 13:27 UTC | 249 | return (asked ? ["authorization"] : []).concat(names); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 250 | } |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 251 | |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 252 | function renderFields() { |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 253 | const table = $("fields"); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 254 | table.replaceChildren(); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 255 | for (const name of fieldNames()) { |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 256 | const f = FIELDS[name]; |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 257 | const value = fieldValue(name); |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 258 | const choices = options(name); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 259 | let input; |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 260 | if (choices) { |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 261 | input = el("select", {}, ...choices.map(o => el("option", { value: o, textContent: o || "(none)", selected: o === value }))); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 262 | } else if (f.kind === "textarea") { |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 263 | input = el("textarea", { rows: 3, cols: 40, value, placeholder: f.placeholder || "" }); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 264 | } else { |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 265 | input = el("input", { type: f.kind, value, placeholder: f.placeholder || "", size: 30 }); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 266 | } |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 267 | input.oninput = () => { values[name] = input.value; }; |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 268 | input.onchange = () => { values[name] = input.value; if (choices) renderFields(); }; |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 269 | table.append(el("tr", {}, el("td", { align: "right", valign: "top", textContent: f.label }), el("td", {}, input))); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 270 | } |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 271 | const extra = el("textarea", { rows: 3, cols: 40, value: raw("extra"), placeholder: FIELDS.extra.placeholder }); |
4b690ff501b8 | atagen | 2026-10-10 13:27 UTC | 272 | extra.oninput = () => { values.extra = extra.value; }; |
4b690ff501b8 | atagen | 2026-10-10 13:27 UTC | 273 | const more = el("details", { open: Boolean(values.extra) }, el("summary", { textContent: "more headers" }), extra); |
4b690ff501b8 | atagen | 2026-10-10 13:27 UTC | 274 | table.append(el("tr", {}, el("td"), el("td", {}, more))); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 275 | $("send").value = method + " " + short(current().path); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 276 | } |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 277 | |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 278 | function render() { |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 279 | if (!allowedMethods(current()).includes(method)) return chooseTarget(current()); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 280 | renderTargets(); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 281 | renderMethods(); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 282 | renderFields(); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 283 | } |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 284 | |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 285 | function parseLinks(header) { |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 286 | const resources = []; |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 287 | const moves = []; |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 288 | for (const match of header.matchAll(/<([^>]*)>((?:\s*;\s*[a-z-]+="[^"]*")*)/g)) { |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 289 | const params = Object.fromEntries([...match[2].matchAll(/([a-z-]+)="([^"]*)"/g)].map(p => [p[1], p[2]])); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 290 | const name = (params.rel || "").replace(REL, ""); |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 291 | if (name === "technique") { |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 292 | moves.push({ name: params.title, lubricant: params.lubricant || null }); |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 293 | continue; |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 294 | } |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 295 | const methods = (params.allow || "GET").split(",").map(s => s.trim()); |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 296 | resources.push({ key: name, name: name === "run" ? "the run" : name, path: match[1], methods }); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 297 | } |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 298 | return [resources, moves]; |
99524cf9f17c | atagen | 2026-10-10 10:53 UTC | 299 | } |
99524cf9f17c | atagen | 2026-10-10 10:53 UTC | 300 | |
99524cf9f17c | atagen | 2026-10-10 10:53 UTC | 301 | function hrefs(value, found) { |
99524cf9f17c | atagen | 2026-10-10 10:53 UTC | 302 | if (value && typeof value === "object") { |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 303 | if (typeof value.href === "string") { |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 304 | const name = value.title || value.item || value.name || value.href.split("/").pop(); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 305 | found.push({ key: "offered", name, path: value.href, methods: [value.method || "GET"] }); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 306 | } |
99524cf9f17c | atagen | 2026-10-10 10:53 UTC | 307 | for (const key in value) hrefs(value[key], found); |
99524cf9f17c | atagen | 2026-10-10 10:53 UTC | 308 | } |
99524cf9f17c | atagen | 2026-10-10 10:53 UTC | 309 | return found; |
99524cf9f17c | atagen | 2026-10-10 10:53 UTC | 310 | } |
99524cf9f17c | atagen | 2026-10-10 10:53 UTC | 311 | |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 312 | function log(text) { |
585e6b7ce086 | atagen | 2026-10-10 13:43 UTC | 313 | $("log").prepend(text + "\n\n"); |
585e6b7ce086 | atagen | 2026-10-10 13:43 UTC | 314 | $("frame").scrollTop = 0; |
99524cf9f17c | atagen | 2026-10-10 10:53 UTC | 315 | } |
99524cf9f17c | atagen | 2026-10-10 10:53 UTC | 316 | |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 317 | function describe(r) { |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 318 | const lines = ["< " + r.status + " " + r.reason]; |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 319 | for (const [name, value] of r.headers) { |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 320 | if (!QUIET.has(name)) lines.push("< " + name + ": " + short(value)); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 321 | } |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 322 | let body = null; |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 323 | try { body = JSON.parse(r.body); } catch (e) {} |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 324 | if (body && typeof body === "object") { |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 325 | const rest = Object.assign({}, body); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 326 | if (rest.detail) lines.push(" " + rest.detail); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 327 | for (const key of ["type", "title", "status", "detail"]) delete rest[key]; |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 328 | if (Object.keys(rest).length) lines.push(short(JSON.stringify(rest, null, 2)).replace(/^/gm, " ")); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 329 | } else if (r.body) { |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 330 | lines.push(" " + r.body); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 331 | } |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 332 | return lines.join("\n"); |
99524cf9f17c | atagen | 2026-10-10 10:53 UTC | 333 | } |
99524cf9f17c | atagen | 2026-10-10 10:53 UTC | 334 | |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 335 | function absorb(r, sentMethod, sentPath) { |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 336 | const headers = Object.fromEntries(r.headers.map(([n, v]) => [n.toLowerCase(), v])); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 337 | let body = null; |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 338 | try { body = JSON.parse(r.body); } catch (e) {} |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 339 | const problem = body && typeof body.type === "string" ? body.type.split("/").pop() : null; |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 340 | const started = r.status === 201 && (sentPath === "/runs" || sentPath.startsWith("/runs?")); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 341 | |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 342 | if (started) { |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 343 | run = headers.location; |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 344 | log("--- a new run has started at " + short(run) + " ---"); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 345 | } |
431c1bc8ded1 | atagen | 2026-10-10 13:20 UTC | 346 | if ("x-eq" in headers) { |
431c1bc8ded1 | atagen | 2026-10-10 13:20 UTC | 347 | renderStats(headers); |
431c1bc8ded1 | atagen | 2026-10-10 13:20 UTC | 348 | renderAlerts(r.headers); |
4b690ff501b8 | atagen | 2026-10-10 13:27 UTC | 349 | challenged = r.status === 401 || "via" in headers; |
431c1bc8ded1 | atagen | 2026-10-10 13:20 UTC | 350 | } |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 351 | if (headers.link) [linked, techniques] = parseLinks(headers.link); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 352 | offered = body ? hrefs(body, []) : []; |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 353 | if (headers.location && !started) { |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 354 | offered.unshift({ key: "offered", name: "Location", path: headers.location, methods: ["GET"] }); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 355 | } |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 356 | const abandoned = sentMethod === "DELETE" && sentPath === run && r.status === 204; |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 357 | if (run && (abandoned || DEATHS.includes(problem))) { |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 358 | log("--- the run has ended ---"); |
431c1bc8ded1 | atagen | 2026-10-10 13:20 UTC | 359 | renderAlerts(null); |
4b690ff501b8 | atagen | 2026-10-10 13:27 UTC | 360 | challenged = false; |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 361 | run = null; |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 362 | linked = []; |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 363 | techniques = []; |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 364 | } |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 365 | if (started || !targets().some(t => t.path === target)) { |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 366 | const home = linked.find(t => t.key === "run"); |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 367 | chooseTarget(home || GLOBALS[0]); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 368 | } else { |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 369 | render(); |
99524cf9f17c | atagen | 2026-10-10 10:53 UTC | 370 | } |
99524cf9f17c | atagen | 2026-10-10 10:53 UTC | 371 | } |
99524cf9f17c | atagen | 2026-10-10 10:53 UTC | 372 | |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 373 | async function go(event) { |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 374 | event.preventDefault(); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 375 | const t = current(); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 376 | const key = t.key + " " + method; |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 377 | const value = name => fieldValue(name).trim(); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 378 | const headers = []; |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 379 | let path = t.path; |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 380 | let body = ""; |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 381 | for (const name of fieldNames()) { |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 382 | const f = FIELDS[name]; |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 383 | if (f.header && value(name)) headers.push([f.header, value(name)]); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 384 | } |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 385 | if (fieldNames().includes("upgrade") && value("upgrade")) headers.push(["Connection", "upgrade"]); |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 386 | for (const line of raw("extra").split("\n")) { |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 387 | const at = line.indexOf(":"); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 388 | if (at > 0) headers.push([line.slice(0, at).trim(), line.slice(at + 1).trim()]); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 389 | } |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 390 | if (key === "run JELQ") { |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 391 | const names = fieldNames(); |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 392 | const chosen = [value("technique")].concat(names.includes("also") && value("also") ? [value("also")] : []); |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 393 | path += "?technique=" + encodeURIComponent(chosen.join(",")); |
58e1fb3943e6 | atagen | 2026-10-10 13:30 UTC | 394 | if (names.includes("intensity")) path += "&intensity=" + encodeURIComponent(value("intensity")); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 395 | } |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 396 | if (key === "runs POST" && value("seed")) path += "?seed=" + encodeURIComponent(value("seed")); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 397 | if (method === "PATCH") { |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 398 | headers.push(["Content-Type", "application/json-patch+json"]); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 399 | body = value("patch"); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 400 | } |
99524cf9f17c | atagen | 2026-10-10 10:53 UTC | 401 | |
585e6b7ce086 | atagen | 2026-10-10 13:43 UTC | 402 | const sent = ["> " + method + " " + short(path)].concat(headers.map(([name, v]) => "> " + name + ": " + v)).join("\n"); |
ef7d6dee5976 | atagen | 2026-10-10 13:23 UTC | 403 | headers.push(["Accept-Language", $("locale").value]); |
7288fc269bb6 | atagen | 2026-10-10 13:36 UTC | 404 | let r; |
7288fc269bb6 | atagen | 2026-10-10 13:36 UTC | 405 | try { |
7288fc269bb6 | atagen | 2026-10-10 13:36 UTC | 406 | const response = await fetch("/ui/send", { |
7288fc269bb6 | atagen | 2026-10-10 13:36 UTC | 407 | method: "POST", |
7288fc269bb6 | atagen | 2026-10-10 13:36 UTC | 408 | headers: { "Content-Type": "application/json" }, |
7288fc269bb6 | atagen | 2026-10-10 13:36 UTC | 409 | body: JSON.stringify({ method, path, headers, body }), |
7288fc269bb6 | atagen | 2026-10-10 13:36 UTC | 410 | }); |
7288fc269bb6 | atagen | 2026-10-10 13:36 UTC | 411 | r = await response.json(); |
7288fc269bb6 | atagen | 2026-10-10 13:36 UTC | 412 | } catch (error) { |
585e6b7ce086 | atagen | 2026-10-10 13:43 UTC | 413 | log(sent + "\n! The server did not answer. Is jelqd still running? (" + error.message + ")"); |
7288fc269bb6 | atagen | 2026-10-10 13:36 UTC | 414 | return; |
7288fc269bb6 | atagen | 2026-10-10 13:36 UTC | 415 | } |
7288fc269bb6 | atagen | 2026-10-10 13:36 UTC | 416 | if (!Array.isArray(r.headers)) { |
585e6b7ce086 | atagen | 2026-10-10 13:43 UTC | 417 | log(sent + "\n! The page could not read that reply:\n " + JSON.stringify(r)); |
7288fc269bb6 | atagen | 2026-10-10 13:36 UTC | 418 | return; |
7288fc269bb6 | atagen | 2026-10-10 13:36 UTC | 419 | } |
585e6b7ce086 | atagen | 2026-10-10 13:43 UTC | 420 | log(sent + "\n" + describe(r)); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 421 | absorb(r, method, path); |
99524cf9f17c | atagen | 2026-10-10 10:53 UTC | 422 | } |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 423 | |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 424 | $("form").onsubmit = go; |
ef7d6dee5976 | atagen | 2026-10-10 13:23 UTC | 425 | $("locale").value = localStorage.getItem("locale") || "en-GB"; |
ef7d6dee5976 | atagen | 2026-10-10 13:23 UTC | 426 | $("locale").onchange = () => localStorage.setItem("locale", $("locale").value); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 427 | renderStats(null); |
185851447ceb | atagen | 2026-10-10 12:58 UTC | 428 | render(); |
585e6b7ce086 | atagen | 2026-10-10 13:43 UTC | 429 | log("Welcome. Choose \"start a new run\" and send POST to begin. The newest turn is always at the top."); |
99524cf9f17c | atagen | 2026-10-10 10:53 UTC | 430 | </script> |
99524cf9f17c | atagen | 2026-10-10 10:53 UTC | 431 | </body> |
99524cf9f17c | atagen | 2026-10-10 10:53 UTC | 432 | </html> |