From c8f6102cfd8ec10d4caab49e5fb17dce5fc311e7 Mon Sep 17 00:00:00 2001 From: ssmithx Date: Thu, 3 Sep 2026 22:37:27 +0000 Subject: [PATCH] Add a real submission form, bypassing the broken Gitea issue-template render MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Gitea 1.27.1 on this instance silently ignores the ?template= param for .github/ISSUE_TEMPLATE/hardware-report.yml — the structured fields never render, just a blank title/body editor (confirmed live: same URL that's supposed to load the form shows nothing). Rather than debug Gitea's YAML issue-forms support, site/report.html is a plain form matching the schema that builds a title + markdown body (with a ready-to-merge YAML block) and opens Gitea's issues/new with them pre-filled via query params, which does work on this instance (verified live). Verified the full round trip in a real browser: filled the form, submitted, confirmed the opened Gitea tab has the correct title and a body containing valid YAML matching every field. Did not actually click "Create Issue" — no reason to leave a test issue on the tracker. Co-Authored-By: Claude Sonnet 5 --- CONTRIBUTING.md | 14 ++++-- site/index.html | 4 +- site/report.html | 126 +++++++++++++++++++++++++++++++++++++++++++++++ site/report.js | 96 ++++++++++++++++++++++++++++++++++++ site/style.css | 79 +++++++++++++++++++++++++++++ 5 files changed, 313 insertions(+), 6 deletions(-) create mode 100644 site/report.html create mode 100644 site/report.js diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 0ecacc1..73f3a39 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,11 +2,17 @@ Two ways to add a report, pick whichever's easier for you. -## Option A — open an issue (no git needed) +## Option A — use the report form (no git needed) -[Open a hardware report issue](https://source.archipelago-foundation.org/ssmithx/ArchyHCL/issues/new?template=hardware-report.yml) -and fill in the form. A maintainer will turn it into a data file and it'll -show up on the site. +[Fill in the report form](https://hcl.archipelago-foundation.org/report.html) — +it opens a pre-filled Gitea issue with a ready-to-merge YAML block for you +(you'll still need a free Gitea account to post it). A maintainer copies the +block into a new data file and it shows up on the site. + +(The repo's `.github/ISSUE_TEMPLATE/hardware-report.yml` structured issue +form doesn't render on this Gitea instance — it silently falls back to a +blank issue instead of showing the fields — so the site form above is the +supported no-git path, not the raw "New Issue" button.) ## Option B — open a PR directly diff --git a/site/index.html b/site/index.html index 62f6c2c..55a4239 100644 --- a/site/index.html +++ b/site/index.html @@ -8,10 +8,10 @@
-

ArchyHCL

+

ArchyHCL

Community-reported hardware compatibility for Archipelago. Every row here is a real install someone tested and reported — see it on GitHub/Gitea as a plain data file, no login required to browse.

- Tested Archipelago on your own hardware? Report it — + Tested Archipelago on your own hardware? Report it — takes two minutes and helps the next person know what to expect before they buy or repurpose a machine.

diff --git a/site/report.html b/site/report.html new file mode 100644 index 0000000..2907316 --- /dev/null +++ b/site/report.html @@ -0,0 +1,126 @@ + + + + + +Report hardware — ArchyHCL + + + +
+

ArchyHCL

+

Fill this in, hit submit — it opens a pre-filled issue on Gitea with everything formatted and ready for a maintainer to merge. You'll still need a (free) Gitea account to actually post it.

+
+ +
+
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+ + +
+ +
+ + +
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ + + + +
+
+ + + + + + diff --git a/site/report.js b/site/report.js new file mode 100644 index 0000000..888e0c8 --- /dev/null +++ b/site/report.js @@ -0,0 +1,96 @@ +// Builds a pre-filled Gitea "new issue" URL (title + body via query params — +// verified working on this Gitea instance even though its YAML issue-forms +// rendering (.github/ISSUE_TEMPLATE/hardware-report.yml) does not render as +// a structured form: it silently falls back to a blank issue instead, so we +// don't rely on it) and opens it. The body includes a ready-to-paste YAML +// block matching data/schema.json, so a maintainer can copy it straight +// into a new data/reports/*.yml file with minimal editing. + +const REPO_URL = "https://source.archipelago-foundation.org/ssmithx/ArchyHCL"; + +const form = document.getElementById("report-form"); +const statusSelect = document.getElementById("status"); +const issuesField = document.getElementById("issues"); +const issuesRequiredHint = document.getElementById("issues-required"); +const errorEl = document.getElementById("form-error"); + +function updateIssuesRequirement() { + const required = statusSelect.value !== "working"; + issuesRequiredHint.hidden = !required; + issuesField.required = required; +} +statusSelect.addEventListener("change", updateIssuesRequirement); +updateIssuesRequirement(); + +// A YAML double-quoted scalar uses the same escaping rules as JSON strings +// for every character that matters here (quotes, backslashes, control +// chars) — JSON.stringify is a safe, simple way to produce one. +function yamlString(value) { + return JSON.stringify(value ?? ""); +} + +function yamlBlock(value) { + const trimmed = (value ?? "").trim(); + if (!trimmed) return null; + return trimmed + .split("\n") + .map((line) => " " + line) + .join("\n"); +} + +function val(id) { + return document.getElementById(id).value.trim(); +} + +function buildYaml() { + const lines = []; + lines.push(`device_model: ${yamlString(val("device_model"))}`); + lines.push(`form_factor: ${val("form_factor")}`); + lines.push(`cpu: ${yamlString(val("cpu"))}`); + lines.push(`ram_gb: ${val("ram_gb")}`); + lines.push("storage:"); + lines.push(` type: ${val("storage_type")}`); + lines.push(` size_gb: ${val("storage_size_gb")}`); + lines.push(`wifi_chip: ${yamlString(val("wifi_chip"))}`); + const ethernet = val("ethernet"); + if (ethernet) lines.push(`ethernet: ${yamlString(ethernet)}`); + lines.push(`archy_version: ${yamlString(val("archy_version"))}`); + lines.push(`install_method: ${val("install_method")}`); + lines.push(`status: ${val("status")}`); + lines.push(`tested_date: ${yamlString(val("tested_date"))}`); + const submittedBy = val("submitted_by"); + if (submittedBy) lines.push(`submitted_by: ${yamlString(submittedBy)}`); + const issuesBlock = yamlBlock(val("issues")); + if (issuesBlock) lines.push(`issues: |\n${issuesBlock}`); + const notesBlock = yamlBlock(val("notes")); + if (notesBlock) lines.push(`notes: |\n${notesBlock}`); + return lines.join("\n"); +} + +form.addEventListener("submit", (e) => { + e.preventDefault(); + errorEl.hidden = true; + + if (statusSelect.value !== "working" && !val("issues")) { + errorEl.textContent = 'Please describe the issue(s) — required when status is "partial" or "broken".'; + errorEl.hidden = false; + issuesField.focus(); + return; + } + + const deviceModel = val("device_model"); + const title = `hw: ${deviceModel}`; + const yaml = buildYaml(); + const body = [ + `Hardware report for **${deviceModel}**, submitted via the site form.`, + "", + "A maintainer: copy the block below into a new file under `data/reports/` (see CONTRIBUTING.md) to add it to the list.", + "", + "```yaml", + yaml, + "```", + ].join("\n"); + + const url = `${REPO_URL}/issues/new?title=${encodeURIComponent(title)}&body=${encodeURIComponent(body)}`; + window.open(url, "_blank", "noopener"); +}); diff --git a/site/style.css b/site/style.css index 2863999..636e40a 100644 --- a/site/style.css +++ b/site/style.css @@ -138,3 +138,82 @@ footer code { padding: 0.1rem 0.35rem; border-radius: 3px; } + +h1 a { color: inherit; text-decoration: none; } +h1 a:hover { color: var(--accent); } + +.report-form { + display: flex; + flex-direction: column; + gap: 1rem; + max-width: 640px; +} + +.field { + display: flex; + flex-direction: column; + gap: 0.3rem; + flex: 1; +} + +.field-row { + display: flex; + gap: 1rem; + flex-wrap: wrap; +} + +.field-row .field { + min-width: 140px; +} + +label { + color: var(--muted); + font-size: 0.85rem; +} + +.required-hint { + color: var(--partial); + font-weight: normal; +} + +textarea { + background: var(--panel); + border: 1px solid var(--border); + color: var(--text); + padding: 0.5rem 0.7rem; + border-radius: 4px; + font-family: inherit; + font-size: 0.9rem; + resize: vertical; +} + +textarea:focus, .report-form input:focus, .report-form select:focus { + outline: none; + border-color: var(--accent-dim); +} + +.report-form input, .report-form select { + width: 100%; +} + +.form-error { + color: var(--broken); + font-size: 0.85rem; +} + +.report-form button { + align-self: flex-start; + background: var(--accent); + color: var(--bg); + border: none; + padding: 0.7rem 1.2rem; + border-radius: 4px; + font-family: inherit; + font-weight: bold; + font-size: 0.9rem; + cursor: pointer; +} + +.report-form button:hover { + background: var(--accent-dim); +}