Website: /mods/submit, the registry's submission form

Sign in with GitHub through the registry's service (no scope), then send
the file and its page; the service checks the file, stages it and opens the
pull request, and the page links to it or says what to fix. A file named
<id>-<version>.<ext> fills in its kind, id and version. Shader packs are
listed and disabled until Horizon's own format exists. Caddy sends
/api/mods/* to REGISTRY_UPSTREAM (unset: the form says it isn't open), and
"Submit yours" now leads here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-24 22:10:05 +02:00
parent 787c3a2f19
commit fb4897ec09
7 changed files with 187 additions and 9 deletions
+14 -1
View File
@@ -1,6 +1,6 @@
import { test } from "node:test";
import assert from "node:assert/strict";
import { CAPABILITIES, listHtml, matches, projectHtml, readIndex } from "./mods.js";
import { CAPABILITIES, entryFrom, listHtml, matches, projectHtml, readIndex, submitHtml } from "./mods.js";
const project = (over = {}) => ({
id: "coords_hud", kind: "mod", name: "Coordinates HUD", summary: "Where you are.", authors: ["Horizon"],
@@ -40,3 +40,16 @@ test("a mod's page says what it may do, as the game does", () => {
assert.ok(projectHtml(project({ key: "RWT" })).includes("Signed"));
assert.ok(html.includes("horizon-launcher mods install --source horizon coords_hud"));
});
test("the submit form sends what the service reads", () => {
const html = submitHtml();
for (const name of ["kind", "file", "id", "version", "game", "name", "summary", "license", "source", "key", "signature"]) {
assert.ok(html.includes(`id="f-${name}"`), name);
}
assert.match(html, /<option value="shader" disabled>/);
const entry = entryFrom({ id: " my_mod ", kind: "mod", name: "My mod", summary: "s", description: "", authors: "Alice, , Bob", license: "MIT", source: "https://x.test", icon: " ", key: "", signature: "", version: "1.0.0", game: "26.3", changelog: "" });
assert.deepEqual(entry.authors, ["Alice", "Bob"]);
assert.equal(entry.id, "my_mod");
assert.equal(entry.icon, undefined);
assert.equal(JSON.parse(JSON.stringify(entry)).key, undefined, "an empty key isn't sent");
});