diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 6613488..75b4ff4 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -2,6 +2,11 @@ # prod: tests, image build (tags: commit hash, `prod`, `latest`), then # deployment to the server. # +# Only what changed since the last deployment (ci/changed-services.sh): the +# Rust tests run when a Rust service changed, only the changed images are +# built, and only their containers restart (each service has its own tag on +# the server: TAG_BACKEND, TAG_FRONTEND, ...; TAG is the fallback). +# # Runs on the self-hosted runner in ci/runner (label `linux`), one job at a # time; building on main too would build every deployed commit twice. Jobs use # the host's Docker daemon, so image builds share its BuildKit cache. @@ -53,14 +58,23 @@ jobs: apk add --no-cache -q git musl-dev git init -q . && git remote add origin "${{ github.server_url }}/${{ github.repository }}.git" git fetch -q --depth 1 origin "${{ github.sha }}" && git checkout -q FETCH_HEAD + git fetch -q --unshallow --tags origin - name: Wait for Postgres run: | for i in $(seq 30); do nc -z postgres 5432 && exit 0; sleep 1; done echo "postgres did not start" >&2; exit 1 # astro-engine and horoscope-api need the Swiss Ephemeris sources and - # data (scripts/fetch-deps.sh); their tests run locally. + # data (scripts/fetch-deps.sh); their tests run locally. Skipped when + # only the frontend (or nothing built) changed since the last deployment. - name: Test - run: cargo test --locked -p backend -p worker -p forum -p object-storage -p db -p horoscope-client -p service-kit -p analysis-prompt -p email-templates + run: | + services=$(sh ci/changed-services.sh) + echo "changed since the last deployment: ${services:-nothing}" + case " $services " in + *" backend "*|*" worker "*|*" forum "*|*" horoscope-api "*) ;; + *) echo "no Rust service changed: tests skipped"; exit 0 ;; + esac + cargo test --locked -p backend -p worker -p forum -p object-storage -p db -p horoscope-client -p service-kit -p analysis-prompt -p email-templates build: needs: test @@ -72,6 +86,7 @@ jobs: apk add --no-cache -q git git init -q . && git remote add origin "${{ github.server_url }}/${{ github.repository }}.git" git fetch -q --depth 1 origin "${{ github.sha }}" && git checkout -q FETCH_HEAD + git fetch -q --unshallow --tags origin - name: Log in to the registry env: TOKEN: ${{ secrets.REGISTRY_TOKEN }} @@ -92,11 +107,15 @@ jobs: docker push -q "$image:$t" done } - build horoscope-api -f services/horoscope-api/Dockerfile . - build backend -f services/backend/Dockerfile . - build worker -f services/worker/Dockerfile . - build forum -f services/forum/Dockerfile . - build frontend services/frontend + services=$(sh ci/changed-services.sh) + echo "building: ${services:-nothing}" + for svc in $services; do + case "$svc" in + # The frontend knows its version (the page's new-version notice, Next's skew protection). + frontend) build frontend --build-arg APP_VERSION="$tag" services/frontend ;; + *) build "$svc" -f "services/$svc/Dockerfile" . ;; + esac + done # Only the last 5 commit images of each service stay in the registry, # plus `main`, `prod`, `latest` and the commit running in production # (the server pulls it by its commit tag). @@ -156,6 +175,7 @@ jobs: apk add --no-cache -q git openssh-client git init -q . && git remote add origin "${{ github.server_url }}/${{ github.repository }}.git" git fetch -q --depth 1 origin "${{ github.sha }}" && git checkout -q FETCH_HEAD + git fetch -q --unshallow --tags origin - name: SSH key env: KEY: ${{ secrets.DEPLOY_SSH_KEY }} @@ -164,8 +184,9 @@ jobs: mkdir -p ~/.ssh && chmod 700 ~/.ssh (umask 077 && printf '%s\n' "$KEY" > ~/.ssh/id_ed25519) printf '%s\n' "$KNOWN_HOSTS" > ~/.ssh/known_hosts - # Copies the compose files, pins TAG in the server's .env and restarts - # the changed services. The database migrations run when the backend starts. + # Copies the compose files, pins the built services' tags (TAG_) + # in the server's .env and restarts the changed services only. The + # database migrations run when the backend (or the forum) starts. - name: Deploy env: HOST: ${{ vars.DEPLOY_HOST }} @@ -173,9 +194,15 @@ jobs: run: | set -eu tag=$(echo "${{ github.sha }}" | cut -c1-12) + services=$(sh ci/changed-services.sh) + echo "deploying: ${services:-nothing new}" + pin="" + for svc in $services; do + var="TAG_$(echo "$svc" | tr 'a-z-' 'A-Z_')" + pin="$pin (grep -q '^$var=' .env && sed -i 's/^$var=.*/$var=$tag/' .env || echo '$var=$tag' >> .env) &&" + done scp -q deploy/docker-compose.yml deploy/Caddyfile "$HOST:$DIR/" - ssh "$HOST" "cd '$DIR' && \ - (grep -q '^TAG=' .env && sed -i 's/^TAG=.*/TAG=$tag/' .env || echo 'TAG=$tag' >> .env) && \ + ssh "$HOST" "cd '$DIR' && $pin \ docker compose pull -q && docker compose up -d --remove-orphans --wait && \ docker compose exec -T caddy caddy reload --config /etc/caddy/Caddyfile --adapter caddyfile && \ docker image prune -af >/dev/null" @@ -188,7 +215,8 @@ jobs: run: | set -eu apk add --no-cache -q curl jq - git fetch -q --unshallow --tags origin + # The checkout above already has the whole history. + git fetch -q --tags origin short=$(echo "${{ github.sha }}" | cut -c1-7) name="v$(date -u +%Y.%m.%d)-$short" if curl -fsS -o /dev/null -H "Authorization: token $TOKEN" "$API/releases/tags/$name" 2>/dev/null; then diff --git a/ci/changed-services.sh b/ci/changed-services.sh new file mode 100755 index 0000000..00050c1 --- /dev/null +++ b/ci/changed-services.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# Prints the services whose image has to be built for HEAD: those whose files +# changed since the last deployment (the newest v* release tag among HEAD's +# ancestors; the release step tags every deployment). Prints all of them when +# there is no such tag or the comparison fails, so a doubt builds everything. +# Needs the full history and the tags (git fetch --unshallow --tags). +# +# frontend services/frontend/ +# backend, worker, forum their folder, the shared crates/, Cargo.toml, Cargo.lock +# horoscope-api the same, and scripts/fetch-deps.sh +set -u +ALL="horoscope-api backend worker forum frontend" +prev=$(git describe --tags --abbrev=0 --match 'v*' HEAD 2>/dev/null) || { echo "$ALL"; exit 0; } +files=$(git diff --name-only "$prev" HEAD) || { echo "$ALL"; exit 0; } +changed() { printf '%s\n' "$files" | grep -Eq "$1"; } +rust='^(crates/|Cargo\.toml$|Cargo\.lock$)' +out="" +changed "^services/horoscope-api/|^scripts/fetch-deps\.sh$|$rust" && out="$out horoscope-api" +for svc in backend worker forum; do + changed "^services/$svc/|$rust" && out="$out $svc" +done +changed '^services/frontend/' && out="$out frontend" +echo $out diff --git a/deploy/README.md b/deploy/README.md index 0770207..1c15dff 100644 --- a/deploy/README.md +++ b/deploy/README.md @@ -9,10 +9,14 @@ A runner egyszerre egy feladatot futtat; ha a main is buildelne, minden kitett c A lépések: -1. **test**: `cargo test` a backendre, a workerre, a db-re, a horoscope-clientre és a service-kitre, egy Postgres szolgáltatás-konténerrel. -2. **build** (csak prod): megépíti a négy image-et, és feltölti őket a `registry.sagifer.com/sagifer/sorsfonalak-` címre. A frontend buildje a TypeScript-típusokat is ellenőrzi. -3. **deploy** (csak prod): felmásolja a `docker-compose.yml`-t és a `Caddyfile`-t a szerverre, beírja az új `TAG`-et a szerveren lévő `.env`-be, majd `docker compose pull && up -d`. Az adatbázis-migrációk a backend indulásakor futnak le. -4. **release** (csak prod, a deploy után): létrehoz egy `v<év.hónap.nap>-` taget és Gitea-release-t az előző release óta bekerült commitok listájával (repó → Releases). +Csak az épül és indul újra, ami az előző élesítés óta változott (`ci/changed-services.sh`: az előző élesítés `v*` taghez képest nézi a változott fájlokat). A frontend a `services/frontend` mappától függ; a backend, a worker és a fórum a saját mappájától és a közös Rust-csomagoktól (`crates/`, `Cargo.toml`, `Cargo.lock`); a horoscope-api ezektől és a `scripts/fetch-deps.sh`-tól. Ha nincs előző tag, vagy kétséges a helyzet, minden épül. + +1. **test**: `cargo test` a Rust-szolgáltatásokra, egy Postgres szolgáltatás-konténerrel. Kimarad, ha egyik Rust-szolgáltatás sem változott. +2. **build** (csak prod): megépíti a változott image-eket, és feltölti őket a `registry.sagifer.com/sagifer/sorsfonalak-` címre. A frontend buildje a TypeScript-típusokat is ellenőrzi, és megkapja a verzióját (`APP_VERSION`, a commit): ebből lesz a Next `deploymentId`-je és a `/api/version` válasza. +3. **deploy** (csak prod): felmásolja a `docker-compose.yml`-t és a `Caddyfile`-t a szerverre, a szerveren lévő `.env`-be csak a megépült szolgáltatások címkéjét írja be (`TAG_BACKEND`, `TAG_FRONTEND`, `TAG_FORUM`, `TAG_WORKER`, `TAG_HOROSCOPE_API`; ahol nincs ilyen, a régi `TAG` érvényes), majd `docker compose pull && up -d`: csak a változott konténerek indulnak újra. Az adatbázis-migrációk a backend (és a fórum) indulásakor futnak le. +4. **release** (csak prod, a deploy után): létrehoz egy `v<év.hónap.nap>-` taget és Gitea-release-t az előző release óta bekerült commitok listájával (repó → Releases). A következő élesítés ehhez a taghez méri a változást. + +Új frontend-verziónál a nyitva hagyott oldalak maguk veszik észre (`VersionWatcher`, 5 percenként és amikor a fül előtérbe kerül): ha a látogató nem csinál semmit és nincs beírt szöveg, újratöltődik, különben egy „Frissült az oldal” sáv kínálja fel a frissítést. Linkre kattintva a Next magától teljes újratöltést csinál. Kézzel is indítható a repó Actions oldaláról (workflow_dispatch). diff --git a/deploy/docker-compose.yml b/deploy/docker-compose.yml index 6c40292..4c8ecd0 100644 --- a/deploy/docker-compose.yml +++ b/deploy/docker-compose.yml @@ -28,7 +28,7 @@ services: restart: unless-stopped horoscope-api: - image: ${REGISTRY_PREFIX:-registry.sagifer.com/sagifer/sorsfonalak}-horoscope-api:${TAG:-latest} + image: ${REGISTRY_PREFIX:-registry.sagifer.com/sagifer/sorsfonalak}-horoscope-api:${TAG_HOROSCOPE_API:-${TAG:-latest}} read_only: true logging: *logging restart: unless-stopped @@ -75,7 +75,7 @@ services: restart: unless-stopped backend: - image: ${REGISTRY_PREFIX:-registry.sagifer.com/sagifer/sorsfonalak}-backend:${TAG:-latest} + image: ${REGISTRY_PREFIX:-registry.sagifer.com/sagifer/sorsfonalak}-backend:${TAG_BACKEND:-${TAG:-latest}} environment: DATABASE_URL: postgres://sorsfonalak:${POSTGRES_PASSWORD}@postgres:5432/sorsfonalak HOROSCOPE_API_URL: http://horoscope-api:8080 @@ -134,7 +134,7 @@ services: # E-mail delivery, cleanup and the other background jobs. worker: - image: ${REGISTRY_PREFIX:-registry.sagifer.com/sagifer/sorsfonalak}-worker:${TAG:-latest} + image: ${REGISTRY_PREFIX:-registry.sagifer.com/sagifer/sorsfonalak}-worker:${TAG_WORKER:-${TAG:-latest}} environment: DATABASE_URL: postgres://sorsfonalak:${POSTGRES_PASSWORD}@postgres:5432/sorsfonalak # forum: the forum's digests, daily sky thread, listener e-mails, weekly summary. @@ -167,7 +167,7 @@ services: # The same image writing the analyses and answers (quick and slow lane); # OPENROUTER_API_KEY comes from .env.secrets. worker-ai: - image: ${REGISTRY_PREFIX:-registry.sagifer.com/sagifer/sorsfonalak}-worker:${TAG:-latest} + image: ${REGISTRY_PREFIX:-registry.sagifer.com/sagifer/sorsfonalak}-worker:${TAG_WORKER:-${TAG:-latest}} environment: DATABASE_URL: postgres://sorsfonalak:${POSTGRES_PASSWORD}@postgres:5432/sorsfonalak WORKER_TASKS: analyses @@ -195,7 +195,7 @@ services: # The forum (docs/kozosseg.md): its own service on the same database and # login; switched on for the visitors by FORUM_URL in the frontend below. forum: - image: ${REGISTRY_PREFIX:-registry.sagifer.com/sagifer/sorsfonalak}-forum:${TAG:-latest} + image: ${REGISTRY_PREFIX:-registry.sagifer.com/sagifer/sorsfonalak}-forum:${TAG_FORUM:-${TAG:-latest}} environment: DATABASE_URL: postgres://sorsfonalak:${POSTGRES_PASSWORD}@postgres:5432/sorsfonalak # The links in the forum's e-mails. @@ -219,7 +219,7 @@ services: restart: unless-stopped frontend: - image: ${REGISTRY_PREFIX:-registry.sagifer.com/sagifer/sorsfonalak}-frontend:${TAG:-latest} + image: ${REGISTRY_PREFIX:-registry.sagifer.com/sagifer/sorsfonalak}-frontend:${TAG_FRONTEND:-${TAG:-latest}} environment: BACKEND_URL: http://backend:8081 HOROSCOPE_API_URL: http://horoscope-api:8080 diff --git a/services/frontend/Dockerfile b/services/frontend/Dockerfile index b096f26..b978a9c 100644 --- a/services/frontend/Dockerfile +++ b/services/frontend/Dockerfile @@ -6,14 +6,17 @@ RUN --mount=type=cache,target=/root/.npm,sharing=locked npm ci --no-audit --no-f FROM node:22.23-alpine AS build WORKDIR /app -ENV NEXT_TELEMETRY_DISABLED=1 +# The commit being built (the CI passes it): Next's deployment id and /api/version. +ARG APP_VERSION="" +ENV NEXT_TELEMETRY_DISABLED=1 APP_VERSION=$APP_VERSION COPY --from=deps /app/node_modules ./node_modules COPY . . RUN npm run build FROM node:22.23-alpine WORKDIR /app -ENV NODE_ENV=production NEXT_TELEMETRY_DISABLED=1 PORT=3000 HOSTNAME=0.0.0.0 +ARG APP_VERSION="" +ENV NODE_ENV=production NEXT_TELEMETRY_DISABLED=1 PORT=3000 HOSTNAME=0.0.0.0 APP_VERSION=$APP_VERSION RUN addgroup -S app && adduser -S -G app app COPY --from=build --chown=app:app /app/.next/standalone ./ COPY --from=build --chown=app:app /app/.next/static ./.next/static diff --git a/services/frontend/next.config.ts b/services/frontend/next.config.ts index 11e06f9..1e958ac 100644 --- a/services/frontend/next.config.ts +++ b/services/frontend/next.config.ts @@ -4,6 +4,10 @@ const config: NextConfig = { // Small self-contained server for the container image. output: "standalone", poweredByHeader: false, + // The image's version (the commit, APP_VERSION from the CI build): a page + // loaded from an older version reloads itself on its next navigation, and + // VersionWatcher offers a reload when a new one is out. None in development. + deploymentId: process.env.APP_VERSION || undefined, // The fonts of the share preview images are read from disk at run time. outputFileTracingIncludes: { "/s/[slug]/kep/[file]": ["./src/assets/og/*.ttf"], diff --git a/services/frontend/src/app/Landing.tsx b/services/frontend/src/app/Landing.tsx index c50e133..87349ac 100644 --- a/services/frontend/src/app/Landing.tsx +++ b/services/frontend/src/app/Landing.tsx @@ -71,10 +71,23 @@ export function Landing({ inviteOnly, loggedIn = false }: { inviteOnly: boolean; Add meg, mikor és hol születtél: percre pontosan kiszámoljuk a képletedet, és személyre szóló elemzést írunk belőle. Megmutatjuk, mit hoz az éved, és mennyire illetek össze azzal, akit szeretsz.

