diff --git a/scripts/caddy/README.md b/scripts/caddy/README.md index ae4921d..4d1fc8c 100644 --- a/scripts/caddy/README.md +++ b/scripts/caddy/README.md @@ -41,10 +41,6 @@ Host runtime: `/etc/caddy/secrets/dossiers-ngi-basicauth.txt` (root-only). SoT: `koopa-admin-secrets-enc` (git-crypt) → `koopa/home-hernani/caddy/`. Hosts: `dossiers.ngi` / `dossiers.2.ngi` / `dossiers.3.ngi`.hacktivism.ch -HTTP→HTTPS 308 for `dossiers.ngi` (add host to the shared ACME list, leave -HTTPS body alone): `scripts/dossiers-ngi/apply-dossiers-ngi-http-308.sh` -then `sudo ~/bin/caddy-apply`. - ## silverbullet.hacktivism.ch — merge + basic_auth After podman cutover (`scripts/notes/cutover-to-silverbullet.sh --apply`) and DNS: diff --git a/scripts/dossiers-ngi/README.md b/scripts/dossiers-ngi/README.md index 6b9b65c..d4f2efa 100644 --- a/scripts/dossiers-ngi/README.md +++ b/scripts/dossiers-ngi/README.md @@ -136,30 +136,5 @@ sudo ~/bin/caddy-apply Stanza SoT: `scripts/dossiers-ngi/caddy-dossiers-ngi.snippet`. -## HTTP → HTTPS 308 - -Shared Caddy HTTP list already `redir https://{host}{uri} permanent` (308). -`dossiers.ngi.hacktivism.ch` was missing there → HTTP `200` empty body / -Firefox `NS_ERROR_NET_EMPTY_RESPONSE`. HTTPS site body stays untouched. - -On koopa (hernani, then root apply): - -```bash -# SoT: scripts/dossiers-ngi/apply-dossiers-ngi-http-308.sh -cp /path/to/apply-dossiers-ngi-http-308.sh ~/bin/ -chmod +x ~/bin/apply-dossiers-ngi-http-308.sh -bash ~/bin/apply-dossiers-ngi-http-308.sh -sudo ~/bin/caddy-apply -``` - -Smoke after apply: - -```bash -curl -sSI http://dossiers.ngi.hacktivism.ch/ | grep -Ei 'HTTP|location' -# 308 Location: https://dossiers.ngi.hacktivism.ch/ -``` - -`.2` / `.3` stay off this list unless `SITE=` is set. - Caddy edition map must list each `editions/` explicitly. A map output of `{http.request.cookie.tdpd_edition}` did not expand on Caddy v2.11.4 (only `flask` worked → 404 for `main`/views). After new tips appear, refresh the snippet map (or regenerate from `ls editions`) before `apply-dossiers-ngi-edition-switch` + `caddy-apply`. diff --git a/scripts/dossiers-ngi/caddy-dossiers-ngi.snippet b/scripts/dossiers-ngi/caddy-dossiers-ngi.snippet index 7e02a41..c746406 100644 --- a/scripts/dossiers-ngi/caddy-dossiers-ngi.snippet +++ b/scripts/dossiers-ngi/caddy-dossiers-ngi.snippet @@ -19,10 +19,7 @@ handle @use { header Set-Cookie "tdpd_edition={re.use.1}; Path=/; Max-Age=31536000; SameSite=Lax" header Cache-Control "private, no-store" - # Keep the caller's path (?next=). Never bounce to /. No next → bar page. - @next query_regexp next ^(/|/[^/].*)$ - redir @next {query.next} 302 - redir * /_cascade/ 302 + redir * / 302 } handle /_cascade/* { diff --git a/sites/dossiers.ngi.hacktivism.ch/_cascade/bar.css b/sites/dossiers.ngi.hacktivism.ch/_cascade/bar.css index feefe10..d0a638e 100644 --- a/sites/dossiers.ngi.hacktivism.ch/_cascade/bar.css +++ b/sites/dossiers.ngi.hacktivism.ch/_cascade/bar.css @@ -118,24 +118,3 @@ a.cascade-tree-row.is-active:hover { color: #8a96a3; font-weight: 600; } -.cascade-hint { - width: 100%; - max-width: 45rem; - margin: 0.15rem auto 0; - box-sizing: border-box; - padding: 0.2rem 0.35rem; - color: #f0c674; - text-align: center; -} -.cascade-hint[hidden] { - display: none; -} -.cascade-missing-msg { - max-width: 45rem; - margin: 1.5rem auto; - padding: 0 0.75rem; - color: #c8d0d8; - font-family: ui-sans-serif, system-ui, sans-serif; - font-size: 1rem; - line-height: 1.4; -} diff --git a/sites/dossiers.ngi.hacktivism.ch/_cascade/bar.html b/sites/dossiers.ngi.hacktivism.ch/_cascade/bar.html index d81564d..ed51952 100644 --- a/sites/dossiers.ngi.hacktivism.ch/_cascade/bar.html +++ b/sites/dossiers.ngi.hacktivism.ch/_cascade/bar.html @@ -1,6 +1,5 @@ diff --git a/sites/dossiers.ngi.hacktivism.ch/_cascade/bar.js b/sites/dossiers.ngi.hacktivism.ch/_cascade/bar.js index 8db6e4a..8fe4765 100644 --- a/sites/dossiers.ngi.hacktivism.ch/_cascade/bar.js +++ b/sites/dossiers.ngi.hacktivism.ch/_cascade/bar.js @@ -25,99 +25,6 @@ } } - function setEditionCookie(edition) { - document.cookie = - "tdpd_edition=" + - encodeURIComponent(edition) + - "; Path=/; Max-Age=31536000; SameSite=Lax"; - } - - function keepPath() { - return location.pathname + location.search; - } - - function useHref(edition) { - var path = keepPath(); - var href = "/_cascade/use/" + encodeURIComponent(edition); - if (!path || path.indexOf("/_cascade/use/") === 0) return href; - return href + "?next=" + encodeURIComponent(path); - } - - function hintEl() { - return document.getElementById("cascade-hint"); - } - - function showHint(msg) { - var el = hintEl(); - if (!el) { - var bar = document.getElementById("cascade-bar"); - if (!bar) return; - el = document.createElement("div"); - el.id = "cascade-hint"; - el.className = "cascade-hint"; - el.setAttribute("role", "status"); - bar.appendChild(el); - } - el.hidden = false; - el.textContent = msg; - pinBar(); - } - - function clearHint() { - var el = hintEl(); - if (!el) return; - el.hidden = true; - el.textContent = ""; - pinBar(); - } - - function responseKeepsBar(res, text) { - if (res && res.ok) return true; - var body = text || ""; - return ( - body.indexOf("cascade-bar") !== -1 || - body.indexOf("cascade-missing") !== -1 - ); - } - - function switchEdition(edition, branchLabel) { - var prev = cookieEdition(); - var here = keepPath() || "/"; - var label = branchLabel || edition; - if (!edition) return; - if (edition === prev) { - clearHint(); - return; - } - setEditionCookie(edition); - fetch(here, { cache: "no-store", credentials: "same-origin" }) - .then(function (res) { - return res.text().then(function (text) { - return { res: res, text: text }; - }); - }) - .then(function (got) { - if (responseKeepsBar(got.res, got.text)) { - location.replace(here + location.hash); - return; - } - setEditionCookie(prev); - showHint( - "This path is not in " + - label + - ". Choose another branch above." - ); - }) - .catch(function () { - setEditionCookie(prev); - showHint( - "This path is not in " + - label + - ". Choose another branch above." - ); - }); - } - function esc(s) { return String(s) .replace(/&/g, "&") @@ -369,8 +276,8 @@ var parent = row.parent || ""; var isDefault = branch === defaultBranch; html.push( - 'flask' + + 'flask' + ' (branch-status unavailable)'; markActive(mount, cookieEdition()); pinBar(); @@ -436,26 +341,6 @@ }); } - document.addEventListener("click", function (ev) { - var a = ev.target.closest - ? ev.target.closest("a.cascade-tree-row[data-edition]") - : null; - if (!a || ev.defaultPrevented) return; - if (ev.button !== 0 || ev.metaKey || ev.ctrlKey || ev.shiftKey || ev.altKey) - return; - ev.preventDefault(); - switchEdition( - a.getAttribute("data-edition"), - a.getAttribute("data-branch") || a.getAttribute("data-edition") - ); - }); - - if (document.body && document.body.classList.contains("cascade-missing")) { - showHint( - "This path is not in the current branch. Choose another branch above." - ); - } - loadStatus(false); setInterval(function () { loadStatus(true); diff --git a/sites/dossiers.ngi.hacktivism.ch/_cascade/index.html b/sites/dossiers.ngi.hacktivism.ch/_cascade/index.html index db0bc96..036ead3 100644 --- a/sites/dossiers.ngi.hacktivism.ch/_cascade/index.html +++ b/sites/dossiers.ngi.hacktivism.ch/_cascade/index.html @@ -9,7 +9,6 @@

