diff --git a/CHANGELOG.md b/CHANGELOG.md
index 55fd9337..f2773e51 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,8 @@ User-facing changes only. The release workflow publishes the matching
### Fixed
+- HUD: an imported HUD that is also in the catalog now offers Match to catalog, so it can get
+ updates. The button was missing for imported HUDs.
- Mods: when a mod you import or download turns out to be a HUD, the file review now offers
Install as HUD. Before, the install was refused and you had to import the file again in HUD.
- Mods: a HUD found on GameBanana can now be installed from its card with Install HUD. Open HUD
diff --git a/apps/desktop/src/HudPane.tsx b/apps/desktop/src/HudPane.tsx
index 5947611d..9ad0b4da 100644
--- a/apps/desktop/src/HudPane.tsx
+++ b/apps/desktop/src/HudPane.tsx
@@ -50,6 +50,7 @@ import {
HUD_SORTS,
hudAuthorCopy,
hudCatalogControls,
+ hudCatalogMatch,
hudDisplayName,
hudInstallSourceCopy,
hudOptionsDirty,
@@ -224,6 +225,7 @@ export function HudPane({
const installedEntry = installedId
? (catalog.find((entry) => entry.id.toLowerCase() === installedId.toLowerCase()) ?? null)
: null;
+ const catalogMatch = hudCatalogMatch(catalog, state);
const mutationBlocked = locked || dirty || stateLoading || stateError !== null;
const mutationReason = running
? "Close TF2 before changing the installed HUD."
@@ -371,8 +373,10 @@ export function HudPane({
{installedEntry ? `${hudAuthorCopy(installedEntry)} · ` : ""}
{installedLabel}
- {state.inferred ? (
- Match it to hud-db to enable updates.
+ {catalogMatch ? (
+
+ Match it to {hudDisplayName(catalogMatch)} in the catalog to get updates.
+
) : null}
{state.updateAvailable ? (
@@ -387,16 +391,16 @@ export function HudPane({
{running ? "Close TF2 to update" : "Update HUD"}
) : null}
- {state.inferred ? (
+ {catalogMatch ? (
onMatch(installedId)}
+ onClick={() => onMatch(catalogMatch.id)}
className="btn btn-ghost"
>
- Match to catalog…
+ Match to catalog
) : null}
{
});
});
+describe("hudCatalogMatch", () => {
+ const catalog = [{ id: "rayshud" }, { id: "Middle-Mann" }, { id: "m0re-hud" }, { id: "m0rehud" }];
+ const match = (id: string, source: "local" | "hudDb" = "local", inferred = false) =>
+ hudCatalogMatch(catalog as never, {
+ installed: { id, hash: null, source, options: {} },
+ inferred,
+ schemaSupported: false,
+ catalogHash: null,
+ updateAvailable: false,
+ })?.id ?? null;
+
+ it("offers the catalog HUD an imported folder is a copy of", () => {
+ expect(match("rayshud")).toBe("rayshud");
+ expect(match("RaysHUD-master")).toBe("rayshud");
+ expect(match("middlemann-main")).toBe("Middle-Mann");
+ expect(match("rayshud", "hudDb", true)).toBe("rayshud");
+ });
+
+ it("offers nothing for a catalog install, an unknown HUD or an unclear name", () => {
+ expect(match("rayshud", "hudDb")).toBeNull();
+ expect(match("pure-hud")).toBeNull();
+ expect(match("m0re_hud")).toBeNull();
+ expect(match("m0re-hud")).toBe("m0re-hud");
+ });
+});
+
describe("hudIdFromName", () => {
it("matches the folder id a HUD is installed under", () => {
expect(hudIdFromName("Pure HUD")).toBe("pure-hud");
diff --git a/apps/desktop/src/lib/hud-ui.ts b/apps/desktop/src/lib/hud-ui.ts
index d5835a21..cc4b0b3a 100644
--- a/apps/desktop/src/lib/hud-ui.ts
+++ b/apps/desktop/src/lib/hud-ui.ts
@@ -539,6 +539,32 @@ export function formatHudRgba(r: number, g: number, b: number, a: number): strin
return `${r} ${g} ${b} ${a}`;
}
+/** Letters and digits only, without the branch suffix GitHub adds to a downloaded folder. */
+function normalizeHudName(name: string): string {
+ const lower = name.trim().toLowerCase();
+ const suffix = ["-master", "-main"].find((end) => lower.endsWith(end));
+ return (suffix ? lower.slice(0, -suffix.length) : lower).replace(/[^a-z0-9]/g, "");
+}
+
+/**
+ * The catalog HUD an imported or found HUD can be matched to: the one with its
+ * folder name, ignoring case, punctuation and a `-master`/`-main` suffix. Null
+ * when the HUD already comes from the catalog, or when no single entry fits.
+ */
+export function hudCatalogMatch(
+ catalog: HudCatalogEntry[],
+ state: HudUiState,
+): HudCatalogEntry | null {
+ const installed = state.installed;
+ if (!installed || (installed.source === "hudDb" && !state.inferred)) return null;
+ const exact = catalog.find((entry) => entry.id.toLowerCase() === installed.id.toLowerCase());
+ if (exact) return exact;
+ const wanted = normalizeHudName(installed.id);
+ if (wanted === "") return null;
+ const close = catalog.filter((entry) => normalizeHudName(entry.id) === wanted);
+ return close.length === 1 ? close[0] : null;
+}
+
/**
* The folder id a HUD gets when it is installed under `name` (an archive, a
* folder or a GameBanana listing title). Mirrors the native `hud_id_from_name`
diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md
index cc5a15c8..2b60ed44 100644
--- a/docs/ARCHITECTURE.md
+++ b/docs/ARCHITECTURE.md
@@ -95,7 +95,7 @@ Change install opens the finder with the previous install remembered in memory o
- Mouse `sensitivity` and `zoom_sensitivity_ratio` are exact decimal fields owned by the Gameplay scope (native `managed_cfg` and the frontend scope agree); input accepts plain positive decimals up to 1000 because the pinned dump documents no range, and an invalid entry is shown with a reason but never saved. Because the managed cfg runs after `config.cfg`, a completed absorb that saw `config.cfg` drift rewrites only the managed lines when TF2's options changed them; the sync never adds lines the managed file did not set. Raw input and acceleration stay with mastercomfig's Flat mouse addon, and no recommended sensitivity is offered.
- Gameplay's Weapons group holds auto reload, fast switch and Medigun auto-heal (`tf_medigun_autoheal`); Combat feedback holds damage numbers, combined damage numbers and healing numbers (`hud_combattext`, `_batching`, `_healing`). All are archived client cvars with no sv_cheats or server requirement; values seed from the effective cfg and TF2's defaults apply only when absent. Colors and the batching window are not offered. The same after-game sync covers these toggles, auto reload and fast switch because TF2's Advanced options write them to `config.cfg`; it accepts only values those options would write.
- **HUD** — hud-db catalog (paginated, sorted by name / tf2huds.dev listing activity / downloads / views from exact matched statistics, cached a day), one HUD per profile, install kinds by host (GitHub codeload zip, Dropbox `dl=1`, GameBanana download page, teamfortress.tv thread scrape, or link out), import picker offers ZIP/7z/RAR/folder, and Dropbox, teamfortress.tv and single-file GameBanana HUD downloads accept the same three archive formats through the shared bounded reader, TF2HUD.Editor schemas consumed as data (parser strips `//` comments, options may lack `Name`). Listing activity is not a HUD release date; missing statistics never enter metric rankings. Imgur albums open in the browser; GitHub `showcase.md` albums load in-app.
-- HUD browsing uses six previews per page with numbered navigation and page jumps above and below results; one Import HUD entry offers archive or extracted-folder choices. Imports unwrap a unique nested HUD only when every retained file belongs to it. Multiple HUD roots or sibling files require the user to follow the author's instructions and import one extracted HUD folder. `info.vdf` must declare UI version 3 before install; metadata and payloads are never synthesized or rewritten to imply compatibility. Dropbox download shards are trusted only as Dropbox redirects, one label below `dl.dropboxusercontent.com`.
+- HUD browsing uses six previews per page with numbered navigation and page jumps above and below results; one Import HUD entry offers archive or extracted-folder choices. An imported or found HUD whose folder name matches exactly one catalog entry (ignoring case, punctuation and a `-master`/`-main` suffix) offers Match to catalog, which pairs the record with that entry and renames the folder to its id. Imports unwrap a unique nested HUD only when every retained file belongs to it. Multiple HUD roots or sibling files require the user to follow the author's instructions and import one extracted HUD folder. `info.vdf` must declare UI version 3 before install; metadata and payloads are never synthesized or rewritten to imply compatibility. Dropbox download shards are trusted only as Dropbox redirects, one label below `dl.dropboxusercontent.com`.
- Catalog HUD install and update emit `hud-install-progress` (downloading → checking → installing, the last after the write gate is taken). The card being installed shows exactly those steps, and the header status names the operation ("Installing HUD…"); there is no separate progress banner or percentage. Local imports have no download steps and show no card overlay.
- HUD/mod ZIP, 7z and folder imports share the profile ownership junk policy: case-insensitive `.bak`, `.cache`, `.ztmp`, `.execs-part`, VCS/OS metadata and `node_modules` components are skipped before root detection. Payload bytes and archive/path limits remain unchanged.
- HUD metric sorts rank only entries with a valid selected statistic; coverage and missing counts are explicit, and A to Z includes the full catalog. Statistics reloads serialize independently of the catalog and report loading/failure. tf2huds.dev counts follow its HUD list, then match explicit comfig links or unique GitHub repositories; names and missing values are never guessed into rankings. Browser fixture data is labeled Preview data.
diff --git a/docs/guide/hud.md b/docs/guide/hud.md
index 437de323..bfcaa611 100644
--- a/docs/guide/hud.md
+++ b/docs/guide/hud.md
@@ -14,6 +14,8 @@ A HUD that is on GameBanana but not in this list can be installed from Mods: fin
**Import HUD** takes a ZIP, 7z or RAR, or a folder you already extracted. execs checks that it is a TF2 HUD (its `info.vdf` declares UI version 3) before installing it. An archive with several HUDs inside asks you to import the one you want as a folder.
+An imported HUD that is also in the catalog shows **Match to catalog** on the Installed view. Matching it lets execs check that HUD for updates; a folder named after a download (`rayshud-master`) is renamed to the catalog's name.
+
When you install or import a HUD over another one, the old HUD is kept as a backup outside TF2's HUD folders. App settings → Storage lists those backups.
## HUD options