Compare commits

...
Author SHA1 Message Date
joshua ebcee43594 Merge branch 'fix/feed-after-reseed' 2026-11-27 15:35:42 +02:00
joshuaandClaude Opus 5.5 7f681c9e81 Events 3.7.2 + Website 1.6.1: no duplicate events after a reseed; "Events site" in the header
A reseed gives every event a new id without listing the old ones in the
feed's `deleted`, and consumers only fetched ?updatedSince= after the first
sync, so the old copies stayed beside the new ones.

- Both: the 15-minute feed poll and "Sync now" fetch the whole list and
  drop copies that aren't in it; the fetch after event.changed stays
  incremental.
- Events set-demo.js keeps FeedEntry and marks its live entries removed,
  resets the links' lastGoodAt, then publishes the new feed, sends
  event.changed and fetches the linked products' events back in.
- Website loadDemo lists the old published events in FeedRemoval and sends
  event.changed after publishing.
- Website header: links to the church's other sites read "Events site"
  with an external-link icon, not a second "Events".

Checked: Website backend tests (133), Events backend tests (802), both
typechecks, Website frontend build. set-demo.js not run end to end (no
local database).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 15:35:38 +02:00
joshua a75d2f7b46 Merge branch 'docs/released-site-1.9.1' 2026-11-27 15:13:39 +02:00
joshuaandClaude Opus 5.5 2edb9f681a docs: crosscode.co.za 1.9.1 released
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 15:13:38 +02:00
joshua d299442015 Merge branch 'docs/deployed-everything' 2026-11-27 15:09:29 +02:00
joshuaandClaude Opus 5.5 9994cbd760 docs: everything deployed on the latest releases
Hub 2.25.0, agent 1.6.0 (church-server1 and the central server), Cross Events
3.7.1 and Accounts 1.8.0 at the churches, the Church Website 1.6.0 on
cross-demo2, crosscode.co.za 1.9.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 15:09:29 +02:00
joshua 0d6afc7cd1 Merge branch 'docs/released-site-1.9.0' 2026-11-27 15:06:25 +02:00
joshuaandClaude Opus 5.5 3539bf0ac0 docs: crosscode.co.za 1.9.0 released
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 15:06:24 +02:00
joshua ff3d9aefa2 Merge branch 'docs/released-site-1.8.1' 2026-11-27 14:55:00 +02:00
joshuaandClaude Opus 5.5 8c4f5f244c docs: crosscode.co.za 1.8.1 released
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 14:55:00 +02:00
joshua edac4ee767 Merge branch 'test/website-demo-profile' 2026-11-27 14:47:01 +02:00
joshuaandClaude Opus 5.5 090453e14a test: the Website e2e server loads a demo profile (/test/demo?profile=); docs: crosscode.co.za 1.8.0 released
For the crosscode-site screenshots of another church on each template. Test
helper only, no Website release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 14:47:01 +02:00
joshua 9c87208428 Merge branch 'docs/released-website-1.6.0' 2026-11-27 14:32:15 +02:00
joshuaandClaude Opus 5.5 f931226e74 docs: Website 1.6.0 and crosscode.co.za 1.7.1 released
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 14:32:14 +02:00
joshua 1940ff2a91 Merge branch 'feat/website-demo-photos' 2026-11-27 14:32:04 +02:00
joshuaandClaude Opus 5.5 2d4d9ea871 Website 1.6.0: real photos for the demo church, photos sized to their frames
The demo church (and the eight demo profiles) used one generated "hills and
sun" SVG for every picture. Now 104 Unsplash stock photos (models; free under
the Unsplash License, credited in backend/demo-photos/CREDITS.md): a set per
profile, a portrait for every leader (before: only the pastor), a picture for
each event, and a photo for each message instead of the stand-in video's
thumbnail. Demo photos go through processImage like an upload, made once per
machine and copied; without demo-photos/ the illustration still stands in.

A message's thumbnailUrl that is one of the site's own uploads now comes
before the YouTube thumbnail; admins and the YouTube feed store YouTube's
address there, so a church's own messages are unchanged.

Faster on phones: the Community collage hero, the collage row, the team's
portraits and the ministry cards give the browser their real width (sizes),
so a phone no longer fetches the full-width photo for a small frame.

Checked: backend tests (131), Website e2e (130, baselines retaken;
Lighthouse mobile 90-98 performance, 100 accessibility and SEO), typecheck,
lint and both builds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 14:31:57 +02:00
joshua 28085d92ba Merge branch 'docs/deployed-hub-2.25.0-agent-1.6.0' 2026-11-27 10:07:34 +02:00
joshuaandClaude Opus 5.5 fbe814b2d9 docs: Hub 2.25.0 and agent 1.6.0 deployed (Website still 1.2.0 on cross-demo2)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 10:07:34 +02:00
joshua fe4310352e Merge branch 'docs/released-website-1.5.0' 2026-11-27 10:04:58 +02:00
joshuaandClaude Opus 5.5 db12d17796 docs: Website 1.5.0 released
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 10:04:57 +02:00
joshua 22d7e54008 Merge branch 'feat/website-uploads-backup' 2026-11-27 10:04:39 +02:00
joshuaandClaude Opus 5.5 8c213d6d84 Website 1.5.0: back up the photos and files too
The nightly backup (and Back up now) snapshots backend/uploads after the
database, into backups/uploads-YYYYMMDD-HHMMSS/. Unchanged files are hard
links to the last snapshot, so after the first full copy a night costs
only the new files. Built in a partial folder and renamed when complete,
refused up front when the disk hasn't room, kept to the same count as the
database backups, with its own switch on Admin -> Backups.

crosscode script: an uninstall keeps the Website's backups with rsync -aH,
so the snapshots' shared files stay shared.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 10:04:38 +02:00
joshua 48abc06db7 Merge branch 'docs/released-website-1.4.0' 2026-11-27 09:51:00 +02:00
joshuaandClaude Opus 5.5 da283f3cbb docs: Website 1.4.0 released
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 09:50:59 +02:00
joshua 2a4cf7acab Merge branch 'feat/website-backups' 2026-11-27 09:50:35 +02:00
joshuaandClaude Opus 5.5 a3ac3da5a5 Website 1.4.0: nightly database backups and background jobs
As Accounts and Cross Events: a gzipped pg_dump every night (02:20) into
backend/backups/, the same website-*.sql.gz files crosscode makes before
updates, with Admin -> Backups (back up now, download, how many to keep).
The heartbeat, event feed and YouTube move from plain timers onto pg-boss
with the backup, and Admin -> Background jobs switches each on or off,
changes its schedule or runs it now. The heartbeat now reports the newest
backup (before: always none, so the Hub warned) and the real job state.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 09:47:30 +02:00
joshua 8e52bd2d33 Merge branch 'docs/released-hub-2.25.0-website-1.3.0' 2026-11-27 09:31:08 +02:00
joshuaandClaude Opus 5.5 7b49ec2b70 docs: Hub 2.25.0, Website 1.3.0, agent 1.6.0, contracts 1.19.0 released
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 09:31:07 +02:00
joshua d3e04127f3 Merge branch 'feat/website-demo-seeds' 2026-11-27 09:30:15 +02:00
joshuaandClaude Opus 5.5 2fb7ac57da Website 1.3.0, agent 1.6.0, contracts 1.19.0: demo data for the Church Website
Eight demo churches, two per template (the second on the template's other
recommended variants and header), loaded from the Hub on demo sites with
`crosscode demo <church> website --profile <p>`. A profile replaces the
content only: the church's profile from Accounts, the site settings, the
site icon and the admins stay, and the copy names the church.

- contracts: WEBSITE_DEMO_PROFILES, DEMO_PRODUCTS, SEED_WEBSITE_DEMO_MIN_AGENT;
  seed-demo takes an optional product (events by default)
- agent: a Website seed-demo job runs `crosscode demo <church> website`
- crosscode script: backup, demo as the site's user, reload, health check

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 09:20:09 +02:00
joshua 81c01d8a9f Merge branch 'docs/deployed-hub-2.24.1-website-1.2.0' 2026-11-27 08:44:56 +02:00
joshuaandClaude Opus 5.5 2335fd46e4 docs: Hub 2.24.1 deployed, Website 1.2.0 on cross-demo2
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 08:44:55 +02:00
joshua f58711603a Merge branch 'docs/hub-2.24.1' 2026-11-27 08:36:19 +02:00
joshuaandClaude Opus 5.5 d1354a6a17 docs: Hub 2.24.1 released
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 08:36:18 +02:00
joshua 175a6b41eb Merge branch 'docs/hub-2.24.0' 2026-11-27 08:30:15 +02:00
joshuaandClaude Opus 5.5 80d8e903dd docs: Hub 2.24.0 deployed (Website 1.2.0 not on cross-demo2 yet)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 08:30:15 +02:00
joshua 35501deb0d Merge branch 'fix/website-starter-pages' 2026-11-27 08:18:53 +02:00
joshuaandClaude Opus 5.5 79e1450df6 Website 1.2.0: starter pages on a new install, and a site icon
A new install had no pages, so the home page and its live preview showed
only the header and footer (found on cross-demo2). The backend now adds the
fixed pages with starter text at startup. Settings -> Site icon sets the
favicon, with a default from the church's colour and initial. The Latest
message's Card layout has its name; the media picker's placeholder has
enough contrast.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 08:18:47 +02:00
joshua 6905a19c8c Merge branch 'feat/admin-redesign' 2026-11-26 19:57:23 +02:00
joshuaandClaude Opus 5.5 dcc22a5c16 Accounts 1.8.0, Website 1.1.0: admins redesigned as Cross Events' dashboard and settings
- Website: an icon sidebar in groups (Your site, Content, Go live, Team), a
  dashboard with cards and a tile per part of the admin, steps to the first
  publish across the top of every admin page, and a live preview beside the
  page editor and Template and style (computer or phone width, folds away,
  reloads on save). A framed request (Sec-Fetch-Dest: iframe) with an admin
  session reads the drafts, so no preview cookie is set. /preview/start
  takes ?to=. The page editor has Content and Page details tabs.
- Accounts: /admin is an overview (cards, "Needs you", a tile per section);
  People moved to /admin/people; the sidebar shows the part you're in,
  grouped, with a count on Deletion requests; People redesigned, with a
  confirm before Deactivate; Email and WhatsApp split into two cards.
- Both: darker grey labels for contrast; lucide-react in the Website.
- e2e: the live preview shows drafts while the site stays live; axe on the
  page editor.
- docs: VERSIONS, changelogs, WHATS-NEW.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 19:57:22 +02:00
joshua e6c91c3705 Merge branch 'docs/deployed-cross-demo2' 2026-11-26 16:18:45 +02:00
joshuaandClaude Opus 5.5 925b5fbd8b docs: Accounts 1.7.1, Website 1.0.2, Events 3.7.1 deployed on cross-demo2
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 16:18:44 +02:00
joshua 58cadbf472 Merge branch 'fix/link-after-install' 2026-11-26 16:14:20 +02:00
joshuaandClaude Opus 5.5 f6a536ad64 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:<web port>: 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 <noreply@anthropic.com>
2026-11-26 16:14:20 +02:00
joshua 05d808b74c Merge branch 'docs/hub-2.23.1' 2026-11-26 15:27:27 +02:00
joshuaandClaude Opus 5.5 20a23a3ba8 docs: Hub 2.23.1 deployed (Accounts version from the heartbeat)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 15:27:26 +02:00
joshua 9c9c96dd2c Merge branch 'docs/hub-2.23.0' 2026-11-26 15:11:58 +02:00
joshuaandClaude Opus 5.5 f73761f956 docs: Hub 2.23.0 deployed (requirements carry forward)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 15:11:57 +02:00
joshua 62441ad437 Merge branch 'docs/site-1.7.0' 2026-11-26 14:38:00 +02:00
joshuaandClaude Opus 5.5 7814a64cf7 docs: crosscode-site 1.7.0 released (the Website on sale)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 14:37:59 +02:00
joshua 679f61febf Merge branch 'fix/website-1.0.1' 2026-11-26 14:36:35 +02:00
joshuaandClaude Opus 5.5 723bb15a5e website 1.0.1: thumbnails from the site, Calendar dates
- The messages' YouTube thumbnails are served from the site
  (/api/thumbnails/<id>.jpg): the backend fetches a message's thumbnail
  once and keeps it in uploads/.thumbnails (only the site's own videos,
  only a JPEG), so visitors ask nothing of YouTube before pressing play.
  The messages page preloads the first one (its LCP: Heritage 89 -> 95).
- Calendar events' dates read "Sun · November", not
  "Sun (month: November)".
- e2e: no request to YouTube or Spotify before play; the variant
  screenshots round section heights to whole pixels (a one-pixel flake);
  the e2e thumbnail is one of the demo's illustrations.
- crosscode script: a Website's export leaves out uploads/.thumbnails.
- docs: release checks on 1.0.1, VERSIONS, handover.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 14:36:34 +02:00
joshua dd0e5e17b3 Merge branch 'docs/website-release-checks' 2026-11-26 12:03:10 +02:00
joshuaandClaude Opus 5.5 7216035e49 docs: website release checks run again on the release build
Variants: axe passes everywhere, all 104 baselines taken (67 new to look
through). Lighthouse 11 of 12 (Heritage messages 89, the YouTube
thumbnail as LCP). Found: Calendar dates print "Sun (month: November)".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 12:03:10 +02:00
joshua 9bf1739734 Merge branch 'feat/website-release-checks' 2026-11-26 10:54:44 +02:00
joshuaandClaude Opus 5.5 0b99686ca7 website 1.0.0: release checks, contrast and map fixes
- e2e: every section variant in every template (axe and 312 screenshots
  compared with local baselines), Lighthouse on a phone (median of three,
  CPU slowdown calibrated to the machine), the whole suite on real Postgres
  with E2E_DATABASE_URL, a frozen clock, E2E_REUSE for running servers.
- Fixes found by them: contrast on Bold's service times panel and Calendar
  event dates; the OpenStreetMap embed loads only once on screen; the
  messages page's first thumbnail is eager, its host preconnected.