Stuck on an edition without a bar? Pick a build above, or reset to flask.

diff --git a/sites/dossiers.ngi.hacktivism.ch/_cascade/missing.html b/sites/dossiers.ngi.hacktivism.ch/_cascade/missing.html deleted file mode 100644 index 449d470..0000000 --- a/sites/dossiers.ngi.hacktivism.ch/_cascade/missing.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - -path not in this branch - - - - -

This address is not in the current branch. Choose another branch above.

- - - diff --git a/sites/dossiers.ngi.hacktivism.ch/cascade/_cascade/bar.css b/sites/dossiers.ngi.hacktivism.ch/cascade/_cascade/bar.css index feefe10..d0a638e 100644 --- a/sites/dossiers.ngi.hacktivism.ch/cascade/_cascade/bar.css +++ b/sites/dossiers.ngi.hacktivism.ch/cascade/_cascade/bar.css @@ -118,24 +118,3 @@ a.cascade-tree-row.is-active:hover { color: #8a96a3; font-weight: 600; } -.cascade-hint { - width: 100%; - max-width: 45rem; - margin: 0.15rem auto 0; - box-sizing: border-box; - padding: 0.2rem 0.35rem; - color: #f0c674; - text-align: center; -} -.cascade-hint[hidden] { - display: none; -} -.cascade-missing-msg { - max-width: 45rem; - margin: 1.5rem auto; - padding: 0 0.75rem; - color: #c8d0d8; - font-family: ui-sans-serif, system-ui, sans-serif; - font-size: 1rem; - line-height: 1.4; -} diff --git a/sites/dossiers.ngi.hacktivism.ch/cascade/_cascade/bar.html b/sites/dossiers.ngi.hacktivism.ch/cascade/_cascade/bar.html index d81564d..ed51952 100644 --- a/sites/dossiers.ngi.hacktivism.ch/cascade/_cascade/bar.html +++ b/sites/dossiers.ngi.hacktivism.ch/cascade/_cascade/bar.html @@ -1,6 +1,5 @@ diff --git a/sites/dossiers.ngi.hacktivism.ch/cascade/_cascade/bar.js b/sites/dossiers.ngi.hacktivism.ch/cascade/_cascade/bar.js index 8db6e4a..8fe4765 100644 --- a/sites/dossiers.ngi.hacktivism.ch/cascade/_cascade/bar.js +++ b/sites/dossiers.ngi.hacktivism.ch/cascade/_cascade/bar.js @@ -25,99 +25,6 @@ } } - function setEditionCookie(edition) { - document.cookie = - "tdpd_edition=" + - encodeURIComponent(edition) + - "; Path=/; Max-Age=31536000; SameSite=Lax"; - } - - function keepPath() { - return location.pathname + location.search; - } - - function useHref(edition) { - var path = keepPath(); - var href = "/_cascade/use/" + encodeURIComponent(edition); - if (!path || path.indexOf("/_cascade/use/") === 0) return href; - return href + "?next=" + encodeURIComponent(path); - } - - function hintEl() { - return document.getElementById("cascade-hint"); - } - - function showHint(msg) { - var el = hintEl(); - if (!el) { - var bar = document.getElementById("cascade-bar"); - if (!bar) return; - el = document.createElement("div"); - el.id = "cascade-hint"; - el.className = "cascade-hint"; - el.setAttribute("role", "status"); - bar.appendChild(el); - } - el.hidden = false; - el.textContent = msg; - pinBar(); - } - - function clearHint() { - var el = hintEl(); - if (!el) return; - el.hidden = true; - el.textContent = ""; - pinBar(); - } - - function responseKeepsBar(res, text) { - if (res && res.ok) return true; - var body = text || ""; - return ( - body.indexOf("cascade-bar") !== -1 || - body.indexOf("cascade-missing") !== -1 - ); - } - - function switchEdition(edition, branchLabel) { - var prev = cookieEdition(); - var here = keepPath() || "/"; - var label = branchLabel || edition; - if (!edition) return; - if (edition === prev) { - clearHint(); - return; - } - setEditionCookie(edition); - fetch(here, { cache: "no-store", credentials: "same-origin" }) - .then(function (res) { - return res.text().then(function (text) { - return { res: res, text: text }; - }); - }) - .then(function (got) { - if (responseKeepsBar(got.res, got.text)) { - location.replace(here + location.hash); - return; - } - setEditionCookie(prev); - showHint( - "This path is not in " + - label + - ". Choose another branch above." - ); - }) - .catch(function () { - setEditionCookie(prev); - showHint( - "This path is not in " + - label + - ". Choose another branch above." - ); - }); - } - function esc(s) { return String(s) .replace(/&/g, "&") @@ -369,8 +276,8 @@ var parent = row.parent || ""; var isDefault = branch === defaultBranch; html.push( - 'flask' + + 'flask' + ' (branch-status unavailable)'; markActive(mount, cookieEdition()); pinBar(); @@ -436,26 +341,6 @@ }); } - document.addEventListener("click", function (ev) { - var a = ev.target.closest - ? ev.target.closest("a.cascade-tree-row[data-edition]") - : null; - if (!a || ev.defaultPrevented) return; - if (ev.button !== 0 || ev.metaKey || ev.ctrlKey || ev.shiftKey || ev.altKey) - return; - ev.preventDefault(); - switchEdition( - a.getAttribute("data-edition"), - a.getAttribute("data-branch") || a.getAttribute("data-edition") - ); - }); - - if (document.body && document.body.classList.contains("cascade-missing")) { - showHint( - "This path is not in the current branch. Choose another branch above." - ); - } - loadStatus(false); setInterval(function () { loadStatus(true); diff --git a/sites/dossiers.ngi.hacktivism.ch/cascade/_cascade/index.html b/sites/dossiers.ngi.hacktivism.ch/cascade/_cascade/index.html index db0bc96..036ead3 100644 --- a/sites/dossiers.ngi.hacktivism.ch/cascade/_cascade/index.html +++ b/sites/dossiers.ngi.hacktivism.ch/cascade/_cascade/index.html @@ -9,7 +9,6 @@

Stuck on an edition without a bar? Pick a build above, or reset to flask.