-

- Részletes, személyre szóló elemzések a legfejlettebb AI-modellekkel: percek alatt, egy személyes konzultáció - árának töredékéért. -

+
+ +
+ Nem sablonszöveg, hanem a te elemzésed +

+ Sok horoszkópoldalon előre megírt bekezdések állnak össze: minden Halak ugyanazt kapja. Itt minden + elemzés a te képletedből készül. Nem azt olvasod, hogy „a Halak érzékeny”, hanem hogy a te Halak Napod a + te házaidban, a te fényszögeiddel mit jelent, percek alatt, a legfejlettebb AI-modellekkel. +

+
+
{signIn} @@ -195,7 +208,7 @@ export function Landing({ inviteOnly, loggedIn = false }: { inviteOnly: boolean;
Miért más?

- Alapos elemzés, töredék áron + Személyre szabott, nem előre megírt

    @@ -204,10 +217,11 @@ export function Landing({ inviteOnly, loggedIn = false }: { inviteOnly: boolean; -

    A legfejlettebb AI-modellek

    +

    Minden mondat rólad szól

    - Az elemzéseket a legújabb, legnagyobb nyelvi modellek írják, a te képleted pontosan kiszámolt adataiból. Nem - sablonszövegekből rakjuk össze: minden mondat a te képletedről szól. + Nem csillagjegyenként előre megírt szövegekből rakjuk össze. A legújabb, legnagyobb nyelvi modellek a te + képleted pontosan kiszámolt adataiból írják meg, ezért két ember elemzése akkor is más, ha ugyanaz a + csillagjegyük.

  • diff --git a/services/frontend/src/app/api/version/route.ts b/services/frontend/src/app/api/version/route.ts new file mode 100644 index 0000000..a30753d --- /dev/null +++ b/services/frontend/src/app/api/version/route.ts @@ -0,0 +1,7 @@ +// The version this frontend runs (the commit it was built from), for the +// pages' new-version notice (VersionWatcher). null in development. +export const dynamic = "force-dynamic"; + +export function GET() { + return Response.json({ version: process.env.APP_VERSION || null }, { headers: { "cache-control": "no-store" } }); +} diff --git a/services/frontend/src/app/globals.css b/services/frontend/src/app/globals.css index 4348fe1..4d9527c 100644 --- a/services/frontend/src/app/globals.css +++ b/services/frontend/src/app/globals.css @@ -1814,3 +1814,28 @@ span.tarot-fan-card { cursor: default; } } .pw-eye:hover, .pw-eye:focus-visible { color: var(--gold); } .pw-eye svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; } + +/* The home page: analyses written for each chart, not template texts. */ +.lp-personal { + display: flex; gap: 14px; align-items: flex-start; max-width: 560px; padding: 16px 18px; + border: 1px solid rgba(217, 180, 106, 0.35); border-radius: 14px; background: rgba(217, 180, 106, 0.07); +} +.lp-personal-icon { width: 30px; height: 30px; flex: none; margin-top: 2px; fill: none; stroke: var(--gold); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; } +.lp-personal-title { display: block; color: var(--ink); font-size: 17px; font-weight: 600; margin-bottom: 4px; } +.lp-personal-text { margin: 0; color: var(--ink-2); font-size: 15.5px; line-height: 1.6; } +/* Phones: the hero's two buttons side by side (each takes half the row). */ +@media (max-width: 479px) { + .lp-hero .lp-actions { flex-wrap: nowrap; gap: 10px; } + .lp-hero .lp-actions .lp-btn { flex: 1 1 auto; min-width: 0; padding: 0 14px; font-size: 15px; text-align: center; } +} + +/* "Frissült az oldal": a new version is out (VersionWatcher). */ +.update-note { + position: fixed; top: calc(12px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 80; + display: flex; align-items: center; gap: 12px; width: max-content; max-width: calc(100vw - 24px); padding: 10px 12px 10px 16px; + background: var(--panel, #121a2e); color: var(--ink, #ece6d8); border: 1px solid var(--gold); border-radius: 14px; + box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35); font-size: 15px; +} +.update-note-later { border: 0; background: none; color: var(--ink-2, #c9cfdc); font: inherit; font-size: 14px; cursor: pointer; padding: 6px; } +.update-note-later:hover { color: var(--gold); } +@media (max-width: 479px) { .update-note { flex-wrap: wrap; justify-content: center; text-align: center; } } diff --git a/services/frontend/src/app/layout.tsx b/services/frontend/src/app/layout.tsx index 00ec660..e8ca2c9 100644 --- a/services/frontend/src/app/layout.tsx +++ b/services/frontend/src/app/layout.tsx @@ -9,6 +9,7 @@ import { PaymentReturn } from "@/components/PaymentReturn"; import { SiteFooter } from "@/components/PublicFooter"; import { SiteHeader } from "@/components/SiteHeader"; import { ValidationMessages } from "@/components/ValidationMessages"; +import { VersionWatcher } from "@/components/VersionWatcher"; import { getMe } from "@/lib/server"; import { loadSky } from "@/lib/sky"; import { siteUrl } from "@/lib/share"; @@ -44,6 +45,7 @@ export default async function RootLayout({ children }: { children: React.ReactNo + {me && } {children} diff --git a/services/frontend/src/components/VersionWatcher.tsx b/services/frontend/src/components/VersionWatcher.tsx new file mode 100644 index 0000000..b3403fe --- /dev/null +++ b/services/frontend/src/components/VersionWatcher.tsx @@ -0,0 +1,89 @@ +"use client"; + +import { useEffect, useState } from "react"; + +/** How often an open page asks (only while it is in front). */ +const EVERY_MS = 5 * 60 * 1000; +/** No key, click or touch for this long counts as idle. */ +const IDLE_MS = 2 * 60 * 1000; + +/** Typed text that a reload would lose (a reply being written, a form filled in). */ +function unsaved(): boolean { + const fields = document.querySelectorAll( + "textarea, input:not([type]), input[type=text], input[type=email], input[type=search], input[type=password]", + ); + return Array.from(fields).some( + (f) => !f.readOnly && !f.disabled && f.value.trim() !== "" && f.value !== f.defaultValue, + ); +} + +/** + * When a new version of the site is out (its /api/version differs from the + * one this page was built from, Next's `data-dpl-id`): an idle page with + * nothing typed in reloads itself; otherwise a small notice offers the reload. + * (A click on a link reloads anyway: Next's skew protection.) + */ +export function VersionWatcher() { + const [fresh, setFresh] = useState(false); + + useEffect(() => { + const mine = document.documentElement.dataset.dplId; + if (!mine) return; + let lastInput = Date.now(); + let dismissed = false; + const touched = () => { + lastInput = Date.now(); + }; + const check = async () => { + if (document.visibilityState !== "visible" || dismissed) return; + try { + const res = await fetch("/api/version", { cache: "no-store" }); + const { version } = (await res.json()) as { version: string | null }; + if (!version || version === mine) return; + const idle = Date.now() - lastInput > IDLE_MS; + if (idle && !unsaved() && !document.querySelector("dialog[open]")) window.location.reload(); + else setFresh(true); + } catch { + // Offline or mid-deployment: the next check tries again. + } + }; + const timer = window.setInterval(check, EVERY_MS); + const onVisible = () => document.visibilityState === "visible" && void check(); + document.addEventListener("visibilitychange", onVisible); + window.addEventListener("focus", onVisible); + window.addEventListener("online", onVisible); + for (const e of ["keydown", "pointerdown", "touchstart"]) window.addEventListener(e, touched, { passive: true }); + const later = () => { + dismissed = true; + setFresh(false); + window.setTimeout(() => (dismissed = false), 30 * 60 * 1000); + }; + window.addEventListener("version-watcher:later", later); + return () => { + window.clearInterval(timer); + document.removeEventListener("visibilitychange", onVisible); + window.removeEventListener("focus", onVisible); + window.removeEventListener("online", onVisible); + for (const e of ["keydown", "pointerdown", "touchstart"]) window.removeEventListener(e, touched); + window.removeEventListener("version-watcher:later", later); + }; + }, []); + + if (!fresh) return null; + return ( +
    + Frissült az oldal: elérhető az új változata. + + +
    + ); +}