From f6a536ad64a50095a817560772cae537228244f9 Mon Sep 17 00:00:00 2001 From: Joshua Oosthuizen Date: Thu, 26 Nov 2026 16:14:20 +0200 Subject: [PATCH] Accounts 1.7.1, Website 1.0.2, Events 3.7.1: link right after an install; Preview behind the proxy Found installing the Website for cross-demo2. - All three: a connect involving an install that isn't in the cached copy of the Hub's list yet asks the Hub for a fresh list (one heartbeat, at most once a minute) instead of refusing. A new Website's admin couldn't sign in for up to 30 minutes. - Accounts: a heartbeat on every start. - Website: /admin links to Accounts on the spot (at most every 15 s), one connect to Accounts at a time, and the problem page says "not linked yet" (ACCOUNTS_NOT_LINKED). Preview redirected to the server's own http://localhost:: the preview routes now answer with a relative Location. - Events: a new Website can connect for the event feed straight away. - docs: VERSIONS, changelogs, WHATS-NEW. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 14 ++++ apps/accounts/CHANGELOG.md | 16 +++++ apps/accounts/WHATS-NEW.md | 5 ++ apps/accounts/backend/package.json | 2 +- apps/accounts/backend/src/index.ts | 4 +- apps/accounts/backend/src/links/connect.ts | 32 +++++++-- apps/accounts/backend/tests/products.test.ts | 40 +++++++++++ apps/accounts/frontend/package.json | 2 +- apps/events/CHANGELOG.md | 13 ++++ apps/events/WHATS-NEW.md | 5 ++ apps/events/backend/package.json | 2 +- apps/events/backend/src/links/connect.ts | 36 ++++++++-- .../backend/tests/linkedProducts.test.js | 24 +++++++ apps/events/frontend/package.json | 2 +- apps/events/package.json | 2 +- apps/website/CHANGELOG.md | 24 +++++++ apps/website/WHATS-NEW.md | 7 ++ apps/website/backend/package.json | 2 +- apps/website/backend/src/auth/accounts.ts | 15 ++-- apps/website/backend/src/auth/routes.ts | 7 +- apps/website/backend/src/links/connect.ts | 72 +++++++++++++++++-- apps/website/backend/tests/links.test.ts | 68 +++++++++++++++++- apps/website/backend/tests/signin.test.ts | 2 +- apps/website/frontend/package.json | 2 +- .../frontend/src/app/auth/problem/page.tsx | 5 ++ .../frontend/src/app/preview/[token]/route.ts | 7 +- .../frontend/src/app/preview/exit/route.ts | 5 +- .../frontend/src/app/preview/start/route.ts | 5 +- .../website/frontend/src/lib/localRedirect.ts | 11 +++ docs/VERSIONS.md | 19 +++-- package-lock.json | 12 ++-- 31 files changed, 416 insertions(+), 46 deletions(-) create mode 100644 apps/website/frontend/src/lib/localRedirect.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ec106f..b1d8b1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,20 @@ Each package and app has its own section and its own tags (`contracts@1.0.0`, `accounts@1.0.0`, …). +## accounts@1.7.1 + website@1.0.2 + events@3.7.1 - 2026-11-26 + +Found installing the Website for cross-demo2. Details in each app's CHANGELOG.md. No migrations. + +- **Linking right after an install** (all three): a connect involving an install that isn't in the + cached copy of the Hub's list yet asks the Hub for a fresh list (one heartbeat, at most once a + minute) instead of refusing. Before, a new product and its siblings only learned of each other at + their 15-minute heartbeats, so a new Website's admin couldn't sign in for up to 30 minutes. +- **Accounts 1.7.1:** also a heartbeat on every start. +- **Website 1.0.2:** opening `/admin` without a link to Accounts links on the spot; the problem page + says "not linked yet" (`ACCOUNTS_NOT_LINKED`) instead of "can't reach your sign-in". Preview no + longer redirects to the server's own `http://localhost:` (relative redirects). +- **Events 3.7.1:** a new Website can connect for the event feed straight away. + ## website@1.0.1 + crosscode script - 2026-11-26 Details in `apps/website/CHANGELOG.md`. diff --git a/apps/accounts/CHANGELOG.md b/apps/accounts/CHANGELOG.md index 5690d15..47406e8 100644 --- a/apps/accounts/CHANGELOG.md +++ b/apps/accounts/CHANGELOG.md @@ -1,5 +1,21 @@ # Changelog — Accounts +## [1.7.1] - 2026-11-26 + +No migrations, no new settings. + +### Fixed + +- **A product installed after Accounts' last heartbeat links straight away.** Accounts accepted a + connect only from installs in its cached copy of the Hub's list, which it refreshed every 15 + minutes. A new Church Website (or Events) was refused ("doesn't know that install yet") and tried + again only at its own next heartbeat, so its admin couldn't sign in for up to 30 minutes after the + install (found on cross-demo2). Now, for an install it doesn't know, Accounts sends the Hub a + heartbeat to get a fresh list and looks again (at most one such heartbeat a minute, so unknown + installs can't make it call the Hub more often). The same applies when an Accounts admin connects. +- **A heartbeat on every start**, not only the first: after a restart the list of the church's + products is fresh at once. + ## [1.7.0] - 2026-11-24 Needs contracts 1.17.0. The first part of the Church Website 1.0.0 (WEBSITE-1.0-PLAN §11). diff --git a/apps/accounts/WHATS-NEW.md b/apps/accounts/WHATS-NEW.md index 8d49983..7ca7bba 100644 --- a/apps/accounts/WHATS-NEW.md +++ b/apps/accounts/WHATS-NEW.md @@ -3,6 +3,11 @@ What each version changes for the church, in plain language (read by the Hub like Cross Events' WHATS-NEW.md; a section shows once its version is tagged). +## 1.7.1 + +- **New sites connect to your sign-in straight away.** A Church Website or Cross Events installed + for your church can be signed in to within moments, instead of after up to half an hour. + ## 1.7.0 - **Choose your church's fonts and corners.** Admin → Church profile → **Brand style** has 8 font diff --git a/apps/accounts/backend/package.json b/apps/accounts/backend/package.json index 02fdda1..fd377dd 100644 --- a/apps/accounts/backend/package.json +++ b/apps/accounts/backend/package.json @@ -1,6 +1,6 @@ { "name": "@crosscode/accounts-backend", - "version": "1.7.0", + "version": "1.7.1", "description": "Cross Code Accounts: the church's sign-in (OpenID Connect provider), account pages API and admin API", "private": true, "type": "module", diff --git a/apps/accounts/backend/src/index.ts b/apps/accounts/backend/src/index.ts index 9c71b40..95d80b7 100644 --- a/apps/accounts/backend/src/index.ts +++ b/apps/accounts/backend/src/index.ts @@ -23,8 +23,10 @@ async function main() { const server = app.listen(config.port, () => console.log(`[accounts] Listening on ${config.port} (${config.publicUrl}).`)); const stopJobs = await startJobs(ctx, url); + // 1.7.1: a heartbeat on every start, not only the first (as the Website), so the list of the + // church's products is fresh after a restart. connectFromEnv(ctx).then((r) => { - if (r.connected) heartbeat(ctx).catch(() => {}); + if (r.connected || r.reason === 'already') heartbeat(ctx).catch(() => {}); }).catch(() => {}); const stop = async () => { diff --git a/apps/accounts/backend/src/links/connect.ts b/apps/accounts/backend/src/links/connect.ts index f437b70..cabfbcf 100644 --- a/apps/accounts/backend/src/links/connect.ts +++ b/apps/accounts/backend/src/links/connect.ts @@ -11,6 +11,7 @@ import { import { newLinkNonce, newLinkSecret, signLink, verifyLink } from '@crosscode/contracts/signing'; import type { Request } from 'express'; import type { Ctx } from '../context.js'; +import { heartbeat } from '../hub/client.js'; import { audit, clientIp } from '../lib/audit.js'; import { callSibling, LinkCallError, siblingUrl } from './http.js'; import { keyPair, listedProduct } from './store.js'; @@ -24,6 +25,29 @@ export class LinkError extends Error { /** Products that sign people in through Accounts. */ const CLIENT_PRODUCTS = new Set(['events', 'website', 'app']); const NONCE_KEEP_MS = 60 * 60 * 1000; +const REFRESH_EVERY_MS = 60 * 1000; + +const refreshes = new WeakMap }>(); + +/** + * 1.7.1: the install as the Hub listed it. If the cached list doesn't have it yet (it was installed + * after Accounts' last heartbeat), Accounts asks the Hub for a fresh list with a heartbeat and looks + * again, so a new Website links straight away instead of up to 30 minutes later. There's at most + * one such heartbeat a minute, so a message from an unknown install can't make Accounts call the Hub + * more often than that. + */ +async function listedOrRefreshed(ctx: Ctx, installId: string) { + const found = await listedProduct(ctx, installId); + if (found) return found; + const now = ctx.now().getTime(); + let r = refreshes.get(ctx); + if (!r || now - r.at >= REFRESH_EVERY_MS) { + r = { at: now, run: heartbeat(ctx).catch((e) => console.warn('[links] Asking the Hub for a fresh list failed:', (e as Error).message)) }; + refreshes.set(ctx, r); + } + await r.run; + return listedProduct(ctx, installId); +} async function self(ctx: Ctx) { const installId = await ctx.settings.get('hub_install_id'); @@ -55,8 +79,8 @@ const logLink = (ctx: Ctx, action: string, link: { installId: string; product: s audit(ctx, { actorId: actor?.id ?? null, actorRole: actor?.role ?? 'linked_product', action, targetType: 'product_link', targetId: link.installId, metadata: { product: link.product, by }, ip: clientIp(req) }); export async function connectTo(ctx: Ctx, installId: string, actor: { id: string; role: string }, req?: Request) { - const sibling = await listedProduct(ctx, installId); - if (!sibling || !CLIENT_PRODUCTS.has(sibling.product)) throw new LinkError('That product isn\'t in the list the Hub gave Accounts. Wait for the next Hub heartbeat (up to 15 minutes).', 'NOT_LINKED', 404); + const sibling = await listedOrRefreshed(ctx, installId); + if (!sibling || !CLIENT_PRODUCTS.has(sibling.product)) throw new LinkError('The Hub doesn\'t list that product for this church.', 'NOT_LINKED', 404); const me = await self(ctx); const secret = newLinkSecret(); const message = signLink>({ @@ -86,9 +110,9 @@ export async function acceptConnect(ctx: Ctx, body: unknown, req?: Request): Pro const m = parsed.data; const me = await self(ctx); if (m.to.installId !== me.installId) throw new LinkError('That message is for another install.', 'WRONG_INSTALL', 400); - const sibling = await listedProduct(ctx, m.from.installId); + const sibling = await listedOrRefreshed(ctx, m.from.installId); if (!sibling || sibling.product !== m.from.product || !CLIENT_PRODUCTS.has(sibling.product)) { - throw new LinkError('Accounts doesn\'t know that install yet: the Hub lists the church\'s products in its next heartbeat (up to 15 minutes).', 'NOT_LINKED', 403); + throw new LinkError('The Hub doesn\'t list that install for this church (Accounts asks it again at most once a minute).', 'NOT_LINKED', 403); } const check = verifyLink(m as unknown as Record, sibling.publicKey, { now: ctx.now() }); if (!check.ok) throw new LinkError(check.code === 'STALE_REQUEST' ? 'The message is too old, or a clock is wrong.' : 'The signature doesn\'t match the key the Hub listed.', check.code, 401); diff --git a/apps/accounts/backend/tests/products.test.ts b/apps/accounts/backend/tests/products.test.ts index 16c1aa5..0ec7445 100644 --- a/apps/accounts/backend/tests/products.test.ts +++ b/apps/accounts/backend/tests/products.test.ts @@ -2,6 +2,8 @@ // signed back-channel calls, deletion with a product that says "not yet", "download my data", the // church profile, Connect, and admin and setup rules. import assert from 'node:assert/strict'; +import http from 'node:http'; +import type { AddressInfo } from 'node:net'; import { after, before, beforeEach, describe, test } from 'node:test'; import { churchSchema, IDENTITY_SCHEMA, LINK_SCHEMA, OIDC_CLIENT_PATHS } from '@crosscode/contracts'; import { generateEd25519, ed25519PublicToPem, newLinkNonce, newLinkSecret, signLink } from '@crosscode/contracts/signing'; @@ -156,6 +158,44 @@ describe('Connect from a product', () => { const client = await h.provider.Client.find(APP_ID); assert.deepEqual(client?.redirectUris, ['http://127.0.0.1:7/api/auth/callback']); }); + + test('1.7.1: a product installed after the last heartbeat is found in a fresh list from the Hub, at most once a minute', async () => { + let clock = new Date('2026-11-26T15:00:00Z'); + const own = await startHarness({ now: () => clock }); + const appKey = generateEd25519(); + const NEW_ID = '5c1d7e2f-8a3b-4c4d-9e5f-6a7b8c9d0e1f'; + const listed = { product: 'website', installId: NEW_ID, url: 'http://127.0.0.1:7', publicKey: ed25519PublicToPem(appKey.publicKey) }; + // A Hub whose list has the new Website; Accounts' cached list doesn't yet. + const hubCalls: string[] = []; + const hub = http.createServer((req, res) => { + hubCalls.push(String(req.url)); + res.setHeader('content-type', 'application/json'); + res.end(JSON.stringify({ ok: true, licence: '', linkedProducts: [listed] })); + }); + await new Promise((r) => hub.listen(0, '127.0.0.1', () => r())); + try { + own.ctx.config.hubUrl = `http://127.0.0.1:${(hub.address() as AddressInfo).port}`; + await own.ctx.settings.setMany({ hub_install_secret: 'secret', hub_linked_products: '[]' }); + const msg = (installId: string) => signLink({ schema: LINK_SCHEMA, type: 'link.connect', from: { product: 'website', installId, url: 'http://127.0.0.1:7' }, to: { installId: ACCOUNTS_ID }, secret: newLinkSecret(), issuedAt: clock.toISOString(), nonce: newLinkNonce() }, appKey.privateKeyPem); + const send = (installId: string) => fetch(`${own.publicUrl}/api/links/v1/connect`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(msg(installId)) }); + + assert.equal((await send(NEW_ID)).status, 200, 'linked at once'); + assert.deepEqual(hubCalls, ['/api/installs/heartbeat']); + assert.equal(await own.db.productLink.count({ where: { installId: NEW_ID } }), 1); + + // An install the Hub doesn't list: refused, and within the minute the Hub isn't asked again. + const UNKNOWN = '7e3f9a4b-0c5d-4e6f-8a7b-9c0d1e2f3a4b'; + assert.equal((await send(UNKNOWN)).status, 403); + assert.equal((await send(UNKNOWN)).status, 403); + assert.equal(hubCalls.length, 1); + clock = new Date(clock.getTime() + 61_000); + assert.equal((await send(UNKNOWN)).status, 403); + assert.equal(hubCalls.length, 2); + } finally { + await new Promise((r) => hub.close(r)); + await own.close(); + } + }); }); describe('admin and setup', () => { diff --git a/apps/accounts/frontend/package.json b/apps/accounts/frontend/package.json index a026e85..2d90f21 100644 --- a/apps/accounts/frontend/package.json +++ b/apps/accounts/frontend/package.json @@ -1,6 +1,6 @@ { "name": "@crosscode/accounts-frontend", - "version": "1.7.0", + "version": "1.7.1", "private": true, "description": "Cross Code Accounts: the church's sign-in pages, the account page and admin", "scripts": { diff --git a/apps/events/CHANGELOG.md b/apps/events/CHANGELOG.md index b5a2f18..8730d73 100644 --- a/apps/events/CHANGELOG.md +++ b/apps/events/CHANGELOG.md @@ -5,6 +5,19 @@ All notable changes to this project are documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project follows [Semantic Versioning](https://semver.org/). +## [3.7.1] - 2026-11-26 + +No migrations, no new settings. + +### Fixed + +- **A product installed after this site's last heartbeat can connect straight away.** A connect + (in either direction) was refused while the other install wasn't in the cached copy of the Hub's + list, refreshed every 15 minutes. So a new Church Website couldn't connect for the event feed + until then. Now, for an install it doesn't know, the site sends the Hub a heartbeat to get a fresh + list and looks again (at most one such heartbeat a minute, so unknown installs can't make it call + the Hub more often). Same change as Accounts 1.7.1 and Website 1.0.2. + ## [3.7.0] - 2026-11-24 The church's look from its Accounts (docs/WEBSITE-1.0-PLAN.md §9). **Requires Accounts 1.7.0** diff --git a/apps/events/WHATS-NEW.md b/apps/events/WHATS-NEW.md index 3d15236..afd2503 100644 --- a/apps/events/WHATS-NEW.md +++ b/apps/events/WHATS-NEW.md @@ -12,6 +12,11 @@ Write for church admins, not developers: no environment variables, endpoints or developer log is CHANGELOG.md. A tagged version without a section here shows "No details given". --> +## 3.7.1 + +- **Connecting to your new Church Website works straight away**, so its events page can show your + Cross Events events as soon as it's installed, instead of after up to 15 minutes. + ## 3.7.0 — requires accounts 1.7.0 - **Your public pages look like the rest of your church's sites.** With sign-in through your diff --git a/apps/events/backend/package.json b/apps/events/backend/package.json index 7d7ffb2..48143c0 100644 --- a/apps/events/backend/package.json +++ b/apps/events/backend/package.json @@ -1,6 +1,6 @@ { "name": "@crosscode/events-backend", - "version": "3.7.0", + "version": "3.7.1", "description": "Event Management System Backend", "main": "src/index.js", "scripts": { diff --git a/apps/events/backend/src/links/connect.ts b/apps/events/backend/src/links/connect.ts index bdb7145..08e1b59 100644 --- a/apps/events/backend/src/links/connect.ts +++ b/apps/events/backend/src/links/connect.ts @@ -35,6 +35,34 @@ export class LinkError extends Error { } const NONCE_KEEP_MS = 60 * 60 * 1000; +const REFRESH_EVERY_MS = 60 * 1000; + +let refresh: { at: number; run: Promise } | null = null; + +/** For tests. */ +export function forgetRefresh(): void { + refresh = null; +} + +/** + * 3.7.1: the install as the Hub listed it. If the cached list doesn't have it yet (it was installed + * after this site's last heartbeat, like a new Church Website), the site asks the Hub for a fresh + * list with a heartbeat and looks again, instead of refusing for up to 15 minutes. There's at most + * one such heartbeat a minute, so a message from an unknown install can't make this site call the + * Hub more often than that. + */ +async function listedOrRefreshed(installId: string, now: Date) { + const found = await listedProduct(installId); + if (found) return found; + if (!refresh || now.getTime() - refresh.at >= REFRESH_EVERY_MS) { + // eslint-disable-next-line @typescript-eslint/no-require-imports -- CommonJS, and hub/client.js needs this module's siblings + const run = Promise.resolve().then(() => require('../hub/client').heartbeat()) + .catch((e: Error) => console.warn('[links] Asking the Hub for a fresh list failed:', e?.message || e)); + refresh = { at: now.getTime(), run }; + } + await refresh.run; + return listedProduct(installId); +} type Self = { installId: string; url: string; privateKeyPem: string }; @@ -81,8 +109,8 @@ async function saveLink(sibling: hub.LinkedProduct, secret: string, connectedByI // ─── This site connects (an admin clicked Connect) ───────────────────────────── export async function connectTo(installId: string, actor: { id: string | null; role: string }, ip: string | null, now = new Date()) { - const sibling = await listedProduct(installId); - if (!sibling) throw new LinkError('That product isn\'t in the list the Hub gave this site. Wait for the next Hub heartbeat (up to 15 minutes).', 'NOT_LINKED', 404); + const sibling = await listedOrRefreshed(installId, now); + if (!sibling) throw new LinkError('The Hub doesn\'t list that product for this church.', 'NOT_LINKED', 404); const me = await self(); const secret = newLinkSecret(); const message = signLink>({ @@ -123,9 +151,9 @@ export async function acceptConnect(body: unknown, ip: string | null, now = new const m = parsed.data; const me = await self(); if (m.to.installId !== me.installId) throw new LinkError('That message is for another install.', 'WRONG_INSTALL', 400); - const sibling = await listedProduct(m.from.installId); + const sibling = await listedOrRefreshed(m.from.installId, now); if (!sibling || sibling.product !== m.from.product) { - throw new LinkError('This site doesn\'t know that install yet: the Hub lists the church\'s products in its next heartbeat (up to 15 minutes).', 'NOT_LINKED', 403); + throw new LinkError('The Hub doesn\'t list that install for this church (this site asks it again at most once a minute).', 'NOT_LINKED', 403); } const check = verifyLink(m as unknown as Record, sibling.publicKey, { now }); if (!check.ok) throw new LinkError(check.code === 'STALE_REQUEST' ? 'The message is too old, or a clock is wrong.' : 'The signature doesn\'t match the key the Hub listed.', check.code, 401); diff --git a/apps/events/backend/tests/linkedProducts.test.js b/apps/events/backend/tests/linkedProducts.test.js index 28e2a7f..1c7dbe4 100644 --- a/apps/events/backend/tests/linkedProducts.test.js +++ b/apps/events/backend/tests/linkedProducts.test.js @@ -87,6 +87,7 @@ const pem = (k) => signing.ed25519PublicToPem(k.publicKey); async function setUpSite({ linked = true } = {}) { db.reset(); store.forgetKeyPair(); + connect.forgetRefresh(); db.t.appSetting.set('hub_install_id', { key: 'hub_install_id', value: EVENTS_ID }); db.t.appSetting.set('hub_private_key', { key: 'hub_private_key', value: encrypt(keys.events.privateKeyPem) }); db.t.appSetting.set('hub_public_key', { key: 'hub_public_key', value: pem(keys.events) }); @@ -286,6 +287,29 @@ describe('Connect from a linked product', () => { await expect(connect.acceptConnect(m, null)).rejects.toMatchObject({ code: 'REPLAYED' }); }); + test('3.7.1: a product installed after the last heartbeat is found in a fresh list from the Hub, at most once a minute', async () => { + await store.saveLinkedProducts([]); + const hubClient = require('../src/hub/client'); + let listed = [{ product: 'website', installId: WEBSITE_ID, url: WEBSITE_URL, publicKey: pem(keys.website) }]; + const spy = jest.spyOn(hubClient, 'heartbeat').mockImplementation(async () => { await store.saveLinkedProducts(listed); return { ok: true }; }); + try { + await connect.acceptConnect(connectMessage(), null, new Date()); + expect(spy).toHaveBeenCalledTimes(1); + expect(db.t.productLink.get(WEBSITE_ID)).toMatchObject({ product: 'website' }); + + // An install the Hub doesn't list: refused, and the Hub isn't asked again within the minute. + listed = []; + await store.saveLinkedProducts([]); + const t = new Date(); + await expect(connect.acceptConnect(connectMessage(), null, t)).rejects.toMatchObject({ code: 'NOT_LINKED' }); + expect(spy).toHaveBeenCalledTimes(1); + await expect(connect.acceptConnect(connectMessage(), null, new Date(t.getTime() + 61_000))).rejects.toMatchObject({ code: 'NOT_LINKED' }); + expect(spy).toHaveBeenCalledTimes(2); + } finally { + spy.mockRestore(); + } + }); + test('disconnect from the sibling removes the link and its events; a forged one doesn\'t', async () => { await connect.acceptConnect(connectMessage(), null); db.t.importedEvent.set('website:x', { key: 'website:x', linkId: WEBSITE_ID }); diff --git a/apps/events/frontend/package.json b/apps/events/frontend/package.json index 3f17c27..5d02bea 100644 --- a/apps/events/frontend/package.json +++ b/apps/events/frontend/package.json @@ -1,6 +1,6 @@ { "name": "@crosscode/events-frontend", - "version": "3.7.0", + "version": "3.7.1", "private": true, "scripts": { "dev": "next dev", diff --git a/apps/events/package.json b/apps/events/package.json index 4100c54..ad8fc5e 100644 --- a/apps/events/package.json +++ b/apps/events/package.json @@ -1,6 +1,6 @@ { "name": "@crosscode/events", - "version": "3.7.0", + "version": "3.7.1", "main": "index.js", "scripts": { "dev:backend": "cd backend && npm run dev", diff --git a/apps/website/CHANGELOG.md b/apps/website/CHANGELOG.md index bec7693..ad2e5db 100644 --- a/apps/website/CHANGELOG.md +++ b/apps/website/CHANGELOG.md @@ -1,5 +1,29 @@ # Changelog — Church Website +## [1.0.2] — 2026-11-26 + +No migration, no new settings. Works with Accounts 1.7.0; with Accounts 1.7.1 the first sign-in +after an install links at once. + +### Fixed + +- **Preview sent admins to the server's own address** (`http://localhost:`, found on + cross-demo2). `/preview/start`, `/preview/exit` and shared preview links redirected to + `new URL(path, request.url)`, and behind the proxy `request.url` is the address Next.js is reached + on. They now answer with a relative `Location` (`src/lib/localRedirect.ts`), so the browser stays + on the site's address. +- **The admin couldn't be signed in to for up to 30 minutes after an install.** The Website links + itself to the church's Accounts, but only at a heartbeat, and Accounts refused it until Accounts' + own next heartbeat. Now opening `/admin` without a link links on the spot (asking the Hub for a + fresh list first when it has no Accounts in it; tried at most every 15 seconds). A connect + involving an install that isn't in the cached list yet (Accounts, or Events for the event feed) + also asks the Hub for a fresh list (at most once a minute) instead of refusing. Only one connect to + Accounts runs at a time, so a heartbeat and a sign-in can't leave the two sides with different + secrets. +- **The sign-in problem page says when the site isn't linked yet** (`ACCOUNTS_NOT_LINKED`: "This + website isn't linked to your church's sign-in yet"), instead of "can't reach your church's + sign-in", which read like an outage. + ## [1.0.1] — 2026-11-26 ### Fixed diff --git a/apps/website/WHATS-NEW.md b/apps/website/WHATS-NEW.md index 80bb914..7ae0143 100644 --- a/apps/website/WHATS-NEW.md +++ b/apps/website/WHATS-NEW.md @@ -3,6 +3,13 @@ What each version changes for the church, in plain language (read by the Hub like Cross Events' WHATS-NEW.md; a section shows once its version is tagged). +## 1.0.2 + +- **Preview works:** pressing Preview in the admin shows your site with your changes, instead of + an error page. +- **Signing in right after your website is installed** works straight away, instead of after up to + half an hour. If it isn't connected to your church's sign-in yet, the page now says so. + ## 1.0.1 - **Your visitors' privacy:** the pictures on your messages now come from your own website, so diff --git a/apps/website/backend/package.json b/apps/website/backend/package.json index 7c0cba7..baf610a 100644 --- a/apps/website/backend/package.json +++ b/apps/website/backend/package.json @@ -1,6 +1,6 @@ { "name": "@crosscode/website-backend", - "version": "1.0.1", + "version": "1.0.2", "description": "Church Website: the public site's content API, the admin API, publishing and uploads", "private": true, "type": "module", diff --git a/apps/website/backend/src/auth/accounts.ts b/apps/website/backend/src/auth/accounts.ts index 3b5fc1b..2a513e3 100644 --- a/apps/website/backend/src/auth/accounts.ts +++ b/apps/website/backend/src/auth/accounts.ts @@ -8,13 +8,15 @@ import type * as AuthClient from '@crosscode/auth-client'; import type { AccountsClient } from '@crosscode/auth-client'; import type { Ctx } from '../context.js'; import { ApiError } from '../http.js'; +import { linkAccountsNow } from '../links/connect.js'; export type AuthClientModule = typeof AuthClient; export const loadAuthClient = (): Promise => import('@crosscode/auth-client'); export class AccountsUnavailable extends ApiError { - constructor(message: string) { + /** 1.0.2: `not_linked` (no link to Accounts yet) or `unreachable` (linked, but it didn't answer). */ + constructor(message: string, public reason: 'not_linked' | 'unreachable' = 'unreachable') { super(503, 'ACCOUNTS_UNAVAILABLE', message); } } @@ -28,10 +30,15 @@ const cache = new WeakMap }> /** The client for the church's Accounts (discovery done once per link). Throws AccountsUnavailable. */ export async function accounts(ctx: Ctx): Promise { - const link = await accountsLink(ctx); - if (!link) throw new AccountsUnavailable('The Website isn\'t linked to the church\'s Accounts yet. It links by itself within 15 minutes of being installed.'); + let link = await accountsLink(ctx); + if (!link) { + // 1.0.2: link now rather than wait for the next heartbeat. + await linkAccountsNow(ctx); + link = await accountsLink(ctx); + } + if (!link) throw new AccountsUnavailable('The Website isn\'t linked to the church\'s Accounts yet.', 'not_linked'); const clientId = await ctx.settings.get('hub_install_id'); - if (!clientId) throw new AccountsUnavailable('The Website isn\'t connected to the Hub yet.'); + if (!clientId) throw new AccountsUnavailable('The Website isn\'t connected to the Hub yet.', 'not_linked'); const key = `${link.installId}|${link.updatedAt.getTime()}|${clientId}|${ctx.config.publicUrl}`; let hit = cache.get(ctx); if (!hit || hit.key !== key) { diff --git a/apps/website/backend/src/auth/routes.ts b/apps/website/backend/src/auth/routes.ts index 892ac36..40cc882 100644 --- a/apps/website/backend/src/auth/routes.ts +++ b/apps/website/backend/src/auth/routes.ts @@ -34,6 +34,9 @@ const page = (ctx: Ctx, path: string) => `${ctx.config.publicUrl}${path}`; const problem = (ctx: Ctx, res: Response, code: string, returnTo = '/admin') => res.redirect(303, page(ctx, `/auth/problem?code=${encodeURIComponent(code)}&returnTo=${encodeURIComponent(safeReturnPath(returnTo))}`)); +/** 1.0.2: the problem page says which it is: not linked to Accounts yet, or Accounts not answering. */ +const unavailableCode = (e: AccountsUnavailable) => (e.reason === 'not_linked' ? 'ACCOUNTS_NOT_LINKED' : 'ACCOUNTS_UNAVAILABLE'); + type UserRow = { id: string; name: string; email: string; role: WebsiteRole }; /** @@ -70,7 +73,7 @@ export function authRouter(ctx: Ctx) { else res.clearCookie(MFA_COOKIE, cookieOptions(ctx, COOKIE_PATH)); return res.redirect(303, url); } catch (e) { - if (e instanceof AccountsUnavailable) return problem(ctx, res, 'ACCOUNTS_UNAVAILABLE', returnTo); + if (e instanceof AccountsUnavailable) return problem(ctx, res, unavailableCode(e), returnTo); console.error('[auth] Starting a sign-in failed:', e); return problem(ctx, res, 'SIGNIN_FAILED', returnTo); } @@ -86,7 +89,7 @@ export function authRouter(ctx: Ctx) { const auth = await accounts(ctx); result = await auth.finishSignIn(new URL(req.originalUrl, ctx.config.publicUrl), cookies[PENDING_COOKIE]); } catch (e) { - if (e instanceof AccountsUnavailable) return problem(ctx, res, 'ACCOUNTS_UNAVAILABLE'); + if (e instanceof AccountsUnavailable) return problem(ctx, res, unavailableCode(e)); const code = (e as { code?: string }).code; // The person pressed Cancel at Accounts, or the pending cookie expired. if (req.query.error === 'access_denied') return res.redirect(303, page(ctx, '/')); diff --git a/apps/website/backend/src/links/connect.ts b/apps/website/backend/src/links/connect.ts index ef9afb9..a576c57 100644 --- a/apps/website/backend/src/links/connect.ts +++ b/apps/website/backend/src/links/connect.ts @@ -27,6 +27,37 @@ export class LinkError extends Error { /** The products the Website links to. */ const LINKABLE = new Set(['accounts', 'events', 'app']); const NONCE_KEEP_MS = 60 * 60 * 1000; +const REFRESH_EVERY_MS = 60 * 1000; +const SIGN_IN_TRY_EVERY_MS = 15 * 1000; + +const refreshes = new WeakMap }>(); + +/** + * 1.0.2: a fresh list of the church's products from the Hub (a heartbeat), at most once a minute, + * so a message from an unknown install can't make the Website call the Hub more often than that. + * Several callers inside that minute share one heartbeat. Never throws. + */ +async function refreshList(ctx: Ctx): Promise { + const now = ctx.now().getTime(); + let r = refreshes.get(ctx); + if (!r || now - r.at >= REFRESH_EVERY_MS) { + // Imported here: hub/client.ts imports this file (it links to Accounts after each heartbeat). + r = { at: now, run: import('../hub/client.js').then((m) => m.heartbeat(ctx)).catch((e) => console.warn('[links] Asking the Hub for a fresh list failed:', (e as Error).message)) }; + refreshes.set(ctx, r); + } + await r.run; +} + +/** + * 1.0.2: the install as the Hub listed it. If the cached list doesn't have it yet (it was installed + * after this site's last heartbeat), the Website asks the Hub for a fresh list and looks again. + */ +async function listedOrRefreshed(ctx: Ctx, installId: string) { + const found = await listedProduct(ctx, installId); + if (found) return found; + await refreshList(ctx); + return listedProduct(ctx, installId); +} type Actor = { id: string | null; role: string }; @@ -61,8 +92,8 @@ const logLink = (ctx: Ctx, action: string, link: { installId: string; product: s /** This site connects (an admin pressed Connect, or the automatic connect to Accounts below). */ export async function connectTo(ctx: Ctx, installId: string, actor: Actor, req?: Request) { - const sibling = await listedProduct(ctx, installId); - if (!sibling || !LINKABLE.has(sibling.product)) throw new LinkError('That product isn\'t in the list the Hub gave this site. Wait for the next Hub heartbeat (up to 15 minutes).', 'NOT_LINKED', 404); + const sibling = await listedOrRefreshed(ctx, installId); + if (!sibling || !LINKABLE.has(sibling.product)) throw new LinkError('The Hub doesn\'t list that product for this church.', 'NOT_LINKED', 404); const me = await self(ctx); const secret = newLinkSecret(); const message = signLink>({ @@ -93,9 +124,9 @@ export async function acceptConnect(ctx: Ctx, body: unknown, req?: Request): Pro const m = parsed.data; const me = await self(ctx); if (m.to.installId !== me.installId) throw new LinkError('That message is for another install.', 'WRONG_INSTALL', 400); - const sibling = await listedProduct(ctx, m.from.installId); + const sibling = await listedOrRefreshed(ctx, m.from.installId); if (!sibling || sibling.product !== m.from.product || !LINKABLE.has(sibling.product)) { - throw new LinkError('This site doesn\'t know that install yet: the Hub lists the church\'s products in its next heartbeat (up to 15 minutes).', 'NOT_LINKED', 403); + throw new LinkError('The Hub doesn\'t list that install for this church (the Website asks it again at most once a minute).', 'NOT_LINKED', 403); } const check = verifyLink(m as unknown as Record, sibling.publicKey, { now: ctx.now() }); if (!check.ok) throw new LinkError(check.code === 'STALE_REQUEST' ? 'The message is too old, or a clock is wrong.' : 'The signature doesn\'t match the key the Hub listed.', check.code, 401); @@ -146,7 +177,20 @@ export async function acceptDisconnect(ctx: Ctx, body: unknown, req?: Request): * Hub lists one and nothing is linked yet (as Events 3.x's autoConnect). Run after each heartbeat. * Never throws: a failure is tried again at the next heartbeat. */ -export async function connectAccountsIfListed(ctx: Ctx): Promise<'connected' | 'skipped' | 'failed'> { +export function connectAccountsIfListed(ctx: Ctx): Promise<'connected' | 'skipped' | 'failed'> { + // 1.0.2: one connect at a time (a heartbeat and a sign-in can both try): two at once would each + // send Accounts a different secret, and the one each side kept last might not be the same. + let run = connecting.get(ctx); + if (!run) { + run = connectAccountsOnce(ctx).finally(() => connecting.delete(ctx)); + connecting.set(ctx, run); + } + return run; +} + +const connecting = new WeakMap>(); + +async function connectAccountsOnce(ctx: Ctx): Promise<'connected' | 'skipped' | 'failed'> { if (await ctx.db.productLink.findFirst({ where: { product: 'accounts' } })) return 'skipped'; const listed = (await linkedProducts(ctx)).find((p) => p.product === 'accounts'); if (!listed) return 'skipped'; @@ -158,3 +202,21 @@ export async function connectAccountsIfListed(ctx: Ctx): Promise<'connected' | ' return 'failed'; } } + +const signInTries = new WeakMap(); + +/** + * 1.0.2: someone wants to sign in and there's no link to Accounts yet: link now instead of waiting + * for the next heartbeat. If the cached list has no Accounts, the Hub is asked for a fresh one first + * (which links by itself when it lists one). Tried at most every 15 seconds, so visitors opening + * /admin can't make the Website call Accounts or the Hub more often than that. + */ +export async function linkAccountsNow(ctx: Ctx): Promise { + if (await ctx.db.productLink.findFirst({ where: { product: 'accounts' } })) return; + const now = ctx.now().getTime(); + const last = signInTries.get(ctx); + if (last !== undefined && now - last < SIGN_IN_TRY_EVERY_MS) return; + signInTries.set(ctx, now); + if (!(await linkedProducts(ctx)).some((p) => p.product === 'accounts')) await refreshList(ctx); + await connectAccountsIfListed(ctx); +} diff --git a/apps/website/backend/tests/links.test.ts b/apps/website/backend/tests/links.test.ts index d93ebda..75804e0 100644 --- a/apps/website/backend/tests/links.test.ts +++ b/apps/website/backend/tests/links.test.ts @@ -10,7 +10,7 @@ import { buildExport } from '../src/export/churchExport.js'; import { stats } from '../src/hub/client.js'; import { connectAccountsIfListed } from '../src/links/connect.js'; import { keyPair, saveLinkedProducts } from '../src/links/store.js'; -import { ACCOUNTS_INSTALL_ID, harness, INSTALL_ID } from './support/harness.js'; +import { ACCOUNTS_INSTALL_ID, harness, INSTALL_ID, SITE } from './support/harness.js'; const accountsKeys = generateEd25519(); const accountsPublic = ed25519PublicToPem(accountsKeys.publicKey); @@ -88,6 +88,72 @@ describe('linking to the church\'s Accounts', () => { }); }); +/** A Hub answering heartbeats with `list` as the church's products (only what the Website reads). */ +async function fakeHub(list: () => unknown[]) { + const calls: string[] = []; + const server = http.createServer((req, res) => { + calls.push(String(req.url)); + res.setHeader('content-type', 'application/json'); + res.end(JSON.stringify({ ok: true, licence: '', linkedProducts: list() })); + }); + await new Promise((r) => server.listen(0, '127.0.0.1', () => r())); + const url = `http://127.0.0.1:${(server.address() as AddressInfo).port}`; + closers.push(() => new Promise((r) => server.close(r))); + return { url, calls }; +} + +describe('1.0.2: linking right after an install', () => { + it('links to Accounts when someone opens /admin, asking the Hub for a fresh list first', async () => { + let accountsUrl = ''; + const hubServer = await fakeHub(() => [{ product: 'accounts', installId: ACCOUNTS_INSTALL_ID, url: accountsUrl, publicKey: accountsPublic }]); + const h = await harness({ linked: false, env: { LINKS_ALLOW_PRIVATE: 'true', HUB_URL: hubServer.url } }); + await h.ctx.settings.set('hub_install_secret', 'secret'); + const accounts = await fakeAccounts(async () => (await keyPair(h.ctx)).publicKeyPem); + closers.push(accounts.close); + accountsUrl = accounts.url; + + // The Website's cached list has no Accounts yet (it registered before the Hub knew of one). + const res = await request(h.app).get('/api/auth/signin?returnTo=%2Fadmin'); + assert.equal(res.status, 303); + assert.match(res.headers.location!, /^https:\/\/accounts\.hope\.test\//, 'off to Accounts, not the problem page'); + assert.deepEqual(hubServer.calls, ['/api/installs/heartbeat']); + assert.equal(accounts.seen.length, 1, 'one connect, not one from the heartbeat and another from the sign-in'); + assert.equal(await h.db.productLink.count({ where: { product: 'accounts' } }), 1); + }); + + it('tries again at most every 15 seconds while it can\'t link', async () => { + let clock = new Date('2026-11-26T15:00:00Z'); + const hubServer = await fakeHub(() => []); + const h = await harness({ linked: false, env: { HUB_URL: hubServer.url } }); + h.ctx.now = () => clock; + await h.ctx.settings.set('hub_install_secret', 'secret'); + const problem = `${SITE}/auth/problem?code=ACCOUNTS_NOT_LINKED&returnTo=%2Fadmin`; + assert.equal((await request(h.app).get('/api/auth/signin?returnTo=%2Fadmin')).headers.location, problem); + assert.equal((await request(h.app).get('/api/auth/signin?returnTo=%2Fadmin')).headers.location, problem); + assert.equal(hubServer.calls.length, 1); + clock = new Date(clock.getTime() + 61_000); + await request(h.app).get('/api/auth/signin?returnTo=%2Fadmin'); + assert.equal(hubServer.calls.length, 2); + }); + + it('accepts a connect from a product installed after its last heartbeat (Events, for the event feed)', async () => { + const EVENTS_INSTALL_ID = '4d2e8f3a-9b1c-4d0e-8f7a-6b5c4d3e2f1a'; + const eventsKeys = generateEd25519(); + const events = { product: 'events', installId: EVENTS_INSTALL_ID, url: 'https://events.hope.test', publicKey: ed25519PublicToPem(eventsKeys.publicKey) }; + const hubServer = await fakeHub(() => [events]); + const h = await harness({ env: { HUB_URL: hubServer.url } }); + await h.ctx.settings.set('hub_install_secret', 'secret'); + const m = signLink({ + schema: LINK_SCHEMA, type: 'link.connect', from: { product: 'events', installId: EVENTS_INSTALL_ID, url: events.url }, + to: { installId: INSTALL_ID }, secret: newLinkSecret(), issuedAt: new Date().toISOString(), nonce: newLinkNonce(), + }, eventsKeys.privateKeyPem); + const res = await request(h.app).post('/api/links/v1/connect').send(m); + assert.equal(res.status, 200, JSON.stringify(res.body)); + assert.equal(hubServer.calls.length, 1); + assert.equal(await h.db.productLink.count({ where: { product: 'events' } }), 1); + }); +}); + describe('the heartbeat and the export', () => { it('reports aggregate counts the Hub accepts', async () => { const h = await harness(); diff --git a/apps/website/backend/tests/signin.test.ts b/apps/website/backend/tests/signin.test.ts index 0468d30..d025260 100644 --- a/apps/website/backend/tests/signin.test.ts +++ b/apps/website/backend/tests/signin.test.ts @@ -35,7 +35,7 @@ describe('signing in to the admin through Accounts', () => { const h = await harness({ linked: false }); const res = await request(h.app).get('/api/auth/signin?returnTo=%2Fadmin'); assert.equal(res.status, 303); - assert.equal(res.headers.location, `${SITE}/auth/problem?code=ACCOUNTS_UNAVAILABLE&returnTo=%2Fadmin`); + assert.equal(res.headers.location, `${SITE}/auth/problem?code=ACCOUNTS_NOT_LINKED&returnTo=%2Fadmin`); }); it('makes the Hub\'s admin email (verified) the first Owner and lands on the page they started from', async () => { diff --git a/apps/website/frontend/package.json b/apps/website/frontend/package.json index 486f583..5bb56a8 100644 --- a/apps/website/frontend/package.json +++ b/apps/website/frontend/package.json @@ -1,6 +1,6 @@ { "name": "@crosscode/website-frontend", - "version": "1.0.1", + "version": "1.0.2", "private": true, "description": "Church Website: the church's public site in its template, and the admin", "scripts": { diff --git a/apps/website/frontend/src/app/auth/problem/page.tsx b/apps/website/frontend/src/app/auth/problem/page.tsx index 014e5ef..188a4c8 100644 --- a/apps/website/frontend/src/app/auth/problem/page.tsx +++ b/apps/website/frontend/src/app/auth/problem/page.tsx @@ -16,6 +16,11 @@ const PROBLEMS: Record text: "Owners and Admins of this website sign in with a second step. Turn on two-step sign-in in your church account, then try again.", retry: true, }, + ACCOUNTS_NOT_LINKED: { + title: "This website isn't linked to your church's sign-in yet", + text: "It links by itself shortly after it's installed. Please try again in a minute. If this keeps happening, contact Cross Code.", + retry: true, + }, ACCOUNTS_UNAVAILABLE: { title: "Signing in isn't available right now", text: "The website can't reach your church's sign-in at the moment. Please try again in a few minutes.", diff --git a/apps/website/frontend/src/app/preview/[token]/route.ts b/apps/website/frontend/src/app/preview/[token]/route.ts index f2d45ac..60b322d 100644 --- a/apps/website/frontend/src/app/preview/[token]/route.ts +++ b/apps/website/frontend/src/app/preview/[token]/route.ts @@ -1,12 +1,13 @@ -import { NextResponse, type NextRequest } from "next/server"; +import type { NextRequest } from "next/server"; +import { localRedirect } from "@/lib/localRedirect"; /** * A shared preview link (§4): keeps its token in a cookie for the rest of the visit, so every page * shows the working copy. The backend checks the token (7 days, until revoked) on every page. */ -export async function GET(request: NextRequest, { params }: { params: Promise<{ token: string }> }) { +export async function GET(_request: NextRequest, { params }: { params: Promise<{ token: string }> }) { const { token } = await params; - const res = NextResponse.redirect(new URL("/", request.url), 303); + const res = localRedirect("/"); if (/^[A-Za-z0-9_-]{20,100}$/.test(token)) { res.cookies.set("ccw_preview", token, { httpOnly: true, sameSite: "lax", secure: process.env.NODE_ENV === "production", path: "/", maxAge: 7 * 86400 }); } diff --git a/apps/website/frontend/src/app/preview/exit/route.ts b/apps/website/frontend/src/app/preview/exit/route.ts index 6acab3a..d2d3abc 100644 --- a/apps/website/frontend/src/app/preview/exit/route.ts +++ b/apps/website/frontend/src/app/preview/exit/route.ts @@ -1,11 +1,12 @@ -import { NextResponse, type NextRequest } from "next/server"; +import type { NextRequest } from "next/server"; +import { localRedirect } from "@/lib/localRedirect"; /** Leaves the preview: an admin goes back to editing, someone with a shared link to the live site. */ export function GET(request: NextRequest) { const admin = request.cookies.get("ccw_preview")?.value === "admin"; const trying = !!request.cookies.get("ccw_preview_template")?.value; const to = admin ? (request.nextUrl.searchParams.get("published") ? "/admin/publish" : trying ? "/admin/template" : "/admin") : "/"; - const res = NextResponse.redirect(new URL(to, request.url), 303); + const res = localRedirect(to); res.cookies.delete("ccw_preview"); res.cookies.delete("ccw_preview_template"); return res; diff --git a/apps/website/frontend/src/app/preview/start/route.ts b/apps/website/frontend/src/app/preview/start/route.ts index 56874e8..1fad833 100644 --- a/apps/website/frontend/src/app/preview/start/route.ts +++ b/apps/website/frontend/src/app/preview/start/route.ts @@ -1,4 +1,5 @@ -import { NextResponse, type NextRequest } from "next/server"; +import type { NextRequest } from "next/server"; +import { localRedirect } from "@/lib/localRedirect"; /** * Preview (WEBSITE-1.0-PLAN §4): a signed-in admin sees the working copy on the site's own @@ -6,7 +7,7 @@ import { NextResponse, type NextRequest } from "next/server"; * on every page (site/preview), so it shows nothing to anyone else. */ export function GET(request: NextRequest) { - const res = NextResponse.redirect(new URL("/", request.url), 303); + const res = localRedirect("/"); const opts = { httpOnly: true, sameSite: "lax" as const, secure: process.env.NODE_ENV === "production", path: "/" }; res.cookies.set("ccw_preview", "admin", opts); // "Choose your template": the church's own content in another template, nothing saved. diff --git a/apps/website/frontend/src/lib/localRedirect.ts b/apps/website/frontend/src/lib/localRedirect.ts new file mode 100644 index 0000000..553e4f4 --- /dev/null +++ b/apps/website/frontend/src/lib/localRedirect.ts @@ -0,0 +1,11 @@ +import { NextResponse } from "next/server"; + +/** + * 1.0.2: a 303 to a page of this site with a relative Location ("/admin"), so the browser stays on the + * address it's on. `new URL(path, request.url)` used the address the request reached Next.js on, + * which behind the proxy is the server's own (http://localhost:): Preview sent admins there. + */ +export function localRedirect(path: string): NextResponse { + if (!path.startsWith("/") || path.startsWith("//")) throw new Error(`Not a path on this site: ${path}`); + return new NextResponse(null, { status: 303, headers: { Location: path } }); +} diff --git a/docs/VERSIONS.md b/docs/VERSIONS.md index aa74d9d..947e2b2 100644 --- a/docs/VERSIONS.md +++ b/docs/VERSIONS.md @@ -10,9 +10,9 @@ separately below; the two often differ. | What | Repo | Latest | Tag | Released | |------|------|--------|-----|----------| -| Cross Events | `crosscode-platform` (`apps/events`) | **3.7.0** | `events@3.7.0` | 2026-11-24 | -| Church Website | `crosscode-platform` (`apps/website`) | **1.0.1** | `website@1.0.1` | 2026-11-26 | -| Accounts | `crosscode-platform` (`apps/accounts`) | **1.7.0** | `accounts@1.7.0` | 2026-11-24 | +| Cross Events | `crosscode-platform` (`apps/events`) | **3.7.1** | `events@3.7.1` | 2026-11-26 | +| Church Website | `crosscode-platform` (`apps/website`) | **1.0.2** | `website@1.0.2` | 2026-11-26 | +| Accounts | `crosscode-platform` (`apps/accounts`) | **1.7.1** | `accounts@1.7.1` | 2026-11-26 | | Server agent | `crosscode-platform` (`apps/agent`) | **1.5.0** | `agent@1.5.0` | 2026-11-23 | | Contracts | `crosscode-platform` (`packages/contracts`) | **1.18.0** | `contracts@1.18.0` | 2026-11-25 | | Cross Code Hub | `events-hub` | **2.23.1** | `v2.23.1` | 2026-11-26 | @@ -30,7 +30,7 @@ on each run, so merging to `main` and pushing releases it. Its changes are liste | `@crosscode/auth-client` | `packages/auth-client` | 1.1.0 (released with Events 3.0.0 and Accounts 1.1.0) | | `@crosscode/seo` | `packages/seo` | 1.0.0 (released with Events 2.4.0) | | `@crosscode/ui` | `packages/ui` | 0.3.0 (fonts, `ChurchFooter`; 0.2.0 with Accounts 1.7.0, 0.3.0 with Events 3.7.0) | -| Website | `apps/website` | 1.0.1 (1.0.0 and 1.0.1 released 2026-11-26; not installed for a church yet: Hope Family Church first, after Accounts 1.7.0 and Events 3.7.0 are rolled out) | +| Website | `apps/website` | 1.0.2 (1.0.0–1.0.2 released 2026-11-26; installed for the demo church cross-demo2 (1.0.1) only, Hope Family Church next) | | App | `apps/app` | 0.0.0 (not started, phase 6) | These shared packages ship inside the apps that use them, from the same checkout, so they don't @@ -38,6 +38,17 @@ need their own tags until something outside this repo depends on them. ## What each latest release was for +- **Accounts 1.7.1 + Church Website 1.0.2 + Cross Events 3.7.1 (2026-11-26):** found installing + the Website for cross-demo2. All three: a connect involving an install that isn't in the cached + copy of the Hub's list yet asks the Hub for a fresh one (one heartbeat, at most once a minute) + instead of refusing, so a new product links straight away. Before, the new Website's admin + couldn't sign in for up to 30 minutes ("can't reach your church's sign-in"). Accounts also sends a + heartbeat on every start. The Website links on the spot when someone opens `/admin`, its problem + page says "not linked yet" (`ACCOUNTS_NOT_LINKED`), and **Preview no longer redirects to the + server's own `http://localhost:`** (the preview routes built absolute URLs from + `request.url`; now relative). No migrations. Checked: the backend tests (Accounts 80, Website 100, + Events 801), typechecks, the Website's frontend lint and build, the preview redirects against + `next start`, and the Website's e2e suite. **Not deployed yet.** - **Hub 2.23.1 (2026-11-26):** New install reads a church's Accounts version from its heartbeat, not the install record. The record only changed with the Hub's own jobs for that product, so cross-demo2's Accounts, updated alongside Events 3.7.0, still showed 1.6.0 there. New install → diff --git a/package-lock.json b/package-lock.json index 851339c..d3d3f8c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -51,7 +51,7 @@ }, "apps/accounts/backend": { "name": "@crosscode/accounts-backend", - "version": "1.7.0", + "version": "1.7.1", "hasInstallScript": true, "dependencies": { "@crosscode/contracts": "*", @@ -88,7 +88,7 @@ }, "apps/accounts/frontend": { "name": "@crosscode/accounts-frontend", - "version": "1.7.0", + "version": "1.7.1", "dependencies": { "@crosscode/contracts": "*", "@crosscode/ui": "*", @@ -133,7 +133,7 @@ }, "apps/events/backend": { "name": "@crosscode/events-backend", - "version": "3.7.0", + "version": "3.7.1", "hasInstallScript": true, "dependencies": { "@cj-tech-master/excelts": "^10.2.0", @@ -183,7 +183,7 @@ }, "apps/events/frontend": { "name": "@crosscode/events-frontend", - "version": "3.7.0", + "version": "3.7.1", "dependencies": { "@crosscode/contracts": "*", "@crosscode/seo": "*", @@ -360,7 +360,7 @@ }, "apps/website/backend": { "name": "@crosscode/website-backend", - "version": "1.0.1", + "version": "1.0.2", "hasInstallScript": true, "dependencies": { "@crosscode/auth-client": "*", @@ -387,7 +387,7 @@ }, "apps/website/frontend": { "name": "@crosscode/website-frontend", - "version": "1.0.1", + "version": "1.0.2", "dependencies": { "@crosscode/contracts": "*", "@crosscode/seo": "*",