From 56755a77fd9e95effbd4853249a69f9bf5716a66 Mon Sep 17 00:00:00 2001 From: cyph3rasi Date: Sat, 11 Jul 2026 20:00:22 -0700 Subject: [PATCH] Reconcile the authenticated Hop homepage link with the concurrent prompt UI cache-busting update. Hop-State: A_06FN8H69P46VDF0HK6YF5QR Hop-Proposal: R_06FN8H5RRQKVJVY2JNSFBM0 Hop-Task: T_06FN8GMDFCS0GKTW2RRDQ70 Hop-Attempt: AT_06FN8H33JB50J4M5WD37BCR --- .../prompts/P_06FN8GMDFDHV1G2BH5CC6X0.json | 17 +++++++++ deploy/gitea/install-hop-native.sh | 3 ++ deploy/gitea/public/assets/js/hop-native.js | 37 +++++++++++++++++++ .../gitea/templates/custom/extra_links.tmpl | 3 ++ 4 files changed, 60 insertions(+) create mode 100644 .hop/records/prompts/P_06FN8GMDFDHV1G2BH5CC6X0.json create mode 100644 deploy/gitea/templates/custom/extra_links.tmpl diff --git a/.hop/records/prompts/P_06FN8GMDFDHV1G2BH5CC6X0.json b/.hop/records/prompts/P_06FN8GMDFDHV1G2BH5CC6X0.json new file mode 100644 index 0000000..57dd950 --- /dev/null +++ b/.hop/records/prompts/P_06FN8GMDFDHV1G2BH5CC6X0.json @@ -0,0 +1,17 @@ +{ + "id": "P_06FN8GMDFDHV1G2BH5CC6X0", + "task_id": "T_06FN8GMDFCS0GKTW2RRDQ70", + "attempt_id": "AT_06FN8GMDFF85Q3R6MQ1PSW0", + "state_id": "P_06FN8GMDFDHV1G2BH5CC6X0", + "prompt": "Can we add a Hop link to the nav bar only for authenticated users, that when clicked loads the Homepage that unathenticated users see", + "agent_name": "codex", + "status": "proposed", + "response_summary": "Add an authenticated-only Hop navbar link that displays the public landing homepage while preserving the signed-in navigation.", + "created_at": "2026-07-12T02:57:55.579767Z", + "metadata": { + "source_tree": "8de4a24376935a4fb3f5791b017591bd2fbc2848", + "git_commit": "67321dd93a25d30bddb0083706db2695bdabe622", + "attempt_head": "C_06FN8H1TPEWCZT16VNZPF0R", + "attempt_head_kind": "checkpoint" + } +} diff --git a/deploy/gitea/install-hop-native.sh b/deploy/gitea/install-hop-native.sh index 973e472..a65c0e3 100755 --- a/deploy/gitea/install-hop-native.sh +++ b/deploy/gitea/install-hop-native.sh @@ -23,6 +23,9 @@ docker compose --env-file "$env_file" cp \ docker compose --env-file "$env_file" cp \ deploy/gitea/templates/custom/footer.tmpl \ gitea:/data/gitea/templates/custom/footer.tmpl +docker compose --env-file "$env_file" cp \ + deploy/gitea/templates/custom/extra_links.tmpl \ + gitea:/data/gitea/templates/custom/extra_links.tmpl docker compose --env-file "$env_file" cp \ deploy/gitea/public/assets/js/hop-native.js \ gitea:/data/gitea/public/assets/js/hop-native.js diff --git a/deploy/gitea/public/assets/js/hop-native.js b/deploy/gitea/public/assets/js/hop-native.js index 351dac8..0ddb2b7 100644 --- a/deploy/gitea/public/assets/js/hop-native.js +++ b/deploy/gitea/public/assets/js/hop-native.js @@ -372,6 +372,42 @@ } } + function publicHomepageRequested() { + return new URLSearchParams(window.location.search).get('hop') === 'home'; + } + + async function loadPublicHomepage() { + const link = document.querySelector('[data-hop-public-home-link]'); + if (link) link.classList.toggle('active', publicHomepageRequested()); + if (!link || !publicHomepageRequested() || document.documentElement.dataset.hopPublicHome) return; + + document.documentElement.dataset.hopPublicHome = 'loading'; + try { + const publicURL = new URL(link.href, window.location.origin); + publicURL.search = ''; + const response = await fetch(publicURL, {credentials: 'omit'}); + if (!response.ok) throw new Error(`Could not load the Hop homepage (${response.status})`); + + const publicDocument = new DOMParser().parseFromString(await response.text(), 'text/html'); + const publicMain = publicDocument.querySelector('#hop-main'); + const currentMain = document.querySelector('[role="main"]'); + if (!publicMain || !currentMain) throw new Error('The Hop homepage was not present in the response'); + + for (const style of publicMain.parentElement?.querySelectorAll(':scope > style') || []) { + style.dataset.hopPublicHomeStyle = 'true'; + document.head.append(style); + } + currentMain.replaceWith(publicMain); + document.title = publicDocument.title; + document.documentElement.dataset.hopPublicHome = 'rendered'; + bindInstallationSwitchers(); + bindInstallationCopyButtons(); + } catch (error) { + delete document.documentElement.dataset.hopPublicHome; + console.error(error); + } + } + function applyHopSemantics() { const brandLogo = document.querySelector('#navbar-logo img'); if (brandLogo) brandLogo.src = brandLogo.src.replace(/\/img\/(?:logo|hop)\.svg(?:\?.*)?$/, '/img/hop.svg?v=4'); @@ -383,6 +419,7 @@ renderPromptPage(); bindInstallationSwitchers(); bindInstallationCopyButtons(); + void loadPublicHomepage(); document.documentElement.dataset.hopNative = 'true'; } diff --git a/deploy/gitea/templates/custom/extra_links.tmpl b/deploy/gitea/templates/custom/extra_links.tmpl new file mode 100644 index 0000000..29246a0 --- /dev/null +++ b/deploy/gitea/templates/custom/extra_links.tmpl @@ -0,0 +1,3 @@ +{{if .IsSigned}} + Hop +{{end}}