Compare commits
14
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ebcee43594 | ||
|
|
7f681c9e81 | ||
|
|
a75d2f7b46 | ||
|
|
2edb9f681a | ||
|
|
d299442015 | ||
|
|
9994cbd760 | ||
|
|
0d6afc7cd1 | ||
|
|
3539bf0ac0 | ||
|
|
ff3d9aefa2 | ||
|
|
8c4f5f244c | ||
|
|
edac4ee767 | ||
|
|
090453e14a | ||
|
|
9c87208428 | ||
|
|
f931226e74 |
@@ -2,6 +2,19 @@
|
||||
|
||||
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
|
||||
|
||||
@@ -5,6 +5,23 @@ 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.
|
||||
|
||||
@@ -12,6 +12,11 @@ Write for church admins, not developers: no environment variables, endpoints or
|
||||
developer log is CHANGELOG.md. A tagged version without a section here shows "No details given".
|
||||
-->
|
||||
|
||||
## 3.7.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
|
||||
|
||||
@@ -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,6 +1,6 @@
|
||||
{
|
||||
"name": "@crosscode/events-backend",
|
||||
"version": "3.7.1",
|
||||
"version": "3.7.2",
|
||||
"description": "Event Management System Backend",
|
||||
"main": "src/index.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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 };
|
||||
}
|
||||
|
||||
|
||||
@@ -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() };
|
||||
},
|
||||
});
|
||||
|
||||
@@ -399,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();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@crosscode/events-frontend",
|
||||
"version": "3.7.1",
|
||||
"version": "3.7.2",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@crosscode/events",
|
||||
"version": "3.7.1",
|
||||
"version": "3.7.2",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"dev:backend": "cd backend && npm run dev",
|
||||
|
||||
@@ -1,5 +1,28 @@
|
||||
# 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.
|
||||
|
||||
@@ -3,6 +3,14 @@
|
||||
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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@crosscode/website-backend",
|
||||
"version": "1.6.0",
|
||||
"version": "1.6.1",
|
||||
"description": "Church Website: the public site's content API, the admin API, publishing and uploads",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
|
||||
@@ -179,7 +179,7 @@ export function adminRouter(ctx: Ctx) {
|
||||
r.post('/links/:id/sync', editor, handle(async (req) => {
|
||||
const link = await ctx.db.productLink.findUnique({ where: { installId: param(req, 'id') } });
|
||||
if (!link) throw new ApiError(404, 'NOT_LINKED', "That product isn't connected.");
|
||||
return syncLink(ctx, link);
|
||||
return syncLink(ctx, link, { full: true });
|
||||
}));
|
||||
r.put('/feed', editor, json, handle(async (req) => {
|
||||
await ctx.settings.set('feed_publish', req.body?.publish === false ? 'false' : 'true');
|
||||
|
||||
@@ -18,6 +18,7 @@ import { fileURLToPath } from 'node:url';
|
||||
import { CHURCH_SCHEMA, WEBSITE_TEMPLATES, type agent, type Church, type WebsiteTemplate } from '@crosscode/contracts';
|
||||
import type { Ctx } from '../context.js';
|
||||
import { churchProfile } from '../church/profile.js';
|
||||
import { markRemoved, notifyLinks } from '../feed/feed.js';
|
||||
import type { SectionData } from '../site/sections.js';
|
||||
import { publish } from '../site/snapshot.js';
|
||||
import { TEMPLATE_HEADERS, TEMPLATE_VARIANTS, SECTION_TYPES, defaultDesign, type SiteDesign } from '../site/variants.js';
|
||||
@@ -248,6 +249,10 @@ export async function loadDemo(ctx: Ctx, what: WebsiteTemplate | agent.WebsiteDe
|
||||
|
||||
// The site icon is a setting, so its picture stays; every other picture goes with the content.
|
||||
const faviconId = classic ? null : await ctx.settings.get('favicon_media_id');
|
||||
// 1.6.1: the published events that go are listed in the feed's `deleted`, so linked products
|
||||
// (Cross Events) drop their copies instead of showing them beside the new ones.
|
||||
const gone = (await db.simpleEvent.findMany({ where: { publishedAt: { not: null } }, select: { id: true } })).map((e) => e.id);
|
||||
for (const id of gone) await markRemoved(ctx, id, true);
|
||||
for (const m of ['section', 'page', 'ministry', 'leader', 'message', 'messageSeries', 'simpleEvent', 'siteVersion', 'siteDesign', 'slugHistory', 'previewLink'] as const) {
|
||||
await (db[m] as unknown as { deleteMany: (a?: object) => Promise<unknown> }).deleteMany({});
|
||||
}
|
||||
@@ -324,9 +329,13 @@ export async function loadDemo(ctx: Ctx, what: WebsiteTemplate | agent.WebsiteDe
|
||||
await db.message.create({ data: { slug, title, date: new Date(now.getTime() - ago * day), source: 'youtube', mediaUrl: 'https://www.youtube.com/watch?v=aqz-KE-bpKQ', thumbnailUrl, speaker, passage, seriesId: series.id, publishedAt: now } });
|
||||
}
|
||||
n = 0;
|
||||
const made: string[] = [];
|
||||
for (const [slug, title, inDays, description] of seed.events) {
|
||||
const startsAt = new Date(Math.floor((now.getTime() + inDays * day) / day) * day + 8 * 3600e3);
|
||||
await db.simpleEvent.create({ data: { slug, title, startsAt, endsAt: new Date(startsAt.getTime() + 3 * 3600e3), location: t(seed.venue), description: t(description), imageId: img[`event${n++}`] ?? null, publishedAt: now } });
|
||||
made.push((await db.simpleEvent.create({ data: { slug, title, startsAt, endsAt: new Date(startsAt.getTime() + 3 * 3600e3), location: t(seed.venue), description: t(description), imageId: img[`event${n++}`] ?? null, publishedAt: now } })).id);
|
||||
}
|
||||
return publish(ctx, { id: opts.publishedBy ?? 'demo', role: 'system' }, classic ? `Demo church on ${seed.template}` : `Demo: ${seed.label}`);
|
||||
const version = await publish(ctx, { id: opts.publishedBy ?? 'demo', role: 'system' }, classic ? `Demo church on ${seed.template}` : `Demo: ${seed.label}`);
|
||||
// Linked products fetch the feed now, not at their next poll (one try; the poll catches up).
|
||||
await notifyLinks(ctx, [...gone, ...made]).catch(() => {});
|
||||
return version;
|
||||
}
|
||||
|
||||
@@ -113,15 +113,19 @@ type LinkRow = { installId: string; product: string; url: string; showEvents: bo
|
||||
|
||||
export type SyncResult = { installId: string; ok: boolean; imported?: number; deleted?: number; rejected?: number; error?: string };
|
||||
|
||||
/** Fetches one sibling's feed into read-only copies. */
|
||||
export async function syncLink(ctx: Ctx, link: LinkRow): Promise<SyncResult> {
|
||||
/**
|
||||
* Fetches one sibling's feed into read-only copies. `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(ctx: Ctx, link: LinkRow, { full = false }: { full?: boolean } = {}): Promise<SyncResult> {
|
||||
if (link.product === 'accounts') return { installId: link.installId, ok: true, imported: 0 };
|
||||
if (!link.showEvents) {
|
||||
const gone = (await ctx.db.importedEvent.deleteMany({ where: { linkId: link.installId } })).count;
|
||||
return { installId: link.installId, ok: true, imported: 0, deleted: gone };
|
||||
}
|
||||
const now = ctx.now();
|
||||
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(ctx, link.url, FEED_PATHS.events);
|
||||
if (since) url.searchParams.set('updatedSince', since.toISOString());
|
||||
@@ -153,11 +157,11 @@ export async function syncLink(ctx: Ctx, link: LinkRow): Promise<SyncResult> {
|
||||
}
|
||||
}
|
||||
|
||||
/** Every linked sibling, one after another; one failing never stops the rest. */
|
||||
/** Every linked sibling's whole list, one after another; one failing never stops the rest. */
|
||||
export async function syncAll(ctx: Ctx) {
|
||||
const links = await ctx.db.productLink.findMany({ where: { product: { not: 'accounts' } } });
|
||||
let failed = 0;
|
||||
for (const link of links) if (!(await syncLink(ctx, link)).ok) failed++;
|
||||
for (const link of links) if (!(await syncLink(ctx, link, { full: true })).ok) failed++;
|
||||
return { links: links.length, failed };
|
||||
}
|
||||
|
||||
|
||||
@@ -135,6 +135,19 @@ describe('showing events from Cross Events (Show events from)', () => {
|
||||
assert.equal(await db.importedEvent.count(), 0);
|
||||
});
|
||||
|
||||
it('a full fetch (the 15-minute poll) drops copies of events Events lost without saying (a reseed)', async () => {
|
||||
const { ctx, events, link, db } = await site();
|
||||
events.state.feed = { schema: EVENT_FEED_SCHEMA, generatedAt: new Date().toISOString(), deleted: [], events: [ev('6c7d8e9f-0a1b-4c2d-8e3f-4a5b6c7d8e9f', 'Family Fun Day', 10)] };
|
||||
await syncLink(ctx, await link());
|
||||
// Reseeded: the same event under a new id, and no word about the old one.
|
||||
events.state.feed = { schema: EVENT_FEED_SCHEMA, generatedAt: new Date().toISOString(), deleted: [], events: [ev('9f0a1b2c-3d4e-4f5a-8b6c-7d8e9f0a1b2c', 'Family Fun Day', 10)] };
|
||||
await syncLink(ctx, await link());
|
||||
assert.equal(await db.importedEvent.count(), 2, 'an incremental fetch can\'t know');
|
||||
await syncLink(ctx, await link(), { full: true });
|
||||
assert.doesNotMatch(events.state.asked.at(-1)!, /updatedSince=/);
|
||||
assert.deepEqual((await db.importedEvent.findMany()).map((e) => e.originId), ['9f0a1b2c-3d4e-4f5a-8b6c-7d8e9f0a1b2c']);
|
||||
});
|
||||
|
||||
it('switching Show events off removes its events; a signed event.changed fetches at once', async () => {
|
||||
const { ctx, events, link, db, go, app } = await site();
|
||||
events.state.feed = { schema: EVENT_FEED_SCHEMA, generatedAt: new Date().toISOString(), deleted: [], events: [ev('6c7d8e9f-0a1b-4c2d-8e3f-4a5b6c7d8e9f', 'Youth camp', 10)] };
|
||||
|
||||
@@ -188,6 +188,18 @@ describe('the public site\'s content', () => {
|
||||
assert.equal((await siteContent(h.ctx)).church?.name, 'Acacia Hill Church', 'the profile saved by the first demo stays');
|
||||
});
|
||||
|
||||
it('1.6.1: loading a demo again lists the old events as removed in the feed, so Cross Events drops its copies', async () => {
|
||||
const h = await harness({ linked: false });
|
||||
const dir = tmp();
|
||||
await loadDemo(h.ctx, 'heritage', { uploadDir: dir });
|
||||
const old = (await h.db.simpleEvent.findMany()).map((e) => e.id).sort();
|
||||
assert.ok(old.length > 0);
|
||||
await loadDemo(h.ctx, 'community-town', { uploadDir: dir });
|
||||
assert.deepEqual((await h.db.feedRemoval.findMany()).map((r) => r.eventId).sort(), old);
|
||||
const now = (await h.db.simpleEvent.findMany()).map((e) => e.id);
|
||||
assert.ok(now.length > 0 && now.every((id) => !old.includes(id)));
|
||||
});
|
||||
|
||||
it('1.3.0: a profile on a site with no church profile at all saves the demo one, so the site has a name', async () => {
|
||||
const h = await harness({ linked: false });
|
||||
await loadDemo(h.ctx, 'clean-campus', { uploadDir: tmp() });
|
||||
|
||||
@@ -4,7 +4,8 @@
|
||||
* (freshPostgres, below), and the demo church published. The pages run as a production build on
|
||||
* 3310 and send /api here.
|
||||
*
|
||||
* Test helpers: POST /test/demo?template=<id> loads the demo church on that template;
|
||||
* Test helpers: POST /test/demo?template=<id> loads the demo church on that template (or
|
||||
* ?profile=<id>, a demo profile);
|
||||
* POST /test/design { variants?, style?, home? } changes the design and publishes again.
|
||||
*/
|
||||
import { execSync } from 'node:child_process';
|
||||
@@ -15,7 +16,7 @@ import express from 'express';
|
||||
import pg from 'pg';
|
||||
import sharp from 'sharp';
|
||||
import { PrismaPg } from '@prisma/adapter-pg';
|
||||
import { websiteTemplateSchema } from '@crosscode/contracts';
|
||||
import { agent, websiteTemplateSchema } from '@crosscode/contracts';
|
||||
import { PrismaClient } from '../backend/src/generated/prisma/client.js';
|
||||
import { createApp } from '../backend/src/app.js';
|
||||
import { createCtx } from '../backend/src/context.js';
|
||||
@@ -67,6 +68,14 @@ await loadDemo(ctx, websiteTemplateSchema.parse(process.env.DEMO_TEMPLATE ?? 'he
|
||||
|
||||
const app = express();
|
||||
app.post('/test/demo', async (req, res) => {
|
||||
// ?profile=<id>: one of the demo profiles (the crosscode-site screenshots of another church on
|
||||
// a template); it keeps the church profile the template demo saved (Acacia Hill).
|
||||
const profile = String(req.query.profile ?? '');
|
||||
if (profile) {
|
||||
if (!(agent.WEBSITE_DEMO_PROFILES as readonly string[]).includes(profile)) return res.status(400).json({ error: 'profile' });
|
||||
await loadDemo(ctx, profile as agent.WebsiteDemoProfile, { uploadDir: uploads });
|
||||
return res.json({ ok: true, profile });
|
||||
}
|
||||
const t = websiteTemplateSchema.safeParse(req.query.template);
|
||||
if (!t.success) return res.status(400).json({ error: 'template' });
|
||||
await loadDemo(ctx, t.data, { uploadDir: uploads });
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@crosscode/website-frontend",
|
||||
"version": "1.6.0",
|
||||
"version": "1.6.1",
|
||||
"private": true,
|
||||
"description": "Church Website: the church's public site in its template, and the admin",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,20 +1,23 @@
|
||||
/**
|
||||
* Each template's header (WEBSITE-1.0-PLAN §3, "Headers"), with its options from the Header style
|
||||
* setting. Every header collapses to a Menu button on phones (a <details>, so it works without
|
||||
* JavaScript). Links to the church's other sites (Events, App) sit next to the pages (§9).
|
||||
* JavaScript). Links to the church's other sites sit next to the pages (§9), as "Events site" with an
|
||||
* external-link icon (1.6.1), so they aren't mistaken for this site's own Events page.
|
||||
*/
|
||||
import Link from "next/link";
|
||||
import { ExternalLink } from "lucide-react";
|
||||
import { productLinks } from "@crosscode/ui";
|
||||
import { ScrollSolid } from "./ScrollSolid";
|
||||
import { cx } from "./parts";
|
||||
import type { Published } from "./types";
|
||||
|
||||
type Item = { label: string; href: string; current: boolean };
|
||||
/** `external`: one of the church's other sites (1.6.1), marked so it isn't mistaken for a page here. */
|
||||
type Item = { label: string; href: string; current: boolean; external?: boolean };
|
||||
|
||||
function items(site: Published, path: string): { nav: Item[]; visit: Item | null } {
|
||||
const pages = site.snapshot.pages;
|
||||
const nav: Item[] = pages.filter((p) => p.inNav).map((p) => ({ label: p.navLabel, href: p.path, current: p.path === path }));
|
||||
for (const l of site.church ? productLinks(site.church.links, "website") : []) nav.push({ label: l.label, href: l.href, current: false });
|
||||
for (const l of site.church ? productLinks(site.church.links, "website") : []) nav.push({ label: `${l.label} site`, href: l.href, current: false, external: true });
|
||||
const v = pages.find((p) => p.kind === "visit");
|
||||
return { nav, visit: v ? { label: v.navLabel, href: v.path, current: v.path === path } : null };
|
||||
}
|
||||
@@ -36,7 +39,10 @@ function Links({ nav, className, linkClass }: { nav: Item[]; className?: string;
|
||||
<ul className={className}>
|
||||
{nav.map((n) => (
|
||||
<li key={n.href}>
|
||||
<a href={n.href} aria-current={n.current ? "page" : undefined} className={cx("no-underline hover:underline underline-offset-8", n.current && "underline", linkClass)}>{n.label}</a>
|
||||
<a href={n.href} aria-current={n.current ? "page" : undefined} title={n.external ? "Our separate site" : undefined} className={cx("no-underline hover:underline underline-offset-8", n.current && "underline", n.external && "inline-flex items-center gap-1", linkClass)}>
|
||||
{n.label}
|
||||
{n.external && <ExternalLink className="h-[0.85em] w-[0.85em] shrink-0 opacity-70" aria-hidden />}
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
|
||||
@@ -237,6 +237,11 @@ from"). When on:
|
||||
secret). It fetches `?updatedSince=<lastGoodAt minus 5 minutes>`, 15 s timeout, parses with
|
||||
`parseEventFeed` (rejected events are logged, never block the rest), and upserts into
|
||||
`ImportedEvent`. One failing link never holds up another (separate jobs).
|
||||
**Changed in Events 3.7.2 / Website 1.6.1:** the 15-minute poll and "Sync now" fetch the whole
|
||||
list (no `updatedSince`) 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 forever. Only the fetch after an
|
||||
`event.changed` asks for what changed. Demo reseeds (`set-demo.js`, the Website's `loadDemo`)
|
||||
list the old events in `deleted` and send `event.changed`, so siblings are right at once.
|
||||
- **The last good copy stays.** A failed sync only sets `lastSyncError`; admins see "Last synced
|
||||
2 hours ago" on Linked products and on the dashboard's event list.
|
||||
- **Read-only**, keyed by `origin.product` + `id` (`eventKey`), and **never re-published**: the
|
||||
|
||||
+51
-16
@@ -10,13 +10,13 @@ separately below; the two often differ.
|
||||
|
||||
| What | Repo | Latest | Tag | Released |
|
||||
|------|------|--------|-----|----------|
|
||||
| Cross Events | `crosscode-platform` (`apps/events`) | **3.7.1** | `events@3.7.1` | 2026-11-26 |
|
||||
| Church Website | `crosscode-platform` (`apps/website`) | **1.5.0** | `website@1.5.0` | 2026-11-27 |
|
||||
| Cross Events | `crosscode-platform` (`apps/events`) | **3.7.2** | `events@3.7.2` | 2026-11-27 |
|
||||
| Church Website | `crosscode-platform` (`apps/website`) | **1.6.1** | `website@1.6.1` | 2026-11-27 |
|
||||
| Accounts | `crosscode-platform` (`apps/accounts`) | **1.8.0** | `accounts@1.8.0` | 2026-11-26 |
|
||||
| Server agent | `crosscode-platform` (`apps/agent`) | **1.6.0** | `agent@1.6.0` | 2026-11-27 |
|
||||
| Contracts | `crosscode-platform` (`packages/contracts`) | **1.19.0** | `contracts@1.19.0` | 2026-11-27 |
|
||||
| Cross Code Hub | `events-hub` | **2.25.0** | `v2.25.0` | 2026-11-27 |
|
||||
| crosscode.co.za | `crosscode-site` | **1.7.0** | `v1.7.0` | 2026-11-26 |
|
||||
| crosscode.co.za | `crosscode-site` | **1.9.1** | `v1.9.1` | 2026-11-27 |
|
||||
| `crosscode` script | `crosscode-platform` (`scripts/`) | `main` | none | 2026-11-27 (last change: an uninstall keeps the Website's backup snapshots shared, `rsync -aH`) |
|
||||
|
||||
The `crosscode` script has no version: every server's copy (`/opt/crosscode/tools`) pulls `main`
|
||||
@@ -30,7 +30,7 @@ on each run, so merging to `main` and pushing releases it. Its changes are liste
|
||||
| `@crosscode/auth-client` | `packages/auth-client` | 1.1.0 (released with Events 3.0.0 and Accounts 1.1.0) |
|
||||
| `@crosscode/seo` | `packages/seo` | 1.0.0 (released with Events 2.4.0) |
|
||||
| `@crosscode/ui` | `packages/ui` | 0.3.0 (fonts, `ChurchFooter`; 0.2.0 with Accounts 1.7.0, 0.3.0 with Events 3.7.0) |
|
||||
| Website | `apps/website` | 1.5.0 (1.0.0–1.1.0 released 2026-11-26, 1.2.0–1.5.0 on 2026-11-27; installed for the demo church cross-demo2 (1.2.0) only, Hope Family Church next) |
|
||||
| Website | `apps/website` | 1.6.1 (1.0.0–1.1.0 released 2026-11-26, 1.2.0–1.6.1 on 2026-11-27; installed for the demo church cross-demo2 (1.6.0) only, Hope Family Church next) |
|
||||
| App | `apps/app` | 0.0.0 (not started, phase 6) |
|
||||
|
||||
These shared packages ship inside the apps that use them, from the same checkout, so they don't
|
||||
@@ -38,13 +38,47 @@ need their own tags until something outside this repo depends on them.
|
||||
|
||||
## What each latest release was for
|
||||
|
||||
- **Cross Events 3.7.2 + Church Website 1.6.1 (2026-11-27):** events from the other product no
|
||||
longer show twice after a reseed: the 15-minute feed poll and "Sync now" fetch the whole list and
|
||||
drop copies that are gone, and both demo loaders list the old events as removed and tell the
|
||||
other product at once (Events' `set-demo.js` also fetches the Website's events back in). The
|
||||
Website's header says "Events site" with an external-link icon instead of a second "Events".
|
||||
**Not deployed yet.**
|
||||
- **crosscode.co.za 1.9.1 (2026-11-27):** the web address examples (both product pages and the
|
||||
Church Website brochure) say yourchurch instead of a real church's name (hopefamily). **Not
|
||||
deployed yet.**
|
||||
- **crosscode.co.za 1.9.0 (2026-11-27):** a Church Website brochure (`church-website-brochure.pdf`,
|
||||
five A4 pages, from the site's data and the demo screenshots), linked from the Church Website
|
||||
page; `npm run brochure` renders both brochures. The Website's founding offer no longer mentions
|
||||
tiers. Brochure links carry a hash of the file (`?v=`), like the screenshots. **Deployed** 2026-11-27.
|
||||
- **crosscode.co.za 1.8.1 (2026-11-27):** readable on dark: the template pages' "Compare the
|
||||
templates" button (it was dark text on the navy hero) and the "Good for" text there, the
|
||||
WhatsApp buttons' green (#168243, white text 4.9:1; was 3.1:1) and the Founding heading on the
|
||||
Cross Events price table. axe (WCAG 2.2 AA) on all 16 pages, desktop and phone: no problems
|
||||
(was 20). **Deployed** 2026-11-27.
|
||||
- **crosscode.co.za 1.8.0 (2026-11-27):** each Church Website template's page shows the whole
|
||||
demo website (a gallery of Plan your visit, About us, Ministries, Leadership, Events, an event,
|
||||
Messages and Contact) and "the same template, a different church" (the template's second demo
|
||||
profile). Screenshot URLs carry a hash of the file (`?v=`): `/assets/` is cached for 30 days, so
|
||||
after deploying 1.7.1 the template grid still showed the old illustrated screenshots. The
|
||||
Website's e2e server takes `/test/demo?profile=` for these screenshots (test helper only, no
|
||||
Website release). **Deployed** 2026-11-27.
|
||||
- **Church Website 1.6.0 + crosscode.co.za 1.7.1 (2026-11-27):** the demo church has real photos:
|
||||
104 Unsplash stock photos (models; free under the Unsplash License, credited in
|
||||
`apps/website/backend/demo-photos/CREDITS.md`, 12 MB) instead of the generated "hills and sun"
|
||||
illustration: a set per demo profile, a portrait for every leader, a picture per event and a
|
||||
photo per message (before: the stand-in video's thumbnail). Faster on phones: the collage hero,
|
||||
the team's portraits and the ministry cards say their real width (`sizes`). No migration.
|
||||
Checked: backend tests (131), the Website e2e (130; the variant screenshots taken again;
|
||||
Lighthouse mobile 90–98 performance, 100 accessibility and SEO), typecheck, lint and both
|
||||
builds. crosscode.co.za 1.7.1: the 24 Church Website screenshots taken again from the new demo.
|
||||
**Deployed** 2026-11-27.
|
||||
- **Church Website 1.5.0 + crosscode script (2026-11-27):** the nightly backup also backs up the
|
||||
photos and files: a snapshot of `backend/uploads` in `backups/uploads-…/`, unchanged files hard
|
||||
links to the last snapshot (after the first full copy, a night costs only the new files), with
|
||||
its own switch on Admin → Backups. Script: an uninstall keeps the snapshots with `rsync -aH`. No
|
||||
migration. Checked: backend tests (130), the admin e2e's axe check, both builds, typecheck and
|
||||
lint, the website and uninstall bats tests (11). **Not deployed yet**: cross-demo2's Website
|
||||
still reports 1.2.0 (`/api/health`, checked 2026-11-27). The script change is live (servers pull
|
||||
lint, the website and uninstall bats tests (11). **Deployed** 2026-11-27. The script change is live (servers pull
|
||||
`main`).
|
||||
- **Church Website 1.4.0 (2026-11-27):** nightly database backups (02:20, `backend/backups/`, the
|
||||
same files crosscode makes before updates) with Admin → Backups, and background jobs on pg-boss
|
||||
@@ -52,7 +86,7 @@ need their own tags until something outside this repo depends on them.
|
||||
to switch each on or off, reschedule or run it. The heartbeat reports the newest backup (before:
|
||||
always none, so the Hub warned "No backup reported") and the real job state. No migration.
|
||||
Uploads weren't in the backups (1.5.0 adds them). Checked: backend tests (125), the admin e2e (10, axe
|
||||
on both new pages), both builds, typecheck and lint. **Not deployed yet** (cross-demo2: 1.2.0).
|
||||
on both new pages), both builds, typecheck and lint. **Deployed** 2026-11-27.
|
||||
- **Hub 2.25.0 + Church Website 1.3.0 + agent 1.6.0 + contracts 1.19.0 + crosscode script
|
||||
(2026-11-27):** demo clients and demo data for the Website. Hub: a customer can be a demo client:
|
||||
every install a demo site (Accounts included, and any it gets later) and never billed (billing
|
||||
@@ -88,7 +122,7 @@ need their own tags until something outside this repo depends on them.
|
||||
first publish across the top, and a live preview beside the page editor (drafts for a framed
|
||||
request with an admin session, no preview cookie). No migrations, no backend changes. Checked:
|
||||
typechecks and lint, the Website's e2e (10, with axe on the admin and the editor) and Accounts' e2e
|
||||
(11). **Not deployed yet.**
|
||||
(11). **Deployed** 2026-11-27.
|
||||
- **Accounts 1.7.1 + Church Website 1.0.2 + Cross Events 3.7.1 (2026-11-26):** found installing
|
||||
the Website for cross-demo2. All three: a connect involving an install that isn't in the cached
|
||||
copy of the Hub's list yet asks the Hub for a fresh one (one heartbeat, at most once a minute)
|
||||
@@ -204,7 +238,7 @@ need their own tags until something outside this repo depends on them.
|
||||
with Cross Events, FAQ, `SoftwareApplication` JSON-LD with its offer) and a page per template; the
|
||||
products and home pages, the contact form's topics, the Cross Events page and the brochure updated.
|
||||
Screenshots from the Website's e2e demo (`npm run screenshots:website`). The Hub already had these
|
||||
prices (2.21.0). **Not deployed yet** (`deploy/deploy.sh` on the server).
|
||||
prices (2.21.0). **Deployed** 2026-11-27.
|
||||
- **crosscode.co.za 1.6.1 (2026-11-23):** the web address choices on the Cross Events page are three
|
||||
cards (name, price, "best if", an example address, short points); the option names were white on
|
||||
a light background and couldn't be seen. Prices unchanged. Deployed 2026-11-23.
|
||||
@@ -333,10 +367,11 @@ you deploy one.
|
||||
|
||||
| What | Running | Since | Notes |
|
||||
|------|---------|-------|-------|
|
||||
| Hub | 2.24.1 | 2026-11-27 | Servers → Updates offers every product (the Church Website too). Before it, 2.24.0 (2026-11-27): "Update everything to latest" on a customer's Sites card: every product that's behind, in one batch (Accounts first); before that, 2.23.1 (2026-11-26): a church's Accounts version comes from its heartbeat in New install, and heartbeats keep the install record's version current; 2.23.0 (2026-11-26): release requirements carry forward (`requires accounts …` written once in WHATS-NEW.md) |
|
||||
| Agent on church-server1 | 1.5.0 | 2026-11-23 | Uninstalls one product of a church at a time |
|
||||
| Agent on the central server | 1.5.0 | 2026-11-23 | Reads and changes frps's config from the Hub (no longer read-only; decision 35 superseded) |
|
||||
| Cross Events (churches) | 3.6.1 | 2026-11-20 | Every install adopted onto the monorepo and signing in through Accounts |
|
||||
| Accounts (churches) | 1.6.0 | 2026-11-20 | |
|
||||
| cross-demo2 (demo church) | Accounts 1.7.1, Cross Events 3.7.1, Church Website 1.2.0 | 2026-11-27 | The first Church Website install (`demo2.crosscode.co.za`, added next to the church's Accounts) |
|
||||
| crosscode.co.za | 1.6.1 | 2026-11-23 | Clearer web address choices on the Cross Events page |
|
||||
| Hub | 2.25.0 | 2026-11-27 | Demo clients and demo data for the Website |
|
||||
| Agent on church-server1 | 1.6.0 | 2026-11-27 | |
|
||||
| Agent on the central server | 1.6.0 | 2026-11-27 | |
|
||||
| Cross Events (churches) | 3.7.1 | 2026-11-27 | |
|
||||
| Accounts (churches) | 1.8.0 | 2026-11-27 | |
|
||||
| Church Website (cross-demo2, the demo church) | 1.6.0 | 2026-11-27 | Real demo photos; reload the demo to see them |
|
||||
| cross-demo2 (demo church) | Accounts 1.8.0, Cross Events 3.7.1, Church Website 1.6.0 | 2026-11-27 | The first Church Website install (`demo2.crosscode.co.za`) |
|
||||
| crosscode.co.za | 1.9.0 | 2026-11-27 | The Church Website brochure, every page of each template, screenshots that don't go stale |
|
||||
|
||||
Generated
+4
-4
@@ -133,7 +133,7 @@
|
||||
},
|
||||
"apps/events/backend": {
|
||||
"name": "@crosscode/events-backend",
|
||||
"version": "3.7.1",
|
||||
"version": "3.7.2",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"@cj-tech-master/excelts": "^10.2.0",
|
||||
@@ -183,7 +183,7 @@
|
||||
},
|
||||
"apps/events/frontend": {
|
||||
"name": "@crosscode/events-frontend",
|
||||
"version": "3.7.1",
|
||||
"version": "3.7.2",
|
||||
"dependencies": {
|
||||
"@crosscode/contracts": "*",
|
||||
"@crosscode/seo": "*",
|
||||
@@ -360,7 +360,7 @@
|
||||
},
|
||||
"apps/website/backend": {
|
||||
"name": "@crosscode/website-backend",
|
||||
"version": "1.6.0",
|
||||
"version": "1.6.1",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"@crosscode/auth-client": "*",
|
||||
@@ -389,7 +389,7 @@
|
||||
},
|
||||
"apps/website/frontend": {
|
||||
"name": "@crosscode/website-frontend",
|
||||
"version": "1.6.0",
|
||||
"version": "1.6.1",
|
||||
"dependencies": {
|
||||
"@crosscode/contracts": "*",
|
||||
"@crosscode/seo": "*",
|
||||
|
||||
Reference in New Issue
Block a user