- The restore e2e waits for its second publish (raced on Postgres).
- docs: Hub 2.22.0 deployed; website@1.0.0 released.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 10:54:43 +02:00
joshua 6ffad24db1 Merge branch 'docs/handover-tidy' 2026-11-25 16:29:08 +02:00
joshuaandClaude Opus 5.5 268c9cde88 docs: handover typo
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 16:29:07 +02:00
joshua 9086b549a8 Merge branch 'docs/release-contracts-1.18-hub-2.22' 2026-11-25 16:28:43 +02:00
joshuaandClaude Opus 5.5 154bb94da7 docs: contracts 1.18.0 and Hub 2.22.0 released; Website status
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 16:28:42 +02:00
joshua 312c32c6cb Merge branch 'feat/storage-request' 2026-11-25 16:18:48 +02:00
joshuaandClaude Opus 5.5 283e75737d contracts 1.18.0 + website: Get more storage
contracts: hub.storageRequestSchema and its reply, a sample and JSON
Schemas. Website: an Owner or Admin asks for more 5 GB steps under
Media library (signed to the Hub); the heartbeat reports the licence's
storage limit, so the Hub emails the church at 80% and when full.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 16:18:46 +02:00
joshua 53e5de3f14 Merge branch 'feat/website-settings-seo' 2026-11-25 15:30:29 +02:00
joshuaandClaude Opus 5.5 085265392e feat(website): church details, settings, audit log, search engine data, safer editing
Church details saved through Accounts' church.update (live at once).
Settings: Search Console and Bing codes, Coming soon line, menu order.
Audit log and recent edits. A made share image, Event / VideoObject /
PodcastEpisode / BreadcrumbList structured data, permanent redirects
from old page addresses. Saves refused when someone else saved in
between; Ministry leaders' events; templates previewed with the
church's own content before choosing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 15:30:27 +02:00
joshua d8ed238042 Merge branch 'feat/website-event-feed' 2026-11-25 14:37:43 +02:00
joshuaandClaude Opus 5.5 b767b45e64 feat(website): the event feed both ways, and Linked products
Publish my events: the Website's simple events as crosscode.event/1
(GET /api/feed/v1/events, updatedSince, removals in deleted for 90
days) and a signed event.changed to linked siblings. Show events
from: each sibling's feed every 15 minutes and at once on its signed
event.changed; read-only copies of only that sibling's events, one
bad event skipped, the last good copy kept. Admin: Linked products.
church.changed from Accounts refreshes the profile at once. Plan:
the video hero, more blocks and more pages move to website@1.1.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 14:37:42 +02:00
joshua 193a338ed2 Merge branch 'feat/website-image-sizes' 2026-11-25 14:04:44 +02:00
joshuaandClaude Opus 5.5 2ba755145d feat(website): photos upright, without metadata, in responsive sizes
Every upload is turned upright, stripped of its metadata (EXIF, GPS),
kept at most 2400 px wide and saved at 480/960/1600 px in WebP and
JPEG; the pages pick the size with <picture> and srcset. Every file
counts towards storage; a photo that can't be read is refused. sharp
0.35 (prebuilt, no build step on the servers).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 14:04:43 +02:00
joshua 6be1a2782d Merge branch 'feat/website-people-messages-events' 2026-11-25 13:05:35 +02:00
joshuaandClaude Opus 5.5 37a1f6acf1 feat(website): people and roles, messages with the YouTube feed, simple events
People: Owners and Admins add someone by email (people.ensure through
Accounts), change roles, remove access; only Owners touch Owners,
nobody changes themselves, a lower role ends sessions at once.
Messages: from a YouTube channel or playlist every hour (public feed,
no key) or by hand with a YouTube or Spotify link; own publish, hide.
Simple events: own publish, cancel, remove. Tests and e2e with axe on
the new screens.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 13:05:33 +02:00
joshua 9b8f10e3c8 Merge branch 'feat/website-admin' 2026-11-25 12:30:29 +02:00
joshuaandClaude Opus 5.5 84c5b0c08e feat(website): the admin, with drafts, preview, publish and restore
Admin API and screens: dashboard and setup checklist, template and
style, pages and blocks, ministries, leadership, media library with
the storage limit, publish and history. Pending changes with who and
when, discard one, one Publish, restore any version (each version
keeps the working copy's rows, never sent to visitors). Preview on
the site's own addresses with a bar (widths, back, publish); shared
preview links for 7 days or until revoked. Roles checked, same-origin
changes only. Publish refreshes the public pages at once
(WEBSITE_CONTENT_CACHE_SECONDS). E2E on a production build: the
admin's flows and axe on every screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 12:30:29 +02:00
joshua 3caa1d1e1a Merge branch 'feat/website-templates' 2026-11-25 10:59:04 +02:00
joshuaandClaude Opus 5.5 5ed7201efa feat(website): the four templates and the public site
Heritage, Bold, Community and Clean drawing all 26 section variants
with their headers, homepage order and style settings; colours made
safe (WCAG AA) by the backend; fonts and corners from the shared brand
style. Publishing into numbered versions, the content API with live
messages and events and the church profile from Accounts, uploads,
every page kind, simple event pages, Coming soon, 404, sitemap, SEO
basics and the church's JSON-LD. The demo church (npm run demo) and
Playwright e2e: every template's pages pass axe and the SEO checks.
website.sh builds packages/seo. Decision 17 (first Owner) recorded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 10:59:03 +02:00
joshua 138c73e20c Merge branch 'feat/website-signin' 2026-11-25 09:27:08 +02:00
joshuaandClaude Opus 5.5 58960b5e93 feat(website): crosscode website.sh and signing in through Accounts
crosscode: scripts/products/website.sh (ports 5300/3300, uploads in the
export), crosscode add <church> website (needs Accounts; www.<address>
or the Cross Code address), one install_app for Accounts and the
Website, env template copy, bats tests.

Backend: Hub client (protocol v2, product website), crosscode.link/1
with automatic connect to the church's Accounts, sign-in through
@crosscode/auth-client with the Website's own session and roles, the
first Owner from HUB_ADMIN_EMAIL (verified), 2FA for Owners and Admins,
back-channel logout, Accounts' user.* calls, and the church export.
Frontend: admin sign-in/out and the sign-in problem page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 09:27:07 +02:00
joshua 79121bc447 Merge branch 'feat/website-skeleton' 2026-11-25 08:41:11 +02:00
joshuaandClaude Opus 5.5 36ceb358b8 feat(website): apps/website skeleton
Backend (Express + Prisma, ES modules, as Accounts): /api/health and
/api/v1/site/status (Coming soon until the first publish), the content
model and its first migration, and the confirmed section variants per
template (WEBSITE-1.0-PLAN §3, decision 16) with the template switch
rules, with tests. Frontend (Next.js 16): Coming soon page, admin
placeholder, robots.txt. env.template.json, PM2 example, CHANGELOG and
WHATS-NEW. Root workspaces and lint updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 08:41:11 +02:00
joshua a3a158faa8 Merge branch 'docs/website-section-variants' 2026-11-25 08:13:22 +02:00
joshuaandClaude Opus 5.5 ae604268e0 docs: Website 1.0 section variants per template (confirmed)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 08:13:20 +02:00
joshua ae122a664a Merge branch 'docs/hub-2.21-deployed' 2026-11-25 07:58:30 +02:00
joshuaandClaude Opus 5.5 62d9728b95 docs: Hub 2.21.0 deployed; hope-events archived, FastPanel ^~ /api/ done
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 07:58:30 +02:00
joshua ee129fbd87 Merge branch 'docs/hub-2.21' 2026-11-25 00:03:51 +02:00
joshuaandClaude Opus 5.5 10be55d261 docs: Hub 2.21.0 released (not deployed); website@1.0.0 next
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 00:03:51 +02:00
joshua ed97956a2f Merge branch 'docs/events-3.7-requires' 2026-11-24 23:52:54 +02:00
joshuaandClaude Opus 5.5 e79e5a11f9 docs: Events 3.7.0 requires Accounts 1.7.0
The WHATS-NEW heading now says "— requires accounts 1.7.0", so the Hub
shows the requirement and updates a church's Accounts before Events.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 23:52:54 +02:00
joshua 66557c7f1d Merge branch 'feat/events-3.7' 2026-11-24 23:29:24 +02:00
joshuaandClaude Opus 5.5 f4b6a41f83 Events 3.7.0 + @crosscode/ui 0.3.0: the church's fonts, corners and footer on the public pages
- Backend: the church profile from Accounts (src/accounts/church.ts, kept 10
  minutes, last copy kept while Accounts is down), public GET /api/v2/church,
  and church.changed accepted at POST /api/church/v1/changed (signed with the
  Accounts link; it answered 404 before).
- Frontend: brandAttributes on <html>, @crosscode/ui/fonts.css, body and
  h1-h3 use the church's pairing, --radius follows its corners; the dashboard
  and setup screens (data-cc-staff) keep their fonts and 0.5rem.
- The shared ChurchFooter on public pages when Accounts is connected (terms
  and cookie settings below it); header links to the church's other sites.
- @crosscode/ui 0.3.0: ChurchFooter takes `bottom`.
- Tests: tests/churchProfile.test.ts (8); e2e/church-brand.spec.ts and a
  /test/profile hook on the e2e Accounts.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 23:29:23 +02:00
339 changed files with 20930 additions and 262 deletions
+125
View File
@@ -2,6 +2,131 @@
Each package and app has its own section and its own tags (`contracts@1.0.0`, `accounts@1.0.0`, …).
## events@3.7.2 + website@1.6.1 - 2026-11-27
Events shown on the other product's site no longer show twice after a reseed, and the Website's
header marks the link to the Events site. Details in each app's CHANGELOG. No migrations.
- **Both:** the 15-minute event-feed poll and "Sync now" fetch the whole list and drop copies that
aren't in it, so events a sibling lost without listing them in `deleted` (a reseed, a restore)
can't stay beside the new ones. The fetch after an `event.changed` stays incremental.
- **Events 3.7.2:** new demo data (`set-demo.js`) lists the old events as removed in the feed,
publishes the new ones and tells the Website at once, and fetches the Website's events back in.
- **Website 1.6.1:** loading a demo lists the old events as removed and tells Events; the header
shows "Events site" with an external-link icon instead of a second "Events".
## website@1.6.0 - 2026-11-27
The demo church has real photos, and photos in small frames load at their size. Details in
`apps/website/CHANGELOG.md`. No migration.
- **Demo photos:** 104 Unsplash stock photos (models, free under the Unsplash License, credited
in `apps/website/backend/demo-photos/CREDITS.md`) instead of the generated illustration: a set
per demo profile, a portrait for every leader, a picture for each event, and a photo for each
message instead of the stand-in video's thumbnail. Loaded like uploads, in the responsive sizes.
- **Faster on phones:** the collage hero, the team's portraits and the ministry cards give the
browser their real width (`sizes`), so a phone no longer fetches the full-width photo for a
small frame.
## website@1.5.0 + crosscode script - 2026-11-27
The Church Website's nightly backup also backs up the photos and files. Details in
`apps/website/CHANGELOG.md`. No migration.
- **Website 1.5.0:** each night after the database, a snapshot of `backend/uploads` in
`backend/backups/uploads-YYYYMMDD-HHMMSS/`; unchanged files are hard links to the last snapshot,
so after the first full copy a night costs only the new files. On Admin → Backups, with its own
switch. Kept to the same count as the database backups.
- **crosscode script:** an uninstall keeps the Website's backups with `rsync -aH`, so the
snapshots' shared files stay shared instead of each becoming a full copy.
## website@1.4.0 - 2026-11-27
Database backups and background jobs for the Church Website, as Accounts and Cross Events have.
Details in `apps/website/CHANGELOG.md`. No migration (pg-boss makes its own `pgboss_website`
schema on first start).
- **Backups:** a gzipped `pg_dump` every night at 02:20 into `backend/backups/`, the same
`website-*.sql.gz` files the crosscode script makes before updates; Admin → Backups.
- **Background jobs** on pg-boss: the backup, the Hub heartbeat, the event feed and YouTube (before:
plain timers); Admin → Background jobs switches each on or off, changes its schedule, runs one now.
- **The heartbeat tells the Hub the truth:** the newest backup (before: always none, so the Hub
warned "No backup reported") and the real job mode and failures.
## contracts@1.19.0 + agent@1.6.0 + website@1.3.0 + crosscode script - 2026-11-27
Demo data for the Church Website, from the Hub (Hub 2.25.0). Additive: an Events `seed-demo` job
means what it did. Details in each app's CHANGELOG.md. No migrations.
- **contracts 1.19.0:** `agent.WEBSITE_DEMO_PROFILES` (eight, two per template:
`heritage-parish`, `heritage-city`, `bold-youth`, `bold-plant`, `community-family`,
`community-town`, `clean-modern`, `clean-campus`), `DEMO_PRODUCTS`, `DEMO_PROFILES_BY_PRODUCT`,
`SEED_WEBSITE_DEMO_MIN_AGENT` (1.6.0). `seed-demo` args take an optional `product` (`events`,
the default, or `website`); the profile must be one of that product's, and a Website demo takes
no `adminEmail`.
- **agent 1.6.0:** a Website `seed-demo` job runs `crosscode demo <church> website --profile <p>`.
- **website 1.3.0:** the eight demo churches (`backend/src/demo/seeds.ts`,
`npm run demo -- --profile <p>`, `--list`). They replace the content only: the church's profile
from Accounts, the site settings, the site icon and the admins stay, and the copy names the
church. `--template` alone is still the Acacia Hill development church.
- **crosscode script:** `crosscode demo <church> website --profile <p>`: backup, the demo as the
site's user (`--force`), reload, wait for `/api/health`. Refused on a Website release without
the profiles (before 1.3.0).
## accounts@1.8.0 + website@1.1.0 - 2026-11-26
The admins of both, redesigned as Cross Events' admin dashboard and settings. Details in each app's
CHANGELOG.md. No migrations, no backend changes.
- **Accounts 1.8.0:** `/admin` is an overview (cards, "Needs you", a tile per section); People
moved to `/admin/people`; the sidebar shows the part you're in, grouped; People redesigned.
- **Website 1.1.0:** an icon sidebar in groups, a dashboard, steps to the first publish across the
top, and a live preview beside the page editor and Template and style (drafts in a frame, no
preview cookie).
## 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:<web port>` (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`.
- **Website 1.0.1:** the messages' YouTube thumbnails are served from the site
(`/api/thumbnails/<id>.jpg`), so visitors ask nothing of YouTube until they press play; the
Calendar events' dates read "Sun · November", not "Sun (month: November)". No migration.
- **crosscode script:** a Website's export leaves out `uploads/.thumbnails` (the kept thumbnails).
## contracts@1.18.0 - 2026-11-25
"Get more storage" for the Church Website (WEBSITE-1.0-PLAN §10, decision 12), with Hub 2.22.0.
Additive: products on 1.17.0 keep working.
- **`hub.storageRequestSchema` / `storageRequestResponseSchema`**: a Website asks the Hub for more
5 GB steps (`POST /api/installs/storage-request`, signed as the heartbeat), with what it uses,
its limit and who asked. `hub.STORAGE_STEP_BYTES`. New sample `hub-storage-request.json` and
JSON Schemas `hub-storage-request`, `hub-storage-request-response`.
## events@3.7.0 + @crosscode/ui 0.3.0 - 2026-11-24
Cross Events' public pages use the church's brand style and the shared footer (WEBSITE-1.0-PLAN §9).
Details in `apps/events/CHANGELOG.md`.
- **Events 3.7.0:** the church profile from Accounts (`GET /api/v2/church`), its fonts and corners
on the public pages, `ChurchFooter` and links to the church's other sites; `church.changed` is
accepted at `/api/church/v1/changed`. Dashboard and setup unchanged. No migrations.
- **`@crosscode/ui` 0.3.0:** `ChurchFooter` takes `bottom` (a product's own links).
## contracts@1.17.0 + accounts@1.7.0 + @crosscode/ui 0.2.0 - 2026-11-24
The first release of the Church Website 1.0.0 work (WEBSITE-1.0-PLAN §12). The contracts are
+35
View File
@@ -1,5 +1,40 @@
# Changelog — Accounts
## [1.8.0] - 2026-11-26
No migrations, no new settings, no backend changes. The admin redesigned as Cross Events' admin
dashboard and settings.
### Changed
- **`/admin` is an overview:** four cards (people with an account, deletion requests waiting,
sites that sign in here, last backup), a "Needs you" list with buttons to act, and a tile with a
line about every section. **People moved to `/admin/people`.**
- **The sidebar shows the part you're in** (your account or admin, with a link to the other), and
admin's sections are grouped: People, Church, Signing in, System. Deletion requests shows how many
are waiting. The phone menu shows both parts. Every page title has its section's icon.
- **People:** a search box, a row per person with initials, admin and status badges, two-step
sign-in and last sign-in; the person's card stays in view while scrolling. Deactivating someone
asks to confirm first.
- **Email and WhatsApp** are two cards, each with its own Save.
- Group labels are a darker grey (WCAG AA contrast).
## [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).
+12
View File
@@ -3,6 +3,18 @@
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.8.0
- **An easier admin.** Admin opens on an overview: how many people have an account, anything that
needs you (like deletion requests waiting), and a tile for every setting. The menu down the side
is grouped and shows only the part you're in. People has moved to Admin → **People**, with a
search box and a clearer list; deactivating someone now asks you to confirm.
## 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
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@crosscode/accounts-backend",
"version": "1.7.0",
"version": "1.8.0",
"description": "Cross Code Accounts: the church's sign-in (OpenID Connect provider), account pages API and admin API",
"private": true,
"type": "module",
+3 -1
View File
@@ -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 () => {
+28 -4
View File
@@ -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<Ctx, { at: number; run: Promise<unknown> }>();
/**
* 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<Omit<LinkConnect, 'signature'>>({
@@ -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<string, unknown>, 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);
@@ -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<void>((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', () => {
+4
View File
@@ -102,6 +102,10 @@ test("admin: needs two-step sign-in, then lists people", async ({ page }) => {
await page.getByLabel("Code").fill(await helper(page, `/test/totp?secret=${key}`));
await page.getByRole("button", { name: "Turn on" }).click();
await page.getByRole("button", { name: "I've saved them" }).click();
// 1.8.0: /admin is the overview, with a tile for every section; People is one.
await expect(page.getByRole("heading", { name: "Admin", level: 1 })).toBeVisible();
await expect(page.getByText("People with an account")).toBeVisible();
await page.getByRole("navigation", { name: "Admin" }).getByRole("link", { name: "People", exact: true }).click();
await expect(page.getByRole("heading", { name: "People", level: 1 })).toBeVisible();
await expect(page.getByText("thandi@hope.test")).toBeVisible();
// 1.3.0: every admin section has its own address, down the side; Backups is one.
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@crosscode/accounts-frontend",
"version": "1.7.0",
"version": "1.8.0",
"private": true,
"description": "Cross Code Accounts: the church's sign-in pages, the account page and admin",
"scripts": {
@@ -6,7 +6,7 @@ import QRCode from "qrcode";
import { Activity as ActivityIcon, ArrowUpRight, Calendar, CheckCircle2, Globe, Lock, Mail, ShieldAlert, ShieldCheck, Smartphone, User, type LucideIcon } from "lucide-react";
import { Button, Checkbox, Field, Notice } from "@crosscode/ui";
import { useBranding } from "@/components/BrandingProvider";
import { AppShell, PageTitle, ShellLoading } from "@/components/AppShell";
import { ACCOUNT_NAV, AppShell, PageTitle, ShellLoading } from "@/components/AppShell";
import { Card, Heading } from "@/components/Panel";
import { call, selfSignIn } from "@/lib/api";
import { useExternalEffect } from "@/lib/hooks";
@@ -62,7 +62,7 @@ export function Account({ section = "overview" }: { section?: AccountSection })
const first = me.name.split(" ")[0] || me.name;
return (
<AppShell me={me} active={s.path}>
<PageTitle sub={s.sub(branding.name)}>{section === "overview" ? `Hi, ${first}` : s.title}</PageTitle>
<PageTitle icon={section === "overview" ? undefined : ACCOUNT_NAV.find((n) => n.href === s.path)?.icon} sub={s.sub(branding.name)}>{section === "overview" ? `Hi, ${first}` : s.title}</PageTitle>
{msg && <Notice tone={msg.tone}>{msg.text}</Notice>}
{section === "overview" && <Overview me={me} />}
{section === "details" && <div className="max-w-2xl"><Profile me={me} onDone={done} onFail={fail} /></div>}
+180 -34
View File
@@ -2,9 +2,12 @@
import Link from "next/link";
import React, { useCallback, useState } from "react";
import { DatabaseBackup, Download, Play, RefreshCw, Timer } from "lucide-react";
import {
AlertTriangle, ArrowRight, Building2, CheckCircle2, ChevronRight, DatabaseBackup, Download, Eye, FileText, KeyRound, Link2, LogIn, Mail, MessageCircle, Play,
RefreshCw, ScrollText, Search, ShieldCheck, Timer, UserX, Users,
} from "lucide-react";
import { Button, Checkbox, Field, Notice } from "@crosscode/ui";
import { AppShell, PageTitle, ShellLoading, type ShellUser } from "@/components/AppShell";
import { ADMIN_GROUPS, ADMIN_NAV, AppShell, PageTitle, ShellLoading, type ShellUser } from "@/components/AppShell";
import { NoticeText } from "@/components/NoticeText";
import { Card, Heading } from "@/components/Panel";
import { call, selfSignIn } from "@/lib/api";
@@ -26,6 +29,7 @@ export function Admin({ section = "people" }: { section?: AdminSection }) {
const [me, setMe] = useState<ShellUser | null>(null);
const [allowed, setAllowed] = useState<boolean | null>(null);
const [msg, setMsg] = useState<{ tone: "success" | "error"; text: string } | null>(null);
const [waiting, setWaiting] = useState(0);
useExternalEffect(() => {
let alive = true;
@@ -35,11 +39,15 @@ export function Admin({ section = "people" }: { section?: AdminSection }) {
if (!r.ok && r.error.code === "MFA_REQUIRED") return window.location.assign(selfSignIn(s.path, "&acr=mfa"));
if (who.ok) setMe(who.data);
setAllowed(r.ok);
// The count beside Deletion requests.
if (r.ok) void call<{ items: Deletion[] }>("GET", "/admin/deletions").then((d) => { if (alive && d.ok) setWaiting(d.data.items.filter((x) => x.status === "waiting_approval").length); });
});
return () => { alive = false; };
}, [s.path]);
const flash: Flash = (tone, text) => setMsg({ tone, text });
const icon = ADMIN_NAV.find((n) => n.href === s.path)?.icon;
const badges = { "/admin/deletions": waiting };
if (allowed === null || !me) return <ShellLoading />;
if (!allowed) {
return (
@@ -50,16 +58,20 @@ export function Admin({ section = "people" }: { section?: AdminSection }) {
}
return (
<AppShell me={me} active={s.path}>
<PageTitle sub={s.sub}>{s.title}</PageTitle>
<AppShell me={me} active={s.path} badges={badges}>
<PageTitle icon={section === "overview" ? undefined : icon} sub={section === "overview" ? `Welcome back, ${me.name.split(" ")[0] || me.name}. ${s.sub}` : s.sub}>{s.title}</PageTitle>
{msg && <Notice tone={msg.tone}>{msg.text}</Notice>}
{section === "overview" && <Overview />}
{section === "people" && <People flash={flash} />}
<div className="max-w-3xl">
{section === "deletions" && <Deletions flash={flash} />}
<div className="max-w-3xl space-y-6">
{section === "deletions" && <Deletions flash={flash} onChange={setWaiting} />}
{section === "church" && <><Church flash={flash} /><BrandStyle flash={flash} /></>}
{section === "linked" && <Linked flash={flash} />}
{section === "signin" && <Settings flash={flash} keys={["signup_enabled", "two_factor_required_for_admins", "signin_notices", "session_days"]} />}
{section === "messages" && <Settings flash={flash} keys={["smtp_host", "smtp_port", "smtp_user", "smtp_pass", "smtp_from", "smtp_secure", "wawp_access_token", "wawp_instance_id"]} />}
{section === "signin" && <Settings flash={flash} title="Signing in" icon={<LogIn className="h-4 w-4" />} sub="For everyone with an account at the church." keys={["signup_enabled", "two_factor_required_for_admins", "signin_notices", "session_days"]} />}
{section === "messages" && <>
<Settings flash={flash} title="Email" icon={<Mail className="h-4 w-4" />} sub="The server Accounts sends email through (SMTP): sign-in codes, password links, security notices. Leave it empty to use the server's .env." keys={["smtp_host", "smtp_port", "smtp_user", "smtp_pass", "smtp_from", "smtp_secure"]} />
<Settings flash={flash} title="WhatsApp" icon={<MessageCircle className="h-4 w-4" />} sub="Optional: sign-in codes and notices on WhatsApp, through WAWP." keys={["wawp_access_token", "wawp_instance_id"]} />
</>}
{section === "notice" && <NoticeTab flash={flash} />}
{section === "backups" && <Backups flash={flash} />}
{section === "jobs" && <Jobs flash={flash} />}
@@ -70,11 +82,118 @@ export function Admin({ section = "people" }: { section?: AdminSection }) {
);
}
// ─── Overview (1.8.0, as Cross Events' admin dashboard) ─────────────────────
type Linked = { hubConnected: boolean; items: { installId: string; name: string; listed: boolean; signsInHere: boolean }[] };
type OverviewData = { people: number | null; deletions: number | null; linked: Linked | null; licence: { connected: boolean; state: string } | null; backups: BackupList | null };
const TILE: Record<string, string> = Object.fromEntries(Object.values(ADMIN_SECTIONS).map((x) => [x.path, x.tile]));
function Stat({ icon, label, value, detail, href, warn }: { icon: React.ReactNode; label: string; value: React.ReactNode; detail?: React.ReactNode; href: string; warn?: boolean }) {
return (
<Link href={href} className="group rounded-xl border bg-white p-4 shadow-sm transition hover:border-brand/40 hover:shadow">
<div className="flex items-center gap-3">
<span className={`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg ${warn ? "bg-amber-50 text-amber-700" : "bg-brand/10 text-brand"}`} aria-hidden>{icon}</span>
<span className="min-w-0">
<span className="block text-xs text-gray-500">{label}</span>
<span className="block truncate text-xl font-semibold text-gray-900">{value}</span>
</span>
</div>
{detail && <p className="mt-2 text-xs text-gray-500">{detail}</p>}
</Link>
);
}
function Overview() {
const [d, setD] = useState<OverviewData | null>(null);
useExternalEffect(() => {
let alive = true;
Promise.all([
call<{ total: number }>("GET", "/admin/people?q="), call<{ items: Deletion[] }>("GET", "/admin/deletions"), call<Linked>("GET", "/admin/linked-products"),
call<{ connected: boolean; state: string }>("GET", "/admin/licence"), call<BackupList>("GET", "/admin/backups"),
]).then(([people, dels, linked, licence, backups]) => {
if (!alive) return;
setD({
people: people.ok ? people.data.total : null,
deletions: dels.ok ? dels.data.items.filter((x) => x.status === "waiting_approval").length : null,
linked: linked.ok ? linked.data : null,
licence: licence.ok ? licence.data : null,
backups: backups.ok ? backups.data : null,
});
});
return () => { alive = false; };
}, []);
if (!d) return <p className="text-sm text-gray-500" role="status">Loading…</p>;
const connected = d.linked?.items.filter((l) => l.signsInHere).length ?? 0;
const notConnected = d.linked?.items.filter((l) => !l.signsInHere && l.listed) ?? [];
const lastBackup = d.backups?.items[0]?.createdAt ?? null;
const todo: { text: string; href: string; action: string }[] = [
...(d.deletions ? [{ text: `${d.deletions} ${d.deletions === 1 ? "person has" : "people have"} asked to delete their account.`, href: "/admin/deletions", action: "Review" }] : []),
...(d.licence && !d.licence.connected ? [{ text: "Accounts isn't connected to Cross Code yet, so the church's sites can't find it.", href: "/admin/licence", action: "Connect" }] : []),
...(notConnected.length ? [{ text: `${notConnected.map((l) => l.name).join(", ")} ${notConnected.length === 1 ? "doesn't" : "don't"} sign people in here yet.`, href: "/admin/linked", action: "Connect" }] : []),
...(d.backups?.lastError ? [{ text: "The last backup didn't work.", href: "/admin/backups", action: "See why" }] : []),
];
return (
<div className="space-y-6">
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-4">
<Stat icon={<Users className="h-5 w-5" />} label="People with an account" value={d.people ?? "—"} href="/admin/people" detail="Find someone" />
<Stat icon={<UserX className="h-5 w-5" />} label="Deletion requests waiting" value={d.deletions ?? "—"} warn={!!d.deletions} href="/admin/deletions" detail={d.deletions ? "They need your answer" : "None waiting"} />
<Stat icon={<Link2 className="h-5 w-5" />} label="Sites that sign in here" value={d.linked ? `${connected} of ${d.linked.items.length}` : "—"} warn={notConnected.length > 0} href="/admin/linked" detail={d.linked && !d.linked.hubConnected ? "Not connected to the Hub" : "Linked products"} />
<Stat icon={<DatabaseBackup className="h-5 w-5" />} label="Last backup" value={lastBackup ? when(lastBackup) : "None yet"} warn={!!d.backups?.lastError} href="/admin/backups" detail={d.backups ? (d.backups.nightly ? "Every night at 02:00" : "Nightly backups are off") : undefined} />
</div>
<Card>
<Heading icon={todo.length ? <AlertTriangle className="h-4 w-4" /> : <CheckCircle2 className="h-4 w-4" />}>{todo.length ? "Needs you" : "Nothing needs you right now"}</Heading>
{todo.length > 0 ? (
<ul className="divide-y">
{todo.map((t) => (
<li key={t.href} className="flex flex-wrap items-center justify-between gap-3 py-3">
<span className="text-sm text-gray-700">{t.text}</span>
<Link href={t.href} className="inline-flex items-center gap-1 rounded-lg bg-brand px-3 py-1.5 text-sm font-medium text-white hover:bg-brand-dark">{t.action}<ArrowRight className="h-3.5 w-3.5" aria-hidden /></Link>
</li>
))}
</ul>
) : <p className="text-sm text-gray-600">Nothing is waiting for an admin. Anything that is (a deletion request, a site to connect, a backup that failed) shows here.</p>}
</Card>
<Card>
<Heading sub="Every setting, one click away.">All settings</Heading>
<div className="space-y-5">
{ADMIN_GROUPS.filter((g) => g.title).map((g) => (
<div key={g.title}>
<h3 className="mb-2 text-xs font-semibold uppercase tracking-wide text-gray-500">{g.title}</h3>
<div className="grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3">
{g.items.map((n) => {
const Icon = n.icon;
return (
<Link key={n.href} href={n.href} className="flex items-start gap-3 rounded-xl border bg-white p-4 shadow-sm transition hover:border-brand/40 hover:shadow">
<span className="flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-brand/10 text-brand" aria-hidden><Icon className="h-5 w-5" /></span>
<span className="min-w-0">
<span className="block text-sm font-semibold text-gray-900">{n.label}</span>
<span className="mt-0.5 block text-xs text-gray-500">{TILE[n.href]}</span>
</span>
</Link>
);
})}
</div>
</div>
))}
</div>
</Card>
</div>
);
}
// ─── People ──────────────────────────────────────────────────────────────────
type Person = { id: string; name: string; email: string; role: string; status: string; twoFactor: string | null; lastSignInAt: string | null };
type PersonDetail = Person & { phone: string | null; emailVerified: boolean; recoveryCodesLeft: number; createdAt: string; lockedUntil: string | null; signIns: { type: string; at: string; ip: string | null }[] };
const initials = (name: string) => name.split(/\s+/).filter(Boolean).slice(0, 2).map((x) => x[0]!.toUpperCase()).join("") || "?";
const chip = "inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-medium";
function People({ flash }: { flash: Flash }) {
const [q, setQ] = useState("");
const [list, setList] = useState<{ items: Person[]; total: number } | null>(null);
@@ -94,28 +213,47 @@ function People({ flash }: { flash: Flash }) {
};
return (
<div className="grid gap-6 md:grid-cols-2">
<div className="grid items-start gap-6 lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)]">
<Card>
<form onSubmit={(e) => { e.preventDefault(); void search(q); }} className="mb-4 flex gap-2">
<input aria-label="Search people" value={q} onChange={(e) => setQ(e.target.value)} placeholder="Name or email" className="flex-1 rounded-lg border px-3 py-2" />
<form onSubmit={(e) => { e.preventDefault(); void search(q); }} className="mb-3 flex gap-2">
<span className="relative flex-1">
<Search className="pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400" aria-hidden />
<input aria-label="Search people" value={q} onChange={(e) => setQ(e.target.value)} placeholder="Name or email" className="w-full rounded-lg border py-2 pl-9 pr-3" />
</span>
<Button type="submit" variant="secondary">Search</Button>
</form>
<p className="mb-2 text-sm text-gray-500">{list?.total ?? 0} people</p>
<ul className="divide-y">
<p className="mb-2 text-sm text-gray-500">{list?.total ?? 0} {list?.total === 1 ? "person" : "people"}</p>
<ul className="-mx-2 divide-y">
{list?.items.map((p) => (
<li key={p.id}>
<button type="button" onClick={() => show(p.id)} className="w-full py-2 text-left hover:bg-gray-50">
<span className="block font-medium">{p.name}{p.role === "admin" && <span className="ml-2 rounded bg-brand/10 px-1.5 text-xs text-brand">admin</span>}{p.status !== "active" && <span className="ml-2 text-xs text-amber-700">{p.status}</span>}</span>
<span className="block text-sm text-gray-500">{p.email}</span>
<button type="button" onClick={() => show(p.id)} aria-current={open?.id === p.id ? "true" : undefined}
className={`flex w-full items-center gap-3 rounded-lg px-2 py-2.5 text-left hover:bg-gray-50 ${open?.id === p.id ? "bg-brand/5" : ""}`}>
<span className="flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-brand/10 text-xs font-semibold text-brand-dark" aria-hidden>{initials(p.name)}</span>
<span className="min-w-0 flex-1">
<span className="flex flex-wrap items-center gap-1.5 font-medium text-gray-900">
{p.name}
{p.role === "admin" && <span className={`${chip} bg-brand/10 text-brand-dark`}>admin</span>}
{p.status !== "active" && <span className={`${chip} bg-amber-50 text-amber-800`}>{p.status}</span>}
</span>
<span className="block truncate text-sm text-gray-500">{p.email}</span>
</span>
<span className="hidden shrink-0 text-right text-xs text-gray-500 sm:block">{p.twoFactor ? <span className="inline-flex items-center gap-1 text-green-700"><ShieldCheck className="h-3.5 w-3.5" aria-hidden />Two-step</span> : null}<span className="block">{p.lastSignInAt ? `Signed in ${when(p.lastSignInAt)}` : "Never signed in"}</span></span>
<ChevronRight className="h-4 w-4 shrink-0 text-gray-300" aria-hidden />
</button>
</li>
))}
</ul>
</Card>
{open && (
<Card>
<Heading sub={open.email}>{open.name}</Heading>
<dl className="mb-4 grid grid-cols-2 gap-y-1 text-sm">
{open ? (
<Card className="lg:sticky lg:top-20">
<div className="mb-4 flex items-center gap-3">
<span className="flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-brand/10 text-sm font-semibold text-brand-dark" aria-hidden>{initials(open.name)}</span>
<div className="min-w-0">
<h2 className="text-lg font-semibold text-gray-900">{open.name}</h2>
<p className="truncate text-xs text-gray-500">{open.email}</p>
</div>
</div>
<dl className="mb-4 grid grid-cols-2 gap-y-1.5 rounded-lg bg-gray-50 p-3 text-sm">
<dt className="text-gray-500">Phone</dt><dd>{open.phone ?? "—"}</dd>
<dt className="text-gray-500">Email confirmed</dt><dd>{open.emailVerified ? "yes" : "no"}</dd>
<dt className="text-gray-500">Two-step sign-in</dt><dd>{open.twoFactor ?? "off"}{open.twoFactor ? ` (${open.recoveryCodesLeft} codes left)` : ""}</dd>
@@ -126,12 +264,18 @@ function People({ flash }: { flash: Flash }) {
{open.twoFactor && <Button variant="secondary" onClick={() => act(`/admin/people/${open.id}/reset-two-factor`, {}, "Two-step sign-in reset. They'll set it up again when they next sign in, if they need it.")}>Reset two-step sign-in</Button>}
{open.lockedUntil && <Button variant="secondary" onClick={() => act(`/admin/people/${open.id}/unlock`, {}, "Unlocked.")}>Unlock</Button>}
<Button variant="secondary" onClick={() => act(`/admin/people/${open.id}/role`, { role: open.role === "admin" ? "member" : "admin" }, "Role changed.")}>{open.role === "admin" ? "Remove admin" : "Make Accounts admin"}</Button>
<Button variant={open.status === "active" ? "danger" : "secondary"} onClick={() => act(`/admin/people/${open.id}/status`, { active: open.status !== "active" }, open.status === "active" ? "Deactivated and signed out everywhere." : "Reactivated.")}>{open.status === "active" ? "Deactivate" : "Reactivate"}</Button>
<Button variant={open.status === "active" ? "danger" : "secondary"} onClick={() => { if (open.status === "active" && !window.confirm(`Deactivate ${open.name}? They're signed out of every site straight away.`)) return; void act(`/admin/people/${open.id}/status`, { active: open.status !== "active" }, open.status === "active" ? "Deactivated and signed out everywhere." : "Reactivated."); }}>{open.status === "active" ? "Deactivate" : "Reactivate"}</Button>
</div>
<p className="mb-1 text-xs text-gray-500">Roles in each product (an Events supervisor, for example) are set in that product, not here.</p>
<p className="mb-2 mt-4 text-sm font-medium">Recent sign-ins</p>
<ul className="space-y-1 text-sm text-gray-700">{open.signIns.map((s, i) => <li key={i}>{s.type} · {when(s.at)} {s.ip && <span className="text-gray-400">· {s.ip}</span>}</li>)}</ul>
<ul className="space-y-1 text-sm text-gray-700">{open.signIns.map((x, i) => <li key={i}>{x.type} · {when(x.at)} {x.ip && <span className="text-gray-500">· {x.ip}</span>}</li>)}</ul>
{!open.signIns.length && <p className="text-sm text-gray-500">None yet.</p>}
</Card>
) : (
<div className="hidden rounded-xl border border-dashed p-8 text-center text-sm text-gray-500 lg:block">
<Users className="mx-auto mb-2 h-6 w-6 text-gray-300" aria-hidden />
Choose someone to see their account and what you can do for them.
</div>
)}
</div>
);
@@ -141,16 +285,16 @@ function People({ flash }: { flash: Flash }) {
type Deletion = { id: string; status: string; requestedAt: string; products: Record<string, { status: string; product?: string; reason?: string; retryAfter?: string }>; person: { name: string; email: string } };
function Deletions({ flash }: { flash: Flash }) {
function Deletions({ flash, onChange }: { flash: Flash; onChange: (waiting: number) => void }) {
const [items, setItems] = useState<Deletion[]>([]);
const load = useCallback(async () => {
const r = await call<{ items: Deletion[] }>("GET", "/admin/deletions");
if (r.ok) setItems(r.data.items);
}, []);
if (r.ok) { setItems(r.data.items); onChange(r.data.items.filter((x) => x.status === "waiting_approval").length); }
}, [onChange]);
useExternalEffect(() => { void load(); }, [load]);
return (
<Card>
<Heading sub="People who asked to delete their account. They're signed out and can't sign in while this is open.">Deletion requests</Heading>
<Heading icon={<UserX className="h-4 w-4" />} sub="People who asked to delete their account. They're signed out and can't sign in while this is open.">Deletion requests</Heading>
{!items.length && <p className="text-sm text-gray-500">None waiting.</p>}
<ul className="divide-y">
{items.map((d) => (
@@ -189,7 +333,8 @@ function Church({ flash }: { flash: Flash }) {
const nul = (v: FormDataEntryValue | null) => (v ? String(v) : null);
return (
<Card>
<Heading sub="Shared with all the church's products: the sign-in pages, the website and the app use it.">Church profile</Heading>
<Heading icon={<Building2 className="h-4 w-4" />} sub="Shared with all the church's products: the sign-in pages, the website and the app use it.">Church profile</Heading>
{c.branding.logoUrl && <img src={c.branding.logoUrl} alt="The church's logo" className="mb-4 h-12 w-auto rounded border bg-gray-50 p-1" />}
<form onSubmit={async (e) => {
e.preventDefault();
const f = new FormData(e.currentTarget);
@@ -230,7 +375,7 @@ function Linked({ flash }: { flash: Flash }) {
if (!data) return <p className="text-gray-600">Loading…</p>;
return (
<Card>
<Heading sub="Connected products sign people in here. Usually each product connects from its own settings; you can connect from here too.">Linked products</Heading>
<Heading icon={<Link2 className="h-4 w-4" />} sub="Connected products sign people in here. Usually each product connects from its own settings; you can connect from here too.">Linked products</Heading>
{!data.hubConnected && <Notice tone="warning">Accounts isn&apos;t connected to the Hub yet (Licence).</Notice>}
{!data.items.length && <p className="text-sm text-gray-500">The church has no other Cross Code products yet.</p>}
<ul className="divide-y">
@@ -260,7 +405,7 @@ const SETTING_LABELS: Record<string, [string, "bool" | "text" | "secret" | "numb
wawp_access_token: ["WAWP access token", "secret"], wawp_instance_id: ["WAWP instance id", "text"],
};
function Settings({ flash, keys }: { flash: Flash; keys: string[] }) {
function Settings({ flash, keys, title, icon, sub }: { flash: Flash; keys: string[]; title: string; icon: React.ReactNode; sub?: string }) {
const [values, setValues] = useState<Record<string, string | boolean | null> | null>(null);
useExternalEffect(() => {
let alive = true;
@@ -271,6 +416,7 @@ function Settings({ flash, keys }: { flash: Flash; keys: string[] }) {
const defaults: Record<string, boolean> = { signup_enabled: true, two_factor_required_for_admins: true, signin_notices: true };
return (
<Card>
<Heading icon={icon} sub={sub}>{title}</Heading>
<form onSubmit={async (e) => {
e.preventDefault();
const f = new FormData(e.currentTarget);
@@ -281,7 +427,7 @@ function Settings({ flash, keys }: { flash: Flash; keys: string[] }) {
else body[k] = String(f.get(k) ?? "");
}
const r = await call("PUT", "/admin/settings", body);
if (r.ok) flash("success", "Saved."); else flash("error", r.error.message);
if (r.ok) flash("success", `${title}: saved.`); else flash("error", r.error.message);
}}>
{keys.map((k) => {
const [label, kind] = SETTING_LABELS[k]!;
@@ -318,7 +464,7 @@ function NoticeTab({ flash }: { flash: Flash }) {
return (
<div className="space-y-6">
<Card>
<Heading sub={`Version ${current.version}${isBuiltIn ? " (the built-in notice, filled in from the church profile)" : ""}. Publishing a new version asks everyone to read it the next time they sign in.`}>Edit and publish</Heading>
<Heading icon={<FileText className="h-4 w-4" />} sub={`Version ${current.version}${isBuiltIn ? " (the built-in notice, filled in from the church profile)" : ""}. Publishing a new version asks everyone to read it the next time they sign in.`}>Edit and publish</Heading>
{builtIn && !isBuiltIn && (
<p className="mb-4 text-sm text-gray-600">
The built-in notice was rewritten in Accounts 1.3.0 to say more fully what Accounts does.{" "}
@@ -339,7 +485,7 @@ function NoticeTab({ flash }: { flash: Flash }) {
</form>
</Card>
<Card>
<Heading sub="As people will see it.">Preview</Heading>
<Heading icon={<Eye className="h-4 w-4" />} sub="As people will see it.">Preview</Heading>
<h3 className="mb-3 text-base font-semibold text-gray-900">{draft.title}</h3>
<div className="max-h-[32rem] overflow-y-auto rounded-lg border bg-gray-50 p-4"><NoticeText body={draft.body} compact /></div>
</Card>
@@ -357,7 +503,7 @@ function Licence({ flash }: { flash: Flash }) {
if (!s) return <p className="text-gray-600">Loading…</p>;
return (
<Card>
<Heading sub="Accounts is free with the church's other products. Members can always sign in, whatever the licence says.">Licence</Heading>
<Heading icon={<KeyRound className="h-4 w-4" />} sub="Accounts is free with the church's other products. Members can always sign in, whatever the licence says.">Licence</Heading>
<dl className="mb-4 grid grid-cols-2 gap-y-1 text-sm">
<dt className="text-gray-500">Connected to the Hub</dt><dd>{s.connected ? "yes" : "no"}</dd>
<dt className="text-gray-500">Licence</dt><dd>{s.state}</dd>
@@ -388,7 +534,7 @@ function Audit() {
}, []);
return (
<Card>
<Heading>Audit log</Heading>
<Heading icon={<ScrollText className="h-4 w-4" />}>Audit log</Heading>
<ul className="divide-y text-sm">
{items.map((a) => <li key={a.id} className="flex justify-between gap-3 py-2"><span>{a.action.replace(/_/g, " ")} <span className="text-gray-500">({a.actorRole}{a.targetId ? ` · ${a.targetType}` : ""})</span></span><span className="shrink-0 text-gray-500">{when(a.createdAt)}</span></li>)}
{!items.length && <li className="py-2 text-gray-500">Nothing yet.</li>}
@@ -7,9 +7,9 @@ export async function generateMetadata({ params }: { params: Promise<{ section:
return { title: ADMIN_SECTIONS[section as AdminSection]?.title ?? "Admin" };
}
/** One section of admin (1.3.0): /admin/deletions, /church, /linked, … (/admin itself is People). */
/** One section of admin (1.3.0): /admin/people, /deletions, /church, … (1.8.0: /admin itself is the overview). */
export default async function AdminSectionPage({ params }: { params: Promise<{ section: string }> }) {
const { section } = await params;
if (section === "people" || !(section in ADMIN_SECTIONS)) notFound();
if (section === "overview" || !(section in ADMIN_SECTIONS)) notFound();
return <Admin section={section as AdminSection} />;
}
@@ -3,5 +3,5 @@ import { Admin } from "./Admin";
export const metadata = { title: "Admin" };
export default function AdminPage() {
return <Admin />;
return <Admin section="overview" />;
}
@@ -12,7 +12,7 @@ import { useBranding } from "@/components/BrandingProvider";
/** Who's signed in, as the shell shows them (null: a public page such as the privacy notice). */
export type ShellUser = { name: string; email: string; role: "member" | "admin" };
type NavItem = { href: string; label: string; icon: LucideIcon };
export type NavItem = { href: string; label: string; icon: LucideIcon };
export const ACCOUNT_NAV: NavItem[] = [
{ href: "/account", label: "Overview", icon: LayoutDashboard },
@@ -22,19 +22,21 @@ export const ACCOUNT_NAV: NavItem[] = [
{ href: "/account/activity", label: "Activity", icon: Activity },
];
export const ADMIN_NAV: NavItem[] = [
{ href: "/admin", label: "People", icon: Users },
{ href: "/admin/deletions", label: "Deletion requests", icon: UserX },
{ href: "/admin/church", label: "Church profile", icon: Building2 },
{ href: "/admin/linked", label: "Linked products", icon: Link2 },
{ href: "/admin/signin", label: "Sign-in settings", icon: LogIn },
{ href: "/admin/messages", label: "Email and WhatsApp", icon: Mail },
{ href: "/admin/notice", label: "Privacy notice", icon: FileText },
{ href: "/admin/backups", label: "Backups", icon: DatabaseBackup },
{ href: "/admin/jobs", label: "Background jobs", icon: Timer },
{ href: "/admin/licence", label: "Licence", icon: KeyRound },
{ href: "/admin/audit", label: "Audit log", icon: ScrollText },
/** 1.8.0: the admin's sections in groups, as Cross Events' settings, with the overview first. */
export const ADMIN_GROUPS: { title: string | null; items: NavItem[] }[] = [
{ title: null, items: [{ href: "/admin", label: "Overview", icon: LayoutDashboard }] },
{ title: "People", items: [{ href: "/admin/people", label: "People", icon: Users }, { href: "/admin/deletions", label: "Deletion requests", icon: UserX }] },
{ title: "Church", items: [{ href: "/admin/church", label: "Church profile", icon: Building2 }, { href: "/admin/linked", label: "Linked products", icon: Link2 }] },
{
title: "Signing in",
items: [{ href: "/admin/signin", label: "Sign-in settings", icon: LogIn }, { href: "/admin/messages", label: "Email and WhatsApp", icon: Mail }, { href: "/admin/notice", label: "Privacy notice", icon: FileText }],
},
{
title: "System",
items: [{ href: "/admin/backups", label: "Backups", icon: DatabaseBackup }, { href: "/admin/jobs", label: "Background jobs", icon: Timer }, { href: "/admin/licence", label: "Licence", icon: KeyRound }, { href: "/admin/audit", label: "Audit log", icon: ScrollText }],
},
];
export const ADMIN_NAV: NavItem[] = ADMIN_GROUPS.flatMap((g) => g.items);
/** Signs out of Accounts and every site of the church (RP-initiated logout), ending on /signed-out. */
export function signOutHref() {
@@ -53,28 +55,59 @@ function RoleBadge({ role }: { role: ShellUser["role"] }) {
: <span className="inline-block rounded-full bg-gray-100 px-2 py-0.5 text-[11px] font-medium text-gray-600">Member</span>;
}
function NavList({ title, items, active, onNavigate }: { title: string; items: NavItem[]; active: string; onNavigate?: () => void }) {
/** Counts beside a section (deletion requests waiting, say), by its address. */
export type Badges = Record<string, number>;
function NavLinks({ items, active, badges, onNavigate }: { items: NavItem[]; active: string; badges?: Badges; onNavigate?: () => void }) {
return (
<ul className="space-y-0.5">
{items.map((l) => {
const Icon = l.icon;
const on = active === l.href;
const n = badges?.[l.href] ?? 0;
return (
<li key={l.href}>
<Link href={l.href} onClick={onNavigate} aria-current={on ? "page" : undefined}
className={`flex items-center gap-3 rounded-lg px-3 py-2 text-sm transition-colors ${on ? "bg-brand/10 font-medium text-brand-dark" : "text-gray-600 hover:bg-gray-50 hover:text-gray-900"}`}>
<Icon className="h-4 w-4 shrink-0" aria-hidden />
<span className="flex-1">{l.label}</span>
{n > 0 && <span className="rounded-full bg-amber-100 px-1.5 text-xs font-semibold text-amber-900">{n}<span className="sr-only"> waiting</span></span>}
</Link>
</li>
);
})}
</ul>
);
}
function AccountNav({ active, onNavigate }: { active: string; onNavigate?: () => void }) {
return (
<div className="mb-6">
<p className="mb-2 px-3 text-[11px] font-semibold uppercase tracking-wide text-gray-400">{title}</p>
<nav className="space-y-1" aria-label={title}>
{items.map((l) => {
const Icon = l.icon;
const on = active === l.href;
return (
<Link key={l.href} href={l.href} onClick={onNavigate} aria-current={on ? "page" : undefined}
className={`flex items-center gap-3 rounded-lg px-3 py-2 text-sm transition-colors ${on ? "bg-brand/10 font-medium text-brand-dark" : "text-gray-600 hover:bg-gray-50"}`}>
<Icon className="h-4 w-4 shrink-0" aria-hidden />
{l.label}
</Link>
);
})}
</nav>
<p className="mb-2 px-3 text-[11px] font-semibold uppercase tracking-wide text-gray-500">Your account</p>
<nav aria-label="Your account"><NavLinks items={ACCOUNT_NAV} active={active} onNavigate={onNavigate} /></nav>
</div>
);
}
function SidebarContent({ me, active, onNavigate }: { me: ShellUser; active: string; onNavigate?: () => void }) {
function AdminNav({ active, badges, onNavigate }: { active: string; badges?: Badges; onNavigate?: () => void }) {
return (
<nav aria-label="Admin" className="mb-6 space-y-5">
{ADMIN_GROUPS.map((g, i) => (
<div key={g.title ?? i}>
<p className="mb-1.5 px-3 text-[11px] font-semibold uppercase tracking-wide text-gray-500">{g.title ?? "Admin"}</p>
<NavLinks items={g.items} active={active} badges={badges} onNavigate={onNavigate} />
</div>
))}
</nav>
);
}
/**
* The sidebar: who's signed in, then the sections of the part you're in (1.8.0: your account or
* admin, not both at once; the bar across the top switches). In the phone menu, both.
*/
function SidebarContent({ me, active, badges, both, onNavigate }: { me: ShellUser; active: string; badges?: Badges; both?: boolean; onNavigate?: () => void }) {
const inAdmin = me.role === "admin" && active.startsWith("/admin");
return (
<>
<div className="mb-6 flex items-center gap-3 px-1">
@@ -84,8 +117,14 @@ function SidebarContent({ me, active, onNavigate }: { me: ShellUser; active: str
<RoleBadge role={me.role} />
</div>
</div>
<NavList title="Your account" items={ACCOUNT_NAV} active={active} onNavigate={onNavigate} />
{me.role === "admin" && <NavList title="Admin" items={ADMIN_NAV} active={active} onNavigate={onNavigate} />}
{(both || !inAdmin) && <AccountNav active={active} onNavigate={onNavigate} />}
{me.role === "admin" && (both || inAdmin) && <AdminNav active={active} badges={badges} onNavigate={onNavigate} />}
{!both && me.role === "admin" && (
<Link href={inAdmin ? "/account" : "/admin"} className="flex items-center gap-2 rounded-lg border border-dashed px-3 py-2 text-sm text-gray-600 hover:border-brand/40 hover:text-brand-dark">
{inAdmin ? <User className="h-4 w-4" aria-hidden /> : <ShieldCheck className="h-4 w-4" aria-hidden />}
{inAdmin ? "Go to your account" : "Go to admin"}
</Link>
)}
</>
);
}
@@ -95,7 +134,7 @@ function SidebarContent({ me, active, onNavigate }: { me: ShellUser; active: str
* and name across the top, a sidebar of sections, the page on a light grey, and a dark footer.
* Without `me` (a public page) there's no sidebar. `active` is the current section's address.
*/
export function AppShell({ me, active = "", children }: { me: ShellUser | null; active?: string; children: React.ReactNode }) {
export function AppShell({ me, active = "", badges, children }: { me: ShellUser | null; active?: string; badges?: Badges; children: React.ReactNode }) {
const b = useBranding();
const [open, setOpen] = useState(false);
const top = "text-sm border-b-2 pb-0.5 transition-colors";
@@ -131,7 +170,7 @@ export function AppShell({ me, active = "", children }: { me: ShellUser | null;
<button type="button" className="absolute inset-0 bg-black/30" aria-label="Close the menu" onClick={() => setOpen(false)} />
<div className="absolute inset-y-0 left-0 flex w-72 max-w-[85vw] flex-col overflow-y-auto bg-white p-4 shadow-xl">
<button type="button" onClick={() => setOpen(false)} aria-label="Close the menu" className="mb-2 self-end rounded-md p-2 hover:bg-gray-100"><X className="h-5 w-5" /></button>
<SidebarContent me={me} active={active} onNavigate={() => setOpen(false)} />
<SidebarContent me={me} active={active} badges={badges} both onNavigate={() => setOpen(false)} />
<a href="/signed-out" onClick={(e) => { e.preventDefault(); window.location.assign(signOutHref()); }} className="mt-auto flex items-center gap-3 rounded-lg px-3 py-2 text-sm text-gray-600 hover:bg-gray-50">
<LogOut className="h-4 w-4" aria-hidden /> Sign out
</a>
@@ -142,7 +181,7 @@ export function AppShell({ me, active = "", children }: { me: ShellUser | null;
<div className="mx-auto flex w-full max-w-7xl flex-1">
{me && (
<aside className="hidden w-64 shrink-0 border-r bg-white p-4 md:block">
<div className="sticky top-20"><SidebarContent me={me} active={active} /></div>
<div className="sticky top-20"><SidebarContent me={me} active={active} badges={badges} /></div>
</aside>
)}
<main id="main" className="min-w-0 flex-1 p-4 sm:p-6">{children}</main>
@@ -159,12 +198,15 @@ export function AppShell({ me, active = "", children }: { me: ShellUser | null;
);
}
/** A page's title and a line under it, at the top of the main column. */
export function PageTitle({ children, sub }: { children: React.ReactNode; sub?: React.ReactNode }) {
/** A page's title and a line under it, at the top of the main column; with the section's icon. */
export function PageTitle({ children, sub, icon: Icon }: { children: React.ReactNode; sub?: React.ReactNode; icon?: LucideIcon }) {
return (
<div className="mb-6">
<h1 className="text-2xl font-bold text-gray-900">{children}</h1>
{sub && <p className="mt-1 text-sm text-gray-600">{sub}</p>}
<div className="mb-6 flex items-start gap-3">
{Icon && <span className="mt-0.5 hidden h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-brand/10 text-brand sm:flex" aria-hidden><Icon className="h-5 w-5" /></span>}
<div className="min-w-0">
<h1 className="text-2xl font-bold text-gray-900">{children}</h1>
{sub && <p className="mt-1 text-sm text-gray-600">{sub}</p>}
</div>
</div>
);
}
+17 -12
View File
@@ -1,15 +1,20 @@
/** The admin's sections (1.3.0): one address each, in the sidebar (components/AppShell.tsx). */
/**
* The admin's sections: one address each, in groups down the side (components/AppShell.tsx), and a
* tile each on the overview. 1.8.0: /admin is the overview (as Cross Events' admin dashboard);
* People moved to /admin/people.
*/
export const ADMIN_SECTIONS = {
people: { path: "/admin", title: "People", sub: "Everyone with a church account. Roles in each site (an Events supervisor, for example) are set in that site." },
deletions: { path: "/admin/deletions", title: "Deletion requests", sub: "People who asked to delete their account." },
church: { path: "/admin/church", title: "Church profile", sub: "The church's name, logo, colours and contact details, used by all its sites." },
linked: { path: "/admin/linked", title: "Linked products", sub: "The church's sites and apps that sign people in here." },
signin: { path: "/admin/signin", title: "Sign-in settings", sub: "Who may make an account, two-step sign-in for admins, and how long people stay signed in." },
messages: { path: "/admin/messages", title: "Email and WhatsApp", sub: "How Accounts sends sign-in codes, password links and security notices." },
notice: { path: "/admin/notice", title: "Privacy notice", sub: "What people read before they sign in for the first time, and after it changes." },
backups: { path: "/admin/backups", title: "Backups", sub: "Copies of the Accounts database, kept on this server." },
jobs: { path: "/admin/jobs", title: "Background jobs", sub: "What the server does on a schedule. Switch a job on or off or change when it runs: your choice wins over the server's .env and applies straight away." },
licence: { path: "/admin/licence", title: "Licence", sub: "Accounts' connection to Cross Code." },
audit: { path: "/admin/audit", title: "Audit log", sub: "What admins and the church's sites changed here." },
overview: { path: "/admin", title: "Admin", sub: "How Accounts stands, what needs you, and every setting.", tile: "" },
people: { path: "/admin/people", title: "People", sub: "Everyone with a church account. Roles in each site (an Events supervisor, for example) are set in that site.", tile: "Find someone, reset their two-step sign-in, make an admin" },
deletions: { path: "/admin/deletions", title: "Deletion requests", sub: "People who asked to delete their account.", tile: "Approve or cancel people's requests to delete their account" },
church: { path: "/admin/church", title: "Church profile", sub: "The church's name, logo, colours and contact details, used by all its sites.", tile: "Name, logo, colours and contact details for every site" },
linked: { path: "/admin/linked", title: "Linked products", sub: "The church's sites and apps that sign people in here.", tile: "The sites and apps that sign people in here" },
signin: { path: "/admin/signin", title: "Sign-in settings", sub: "Who may make an account, two-step sign-in for admins, and how long people stay signed in.", tile: "Who can make an account, two-step sign-in, staying signed in" },
messages: { path: "/admin/messages", title: "Email and WhatsApp", sub: "How Accounts sends sign-in codes, password links and security notices.", tile: "How sign-in codes and password links are sent" },
notice: { path: "/admin/notice", title: "Privacy notice", sub: "What people read before they sign in for the first time, and after it changes.", tile: "What people read before they first sign in" },
backups: { path: "/admin/backups", title: "Backups", sub: "Copies of the Accounts database, kept on this server.", tile: "Back up now, download a copy, how many to keep" },
jobs: { path: "/admin/jobs", title: "Background jobs", sub: "What the server does on a schedule. Switch a job on or off or change when it runs: your choice wins over the server's .env and applies straight away.", tile: "What runs on a schedule, and when" },
licence: { path: "/admin/licence", title: "Licence", sub: "Accounts' connection to Cross Code.", tile: "The connection to Cross Code" },
audit: { path: "/admin/audit", title: "Audit log", sub: "What admins and the church's sites changed here.", tile: "Who changed what, and when" },
} as const;
export type AdminSection = keyof typeof ADMIN_SECTIONS;
+6
View File
@@ -13,6 +13,12 @@ Write for the person updating servers: what the agent can now do from the Hub, a
contracts version needs it. The developer log is the commit history of apps/agent.
-->
## 1.6.0
- **Demo data for the Church Website.** The Hub (2.25.0 and later) can load one of the Website's
eight demo churches on a demo site, as it already could for Cross Events. Needs Website 1.3.0 on
the site. Cross Events' demo data works as before.
## 1.5.0
- **One product of a church at a time.** Uninstall, export and purge jobs can name products: only
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@crosscode/agent",
"version": "1.5.0",
"version": "1.6.0",
"private": true,
"description": "The server agent: runs the crosscode script for signed jobs from Cross Code Hub, reports stats (docs/AGENT-1.0-PLAN.md)",
"license": "UNLICENSED",
+3 -1
View File
@@ -59,7 +59,9 @@ export function crosscodeArgs(job: agent.AgentJob, opts: { exportFile?: string }
return out;
}
case "seed-demo":
return ["demo", job.args.church, "--profile", job.args.profile, ...(job.args.adminEmail ? ["--admin-email", job.args.adminEmail] : [])];
// 1.6.0: the Website's demo names the product; Events' (no product) keeps its old form.
return ["demo", job.args.church, ...(job.args.product === "website" ? ["website"] : []), "--profile", job.args.profile,
...(job.args.adminEmail ? ["--admin-email", job.args.adminEmail] : [])];
case "export":
if (!opts.exportFile) throw new Error("export needs a file to write");
return ["export", job.args.church, ...(job.args.products ?? []), "--out", opts.exportFile];
+1 -1
View File
@@ -12,7 +12,7 @@ import { paths } from "./paths";
* the tools that are there; anything missing is null rather than an error.
*/
export const AGENT_VERSION = "1.5.0";
export const AGENT_VERSION = "1.6.0";
function run(cmd: string, args: string[], timeoutMs = 10_000): Promise<string | null> {
return new Promise((resolve) => {
+3
View File
@@ -47,6 +47,9 @@ describe("crosscode arguments for each job", () => {
expect(crosscodeArgs(parsed({ type: "seed-demo", args: { church: "hope", profile: "ministry" } }))).toEqual(["demo", "hope", "--profile", "ministry"]);
expect(crosscodeArgs(parsed({ type: "seed-demo", args: { church: "hope", profile: "events", adminEmail: "jane@hope.test" } })))
.toEqual(["demo", "hope", "--profile", "events", "--admin-email", "jane@hope.test"]);
// 1.6.0: the Website's demo.
expect(crosscodeArgs(parsed({ type: "seed-demo", args: { church: "hope", product: "website", profile: "bold-plant" } }))).toEqual(["demo", "hope", "website", "--profile", "bold-plant"]);
expect(crosscodeArgs(parsed({ type: "seed-demo", args: { church: "hope", product: "events", profile: "small" } }))).toEqual(["demo", "hope", "--profile", "small"]);
});
it("env-read and env-set (1.3.0): crosscode env, each value its own argument", () => {
+62
View File
@@ -5,6 +5,68 @@ 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.2] - 2026-11-27
No migrations, no new settings.
### Fixed
- **New demo data no longer leaves the old events on the church's Website.** `set-demo.js`
truncated `FeedEntry`, so the feed never listed the old events in `deleted` and the Website kept
showing them beside the new ones. Now `FeedEntry` is kept and its live entries are marked removed,
the links' `lastGoodAt` is reset (their copies were truncated, so the next fetch is a full one),
and after loading the script publishes the new events, sends `event.changed` to the linked
products and fetches their events back in (`demoFeed`), so the Website's next page load is right.
- **Copies of a linked product's events can't stay forever.** The 15-minute `feed-sync` job and
"Sync now" fetch the whole list and drop copies that aren't in it (`syncLink(link, now, { full: true })`),
so events a sibling lost without listing them in `deleted` (a reseed, a restore) go within 15
minutes. The fetch after an `event.changed` still asks only for what changed.
## [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**
(WHATS-NEW.md says so, and the Hub updates Accounts first) for the brand style. No migrations, no
new settings.
### Added
- **The church's fonts and corners on the public pages.** The backend reads the church profile from
Accounts (`GET /api/church/v1`, kept for 10 minutes; `src/accounts/church.ts`) and the public
pages get it from the new `GET /api/v2/church` (public). `<html>` gets `brandAttributes(style)`
from `@crosscode/ui` and the root layout imports `@crosscode/ui/fonts.css` (self-hosted, so no
font is loaded from another site). Body text and h1–h3 use `--cc-font-body` and
`--cc-font-heading` when the church picked a pairing, and `--radius` follows the corner style
(`soft` is 0.5rem, the same as before). The dashboard and setup screens (`data-cc-staff`) keep
the system fonts and 0.5rem.
- **`church.changed` from Accounts** at `POST /api/church/v1/changed` (signed with the Accounts
link, `LINK_HEADERS`): the profile is fetched again on the next page. Before 3.7.0 this answered
404 and Accounts kept retrying for a week.
- **The shared church footer** (`ChurchFooter`, `@crosscode/ui` 0.3.0) on the public pages when
Accounts is connected: name and logo, service times, address, contact, social links and links
to the church's other sites and the privacy notice, with Terms of Use and cookie settings below.
Without Accounts, and on the dashboard (`<Footer plain />`), the footer is as before.
- **Links to the church's other sites** in the header of the public pages (its Website, later its
App), from the profile's `links`.
### Changed
- `@crosscode/ui` 0.3.0: `ChurchFooter` takes `bottom` (a product's own links after the copyright).
- Frontend: `transpilePackages: ["@crosscode/ui"]`; Tailwind scans `packages/ui/src` and has
`brand` (brand-700) for the shared footer.
## [3.6.1] - 2026-11-20
### Fixed
+18
View File
@@ -12,6 +12,24 @@ 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.2
- **Fixed: events from your Church Website could show twice** after the website's content was
replaced. Cross Events now checks the full list every 15 minutes and removes events that are gone.
## 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
church's Accounts, the event pages use the fonts and corner style picked under Accounts → Admin →
Brand style (as your sign-in pages, and later your church website, do), and a new footer shows your service times,
address, contact details, social links and links to your other sites. The dashboard looks the same
as before.
## 3.6.1
- **Fix:** uploading a logo or site icon under Settings → Branding could fail with "uploaded, but
+5 -1
View File
@@ -63,9 +63,13 @@ previous demo and creates it again.
| The admin account, including its login history, trusted devices and 2FA | Every other user |
| Migration history | Registrations, payments, tickets, scans, coupons, waitlists, consents, cabins, feedback, analytics, audit log |
| Uploaded files on disk (`public/uploads`) | Queued scheduled emails/WhatsApps (`data/scheduled-emails.json`) |
| Links to the church's other products (Accounts, the Website) | Copies of the linked products' events (fetched again straight away) |
| The event feed's history: the old events are listed as removed | |
The wipe and the new data are written in one database transaction. If that fails,
nothing changes. The past events' cashups run straight afterwards, through the same
nothing changes. Since 3.7.2 the script then publishes the new events in the event feed and
tells the linked products (the Church Website), so their next page load shows the new events
and not the old ones, and fetches the linked products' events back in. The past events' cashups run straight afterwards, through the same
code as the cashup screen. If one of those fails, re-run the script.
---
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@crosscode/events-backend",
"version": "3.6.1",
"version": "3.7.2",
"description": "Event Management System Backend",
"main": "src/index.js",
"scripts": {
+42
View File
@@ -79,6 +79,9 @@ const KEEP_TABLES = new Set([
// 3.5.0: the links to the church's other products (Accounts above all: in Accounts mode, without
// its link nobody can sign in). Their feeds are data and go.
'ProductLink', 'LinkNonce',
// 3.7.2: what the feed last published. Its live entries are marked removed instead (clearData),
// so linked products are told the old events are gone, not left showing them beside the new.
'FeedEntry',
]);
const SCHEDULED_EMAILS_PATH = path.resolve(__dirname, '../data/scheduled-emails.json');
@@ -1823,6 +1826,10 @@ async function clearData(tx) {
await tx.$executeRawUnsafe(`UPDATE "User" SET ${[...new Set(userRefs.map(r => `"${r.column}" = NULL`))].join(', ')}`);
for (const table of deleteInstead) await tx.$executeRawUnsafe(`DELETE FROM "${table}"`);
}
// 3.7.2: every event the feed published goes into its `deleted` list, and the copies of linked
// products' events (truncated above) are fetched again in full.
await tx.feedEntry.updateMany({ where: { removedAt: null }, data: { removedAt: new Date() } });
await tx.productLink.updateMany({ data: { lastGoodAt: null } });
// Their password resets, 2FA codes and trusted devices go with them (onDelete: Cascade).
const { count } = await tx.user.deleteMany({ where: { id: { not: admin.id } } });
await tx.securityEvent.deleteMany({ where: { OR: [{ userId: null }, { userId: { not: admin.id } }] } });
@@ -1911,6 +1918,7 @@ async function main() {
clearScheduledEmails();
const pastFinancials = await closePastEvents();
const accounts = await demoAccounts(oldSubs);
const feed = await demoFeed();
const count = (model, where = () => true) => (rows[model] || []).filter(where).length;
console.log(`\nCleared ${cleared.tables} tables and ${cleared.users} users.`);
@@ -1963,6 +1971,40 @@ async function main() {
if (accounts.removed) console.log(`The ${accounts.removed} demo people of the last demo were removed from the church's Accounts.`);
console.log(`Sign-in goes through the church's Accounts: ${accounts.moved} demo people have church accounts with that password${accounts.refused.length ? ` (${accounts.refused.length} couldn't: ${accounts.refused.map(r => `${r.email} ${r.reason}`).join('; ')})` : ''}.`);
}
if (feed && feed.links) console.log(`Connected products: ${feed.told} of ${feed.links} told the events changed${feed.failed ? `; ${feed.failed} couldn't be fetched from (the next poll catches up)` : ''}.`);
}
/**
* The backend's own code: the compiled code (dist/) on a server, the TypeScript through tsx in
* development. With dist/, its database client is a second one, disconnected at the end.
*/
function backendModule(rel) {
const dist = path.join(__dirname, '..', 'dist', `${rel}.js`);
if (fs.existsSync(dist)) {
accountsDb = require(path.join(__dirname, '..', 'dist', 'config', 'db'));
return require(dist);
}
require('tsx/cjs');
return require(`../src/${rel}.ts`);
}
/**
* 3.7.2: the new events published in the feed straight away, linked products (the Website) told,
* so their next page load shows the new events without the old (marked removed in clearData), and
* their events fetched back in. Never fails the demo: the jobs catch up within 15 minutes.
*/
async function demoFeed() {
try {
const { refreshAndNotify } = backendModule('feed/notify');
const { syncAll } = backendModule('feed/sync');
const { told } = await refreshAndNotify(new Date());
const synced = await syncAll(new Date());
const links = await prisma.productLink.count();
return { links, told, failed: synced.failed };
} catch (e) {
console.warn(`[warn] The feed couldn't be refreshed now (${e.message}); the backend's feed jobs catch up within 15 minutes.`);
return null;
}
}
/**
@@ -0,0 +1,67 @@
/**
* The church profile from the church's Accounts (3.7.0, docs/WEBSITE-1.0-PLAN.md §9): the brand
* style (fonts and corners) and what the shared footer shows (service times, address, contact,
* social, the church's other sites). Accounts owns it and serves it publicly at
* `GET /api/church/v1`; this keeps a copy in memory for the public pages (`GET /api/v2/church`).
*
* Fetched again after 10 minutes, or at once when Accounts sends `church.changed`
* (`POST /api/church/v1/changed`, src/links/routes.ts). While Accounts can't be reached the last
* copy is kept and it's tried again after a minute; a site without Accounts has none, and its
* pages look as they always have.
*/
import { CHURCH_PATHS, churchSchema, type Church } from '@crosscode/contracts';
import { accountsLink } from './client';
const FRESH_MS = 10 * 60e3;
const RETRY_MS = 60e3;
const TIMEOUT_MS = 5000;
type Cached = { url: string; church: Church | null; at: number; ok: boolean };
let cached: Cached | null = null;
let pending: Promise<Church | null> | null = null;
async function fetchProfile(accountsUrl: string): Promise<Church> {
const res = await fetch(`${accountsUrl.replace(/\/+$/, '')}${CHURCH_PATHS.profile}`, { headers: { accept: 'application/json' }, signal: AbortSignal.timeout(TIMEOUT_MS) });
if (!res.ok) throw new Error(`Accounts answered ${res.status}`);
const parsed = churchSchema.safeParse(await res.json());
if (!parsed.success) throw new Error(`the profile isn't crosscode.church/1 (${parsed.error.issues[0]?.message ?? 'invalid'})`);
return parsed.data;
}
/** The church's profile, or null when Accounts isn't connected or hasn't answered yet. Never throws. */
export async function churchProfile(): Promise<Church | null> {
let link;
try {
link = await accountsLink();
} catch {
return cached?.church ?? null;
}
if (!link) return null;
const url = link.url;
if (cached && cached.url === url && Date.now() - cached.at < (cached.ok ? FRESH_MS : RETRY_MS)) return cached.church;
if (!pending) {
const last = cached?.url === url ? cached.church : null;
pending = fetchProfile(url)
.then((church) => {
cached = { url, church, at: Date.now(), ok: true };
return church;
}, (e: Error) => {
console.warn('[church] profile not fetched from Accounts:', e.message);
cached = { url, church: last, at: Date.now(), ok: false };
return last;
})
.finally(() => { pending = null; });
}
return pending;
}
/** `church.changed`: the next `churchProfile()` fetches it again (the last copy is shown meanwhile). */
export function churchChanged(): void {
if (cached) cached = { ...cached, at: 0 };
}
/** Tests: start with nothing. */
export function resetChurchProfile(): void {
cached = null;
pending = null;
}
+8 -3
View File
@@ -23,9 +23,14 @@ type Link = { installId: string; product: string; url: string; showEvents: boole
export type SyncResult = { installId: string; ok: boolean; imported?: number; deleted?: number; rejected?: number; skipped?: number; error?: string };
export async function syncLink(link: Link, now = new Date()): Promise<SyncResult> {
/**
* `full` asks for the whole list and drops copies no longer in it: a sibling that loses events
* without listing them in `deleted` (a reseed, a restore) would otherwise leave stale copies
* beside the new ones for good.
*/
export async function syncLink(link: Link, now = new Date(), { full = false }: { full?: boolean } = {}): Promise<SyncResult> {
if (!link.showEvents) return { installId: link.installId, ok: true, imported: 0, deleted: 0 };
const since = link.lastGoodAt ? new Date(link.lastGoodAt.getTime() - OVERLAP_MS) : null;
const since = !full && link.lastGoodAt ? new Date(link.lastGoodAt.getTime() - OVERLAP_MS) : null;
try {
const url = await siblingUrl(link.url, FEED_PATHS.events, since ? { updatedSince: since.toISOString() } : {});
const parsed = parseEventFeed(await callSibling(url, { method: 'GET' }));
@@ -62,7 +67,7 @@ async function upsert(linkId: string, e: CrosscodeEvent) {
export async function syncAll(now = new Date()): Promise<{ links: number; failed: number }> {
const links: Link[] = await prisma.productLink.findMany({ where: { showEvents: true } });
let failed = 0;
for (const link of links) if (!(await syncLink(link, now)).ok) failed++;
for (const link of links) if (!(await syncLink(link, now, { full: true })).ok) failed++;
return { links: links.length, failed };
}
+32 -4
View File
@@ -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<unknown> } | 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<Omit<LinkConnect, 'signature'>>({
@@ -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<string, unknown>, 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);
+22 -1
View File
@@ -4,6 +4,7 @@
*
* GET /api/feed/v1/events?updatedSince= crosscode.event-feed/1 (public; "Publish my events")
* POST /api/feed/v1/changed event.changed from a linked product (LINK_HEADERS)
* POST /api/church/v1/changed church.changed from the church's Accounts (3.7.0)
* POST /api/links/v1/connect crosscode.link/1 link.connect → link.connected
* POST /api/links/v1/disconnect crosscode.link/1 link.disconnect → link.disconnected
*
@@ -11,11 +12,12 @@
*/
import express, { type Request, type Response, type Router } from 'express';
import rateLimit from 'express-rate-limit';
import { eventChangedSchema, FEED_PATHS, LINK_PATHS, LINK_SCHEMA } from '@crosscode/contracts';
import { CHURCH_PATHS, churchChangedSchema, eventChangedSchema, FEED_PATHS, LINK_PATHS, LINK_SCHEMA } from '@crosscode/contracts';
import { LINK_HEADERS, verify } from '@crosscode/contracts/signing';
import { hubInstallId, publishOn } from '../feed/context';
import { feedResponse, lastRefresh, refreshOnce } from '../feed/entries';
import { acceptConnect, acceptDisconnect, LinkError } from './connect';
import { churchChanged } from '../accounts/church';
/* eslint-disable @typescript-eslint/no-require-imports -- CommonJS */
const prisma = require('../config/db');
@@ -74,6 +76,25 @@ export function crossProductRouter(): Router {
}
});
// 3.7.0: the church profile changed in Accounts (its brand style, footer details): fetch it again.
router.post(CHURCH_PATHS.changed.replace(/^\/api/, ''), limiter(300), express.raw({ type: () => true, limit: '16kb' }), async (req, res) => {
try {
const sender = String(req.get(LINK_HEADERS.sender) || '');
const link = sender ? await prisma.productLink.findUnique({ where: { installId: sender } }) : null;
if (!link || link.product !== 'accounts') return fail(res, 404, 'NOT_LINKED', 'This site has no link with that Accounts.');
const rawBody: Buffer = Buffer.isBuffer(req.body) ? req.body : Buffer.from('');
const check = verify({ secret: decrypt(link.secret), timestamp: req.get(LINK_HEADERS.timestamp), signature: req.get(LINK_HEADERS.signature), rawBody });
if (!check.ok) return fail(res, 401, check.code, "The signature doesn't match this link.");
let body: unknown;
try { body = JSON.parse(rawBody.toString('utf8')); } catch { body = null; }
if (!churchChangedSchema.safeParse(body).success) return fail(res, 400, 'INVALID_REQUEST', "That isn't a church.changed message.");
churchChanged();
return res.status(202).json({ accepted: true });
} catch (e) {
return sendError(res, e);
}
});
router.post(LINK_PATHS.connect.replace(/^\/api/, ''), limiter(30), json, async (req, res) => {
try {
return res.json(await acceptConnect(req.body, getClientIp(req)));
+1
View File
@@ -26,6 +26,7 @@ import './resources/ai';
import './resources/feedback';
import './resources/linkedProducts';
import './resources/signIn';
import './resources/church';
const pkg = require('../../package.json') as { version: string };
@@ -0,0 +1,23 @@
import { churchSchema } from '@crosscode/contracts';
import { defineRoute } from '../route';
import { single } from '../paging';
import { churchProfile } from '../../accounts/church';
/**
* The church profile for the public pages (3.7.0, docs/WEBSITE-1.0-PLAN.md §9): its brand style
* (fonts, corners) and the shared footer's details, from the church's Accounts
* (src/accounts/church.ts). null when Accounts isn't connected.
*/
export const getChurch = defineRoute({
method: 'get',
path: '/church',
tag: 'Site',
summary: "The church's profile",
description: "The church profile (crosscode.church/1) from the church's Accounts: name, logo, brand style, service times, contact details, social links and its other sites. null when sign-in doesn't go through Accounts yet. Kept for up to 10 minutes, or until Accounts says it changed.",
access: 'public',
response: single(churchSchema.nullable()),
async handler({ res }) {
res.setHeader('Cache-Control', 'public, max-age=60');
return { data: await churchProfile() };
},
});
@@ -207,7 +207,7 @@ export const syncNow = defineRoute({
async handler({ params }) {
const link = await prisma.productLink.findUnique({ where: { installId: params.installId } });
if (!link) throw notFound('That connected product');
await syncLink(link);
await syncLink(link, new Date(), { full: true });
return { data: await overview() };
},
});
@@ -0,0 +1,140 @@
// 3.7.0 (docs/WEBSITE-1.0-PLAN.md §9): the church profile from Accounts for the public pages (its
// brand style and the shared footer), kept in memory and fetched again on church.changed.
import fs from 'fs';
import path from 'path';
import express from 'express';
import request from 'supertest';
type Link = { installId: string; product: string; url: string; secret: string; updatedAt: Date };
const mockLinks: Link[] = [];
jest.mock('../src/config/db', () => ({
productLink: {
findFirst: async ({ where }: { where: { product: string } }) => mockLinks.find((l) => l.product === where.product) ?? null,
findUnique: async ({ where }: { where: { installId: string } }) => mockLinks.find((l) => l.installId === where.installId) ?? null,
},
}));
jest.mock('../src/jobs', () => ({ enqueueTask: async () => ({ queued: true }) }));
process.env.JWT_SECRET = 'a-test-secret-that-is-long-enough-for-the-encryption';
import { CHURCH_PATHS } from '@crosscode/contracts';
import { LINK_HEADERS, signedHeaders } from '@crosscode/contracts/signing';
import { churchProfile, resetChurchProfile } from '../src/accounts/church';
import { crossProductRouter } from '../src/links/routes';
import { getChurch } from '../src/v2/resources/church';
// eslint-disable-next-line @typescript-eslint/no-require-imports -- CommonJS
const { encrypt } = require('../src/utils/encryption') as { encrypt(v: string): string };
const SAMPLES = path.join(path.dirname(require.resolve('@crosscode/contracts/package.json')), 'samples');
const sample = (name: string) => JSON.parse(fs.readFileSync(path.join(SAMPLES, name), 'utf8'));
const ACCOUNTS_ID = '5c1d2e3f-4a5b-4c6d-8e7f-9a0b1c2d3e4f';
const SECRET = 'link-secret-for-the-test-0123456789';
let profile = sample('church.json');
let answers: (number | 'down')[] = [];
let fetches = 0;
const realFetch = global.fetch;
beforeAll(() => {
global.fetch = (async (url: string) => {
fetches++;
expect(url).toBe(`https://accounts.hope.test${CHURCH_PATHS.profile}`);
const next = answers.shift() ?? 200;
if (next === 'down') throw new Error('connect ECONNREFUSED');
return new Response(JSON.stringify(profile), { status: next, headers: { 'content-type': 'application/json' } });
}) as typeof fetch;
});
afterAll(() => { global.fetch = realFetch; });
beforeEach(() => {
resetChurchProfile();
mockLinks.length = 0;
answers = [];
fetches = 0;
profile = sample('church.json');
jest.spyOn(console, 'warn').mockImplementation(() => {});
});
afterEach(() => { jest.restoreAllMocks(); });
const connectAccounts = () => mockLinks.push({ installId: ACCOUNTS_ID, product: 'accounts', url: 'https://accounts.hope.test/', secret: encrypt(SECRET), updatedAt: new Date() });
function app() {
const a = express();
a.use('/api', crossProductRouter());
return a;
}
function changed(body: object, { from = ACCOUNTS_ID, secret = SECRET } = {}) {
const raw = JSON.stringify(body);
const headers = signedHeaders(LINK_HEADERS, { senderId: from, secret, rawBody: raw });
return request(app()).post(CHURCH_PATHS.changed).set({ 'content-type': 'application/json', ...headers }).send(raw);
}
describe('the church profile', () => {
test('none without Accounts, and nothing is fetched', async () => {
expect(await churchProfile()).toBeNull();
expect(fetches).toBe(0);
});
test("fetched from the church's Accounts, with its brand style, and kept", async () => {
connectAccounts();
const c = await churchProfile();
expect(c?.branding.style).toEqual({ fontPairing: 'warm', corners: 'soft' });
expect(c?.name).toBe(profile.name);
await churchProfile();
expect(fetches).toBe(1);
});
test('a pairing this version doesn\'t know reads as none, so the page keeps its fonts', async () => {
connectAccounts();
profile.branding.style = { fontPairing: 'from-the-future', corners: 'round' };
expect((await churchProfile())?.branding.style).toEqual({ fontPairing: null, corners: 'round' });
});
test('Accounts down: none at first, then the last copy is kept while it is down', async () => {
connectAccounts();
answers = ['down'];
expect(await churchProfile()).toBeNull();
resetChurchProfile();
expect((await churchProfile())?.name).toBe(profile.name);
});
test('a profile that isn\'t crosscode.church/1 isn\'t used', async () => {
connectAccounts();
profile = { hello: 'world' };
expect(await churchProfile()).toBeNull();
});
test('GET /api/v2/church answers it, cacheable for a minute', async () => {
connectAccounts();
const headers: Record<string, string> = {};
const res = { setHeader: (k: string, v: string) => { headers[k] = v; } };
const out = await getChurch.handler({ res } as never);
expect(getChurch.response.safeParse(out).success).toBe(true);
expect((out as { data: { name: string } }).data.name).toBe(profile.name);
expect(headers['Cache-Control']).toBe('public, max-age=60');
});
});
describe('church.changed from Accounts', () => {
test('fetches the profile again (the last copy until then)', async () => {
connectAccounts();
await churchProfile();
profile.branding.style = { fontPairing: 'classic', corners: 'sharp' };
expect((await churchProfile())?.branding.style?.fontPairing).toBe('warm');
const res = await changed(sample('church-changed.json'));
expect(res.status).toBe(202);
expect((await churchProfile())?.branding.style).toEqual({ fontPairing: 'classic', corners: 'sharp' });
expect(fetches).toBe(2);
});
test('refuses a wrong signature, a sender that isn\'t Accounts and a body that isn\'t church.changed', async () => {
connectAccounts();
mockLinks.push({ installId: 'aaaaaaaa-bbbb-4ccc-8ddd-eeeeeeeeeeee', product: 'website', url: 'https://www.hope.test', secret: encrypt(SECRET), updatedAt: new Date() });
expect((await changed(sample('church-changed.json'), { secret: 'not-the-secret-at-all-0123456789' })).status).toBe(401);
expect((await changed(sample('church-changed.json'), { from: 'aaaaaaaa-bbbb-4ccc-8ddd-eeeeeeeeeeee' })).status).toBe(404);
const bad = await changed({ type: 'something.else' });
expect(bad.status).toBe(400);
expect(bad.body.code).toBe('INVALID_REQUEST');
});
});
@@ -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 });
@@ -375,6 +399,16 @@ describe('events from a linked product', () => {
expect(String(global.fetch.mock.calls[0][0])).toContain('updatedSince=');
});
test('a full fetch (the poll) drops copies of events the source lost without saying (a reseed)', async () => {
db.t.productLink.set(WEBSITE_ID, { ...linkRow(), lastGoodAt: NOW });
db.t.importedEvent.set('website:old', { key: 'website:old', linkId: WEBSITE_ID });
const e = sample();
answer(feedOf([e]));
await syncLink(db.t.productLink.get(WEBSITE_ID), NOW, { full: true });
expect(String(global.fetch.mock.calls[0][0])).not.toContain('updatedSince=');
expect([...db.t.importedEvent.keys()]).toEqual([`website:${e.id}`]);
});
test('deleted events go; never re-published in this site\'s own feed', async () => {
db.t.productLink.set(WEBSITE_ID, { ...linkRow(), lastGoodAt: NOW });
const e = sample();
+117
View File
@@ -0,0 +1,117 @@
import path from "path";
import AxeBuilder from "@axe-core/playwright";
import { test, expect, loginAs, seed } from "./fixtures";
// 3.7.0 (docs/WEBSITE-1.0-PLAN.md §9 and §13): with the church's Accounts connected, the public
// pages use the church's fonts and corners from its profile and the shared church footer, as the
// Website and Accounts' own pages do. The dashboard stays as it is. Accounts runs in memory
// (e2e/support/accounts-server.mts); afterwards the link is removed, so the other specs see the
// site as before.
/* eslint-disable @typescript-eslint/no-require-imports -- the backend's own modules, as prepare-db.js uses them */
const backend = path.join(__dirname, "..", "backend");
require(require.resolve("dotenv", { paths: [backend] })).config({ path: path.join(backend, ".env") });
const { Client } = require(require.resolve("pg", { paths: [backend] }));
const { e2eDatabaseUrl } = require("./support/db-url");
const signing = require(require.resolve("@crosscode/contracts/signing", { paths: [backend] }));
const { encrypt } = require(path.join(backend, "src", "utils", "encryption"));
/* eslint-enable @typescript-eslint/no-require-imports */
const ACCOUNTS_API = "http://127.0.0.1:5221";
const ACCOUNTS_ID = "7e2d1c0b-9a8f-4e6d-8c5b-4a3f2e1d0c9b";
const TAGS = ["wcag2a", "wcag2aa", "wcag21a", "wcag21aa", "wcag22aa"];
async function sql(text: string, values: unknown[] = []) {
const client = new Client({ connectionString: e2eDatabaseUrl() });
await client.connect();
try {
return (await client.query(text, values)).rows;
} finally {
await client.end();
}
}
test.describe.serial("the church's brand style and footer", () => {
test.beforeAll(async () => {
const profile = await fetch(`${ACCOUNTS_API}/test/profile`, {
method: "POST",
body: JSON.stringify({
name: "E2E Church",
branding: { style: { fontPairing: "warm", corners: "round" } },
serviceTimes: [{ day: "sunday", time: "09:00", label: "Morning service", campus: null, note: null }],
contact: { email: "office@e2e.test", phone: "+27161234567", whatsapp: null, address: { line1: "1 Church Street", line2: null, suburb: null, city: "Vereeniging", postalCode: "1939" } },
}),
});
expect(profile.ok, await profile.text()).toBe(true);
// Linked to Accounts, as Connect would (the backend reads the profile from this address).
await sql(`DELETE FROM "ProductLink" WHERE product = 'accounts'`);
await sql(
`INSERT INTO "ProductLink" ("installId", product, url, "publicKey", secret, "connectedAt", "createdAt", "updatedAt") VALUES ($1, 'accounts', $2, 'x', $3, now(), now(), now())`,
[ACCOUNTS_ID, ACCOUNTS_API, encrypt(signing.newLinkSecret())],
);
});
test.afterAll(async () => {
await sql(`DELETE FROM "ProductLink" WHERE product = 'accounts'`);
});
test("public pages: the church's fonts, round corners and the shared footer, all from this site", async ({ page }) => {
const elsewhere: string[] = [];
page.on("request", (r) => {
if (r.resourceType() === "font" && !r.url().startsWith("http://localhost:3100/")) elsewhere.push(r.url());
});
// The site keeps the profile for a minute; reload until it's there.
await expect(async () => {
await page.goto("/events");
await expect(page.locator("html")).toHaveAttribute("data-cc-fonts", "warm", { timeout: 1000 });
}).toPass({ timeout: 90_000 });
await expect(page.locator("html")).toHaveAttribute("data-cc-corners", "round");
await expect(page.getByText("E2E Free Evening")).toBeVisible();
const fonts = await page.evaluate(async () => {
await document.fonts.ready;
const h1 = document.querySelector("h1");
return {
body: getComputedStyle(document.body).fontFamily,
heading: h1 ? getComputedStyle(h1).fontFamily : "",
radius: getComputedStyle(document.documentElement).getPropertyValue("--radius").trim(),
loaded: [...document.fonts].filter((f) => f.status === "loaded").map((f) => f.family.replace(/"/g, "")),
};
});
expect(fonts.body).toContain("CC Nunito Sans");
expect(fonts.heading).toContain("CC Fraunces");
expect(fonts.radius).toBe("0.75rem");
expect(fonts.loaded).toContain("CC Nunito Sans");
const footer = page.locator("footer");
await expect(footer.getByRole("heading", { name: "Service times" })).toBeVisible();
await expect(footer).toContainText("Sundays 09:00");
await expect(footer).toContainText("1 Church Street");
await expect(footer.getByRole("link", { name: "+27161234567" })).toHaveAttribute("href", "tel:+27161234567");
await expect(footer.getByRole("link", { name: "Your account" })).toHaveAttribute("href", /127\.0\.0\.1/);
await expect(footer.getByRole("link", { name: "Privacy notice" })).toHaveAttribute("href", "/legal/privacy");
await expect(footer.getByRole("link", { name: "Terms of Use" })).toBeVisible();
await expect(footer.getByRole("button", { name: /cookie/i })).toBeVisible();
await page.goto(`/events/${seed().events.course}`);
await expect(page.getByRole("heading", { name: "E2E Alpha Course" })).toBeVisible();
await expect(page.locator("footer").getByRole("heading", { name: "Service times" })).toBeVisible();
await page.waitForLoadState("networkidle");
const results = await new AxeBuilder({ page }).withTags(TAGS).analyze();
expect(results.violations.map((v) => `${v.id}: ${v.nodes.map((n) => n.target.join(" ")).join(", ")}`)).toEqual([]);
expect(elsewhere).toEqual([]);
});
test("the dashboard keeps its own fonts, corners and footer", async ({ page }) => {
await loginAs(page, "admin");
await page.goto("/dashboard");
await expect(page.locator("[data-cc-staff]").first()).toBeVisible();
await expect(page.locator("main")).toBeVisible();
const look = await page.evaluate(() => ({
body: getComputedStyle(document.body).fontFamily,
radius: getComputedStyle(document.documentElement).getPropertyValue("--radius").trim(),
}));
expect(look.body).not.toContain("CC ");
expect(look.radius).toBe("0.5rem");
await expect(page.locator("footer")).toContainText("All rights reserved");
});
});
+16 -1
View File
@@ -5,11 +5,13 @@
* differs from the Events site's (localhost), so their cookies stay apart as on two domains.
*
* Test helpers: POST /test/link { installId, url, secret } links Events, as Connect would;
* GET /test/code?to=<email> answers the last code emailed to that address.
* GET /test/code?to=<email> answers the last code emailed to that address; POST /test/profile changes
* the church profile (3.7.0, church-brand.spec.ts), as an admin's save in Accounts would.
*/
import http from 'node:http';
import { ed25519PublicToPem, generateEd25519 } from '@crosscode/contracts/signing';
import { createApp } from '../../../accounts/backend/src/app.ts';
import { updateProfile } from '../../../accounts/backend/src/church/profile.ts';
import { createCtx } from '../../../accounts/backend/src/context.ts';
import { loadConfig } from '../../../accounts/backend/src/lib/config.ts';
import { MemoryMessenger } from '../../../accounts/backend/src/lib/messages.ts';
@@ -33,6 +35,19 @@ http.createServer((req, res) => {
res.writeHead(200, { 'content-type': 'text/plain' }).end(messenger.lastCode(to) ?? '');
return;
}
if (req.method === 'POST' && req.url === '/test/profile') {
let body = '';
req.on('data', (c) => { body += c; });
req.on('end', async () => {
try {
const church = await updateProfile(ctx, JSON.parse(body));
res.writeHead(200, { 'content-type': 'application/json' }).end(JSON.stringify(church));
} catch (e) {
res.writeHead(400, { 'content-type': 'application/json' }).end(JSON.stringify({ message: (e as Error).message }));
}
});
return;
}
if (req.method === 'POST' && req.url === '/test/link') {
let body = '';
req.on('data', (c) => { body += c; });
+2
View File
@@ -14,6 +14,8 @@ const nextConfig: NextConfig = {
// The end-to-end tests run their own dev server; a separate build folder keeps it
// from clashing with one already running.
distDir: process.env.NEXT_DIST_DIR || ".next",
// The shared fonts and footer (3.7.0) are TypeScript source.
transpilePackages: ["@crosscode/ui"],
images: {
// (images.domains is deprecated in Next 16.)
remotePatterns: [{ protocol: 'https', hostname: 'images.unsplash.com' }],
+2 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@crosscode/events-frontend",
"version": "3.6.1",
"version": "3.7.2",
"private": true,
"scripts": {
"dev": "next dev",
@@ -12,6 +12,7 @@
"dependencies": {
"@crosscode/contracts": "*",
"@crosscode/seo": "*",
"@crosscode/ui": "*",
"@dnd-kit/core": "^6.3.1",
"@hookform/resolvers": "^5.2.1",
"@radix-ui/react-accordion": "^1.2.11",
@@ -75,7 +75,7 @@ export default function DashboardLayout({ children }: { children: React.ReactNod
// Don't render protected content until auth state is known
if (loading || !user) {
return (
<div className="min-h-screen flex items-center justify-center bg-gray-50">
<div data-cc-staff className="min-h-screen flex items-center justify-center bg-gray-50">
<div className="text-sm text-gray-400">Loading…</div>
</div>
);
@@ -88,7 +88,7 @@ export default function DashboardLayout({ children }: { children: React.ReactNod
// scroll) so the sidebar can be a plain sibling column that never
// scrolls — only the content column (main + footer) scrolls internally.
return (
<div className="h-screen flex flex-col overflow-hidden">
<div data-cc-staff className="h-screen flex flex-col overflow-hidden">
<Navbar />
<LicenceBanner />
<ProviderNotices />
@@ -99,7 +99,7 @@ export default function DashboardLayout({ children }: { children: React.ReactNod
<Sidebar />
<div className="flex-1 min-w-0 flex flex-col overflow-y-auto">
<main className="flex-1 p-6 bg-gray-50">{children}</main>
<Footer />
<Footer plain />
</div>
</div>
</div>
@@ -107,14 +107,14 @@ export default function DashboardLayout({ children }: { children: React.ReactNod
}
return (
<div className="min-h-screen flex flex-col">
<div data-cc-staff className="min-h-screen flex flex-col">
<Navbar />
<LicenceBanner />
<ProviderNotices />
<PrivacyPrompts />
<CommandPalette />
<main className="flex-1 p-6 bg-gray-50">{children}</main>
<Footer />
<Footer plain />
</div>
);
}
+26 -1
View File
@@ -47,7 +47,8 @@
--input: 214.3 31.8% 91.4%;
--ring: 243 75% 59%;
--radius: 0.5rem;
/* The church's corners (3.7.0, @crosscode/ui fonts.css): soft (0.5rem) unless it picked others. */
--radius: var(--cc-radius-sm, 0.5rem);
/* Fallback brand scale (matches the pre-branding-feature default indigo, brand-600 #4F46E5) */
--brand-50: #EEF2FF;
@@ -73,6 +74,30 @@ html {
scroll-behavior: smooth;
}
/*
* The church's fonts (3.7.0, docs/WEBSITE-1.0-PLAN.md §3 and §9): <html> gets
* data-cc-fonts from its brand style in Accounts, and @crosscode/ui/fonts.css sets these
* variables. Without a pairing they're unset and the page keeps Tailwind's system fonts.
* The dashboard and setup screens (data-cc-staff) stay as they are.
*/
@layer base {
body {
font-family: var(--cc-font-body, theme("fontFamily.sans"));
}
h1,
h2,
h3 {
font-family: var(--cc-font-heading, inherit);
font-variation-settings: var(--cc-heading-variation, normal);
}
html:has([data-cc-staff]) {
--cc-font-body: initial;
--cc-font-heading: initial;
--cc-heading-variation: initial;
--cc-radius-sm: initial;
}
}
/*
* Accessibility (WCAG 2.2 AA, 1.50.0): a clear focus ring for keyboard users on every
* focusable element (mouse clicks don't show it), in the brand colour with a white halo
+10 -2
View File
@@ -1,5 +1,7 @@
import type { Metadata } from "next";
import "@crosscode/ui/fonts.css";
import "./globals.css";
import { brandAttributes } from "@crosscode/ui";
import { AuthProvider } from "@/contexts/AuthContext";
import { SiteSettingsProvider } from "@/contexts/SiteSettingsContext";
import { ToastProvider } from "@/components/shared/ToastProvider";
@@ -11,6 +13,8 @@ import { ImpersonationBanner } from "@/components/shared/ImpersonationBanner";
import { SkipLink } from "@/components/layout/SkipLink";
import { resolveToApiOrigin } from "@/lib/api";
import { getServerSettings } from "@/lib/serverSettings";
import { getServerChurch } from "@/lib/serverChurch";
import { ChurchProvider } from "@/contexts/ChurchContext";
import { buildThemeCssVars } from "@/lib/colorScale";
import { appUrl } from "@/lib/siteConfig";
@@ -49,7 +53,7 @@ export async function generateMetadata(): Promise<Metadata> {
}
export default async function RootLayout({ children }: { children: React.ReactNode }) {
const settings = await getServerSettings();
const [settings, church] = await Promise.all([getServerSettings(), getServerChurch()]);
const cssVars = buildThemeCssVars({
primary: settings.primary_color || settings.accent_color,
secondary: settings.secondary_color,
@@ -57,12 +61,15 @@ export default async function RootLayout({ children }: { children: React.ReactNo
});
return (
<html lang="en">
// The church's fonts and corners from Accounts (3.7.0): used by the public pages; the
// dashboard and setup screens keep their own (globals.css, data-cc-staff).
<html lang="en" {...brandAttributes(church?.branding.style)}>
<body>
{cssVars && (
<style id="brand-theme" dangerouslySetInnerHTML={{ __html: `:root{${cssVars}}` }} />
)}
<SkipLink />
<ChurchProvider church={church}>
<SiteSettingsProvider initialSettings={settings}>
<AuthProvider>
<ToastProvider>
@@ -75,6 +82,7 @@ export default async function RootLayout({ children }: { children: React.ReactNo
</ToastProvider>
</AuthProvider>
</SiteSettingsProvider>
</ChurchProvider>
</body>
</html>
+1 -1
View File
@@ -247,7 +247,7 @@ export default function SetupPage() {
};
return (
<div className="min-h-screen bg-gradient-to-br from-brand-50 to-brand-100 flex items-center justify-center p-4">
<div data-cc-staff className="min-h-screen bg-gradient-to-br from-brand-50 to-brand-100 flex items-center justify-center p-4">
<div className={`bg-white rounded-2xl shadow-lg w-full p-8 transition-all ${step === 3 ? "max-w-4xl" : "max-w-lg"}`}>
{/* Heading */}
@@ -1,30 +1,53 @@
"use client";
import Link from "next/link";
import { ChurchFooter } from "@crosscode/ui";
import { appName } from "@/lib/siteConfig";
import { useSiteSettings } from "@/contexts/SiteSettingsContext";
import { useChurch } from "@/contexts/ChurchContext";
import { CookieSettingsButton } from "@/components/shared/CookieSettingsButton";
export const Footer = () => {
/**
* The public pages' footer. With the church's Accounts connected (3.7.0) it's the shared church
* footer (as on the Website and Accounts' pages): name and logo, service times, address, contact,
* social links and the church's other sites, with this site's terms and cookie settings below.
* `plain`: the dashboard's own footer, as before.
*/
export const Footer = ({ plain = false }: { plain?: boolean }) => {
const { settings } = useSiteSettings();
const church = useChurch();
const displayName = settings.org_name || appName;
return (
<>
<footer className="bg-gray-900 text-white py-6 text-center text-sm">
<p>© {new Date().getFullYear()} {displayName}. All rights reserved.</p>
<div className="mt-2 space-x-4">
<Link href="/legal/terms" className="hover:underline text-gray-300">
Terms of Use
</Link>
<Link href="/legal/privacy" className="hover:underline text-gray-300">
Privacy Policy
</Link>
<CookieSettingsButton className="hover:underline text-gray-300" />
</div>
</footer>
{church && !plain ? (
<ChurchFooter
church={church}
current="events"
privacyUrl="/legal/privacy"
bottom={
<>
<Link href="/legal/terms" className="hover:underline">Terms of Use</Link>
<CookieSettingsButton className="hover:underline" />
</>
}
/>
) : (
<footer className="bg-gray-900 text-white py-6 text-center text-sm">
<p>© {new Date().getFullYear()} {displayName}. All rights reserved.</p>
<div className="mt-2 space-x-4">
<Link href="/legal/terms" className="hover:underline text-gray-300">
Terms of Use
</Link>
<Link href="/legal/privacy" className="hover:underline text-gray-300">
Privacy Policy
</Link>
<CookieSettingsButton className="hover:underline text-gray-300" />
</div>
</footer>
)}
{/* Spacer so content isn't hidden behind the fixed mobile bottom nav */}
<div className="h-16 md:hidden" aria-hidden="true" />
</>
);
};
};
@@ -9,6 +9,8 @@ import { BottomNav } from "./BottomNav";
import defaultLogo from "@/app/default_logo.png";
import { appName } from "@/lib/siteConfig";
import { resolveToApiOrigin } from "@/lib/api";
import { productLinks } from "@crosscode/ui";
import { useChurch } from "@/contexts/ChurchContext";
type NavLink = {
href: string;
@@ -20,6 +22,10 @@ export const Navbar = () => {
const { user, loading: authLoading, logout } = useAuth();
const { settings, loading: settingsLoading } = useSiteSettings();
const pathname = usePathname();
const church = useChurch();
// The church's other sites from its profile in Accounts (3.7.0): its Website, later its App.
// Not on the dashboard, which stays as it is.
const otherSites = church && !pathname?.startsWith("/dashboard") ? productLinks(church.links, "events") : [];
const displayName = settings.org_name || appName;
const logoSrc = settings.logo_url ? resolveToApiOrigin(settings.logo_url) : null;
@@ -94,6 +100,11 @@ export const Navbar = () => {
{link.label}
</Link>
))}
{otherSites.map(site => (
<a key={site.href} href={site.href} className="text-sm pb-0.5 border-b-2 border-transparent text-gray-700 transition-colors hover:text-brand-600">
{site.label}
</a>
))}
{/* Auth links are only known once the token has been validated —
rendering nothing here (instead of guessing "logged out") avoids
@@ -0,0 +1,13 @@
"use client";
import React, { createContext, useContext } from "react";
import type { Church } from "@crosscode/contracts";
/** The church profile from Accounts (3.7.0), fetched once by the root layout; null without Accounts. */
const ChurchContext = createContext<Church | null>(null);
export function ChurchProvider({ church, children }: { church: Church | null; children: React.ReactNode }) {
return <ChurchContext.Provider value={church}>{children}</ChurchContext.Provider>;
}
export const useChurch = () => useContext(ChurchContext);
@@ -74271,6 +74271,648 @@
}
}
}
},
"/church": {
"get": {
"tags": [
"Site"
],
"summary": "The church's profile",
"description": "The church profile (crosscode.church/1) from the church's Accounts: name, logo, brand style, service times, contact details, social links and its other sites. null when sign-in doesn't go through Accounts yet. Kept for up to 10 minutes, or until Accounts says it changed.\n\n**Who:** Anyone.",
"operationId": "getChurch",
"parameters": [],
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"data": {
"anyOf": [
{
"type": "object",
"properties": {
"schema": {
"type": "string",
"const": "crosscode.church/1"
},
"customerId": {
"type": "string",
"format": "uuid",
"pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
},
"updatedAt": {
"type": "string",
"format": "date-time",
"pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
},
"name": {
"type": "string",
"minLength": 1,
"maxLength": 200
},
"shortName": {
"anyOf": [
{
"type": "string",
"maxLength": 30
},
{
"type": "null"
}
]
},
"timezone": {
"type": "string",
"pattern": "^[A-Za-z_]+(\\/[A-Za-z0-9_+-]+){0,2}$|^UTC$"
},
"locale": {
"type": "string",
"pattern": "^[a-z]{2,3}(-[A-Z]{2})?$"
},
"branding": {
"type": "object",
"properties": {
"logoUrl": {
"anyOf": [
{
"type": "string",
"maxLength": 2048,
"format": "uri"
},
{
"type": "null"
}
]
},
"iconUrl": {
"anyOf": [
{
"type": "string",
"maxLength": 2048,
"format": "uri"
},
{
"type": "null"
}
]
},
"colours": {
"type": "object",
"properties": {
"primary": {
"type": "string",
"pattern": "^#[0-9a-fA-F]{6}$"
},
"accent": {
"anyOf": [
{
"type": "string",
"pattern": "^#[0-9a-fA-F]{6}$"
},
{
"type": "null"
}
]
}
},
"required": [
"primary",
"accent"
],
"additionalProperties": false
},
"style": {
"type": "object",
"properties": {
"fontPairing": {
"default": null,
"anyOf": [
{
"type": "string",
"enum": [
"classic",
"scholarly",
"editorial",
"impact",
"contemporary",
"friendly",
"warm",
"modern"
]
},
{
"type": "null"
}
]
},
"corners": {
"default": null,
"anyOf": [
{
"type": "string",
"enum": [
"sharp",
"soft",
"round"
]
},
{
"type": "null"
}
]
}
},
"required": [
"fontPairing",
"corners"
],
"additionalProperties": false
}
},
"required": [
"logoUrl",
"iconUrl",
"colours"
],
"additionalProperties": false
},
"campuses": {
"maxItems": 50,
"type": "array",
"items": {
"type": "object",
"properties": {
"slug": {
"type": "string",
"maxLength": 100,
"pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
},
"name": {
"type": "string",
"minLength": 1,
"maxLength": 200
},
"address": {
"anyOf": [
{
"type": "object",
"properties": {
"line1": {
"type": "string",
"minLength": 1,
"maxLength": 200
},
"line2": {
"anyOf": [
{
"type": "string",
"maxLength": 200
},
{
"type": "null"
}
]
},
"suburb": {
"anyOf": [
{
"type": "string",
"maxLength": 100
},
{
"type": "null"
}
]
},
"city": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"province": {
"anyOf": [
{
"type": "string",
"maxLength": 100
},
{
"type": "null"
}
]
},
"postalCode": {
"anyOf": [
{
"type": "string",
"maxLength": 20
},
{
"type": "null"
}
]
},
"country": {
"type": "string",
"pattern": "^[A-Z]{2}$"
},
"geo": {
"anyOf": [
{
"type": "object",
"properties": {
"lat": {
"type": "number",
"minimum": -90,
"maximum": 90
},
"lng": {
"type": "number",
"minimum": -180,
"maximum": 180
}
},
"required": [
"lat",
"lng"
],
"additionalProperties": false
},
{
"type": "null"
}
]
}
},
"required": [
"line1",
"line2",
"suburb",
"city",
"province",
"postalCode",
"country",
"geo"
],
"additionalProperties": false
},
{
"type": "null"
}
]
}
},
"required": [
"slug",
"name",
"address"
],
"additionalProperties": false
}
},
"serviceTimes": {
"maxItems": 100,
"type": "array",
"items": {
"type": "object",
"properties": {
"day": {
"type": "string",
"enum": [
"monday",
"tuesday",
"wednesday",
"thursday",
"friday",
"saturday",
"sunday"
]
},
"time": {
"type": "string",
"pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
},
"label": {
"anyOf": [
{
"type": "string",
"maxLength": 100
},
{
"type": "null"
}
]
},
"campus": {
"anyOf": [
{
"type": "string",
"maxLength": 100,
"pattern": "^[a-z0-9]+(-[a-z0-9]+)*$"
},
{
"type": "null"
}
]
},
"note": {
"anyOf": [
{
"type": "string",
"maxLength": 300
},
{
"type": "null"
}
]
}
},
"required": [
"day",
"time",
"label",
"campus",
"note"
],
"additionalProperties": false
}
},
"contact": {
"type": "object",
"properties": {
"email": {
"anyOf": [
{
"type": "string",
"maxLength": 254,
"format": "email",
"pattern": "^(?:[A-Za-z0-9_'+\\-]+\\.)*[A-Za-z0-9_'+\\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$"
},
{
"type": "null"
}
]
},
"phone": {
"anyOf": [
{
"type": "string",
"pattern": "^\\+[1-9]\\d{6,14}$"
},
{
"type": "null"
}
]
},
"whatsapp": {
"anyOf": [
{
"type": "string",
"pattern": "^\\+[1-9]\\d{6,14}$"
},
{
"type": "null"
}
]
},
"address": {
"anyOf": [
{
"type": "object",
"properties": {
"line1": {
"type": "string",
"minLength": 1,
"maxLength": 200
},
"line2": {
"anyOf": [
{
"type": "string",
"maxLength": 200
},
{
"type": "null"
}
]
},
"suburb": {
"anyOf": [
{
"type": "string",
"maxLength": 100
},
{
"type": "null"
}
]
},
"city": {
"type": "string",
"minLength": 1,
"maxLength": 100
},
"province": {
"anyOf": [
{
"type": "string",
"maxLength": 100
},
{
"type": "null"
}
]
},
"postalCode": {
"anyOf": [
{
"type": "string",
"maxLength": 20
},
{
"type": "null"
}
]
},
"country": {
"type": "string",
"pattern": "^[A-Z]{2}$"
},
"geo": {
"anyOf": [
{
"type": "object",
"properties": {
"lat": {
"type": "number",
"minimum": -90,
"maximum": 90
},
"lng": {
"type": "number",
"minimum": -180,
"maximum": 180
}
},
"required": [
"lat",
"lng"
],
"additionalProperties": false
},
{
"type": "null"
}
]
}
},
"required": [
"line1",
"line2",
"suburb",
"city",
"province",
"postalCode",
"country",
"geo"
],
"additionalProperties": false
},
{
"type": "null"
}
]
}
},
"required": [
"email",
"phone",
"whatsapp",
"address"
],
"additionalProperties": false
},
"social": {
"maxItems": 20,
"type": "array",
"items": {
"type": "object",
"properties": {
"network": {
"type": "string",
"enum": [
"facebook",
"instagram",
"youtube",
"tiktok",
"x",
"spotify",
"whatsapp-channel",
"other"
]
},
"url": {
"type": "string",
"maxLength": 2048,
"format": "uri"
}
},
"required": [
"network",
"url"
],
"additionalProperties": false
}
},
"links": {
"type": "object",
"properties": {
"website": {
"anyOf": [
{
"type": "string",
"maxLength": 2048,
"format": "uri"
},
{
"type": "null"
}
]
},
"events": {
"anyOf": [
{
"type": "string",
"maxLength": 2048,
"format": "uri"
},
{
"type": "null"
}
]
},
"app": {
"anyOf": [
{
"type": "string",
"maxLength": 2048,
"format": "uri"
},
{
"type": "null"
}
]
},
"accounts": {
"type": "string",
"maxLength": 2048,
"format": "uri"
}
},
"required": [
"website",
"events",
"app",
"accounts"
],
"additionalProperties": false
}
},
"required": [
"schema",
"customerId",
"updatedAt",
"name",
"shortName",
"timezone",
"locale",
"branding",
"campuses",
"serviceTimes",
"contact",
"social",
"links"
],
"additionalProperties": false
},
{
"type": "null"
}
]
}
},
"required": [
"data"
],
"additionalProperties": false
}
}
}
}
}
}
}
},
"components": {
+125
View File
@@ -7760,6 +7760,28 @@ export interface paths {
patch?: never;
trace?: never;
};
"/church": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
/**
* The church's profile
* @description The church profile (crosscode.church/1) from the church's Accounts: name, logo, brand style, service times, contact details, social links and its other sites. null when sign-in doesn't go through Accounts yet. Kept for up to 10 minutes, or until Accounts says it changed.
*
* **Who:** Anyone.
*/
get: operations["getChurch"];
put?: never;
post?: never;
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
}
export type webhooks = Record<string, never>;
export interface components {
@@ -40739,4 +40761,107 @@ export interface operations {
};
};
};
getChurch: {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
requestBody?: never;
responses: {
/** @description OK */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
data: {
/** @constant */
schema: "crosscode.church/1";
/** Format: uuid */
customerId: string;
/** Format: date-time */
updatedAt: string;
name: string;
shortName: string | null;
timezone: string;
locale: string;
branding: {
logoUrl: string | null;
iconUrl: string | null;
colours: {
primary: string;
accent: string | null;
};
style?: {
/** @default null */
fontPairing: ("classic" | "scholarly" | "editorial" | "impact" | "contemporary" | "friendly" | "warm" | "modern") | null;
/** @default null */
corners: ("sharp" | "soft" | "round") | null;
};
};
campuses: {
slug: string;
name: string;
address: {
line1: string;
line2: string | null;
suburb: string | null;
city: string;
province: string | null;
postalCode: string | null;
country: string;
geo: {
lat: number;
lng: number;
} | null;
} | null;
}[];
serviceTimes: {
/** @enum {string} */
day: "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday" | "sunday";
time: string;
label: string | null;
campus: string | null;
note: string | null;
}[];
contact: {
email: string | null;
phone: string | null;
whatsapp: string | null;
address: {
line1: string;
line2: string | null;
suburb: string | null;
city: string;
province: string | null;
postalCode: string | null;
country: string;
geo: {
lat: number;
lng: number;
} | null;
} | null;
};
social: {
/** @enum {string} */
network: "facebook" | "instagram" | "youtube" | "tiktok" | "x" | "spotify" | "whatsapp-channel" | "other";
/** Format: uri */
url: string;
}[];
links: {
website: string | null;
events: string | null;
app: string | null;
/** Format: uri */
accounts: string;
};
} | null;
};
};
};
};
};
}
@@ -0,0 +1,19 @@
import type { Church } from "@crosscode/contracts";
import { API_BASE } from "@/lib/api";
/**
* The church profile from the church's Accounts (3.7.0), through the backend's
* `GET /api/v2/church`: the brand style for `<html>` and the shared footer. null when Accounts
* isn't connected or the backend can't be reached, and the pages look as they always have.
* Fetched the same way as getServerSettings, so Next dedupes it within a request.
*/
export async function getServerChurch(): Promise<Church | null> {
if (!API_BASE) return null;
try {
const res = await fetch(`${API_BASE}/api/v2/church`, { next: { revalidate: 60 } });
if (!res.ok) return null;
return ((await res.json())?.data as Church | null) ?? null;
} catch {
return null;
}
}
+4
View File
@@ -2,6 +2,8 @@
module.exports = {
content: [
"./src/**/*.{js,ts,jsx,tsx}",
// The shared footer (3.7.0)
"../../../packages/ui/src/**/*.{ts,tsx}",
],
theme: {
extend: {
@@ -47,6 +49,8 @@ module.exports = {
// colorScale.ts's buildBrandScale + globals.css for the static
// fallback defaults used when no setting is saved yet).
brand: {
// `brand` alone (the shared footer's links, @crosscode/ui)
DEFAULT: "var(--brand-700)",
50: "var(--brand-50)",
100: "var(--brand-100)",
200: "var(--brand-200)",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@crosscode/events",
"version": "3.6.1",
"version": "3.7.2",
"main": "index.js",
"scripts": {
"dev:backend": "cd backend && npm run dev",
+2
View File
@@ -0,0 +1,2 @@
# this install's PM2 config (made from ecosystem.config.example.cjs by the crosscode script)
/ecosystem.config.cjs
+368
View File
@@ -0,0 +1,368 @@
# Changelog — Church Website
## [1.6.1] — 2026-11-27
No migration, no new environment settings.
### Fixed
- **Events from Cross Events no longer show twice after Events is reseeded.** After the first
fetch, the Website only asked for what changed (`?updatedSince=`) and dropped a copy only when
the feed listed it in `deleted`. A reseed (or a restore) gives every event a new id without
listing the old ones, so the old copies stayed beside the new. The 15-minute poll and "Sync now"
now fetch the whole list and drop copies that aren't in it (`syncLink(…, { full: true })`); the
fetch after an `event.changed` still asks only for what changed.
- **Loading a demo (`npm run demo`, `crosscode demo … website`) tells Cross Events.** The old
published events go into the feed's `deleted` (`FeedRemoval`) and linked products get an
`event.changed`, so Events drops its copies straight away instead of showing them beside the
new ones.
### Changed
- **The header's links to the church's other sites say so:** "Events site" with an external-link
icon (title "Our separate site"), instead of "Events", which looked like a second link to this
site's own Events page.
## [1.6.0] — 2026-11-27
No migration, no new environment settings.
### Changed
- **The demo church has photos** instead of the generated "hills and sun" illustration that
stood in for every picture. 104 stock photos from Unsplash (free under the Unsplash License;
credits in `backend/demo-photos/CREDITS.md` and `photos.json`), 12 MB of WebP in
`backend/demo-photos/`. Each demo profile has its own set (`photos` in `src/demo/seeds.ts`): a
stone parish church, a city spire, a worship night, a school hall, a family table, farmland, a
coffee table, a campus. The ministry pictures match what they are (Sunday school, choir, soup
kitchen, students). Acacia Hill (a template on its own) gets an acacia at sunrise. The people
are the photographers' models.
- **Every leader has a portrait** (before: only the first, so the team showed three empty
circles), named for them in its alt text (`photos.team`).
- **The demo's events have pictures** (`photos.events`; before: the grey placeholder on event
cards). Photos that compress well where an event page shows them large (the picnic is 75 KB at
960 px, not the 170 KB of the busier one), so the event pages stay at Lighthouse 90+.
- **The demo's messages have photos** (`photos.messages`: a pulpit, an open Bible, a
microphone, a preacher who matches the speaker) instead of the stand-in video's thumbnail.
`Message.thumbnailUrl` set to one of the site's own uploads (`/api/uploads/…`) now comes before
the YouTube thumbnail (`messageThumbnail`); admins and the YouTube feed store YouTube's address
there, which is still never used, so nothing changes for a church's own messages.
- Demo photos become media assets the way an upload does (`processImage`: 480, 960 and 1600 px
in WebP and JPEG), so demo sites serve responsive images. Each photo is processed once per
machine (`<tmp>/crosscode-website-demo/`, made in a folder of its own and renamed into place)
and copied into `<uploads>/demo/`. Without `demo-photos/`, the illustration still stands in.
- e2e: the fake YouTube thumbnail is one of the demo photos.
### Fixed
- Photos in small frames are fetched at their size, not the screen's: Community's collage hero
(fixed 10–16rem frames), the collage row in the other templates (a third of the width), the
team's portraits (12rem, 20rem featured) and the ministry cards (a quarter or a third of the
width) say so in `sizes`. A phone fetched the 960 or 1600 px photo for each before.
## [1.5.0] — 2026-11-27
No migration, no new environment settings.
### Added
- **Backups of the photos and files** (`src/backups/uploads.ts`): the nightly `backup` job (and
Back up now) makes, after the database backup, a snapshot of the uploads in
`backend/backups/uploads-YYYYMMDD-HHMMSS/`. A file the same as in the last snapshot (size and
time) is a hard link to it; the rest is copied, keeping its time. Uploads never change once
made, so after the first full copy each night costs only the new files, and each snapshot is
still a real copy: deleting or damaging a file in `uploads/` leaves the snapshots alone.
`.thumbnails` and other dot entries are left out. Built in a `.uploads-…-partial` folder and
renamed when complete (a leftover partial is removed on the next run). Refused before copying
anything when the disk hasn't room for what's new. Each holds a `.snapshot.json` (files, bytes,
new files, new bytes). The newest `backup_retain_count` are kept, as the database backups.
Off with `backup_uploads` = false; the last failure in `backup_uploads_last_error`. To put
them back: `cp -a backups/uploads-…/. uploads/` as the site's user.
- **Admin → Backups:** "Include the photos and files" (saved with the other backup settings), the
snapshots (when, files, size, new since the one before), and their last failure. Back up now
makes both and says if only the database worked.
### Changed
- The `backup` job is "Backup: the database, and the photos and files". The database backup is
made even when the uploads' fails; the job then fails, so its run and the Hub show it.
## [1.4.0] — 2026-11-27
No migration: pg-boss makes its own schema (`pgboss_website`) on first start, as in Accounts. New
dependencies `pg-boss` and `cron-parser`. Needs `pg_dump` on the server (it's there: the
crosscode script uses it for the backups before updates).
### Added
- **Database backups** (`src/backups/backups.ts`, as Accounts 1.3.0): a gzipped `pg_dump` into
`backend/backups/` every night at 02:20 (after Accounts' at 02:00 on the same server) and when an
admin asks; the newest 14 kept (`backup_retain_count`), nightly on by default
(`backup_nightly`), the last failure in `backup_last_error`. Same names as the crosscode
script's backups before updates (`website-YYYYMMDD-HHMMSS.sql.gz`), so the list shows both. A
dump that fails part-way leaves no file. The database only: the uploads aren't in it (as Events).
- **Admin → Backups** (Owners and Admins): back up now, download one (audited, never cached), turn
nightly backups off, how many to keep. `GET /api/v1/admin/backups`, `POST …/backups/run`,
`PUT …/backups/settings`, `GET …/backups/:file/download`.
- **Background jobs on pg-boss** (`src/jobs.ts`, as Accounts 1.4.0): `backup`, `hub-heartbeat`
(every 15 minutes), `event-feed` (every 15 minutes) and `youtube` (hourly). One run per
schedule however many processes run; timers in the process if the queue can't start;
`JOBS_ENABLED=false` turns them all off. Per job: its .env flag (`BACKUP_ENABLED`,
`HUB_HEARTBEAT_ENABLED`, `FEED_JOB_ENABLED`, `YOUTUBE_JOB_ENABLED`) and `JOB_SCHEDULE_<NAME>`.
- **Admin → Background jobs** (Owners and Admins): each job's schedule, next run and last runs;
switch it on or off, change its schedule (kept in `job_overrides`, winning over the .env, live
at once), or run it now. Audited (`job_settings_changed`, `job_run`).
### Changed
- **The heartbeat reports the newest backup** (`lastBackupAt`; before always null, so the Hub
showed "No backup reported" on every Website) **and the real job mode and failed runs in the
last 24 hours** (before always "queue" and 0).
- The heartbeat, the event feed and YouTube were plain timers (`startHeartbeats`,
`startFeedSync`, `startYoutubeSync`, removed); they're jobs now. The first event-feed and
YouTube runs are on their schedule rather than 20 and 30 seconds after a start.
## [1.3.0] — 2026-11-27
No migration, no new environment settings. Needs contracts 1.19.0 (in this checkout).
### Added
- **Eight demo churches**, two per template, for the Hub's demo sites (Hub 2.25.0, agent 1.6.0,
`crosscode demo <church> website --profile <p>`): `heritage-parish`, `heritage-city`,
`bold-youth`, `bold-plant`, `community-family`, `community-town`, `clean-modern`,
`clean-campus` (`src/demo/seeds.ts`, ids from contracts `agent.WEBSITE_DEMO_PROFILES`). Each is
its own kind of church: home page, Plan your visit, About, Give, four ministries, four leaders, a
message series with three messages, and three upcoming events. The second of each template starts
on the template's second recommended variant of every homepage section and its second header, so
the eight show every recommended look.
- **They keep the organisation settings:** a profile replaces the content only. The church's
profile (from Accounts, else `church_profile_local`) stays, the copy names the church
(`{name}`, `{short}`, `{city}`) and the illustrations use its colours. The site settings, the
site icon (`favicon_media_id` and its picture) and the admins stay. Acacia Hill's profile is
saved only on a site with no profile at all, so it still has a name. Slug history and preview
links go with the old content.
- `npm run demo -- --profile <p> [--force]` and `--list`. `--template <t>` alone still loads the
Acacia Hill development church exactly as before (its profile too), so the e2e suite and its
screenshots are unchanged.
## [1.2.0] — 2026-11-27
No migration, no new environment settings. Its first start on an existing site adds the missing
fixed pages (below).
### Fixed
- **A new install had no pages**, so its home page (and the live preview of it) showed only the
header and footer whatever was chosen under Template and style, and Plan your visit, About, Give,
Contact and the rest didn't exist. Only `npm run demo` made pages. Now the backend adds the fixed
pages at startup (`src/site/starter.ts`) with starter text: Home with every homepage section,
Plan your visit, About us, Ministries, Leadership, Events, Messages, Give, Contact, and Terms and
Safeguarding (footer links, not in the menu; WEBSITE-1.0-PLAN §2). All of them while a site has
none of them (pages it made itself move after them; an address already taken is skipped), else
only a missing home page. A removed page isn't brought back. They're drafts, published with the
site; the audit log says "Added the starter pages". Found on cross-demo2.
- **Template and style → Home page layout:** the Latest message's Card layout had no name.
- **Media picker:** the "No image" placeholder had too little contrast (WCAG AA).
### Added
- **Site icon** (Settings): a picture from the media library as the favicon, live at once
(setting `favicon_media_id`; `favicon` in the site content). Without one the site uses the
church's icon from its profile, else a default: the church's initial on its brand colour (a cross
before the church is known). Every page links `/site-icon?v=…`, which redirects to the icon or
serves the default SVG; the version changes with the icon.
## [1.1.0] — 2026-11-26
No migration, no new settings, no backend changes. The admin redesigned as Cross Events' admin
dashboard and settings. Adds `lucide-react` (the version Accounts uses).
### Added
- **Steps to the first publish** across the top of every admin page until the site is live (from
the setup checklist): each step is a link, done ones are ticked, "Next" goes to the first one to
do, and it folds to one line (remembered in the browser). It updates after every save.
- **A live preview beside the page editor** (home and custom pages) and Template and style: the
page at computer or phone width, scaled to fit, reloaded on each save at the same scroll position.
It folds to a tab on the right (remembered); on phones it's a Preview button that opens it full
screen. It shows drafts without the preview cookie: a request from a frame
(`Sec-Fetch-Dest: iframe`) with an admin session reads the drafts, so the live site in another
tab stays live. Links inside it load in full so they stay on drafts. `/preview/start` takes
`?to=` (a site path only) to open the full preview on that page.
### Changed
- **The admin's frame:** a sidebar with icons in groups (Your site, Content, Go live, Team), a
drawer on phones, and a bar across the top with the changes not published, Preview and who's
signed in. Publish shows the number of changes waiting.
- **The dashboard** as Cross Events': a welcome, four cards (site, changes waiting, storage, last
edit), a tile for every part of the admin, and recent edits.
- **The page editor** has tabs, Content and Page details (title, address, menu, search and
sharing); blocks are cards with a summary, icon buttons to move, hide and remove (asks first), and
"Add a block" is a grid of tiles. **Template and style** has tabs: Template, Home page layout,
Style. Every admin page has its icon.
## [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:<web port>`, 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
- **The messages' thumbnails come from the site** (WEBSITE-1.0-PLAN §7): they loaded from YouTube
(`i.ytimg.com`) with the page, so every visitor was in touch with YouTube before pressing play.
The backend now fetches a message's thumbnail once and keeps it (`/api/thumbnails/<id>.jpg`,
kept in `uploads/.thumbnails/`, not counted as storage and left out of the export); only the
site's own messages' videos are fetched, and only a JPEG is kept. The messages page asks for the
first one from the `<head>` (it's the largest thing on screen), and the e2e checks that nothing
is asked of YouTube or Spotify until play is clicked.
- **Calendar events' dates** read "Sun (month: November)": a weekday and month without a day is
printed that way by `Intl`. Now "Sun · November".
- **The variant screenshots no longer flake** (e2e only): a section starting at a fractional
position came out a pixel taller or shorter from run to run. The header's and each section's
height is rounded up before the screenshot; the baselines were taken again with it.
## [1.0.0] — 2026-11-26
### Added
- The app's skeleton (WEBSITE-1.0-PLAN §1): an Express + Prisma backend with `/api/health` and
`/api/v1/site/status` (Coming soon until the first publish), the content model and its first
migration, the section variants per template (§3, decision 16) with the template switch rules, and
a Next.js frontend with the Coming soon page, an admin placeholder and `robots.txt`.
- **Signing in to the admin through the church's Accounts** (§10), as Cross Events 3.x: the Hub
client (protocol v2, product `website`, registers from `HUB_LICENCE_KEY`, heartbeats with
aggregate counts), links (`crosscode.link/1`; the Website connects itself to the church's Accounts
once the Hub lists it), `/api/auth/signin`, `/callback`, `/me`, `/signout` (then Accounts'
sign-out), back-channel logout and Accounts' calls (`user.updated`, `user.export`,
`user.deleted`). The Website keeps its own session (`ccw_session`, only a hash stored) and its own
roles; the **first Owner** is whoever signs in with the Hub's admin email (`HUB_ADMIN_EMAIL`,
verified in Accounts) while the site has none. Owners and Admins sign in with a second step
(`two_factor_required_for_admins`, on by default); asked of Accounts once, then explained.
- **The four templates and the public site** (§3, §5, §6): Heritage, Bold, Community and Clean,
each drawing all 26 section variants its own way, with its headers, homepage order and style
settings (section colour, spacing, buttons, image treatment). The church's colours are made safe
by the backend (`site/palette.ts`: tints, shades and text colours checked against WCAG AA, with a
note for the admin when one is changed); fonts and corners come from its shared brand style, else
the template's suggestion. Pages: home, every page kind (visit, about, ministries, leadership,
events, messages, give, contact, custom) with its blocks, simple event pages, a real 404,
Coming soon from the church profile, `sitemap.xml` and `robots.txt`. Every page has a title,
description, canonical, Open Graph and one `<h1>`; home and contact have the church's JSON-LD.
Messages load YouTube (youtube-nocookie) or Spotify only when clicked; maps are OpenStreetMap.
- **Publishing** (`site/snapshot.ts`): Publish copies the working copy into a numbered version;
visitors see the latest (`GET /api/v1/site/content`, with live messages and events and the church
profile from Accounts, kept 10 minutes). Section data is checked per type (`site/sections.ts`); a
section that doesn't fit is left out, never shown broken. Uploads are served from
`/api/uploads/` (SVGs sandboxed).
- **The demo church** (`npm run demo -- --template <id>`): Acacia Hill Church, fictional, with
illustrated images; refuses to replace a site its admins published unless `--force`.
- **End to end** (`npx playwright test` in apps/website, no database, a production build): every
template's pages pass axe (WCAG 2.2 AA) and the SEO basics, with screenshots at phone and desktop in
`e2e/screens/`; the admin's flows (edit, preview, publish; discard; a shared link, revoked;
restore; a template switch; a Viewer; signing in from a deep admin page) and axe on every admin
screen.
- **The release checks** (§13): **every section variant in every template** (`e2e/variants.spec.ts`:
26 × 4, axe on each, and 312 screenshots at phone, tablet and desktop compared with the last
baselines, kept on the machine that runs them, not in git); **Lighthouse on a phone**
(`e2e/lighthouse.spec.ts`: home, an event and the messages in each template, the median of three
runs with the CPU slowdown calibrated to the machine: SEO 100, accessibility 95+, performance
90+); and **the same suite on real Postgres**
(`E2E_DATABASE_URL=postgresql://…/<name>_e2e`: the database made again, the migrations applied with
`prisma migrate deploy`). The e2e server's clock is frozen, so the demo's dates are the same every
run.
- **The map loads only once it's on screen** (the With map service times): until then, a link to
it. The iframe's own lazy loading fetched OpenStreetMap's 300 KB script with the page on a phone,
and told OpenStreetMap about every visitor. **The messages page's first thumbnail isn't lazy**
(it's the largest thing on screen), and the page connects to its host at once.
- **Contrast on Bold** (found by the variant checks): the service times' notes on Bold's dark panel
(Panel and With map), and the dates of the Calendar events on a dark band, are light now
(`cc-dark` on the panel; `cc-brand-text`, which the dark rules can override, for the dates).
- **The admin** (§4, §10): a dashboard with the setup checklist, pending changes, storage and notes
about the church's colours; Template and style (the template, each homepage section's layout with
the recommended ones first, the homepage order, the style settings); Pages (details, search
engine title and description with a search result preview, the home page's sections, other pages'
blocks: add, move, hide, remove; custom pages); Ministries and Leadership; the media library
(uploads checked by their bytes, alt text, storage; **uploads stop when storage is full**); and
Publish and history. Roles: a Viewer reads, an Editor and above changes and publishes, a Ministry
leader edits only their own ministry. Every change comes from the site itself (same origin).
- **Drafts, preview and publish** (§4): every change is a draft; the pending list says what changed,
who and when, and any one can be **discarded**; one **Publish** for the whole site, with a note;
every version is kept and any can be **restored** into the working copy (each version keeps the
working copy's rows, never sent to visitors). The **preview** shows the working copy on the site's
own addresses, fully clickable, with a bar above the page (phone / tablet / desktop width, Back to
editing, Publish); a **shared preview link** works signed out for 7 days or until revoked, and
can't change anything. Publish refreshes the public pages at once (`WEBSITE_CONTENT_CACHE_SECONDS`,
30 by default, is how long they're kept otherwise).
- **People** (§10): Owners and Admins add someone by email (their account comes from the church's
Accounts through `people.ensure`, with a "choose your password" email when it's new), change
roles and remove access. Only an Owner touches Owners; nobody changes themselves; a lower role or
removal ends that person's sessions at once. A Ministry leader is tied to their ministry.
- **Messages** (§7): from the church's YouTube channel or playlist automatically (YouTube's public
feed, every hour, no API key; each new video goes live by itself), or by hand with a YouTube or
Spotify link; speaker, series, passage and notes; publish, unpublish, hide. A video is never
added twice; one from the feed can only be hidden (deleting it would bring it back).
- **Simple events** (§8): date and time or all day, place, description, photo and an optional
link; publish, cancel, remove. Both publish on their own, not with the site (decision 9).
- **Photos made safe and fast** (§3): every upload is turned upright, **stripped of its metadata**
(a phone photo can carry where it was taken), kept at most 2400 px wide, and saved at 480, 960
and 1600 px in WebP and JPEG; the pages pick the size the screen needs (`<picture>`, `srcset`).
Every file counts towards storage; a photo the library can't read is refused. (sharp 0.35:
prebuilt binaries, no build step on the servers.)
- **The event feed** (§8, roadmap §4), both ways, as Cross Events 2.4: **Publish my events** serves
the Website's published simple events as `crosscode.event/1` (`GET /api/feed/v1/events`,
`?updatedSince=`; unpublished and removed ones in `deleted` for 90 days) and tells linked siblings
with a signed `event.changed`; **Show events from** fetches each linked sibling's feed every 15
minutes and at once on its signed `event.changed`, keeping read-only copies that link back to the
origin (for registering), only of events that really come from that sibling, one bad event
skipped, and the last good copy kept when a fetch fails. Admin → **Linked products**: Connect,
Disconnect, Show events from, Publish my events, Check now. Accounts' signed `church.changed` now
fetches the church profile again at once.
- **Church details** (§2, decision 10): the church's name, colours, fonts and corners, logo,
service times, contact and social links, saved through Accounts' `church.update` as the signed-in
admin; live at once on all the church's sites (not drafts), refused when someone changed them in
between.
- **Settings** (§10): Google Search Console and Bing verification codes (shown on the home page),
the Coming soon line, and the menu's order. **Audit log** for Owners and Admins; **recent edits**
on the dashboard.
- **Search engines** (§11): a share image made from the church's colours and name for pages without
their own; `Event` structured data on the Website's own event pages, `VideoObject` /
`PodcastEpisode` for messages, `BreadcrumbList` on every page but home; a page's old address
sends people on to the new one (permanent redirect) once published.
- **Two editors at once** (§4): a save that someone else's save overtook is refused, saying who, and
nothing is overwritten. **A Ministry leader's events**: an event can belong to a ministry; its
Ministry leader adds and changes it, an Editor publishes it. **Choose your template** with the
church's own content: each template can be previewed on the real site before it's chosen.
- A simple event with an outside link still has its own page here, with a "More information"
button (its address in the event feed).
- **Get more storage** (§10, decision 12; contracts 1.18.0, Hub 2.22.0): an Owner or Admin asks
under Media library (5 GB steps); the request goes to the Hub, which emails Cross Code, and the
new limit arrives with a heartbeat. The heartbeat now reports the licence's storage limit, so the
Hub emails the church at 80% and when it's full.
- The admin page signs people in and out; `/auth/problem` explains a refused sign-in.
- **The church's export** (`scripts/export-church.ts`): `export.json` in
`crosscode.church-export/1` with its `website` part, for `crosscode export` and uninstall.
- **`crosscode`:** `scripts/products/website.sh` (the same hooks as Accounts, ports 5300 / 3300,
uploads in the export), `crosscode add <church> website` (needs the church's Accounts; served on
`www.<address>`, or the Cross Code address itself), and the installer shared by Accounts and the
Website (`install_app`).
+28 -1
View File
@@ -1,3 +1,30 @@
# Church Website
Placeholder: the church's public website and its admin. Built in phase 5 of ROADMAP-v3 (see §6 there).
The church's public website and its admin (ROADMAP-v3 §6, phase 5; plan and decisions in
[docs/WEBSITE-1.0-PLAN.md](../../docs/WEBSITE-1.0-PLAN.md)). Served at `www.<church's address>` (or
`<church>.crosscode.co.za`), with the admin at `/admin`, signed in through the church's Accounts.
The church picks one of four templates (Heritage, Bold, Community, Clean) and makes it its own with
section variants and style settings. Changes are drafts until an editor previews the whole site and
presses Publish; until the first publish visitors see Coming soon.
**State:** being built (2026-11-25): signing in through Accounts, the four templates and the public
site, the admin (editing, preview, publish, discard, restore, shared previews, media), and the demo
church, people and roles, messages (with the YouTube feed), simple events and the event feed with
Cross Events. Still to come: the Hub's "Get more storage", Lighthouse and the VM test. Not released;
`website@1.0.0` is tagged when the plan is built.
**Signing in** (`backend/src/auth/`): the Website registers with the Hub (its install id is its
client id at Accounts), links itself to the church's Accounts once the Hub lists it, and signs
admins in through `@crosscode/auth-client`. Roles are the Website's own; the first Owner is whoever
signs in with the Hub's admin email (`HUB_ADMIN_EMAIL`), verified in Accounts. Locally, set
`LINKS_ALLOW_PRIVATE=true` to link to an Accounts on http://localhost.
- `backend/`: Express + Prisma (ES modules), as Accounts. `npm run dev`, `npm test` (Node's test
runner through tsx), `npm run build`. The content model is in `prisma/schema.prisma`; the section
variants per template (plan §3, decision 16) in `src/site/variants.ts`.
- `frontend/`: Next.js 16. The public site (server-rendered from the latest published version) and
the admin.
Local development: Postgres in `backend/.env` (`DATABASE_URL`, `WEBSITE_URL=http://localhost:3300`),
`npx prisma migrate deploy`, then `npm run dev` in both folders (the frontend runs on 3300 and sends
/api to the backend on 5300).
+94
View File
@@ -0,0 +1,94 @@
# What's new in the Church Website
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.6.1
- **The link to your Cross Events site is easier to tell apart** in your website's menu: it now
says "Events site" with a small arrow icon, so visitors don't mistake it for your website's own
Events page.
- **Fixed: events from Cross Events could show twice** after the Events site's data was replaced.
Your website now checks the full list every 15 minutes and removes events that are gone.
## 1.6.0
- **Photos load faster on phones.** Photos in small frames (the collage at the top of the
Community template, your team's portraits and the ministry cards) are now downloaded at the size
they're shown, instead of full width. Nothing to change on your side.
- Behind the scenes, Cross Code's demonstration websites now show real photos of a (made-up)
church instead of drawings.
## 1.5.0
- **Your photos and files are backed up too.** Every night, after your site's content, your media
library is backed up on the server. After the first time, only new photos and files are copied.
Under **Backups** you see each one, and can switch it off.
## 1.4.0
- **Your website is backed up every night.** A copy of your site's content is kept on the server
every night, and before every update. Owners and Admins find them under **Backups**: make one
now, download one, or choose how many to keep. Your photos and files aren't in them.
- **Background jobs:** under **Background jobs**, see what your site does on a schedule (backups,
your events from Cross Events, new videos from YouTube), and switch each one on or off.
## 1.3.0
- Nothing changes on your site. Behind the scenes, Cross Code can now load demo content on the
websites it uses for demonstrations.
## 1.2.0
- **Your home page and the other pages are there from the start:** a new website now comes with
its home page, Plan your visit, About us, Give, Contact and the rest, with some starter text to
change. Before, a new website had no pages, so the home page and its preview were empty apart
from the header and footer.
- **Your own site icon:** under **Settings → Site icon**, choose the little picture that shows in
the browser tab and bookmarks. Until you do, your site shows your church's initial in its colour.
## 1.1.0
- **An easier admin.** A menu with icons down the side, and a dashboard with a tile for every part
of your site.
- **Steps to get your site live:** until your site is published, the top of every admin page shows
what's left to do. Click a step to go there, or **Next** for the next one.
- **See your page as you edit it:** a live preview beside the editor, at computer or phone size.
It updates every time you save, and you can fold it away to the right.
## 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
nothing is loaded from YouTube until someone presses play. The Messages page also shows a little
sooner.
- **Event dates in the Calendar layout** read properly ("Sun · November").
## 1.0.0 — requires accounts 1.7.0
- **Your church's own website**, managed by you. Choose one of four templates (Heritage, Bold,
Community or Clean), then make it yours: each homepage section has two or three layouts, and you
pick the fonts, corners, colours and spacing. Your logo, colours and details come from your
church profile, so the website, Cross Events and your sign-in pages look like one church.
- **Nothing goes live until you say so.** Every change is a draft. Preview the whole site at phone,
tablet and desktop size (and share a preview link), then press **Publish** once. Every published
version is kept, and you can go back to any of them. Until your first Publish, visitors see a
"Coming soon" page.
- **Pages for everything a visitor looks for:** Plan your visit, About, Ministries, Leadership,
Events, Messages, Give and Contact, plus your own pages built from blocks.
- **Messages straight from YouTube:** link your channel or playlist and each new video appears by
itself, or add messages by hand with a YouTube or Spotify link.
- **Events:** add simple events here, and show the events from your Cross Events (with a link to
register there).
- **People and roles:** Owners, Admins, Editors, Ministry leaders (only their own ministry) and
Viewers, all signing in with their church account. An audit log shows who changed what.
- **Found by search engines:** titles and descriptions you can edit, share images, your church on
maps and in local search, and your Google and Bing verification codes.
- **Photos made safe and fast:** location details removed from every photo, and the right size
sent to each screen. 5 GB of uploads included; ask for more under Media library.
+7
View File
@@ -0,0 +1,7 @@
node_modules/
dist/
src/generated/
.env
uploads/
exports/
/backups/
+115
View File
@@ -0,0 +1,115 @@
# Demo photos
The demo church's photos (`src/demo/`), from [Unsplash](https://unsplash.com), used under the
[Unsplash License](https://unsplash.com/license): free to use, commercially too, without asking.
The people in them are the photographers' models, standing in for the fictional churches' people.
Credit is not required, but given here. Each is WebP, at most 2000 px wide (portraits 1000 × 1250,
cropped to the face); `photos.json` holds their alt text, size and credit, keyed by the names the
demo profiles use (`src/demo/seeds.ts`).
| Photo | Photographer | On Unsplash |
|-------|--------------|-------------|
| `acacia-sunrise` | [Damian Patkowski](https://unsplash.com/@damianpatkowski) | [T-LfvX-7IVg](https://unsplash.com/photos/tree-between-green-land-during-golden-hour-T-LfvX-7IVg) |
| `city-spire` | [Ross Sneddon](https://unsplash.com/@rosssneddon) | [2XTPV6WykVc](https://unsplash.com/photos/person-walking-on-pathway-2XTPV6WykVc) |
| `stone-church` | [Wolfgang Weiser](https://unsplash.com/@hamburgmeinefreundin) | [UCnBapalXbE](https://unsplash.com/photos/historic-brick-church-with-tall-spire-surrounded-by-trees-UCnBapalXbE) |
| `country-church` | [Vedanth Ravi](https://unsplash.com/@vedanthravi) | [ql9-rgPUPZE](https://unsplash.com/photos/old-stone-church-ruins-under-a-blue-sky-ql9-rgPUPZE) |
| `church-light` | [Debby Hudson](https://unsplash.com/@hudsoncrafted) | [sgdyBq6kheQ](https://unsplash.com/photos/cathedral-interior-sgdyBq6kheQ) |
| `church-aisle` | [BEN ELLIOTT](https://unsplash.com/@benjaminelliott) | [-_M9YXEliAI](https://unsplash.com/photos/a-large-church-with-a-large-stained-glass-window--_M9YXEliAI) |
| `church-doors` | [João Weyne Justa](https://unsplash.com/@joaoweynej) | [VCbtM1PR4_o](https://unsplash.com/photos/empty-church-pews-lead-to-a-cross-in-the-distance-VCbtM1PR4_o) |
| `church-white` | [Julia Taubitz](https://unsplash.com/@justmejuliee) | [MVE9TBMdXLs](https://unsplash.com/photos/pews-and-chandelier-in-vimmerby-church-MVE9TBMdXLs) |
| `farm-road` | [Mario Beducci](https://unsplash.com/@mariobeducci) | [sVp8eXOLovA](https://unsplash.com/photos/a-winding-dirt-road-through-rolling-hills-at-sunset-sVp8eXOLovA) |
| `farm-bales` | [Vi Bell](https://unsplash.com/@vibell) | [BZa5NqifCt8](https://unsplash.com/photos/hay-bales-in-harvested-field-BZa5NqifCt8) |
| `school-hall` | [Pix Tresa](https://unsplash.com/@pixtresa) | [qRtFqXNkssY](https://unsplash.com/photos/wooden-folding-chairs-in-paneled-room-qRtFqXNkssY) |
| `hall-chairs` | [Adolfo Félix](https://unsplash.com/@adolfofelix) | [6hSBcpa7qVI](https://unsplash.com/photos/rows-of-empty-chairs-in-a-wood-paneled-room-6hSBcpa7qVI) |
| `campus-path` | [avansear](https://unsplash.com/@avansear) | [nWyKIZVidIs](https://unsplash.com/photos/campus-path-with-trees-and-people-nWyKIZVidIs) |
| `congregation-warm` | [Christian Harb](https://unsplash.com/@c7arb) | [RAENAd2Rxoo](https://unsplash.com/photos/a-congregation-gathered-inside-a-large-hall-RAENAd2Rxoo) |
| `congregation-pews` | [Christian Harb](https://unsplash.com/@c7arb) | [e77txgeniiU](https://unsplash.com/photos/audience-seated-in-a-church-during-a-service-e77txgeniiU) |
| `congregation-modern` | [Sophie Spree](https://unsplash.com/@sophiespree) | [9zJcrli2WCU](https://unsplash.com/photos/a-group-of-people-standing-in-a-room-with-their-hands-in-the-air-9zJcrli2WCU) |
| `congregation-hall` | [Charise Pieterse](https://unsplash.com/@cedarhillchurch) | [IyGJ38BOcP8](https://unsplash.com/photos/people-standing-in-church-worship-IyGJ38BOcP8) |
| `worship-hands` | [Fallon Michael](https://unsplash.com/@fallonmichaeltx) | [bUd6kWoVfII](https://unsplash.com/photos/people-raising-their-hands-up-bUd6kWoVfII) |
| `band-stage` | [Memento Media](https://unsplash.com/@heymemento) | [PbQF8EIsR2U](https://unsplash.com/photos/man-in-black-leather-jacket-playing-guitar-PbQF8EIsR2U) |
| `band-big` | [Bree Anne](https://unsplash.com/@breebuddy) | [dDED_VZ2jbI](https://unsplash.com/photos/people-sitting-on-chairs-watching-band-performing-on-stage-dDED_VZ2jbI) |
| `band-small` | [AMONWAT DUMKRUT](https://unsplash.com/@amonwatdumkrut) | [3E0KqEVDKzg](https://unsplash.com/photos/woman-singing-in-church-worship-service-3E0KqEVDKzg) |
| `guitar-singer` | [Luke Thornton](https://unsplash.com/@lukethorntonofficial) | [JNl7o-Mj2cc](https://unsplash.com/photos/man-in-gray-v-neck-long-sleeve-shirt-playing-brown-acoustic-guitar-JNl7o-Mj2cc) |
| `guitar-room` | [Gabriel Rodrigues](https://unsplash.com/@gabrielrodriguesoficial) | [p6V49LDtWA4](https://unsplash.com/photos/a-man-sitting-on-a-chair-playing-a-guitar-p6V49LDtWA4) |
| `choir-church` | [Green Liu](https://unsplash.com/@greenliustudio) | [ZaZcvU_WuF8](https://unsplash.com/photos/a-group-of-people-singing-in-front-of-a-golden-alter-ZaZcvU_WuF8) |
| `choir-gospel` | [John Onaeko](https://unsplash.com/@iyinoluwaonaeko) | [8__esxuic9Q](https://unsplash.com/photos/group-of-people-standing-on-brown-wooden-floor-8__esxuic9Q) |
| `organ` | [Spencer Plouzek](https://unsplash.com/@theguccer2100) | [aOexpXIBH_I](https://unsplash.com/photos/man-playing-a-large-wooden-pipe-organ-aOexpXIBH_I) |
| `candles` | [Eli Solitas](https://unsplash.com/@elisolitas) | [q6e4zwgtUcM](https://unsplash.com/photos/lighted-candles-on-black-metal-candle-holder-q6e4zwgtUcM) |
| `kids-craft` | [Yosi Prihantoro](https://unsplash.com/@yosipri) | [1q2Fo7Bx-pk](https://unsplash.com/photos/a-young-girl-is-holding-a-cross-made-of-paper-1q2Fo7Bx-pk) |
| `kids-drawing` | [Ruslan Horovyi](https://unsplash.com/@ruslanstock) | [ycuGtOTAtuU](https://unsplash.com/photos/two-young-students-drawing-together-in-a-classroom-ycuGtOTAtuU) |
| `kids-teacher` | [Rewired Digital](https://unsplash.com/@rewired41) | [kPkRpy6pIIg](https://unsplash.com/photos/teacher-guiding-children-drawing-at-a-table-kPkRpy6pIIg) |
| `kids-class` | [Yegor Makarenko](https://unsplash.com/@photochel228) | [WGEgIC76RjA](https://unsplash.com/photos/adult-and-children-in-classroom-WGEgIC76RjA) |
| `toddlers` | [Amanda Costelloe](https://unsplash.com/@oliveevephoto) | [8EHfZL6rFFg](https://unsplash.com/photos/two-young-girls-playing-with-colorful-wooden-blocks-8EHfZL6rFFg) |
| `youth-group` | [Nicolas Lobos](https://unsplash.com/@lobosnico) | [AqUp2AfDgu8](https://unsplash.com/photos/people-standing-near-building-AqUp2AfDgu8) |
| `youth-outdoors` | [Elliot Krueger](https://unsplash.com/@kruegerelliot) | [qNreMakc6eU](https://unsplash.com/photos/a-group-of-people-sitting-on-a-rock-in-the-woods-qNreMakc6eU) |
| `teens` | [Eliott Reyna](https://unsplash.com/@eliottreyna) | [axTm0ee3YP4](https://unsplash.com/photos/five-persons-on-front-of-chain-link-fence-axTm0ee3YP4) |
| `meal-table` | [Jesse Vigil](https://unsplash.com/@jessevig) | [I_b1PEyg8dY](https://unsplash.com/photos/a-group-of-people-sitting-at-a-long-table-I_b1PEyg8dY) |
| `meal-friends` | [Sweet Life](https://unsplash.com/@sweetlifediabetes) | [OxkxluMeAGs](https://unsplash.com/photos/a-group-of-people-sitting-around-a-table-eating-food-OxkxluMeAGs) |
| `meal-family` | [National Cancer Institute](https://unsplash.com/@nci) | [cfGG0niafjc](https://unsplash.com/photos/group-of-person-eating-indoors-cfGG0niafjc) |
| `supper-hall` | [Sweet Life](https://unsplash.com/@sweetlifediabetes) | [sQ3r1oIsaBY](https://unsplash.com/photos/a-group-of-people-sitting-around-a-table-eating-food-sQ3r1oIsaBY) |
| `soup-bowl` | [Dan DeAlmeida](https://unsplash.com/@ddealmeida) | [4aM_QE-HRLw](https://unsplash.com/photos/a-couple-of-people-holding-a-bowl-of-food-4aM_QE-HRLw) |
| `food-parcels` | [Steward Masweneng](https://unsplash.com/@stewardesign) | [fMcRbRaaZiI](https://unsplash.com/photos/a-group-of-people-standing-around-a-purple-plate-fMcRbRaaZiI) |
| `bible-study` | [Ben White](https://unsplash.com/@benwhitephotography) | [qM18dmqsTqk](https://unsplash.com/photos/man-in-black-crew-neck-t-shirt-holding-black-tablet-computer-qM18dmqsTqk) |
| `bible-coffee` | [Nicolas Lobos](https://unsplash.com/@lobosnico) | [rHwMkuJD6GM](https://unsplash.com/photos/black-smartphone-on-white-notebook-rHwMkuJD6GM) |
| `coffee-friends` | [Vitaly Gariev](https://unsplash.com/@silverkblack) | [_9rMpg5aI8k](https://unsplash.com/photos/people-talking-at-cafe-wooden-table-_9rMpg5aI8k) |
| `coffee-group` | [Vitaly Gariev](https://unsplash.com/@silverkblack) | [BlCgKHTRkFI](https://unsplash.com/photos/friends-chat-and-enjoy-coffee-at-a-cafe-BlCgKHTRkFI) |
| `students-lecture` | [Vitaly Gariev](https://unsplash.com/@silverkblack) | [T9yehHSvLL4](https://unsplash.com/photos/students-talking-in-a-lecture-hall-classroom-T9yehHSvLL4) |
| `students-fair` | [Aayush Khator](https://unsplash.com/@aayushkhator) | [VzeCjrU0V04](https://unsplash.com/photos/a-crowd-of-people-at-an-outdoor-event-VzeCjrU0V04) |
| `students-lawn` | [Dominic Kurniawan Suryaputra](https://unsplash.com/@d_ks11) | [tputvRf4bjA](https://unsplash.com/photos/a-group-of-people-sitting-on-top-of-a-lush-green-field-tputvRf4bjA) |
| `prayer-group` | [Elianna Gill](https://unsplash.com/@elianna_gill03) | [Q588c92mWEI](https://unsplash.com/photos/a-group-of-people-standing-around-each-other-Q588c92mWEI) |
| `visit-tea` | [Centre for Ageing Better](https://unsplash.com/@ageing_better) | [GJaWV0YoBeU](https://unsplash.com/photos/three-seniors-talking-and-smiling-together-GJaWV0YoBeU) |
| `welcome-hug` | [Filip Rankovic Grobgaard](https://unsplash.com/@filipgrobgaard) | [tkI306JXz7o](https://unsplash.com/photos/a-group-of-people-embracing-and-laughing-together-tkI306JXz7o) |
| `welcome-greeting` | [Erika Giraud](https://unsplash.com/@erikasayssmile) | [7KhbREQPFD4](https://unsplash.com/photos/two-men-hugging-on-focus-photography-7KhbREQPFD4) |
| `friends-picnic` | [Vitaly Gariev](https://unsplash.com/@silverkblack) | [ux5wWkiW4ZA](https://unsplash.com/photos/friends-celebrating-a-birthday-outdoors-with-a-cake-ux5wWkiW4ZA) |
| `family-picnic` | [Ainur Iman](https://unsplash.com/@mynameisiknow) | [IVCbWMeiFk4](https://unsplash.com/photos/family-picnic-in-sunlit-park-IVCbWMeiFk4) |
| `family-walk` | [Gray Clary](https://unsplash.com/@grayclary57) | [9eU9t4vxQVk](https://unsplash.com/photos/a-group-of-people-walking-down-a-path-in-a-park-9eU9t4vxQVk) |
| `pastor-thandi` | [K Studios](https://unsplash.com/@kstudios) | [pvwaNk2E-6E](https://unsplash.com/photos/a-smiling-woman-with-braided-hair-and-traditional-attire-pvwaNk2E-6E) |
| `pastor-margaret` | [Age Cymru](https://unsplash.com/@agecymru) | [1Mo0BfBzjBk](https://unsplash.com/photos/a-smiling-woman-stands-before-a-rustic-corrugated-building-1Mo0BfBzjBk) |
| `pastor-peter` | [ben o'bro](https://unsplash.com/@benobro) | [C5XyLljkMrY](https://unsplash.com/photos/man-taking-a-selfie-C5XyLljkMrY) |
| `pastor-naidoo` | [manish_ jadhav_photography05](https://unsplash.com/@mjphotography05) | [6jzu-aBdfUU](https://unsplash.com/photos/woman-and-man-in-traditional-attire-6jzu-aBdfUU) |
| `pastor-moore` | [Alef Morais](https://unsplash.com/@alef_visuals) | [Bop-YufQ-LQ](https://unsplash.com/photos/a-smiling-couple-stands-together-near-the-ocean-Bop-YufQ-LQ) |
| `pastor-andile` | [Idowu Emmanuel](https://unsplash.com/@springimagix) | [1D41F-bt6p0](https://unsplash.com/photos/man-in-blue-and-white-striped-button-up-shirt-smiling-1D41F-bt6p0) |
| `pastor-willem` | [Kyle Bushnell](https://unsplash.com/@kylebushnell) | [ZhAWv5iuFGQ](https://unsplash.com/photos/man-in-black-crew-neck-shirt-ZhAWv5iuFGQ) |
| `pastor-daniel` | [Mina Rad](https://unsplash.com/@miinrad) | [1pLb0DK4_1o](https://unsplash.com/photos/a-man-with-a-beard-sitting-on-some-steps-1pLb0DK4_1o) |
| `pastor-ian` | [Shubham Sharan](https://unsplash.com/@shubhamsharan) | [WCZ_1bx6D5I](https://unsplash.com/photos/a-man-wearing-glasses-WCZ_1bx6D5I) |
| `team-pieter` | [Vicky Hladynets](https://unsplash.com/@vhladynets) | [_gDoyVv5F4c](https://unsplash.com/photos/man-in-white-crew-neck-shirt-_gDoyVv5F4c) |
| `team-lerato` | [Christina @ wocintechchat.com M](https://unsplash.com/@wocintechchat) | [Kpd-JMLeKJk](https://unsplash.com/photos/woman-standing-and-smiling-Kpd-JMLeKJk) |
| `team-johan` | [Lance Reis](https://unsplash.com/@lancereis) | [TTdJV-K1IUg](https://unsplash.com/photos/a-man-with-a-beard-wearing-a-hat-TTdJV-K1IUg) |
| `team-sipho` | [Inocent Drici](https://unsplash.com/@inidrici) | [OGljLs0DnJ4](https://unsplash.com/photos/young-black-man-with-a-big-smile-OGljLs0DnJ4) |
| `team-anne` | [Davide Aracri](https://unsplash.com/@davieees) | [0NDVW4wO1Ms](https://unsplash.com/photos/a-woman-with-dark-hair-0NDVW4wO1Ms) |
| `team-david` | [Christophe Meyer](https://unsplash.com/@christophe_myr) | [2k1RUXZhMPY](https://unsplash.com/photos/man-in-red-crew-neck-shirt-2k1RUXZhMPY) |
| `team-claire` | [PodMatch](https://unsplash.com/@podmatch) | [2mMhaoBGjCs](https://unsplash.com/photos/woman-in-black-blazer-smiling-2mMhaoBGjCs) |
| `team-tom` | [Peri Stojnic](https://unsplash.com/@whoisperi) | [G9dttphDDE4](https://unsplash.com/photos/man-in-black-crew-neck-t-shirt-G9dttphDDE4) |
| `team-nomsa` | [Brian Kungu](https://unsplash.com/@oldceltic) | [olDpu0_Q-A0](https://unsplash.com/photos/a-woman-in-a-denim-shirt-holds-a-cup-olDpu0_Q-A0) |
| `team-kagiso` | [Divine Effiong](https://unsplash.com/@iamdivineeffiong) | [O1lbOY0H5rc](https://unsplash.com/photos/man-in-black-crew-neck-t-shirt-O1lbOY0H5rc) |
| `team-megan` | [Felipe Souza](https://unsplash.com/@dszlipe) | [Vc_mU9UmJbM](https://unsplash.com/photos/woman-in-black-hoodie-and-blue-chair-Vc_mU9UmJbM) |
| `team-ruan` | [Nathan Dumlao](https://unsplash.com/@nate_dumlao) | [26rK1-bH9Ls](https://unsplash.com/photos/man-in-gray-crew-neck-shirt-smiling-26rK1-bH9Ls) |
| `team-ayesha` | [Mehrpouya H](https://unsplash.com/@mehrpouya) | [isuiNDHQPzs](https://unsplash.com/photos/woman-in-white-t-shirt-outdoors-isuiNDHQPzs) |
| `team-chris` | [Joseph Gonzalez](https://unsplash.com/@miracletwentyone) | [iFgRcqHznqg](https://unsplash.com/photos/man-wearing-white-v-neck-shirt-iFgRcqHznqg) |
| `team-grace` | [NORBAINE GLORY TAMAR](https://unsplash.com/@g_light) | [o9LPROnZJfA](https://unsplash.com/photos/woman-in-red-blazer-o9LPROnZJfA) |
| `team-michelle` | [Troy Spoelma](https://unsplash.com/@spoelee4) | [EV8PPQG6zxY](https://unsplash.com/photos/a-woman-with-long-hair-wearing-a-blue-blazer-EV8PPQG6zxY) |
| `team-reddy` | [Pranit Tandon](https://unsplash.com/@prantan) | [BJ_PVL5vpc4](https://unsplash.com/photos/man-and-woman-embracing-in-park-BJ_PVL5vpc4) |
| `team-lwazi` | [150 Billi](https://unsplash.com/@150billi) | [dRgM67tRZHk](https://unsplash.com/photos/a-man-with-a-beard-and-a-green-shirt-dRgM67tRZHk) |
| `team-elsie` | [Hosein Sediqi](https://unsplash.com/@hoseinsediqii) | [sBkSyfPzakI](https://unsplash.com/photos/an-older-woman-with-white-hair-and-a-smile-sBkSyfPzakI) |
| `team-bongani` | [melvin Ankrah](https://unsplash.com/@hashtagmelvin) | [fEY925P2GlQ](https://unsplash.com/photos/a-happy-black-man-smiling-in-a-black-shirt-fEY925P2GlQ) |
| `team-marie` | [Doug Bagg](https://unsplash.com/@dougbagg_) | [9iLbXsMZ6ls](https://unsplash.com/photos/smiling-woman-in-brown-blazer-9iLbXsMZ6ls) |
| `team-refilwe` | [alex starnes](https://unsplash.com/@alexstarnes) | [PK_t0Lrh7MM](https://unsplash.com/photos/smiling-woman-in-yellow-blazer-holding-tablet-PK_t0Lrh7MM) |
| `team-sam` | [Its me Pravin](https://unsplash.com/@paul__pro) | [duzGG1gkgMw](https://unsplash.com/photos/a-man-leaning-over-a-wooden-table-in-a-warehouse-duzGG1gkgMw) |
| `team-nadia` | [amin naderloei](https://unsplash.com/@aminnaderloei) | [OmjeNvHwkDI](https://unsplash.com/photos/a-smiling-woman-sits-outdoors-on-a-rock-OmjeNvHwkDI) |
| `team-lisa` | [Ionela Mat](https://unsplash.com/@ionelaaaaa) | [s3PJLnFKjnI](https://unsplash.com/photos/woman-smiles-while-posing-near-foliage-s3PJLnFKjnI) |
| `team-thabo` | [nana o.](https://unsplash.com/@afroscope) | [10fvuGtnoEM](https://unsplash.com/photos/man-near-tree-10fvuGtnoEM) |
| `team-priya` | [amin naderloei](https://unsplash.com/@aminnaderloei) | [5KsbzX5M9mo](https://unsplash.com/photos/young-woman-in-glasses-smiling-in-a-forest-5KsbzX5M9mo) |
| `open-bible` | [Sixteen Miles Out](https://unsplash.com/@sixteenmilesout) | [L-mNqn89I2s](https://unsplash.com/photos/green-plant-on-white-book-page-L-mNqn89I2s) |
| `pulpit` | [Mitchell Leach](https://unsplash.com/@mitchellleach) | [DmdQGZqR_38](https://unsplash.com/photos/brown-wooden-cross-on-brown-wooden-cabinet-DmdQGZqR_38) |
| `church-quiet` | [Martin Jernberg](https://unsplash.com/@martinjernberg) | [ySjfkwugiEA](https://unsplash.com/photos/a-man-sitting-in-a-church-with-stained-glass-windows-ySjfkwugiEA) |
| `sermon-robe` | [Benjamin Brunner](https://unsplash.com/@ben_brunner) | [MbYFGJT06gk](https://unsplash.com/photos/a-man-in-a-black-robe-holding-a-book-MbYFGJT06gk) |
| `sermon-collar` | [RECARDO DAVIDSON](https://unsplash.com/@shotbyriki) | [26JmMEHe9nk](https://unsplash.com/photos/clergywoman-in-black-suit-stands-before-a-stone-wall-26JmMEHe9nk) |
| `sermon-stage` | [Phil Hearing](https://unsplash.com/@philhearing) | [mgPIJGLM0SU](https://unsplash.com/photos/a-man-standing-on-top-of-a-stage-next-to-a-microphone-mgPIJGLM0SU) |
| `sermon-hall` | [adrianna geo](https://unsplash.com/@adrigeo_) | [xjzhVNOvfZM](https://unsplash.com/photos/people-sitting-on-chairs-inside-room-xjzhVNOvfZM) |
| `sermon-dark` | [Zach Lucero](https://unsplash.com/@zlucerophoto) | [X4V-El4qvZ4](https://unsplash.com/photos/a-man-in-a-suit-and-tie-holding-a-piece-of-paper-X4V-El4qvZ4) |
| `mic-audience` | [Joao Cruz](https://unsplash.com/@jcruzweb) | [IkEpl3JkVqU](https://unsplash.com/photos/shallow-focus-photo-of-black-corded-microphone-IkEpl3JkVqU) |
| `mic-blue` | [Matthias Wagner](https://unsplash.com/@matwag) | [QrqeusbpFMM](https://unsplash.com/photos/black-and-gray-microphone-on-black-stand-QrqeusbpFMM) |
| `mic-red` | [Allie Reefer](https://unsplash.com/@thepghtraveler) | [rAoQn6kwv64](https://unsplash.com/photos/a-microphone-on-a-stand-in-front-of-a-red-background-rAoQn6kwv64) |
| `mic-white` | [Madrosah Sunnah](https://unsplash.com/@26_ms) | [UA1nd6-Dndw](https://unsplash.com/photos/black-and-gray-microphone-on-white-background-UA1nd6-Dndw) |
| `mic-crowd` | [Herlambang Tinasih Gusti](https://unsplash.com/@tinasihgusti) | [-ymBs1mVim8](https://unsplash.com/photos/a-man-standing-in-front-of-a-crowd-of-people--ymBs1mVim8) |
Binary file not shown.

After

Width:  |  Height:  |  Size: 183 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 622 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 243 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 275 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 233 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 318 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 151 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 311 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Some files were not shown because too many files have changed in this diff Show More