Compare commits
50
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
36ceb358b8 | ||
|
|
a3a158faa8 | ||
|
|
ae604268e0 | ||
|
|
ae122a664a | ||
|
|
62d9728b95 | ||
|
|
ee129fbd87 | ||
|
|
10be55d261 | ||
|
|
ed97956a2f | ||
|
|
e79e5a11f9 | ||
|
|
66557c7f1d | ||
|
|
f4b6a41f83 | ||
|
|
2eaedb8cec | ||
|
|
45a2edd4cc | ||
|
|
0e3534f29f | ||
|
|
9954e66c33 | ||
|
|
9523976044 | ||
|
|
06eedd0499 | ||
|
|
75aeae1ff2 | ||
|
|
d0df78abe3 | ||
|
|
029d3f4e89 | ||
|
|
0b500934cb | ||
|
|
86ddc2e6d9 | ||
|
|
5fbfd28014 | ||
|
|
703fa7804f | ||
|
|
9eb4d345c6 | ||
|
|
e4730120ab | ||
|
|
ac6800d9de | ||
|
|
fc1e97eba8 | ||
|
|
cd84838e78 | ||
|
|
6c03a10a24 | ||
|
|
fe54d9ab7b | ||
|
|
0d48f81c02 | ||
|
|
c1383d62aa | ||
|
|
9dc42e7481 | ||
|
|
a01465a4bb | ||
|
|
e59e7488a3 | ||
|
|
1fe94bf70e | ||
|
|
970a60d55f | ||
|
|
da0a7b5f15 | ||
|
|
e5bb98c81f | ||
|
|
9dd599cd80 | ||
|
|
8dc2c8ad68 | ||
|
|
1bb64b1902 | ||
|
|
3d28ec6edb | ||
|
|
d7f30d348a | ||
|
|
87069c85dd | ||
|
|
1f9f2f4640 | ||
|
|
544cd30656 | ||
|
|
55a924afb6 | ||
|
|
e9f1e46781 |
@@ -2,6 +2,50 @@
|
||||
|
||||
Each package and app has its own section and its own tags (`contracts@1.0.0`, `accounts@1.0.0`, …).
|
||||
|
||||
## 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
|
||||
additive and optional: products on 1.16.0 keep working. Accounts 1.7.0 ships with them because it
|
||||
answers the new `church.update` request. Details of Accounts in `apps/accounts/CHANGELOG.md`.
|
||||
|
||||
- **Brand style** (`./style`): the 8 font pairings confirmed on 2026-11-24 (`FONT_PAIRINGS`:
|
||||
`classic`, `scholarly`, `editorial`, `impact`, `contemporary`, `friendly`, `warm`, `modern`, each
|
||||
with its heading and body font), the corner styles (`CORNERS`, `DEFAULT_CORNERS` = `soft`), the
|
||||
Website's templates (`WEBSITE_TEMPLATES`) and the three pairings each recommends
|
||||
(`TEMPLATE_FONT_PAIRINGS`, default first). The ids are stored in profiles and never change.
|
||||
- **`crosscode.church/1`:** optional `branding.style` (`fontPairing`, `corners`, each nullable). An
|
||||
id a product doesn't know yet reads as null, so a newer Accounts never breaks an older product.
|
||||
- **`crosscode.church-export/1`:** an optional `website` part (template, first publish, style
|
||||
settings, pages with their sections, messages, simple events, the publish history's notes and
|
||||
the media library's alt text). New sample `church-export-website.json`.
|
||||
- **`church.update`** (identity request, product → Accounts, signed with the link's secret): the
|
||||
Website's admin changes shared profile facts (plan decision 10). The product checks the person's
|
||||
role and sends them as `actor`; only the fields given change (`branding` field by field); live at
|
||||
once, then `church.changed`. Optional `ifUpdatedAt` refuses with the new error code
|
||||
`PROFILE_CHANGED` when someone saved in between. Reply: the profile (`churchUpdateReplySchema`).
|
||||
Accounts 1.7.0 takes it from the Website only.
|
||||
- **Licence:** optional `limits.storageBytes`, the Website's storage limit including add-ons (plan
|
||||
decision 12). New sample `hub-licence-payload-website.json`.
|
||||
- **Accounts 1.7.0:** the brand style in Admin → Church profile, the church's fonts, corners and
|
||||
shared footer on its pages, and `church.update` from the Website. Update Accounts before (or with)
|
||||
anything that sends `church.update`; nothing does until the Website.
|
||||
- **`@crosscode/ui` 0.2.0:** `fonts.css` (the 8 pairings' fonts, Latin and Latin Extended, from the
|
||||
pinned `@fontsource-variable` packages, with Capsize size-matched fallbacks on Arial or Georgia;
|
||||
generated by `scripts/fonts.mjs`, checked by `npm test`, at most 160 KB per pairing for an
|
||||
English page), `brandAttributes`, `ChurchFooter`, `productLinks`; the components' corners follow
|
||||
`--cc-radius` and headings the pairing's heading font. Apps without a pairing look as before.
|
||||
- `package-lock.json` catches up with the agent's and contracts' versions.
|
||||
|
||||
## agent@1.5.0 + contracts@1.16.0 + crosscode script - 2026-11-23
|
||||
|
||||
- **Fix: uninstalling one product removed the whole church.** `crosscode uninstall <church>` only
|
||||
|
||||
@@ -1,5 +1,31 @@
|
||||
# Changelog — Accounts
|
||||
|
||||
## [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).
|
||||
|
||||
### Added
|
||||
|
||||
- **Brand style** in the church profile (`branding.style`: font pairing and corners, contracts
|
||||
1.17.0). Admin → Church profile → **Brand style** shows each of the 8 pairings in its own fonts,
|
||||
and the three corner styles. Served in `GET /api/church/v1` and `/api/v2/branding`.
|
||||
- **The church's fonts and corners on Accounts' pages**: `@crosscode/ui/fonts.css` (self-hosted, no
|
||||
font requests to anyone else) and `brandAttributes` on `<html>`. Without a pairing the pages
|
||||
keep the device fonts, so nothing changes until an admin picks one.
|
||||
- **The shared footer** (`ChurchFooter` from `@crosscode/ui`) on the public pages (sign in, forgot
|
||||
and reset password, signed out, confirm email): service times, address, contact, social links,
|
||||
links to the church's other sites and the privacy notice, from the church profile.
|
||||
- **`church.update`** (contracts 1.17.0): the church's Website changes shared profile facts for its
|
||||
admins (WEBSITE-1.0-PLAN decision 10). Only from a product linked as `website`
|
||||
(`WRONG_PRODUCT`), only for an `actor` who signs in through it (`NOT_ALLOWED`), and refused
|
||||
with `PROFILE_CHANGED` (409) when `ifUpdatedAt` is out of date. Live at once; linked products get
|
||||
`church.changed`; audited as `church_profile_changed_by_product` with the fields changed.
|
||||
|
||||
### Changed
|
||||
|
||||
- Saving the profile merges `branding` field by field (`mergeProfile`), so a form or product that
|
||||
sends only part of it (the colours without the style, or only the style) never drops the rest.
|
||||
|
||||
## [1.6.0] - 2026-11-20
|
||||
|
||||
### Added
|
||||
|
||||
@@ -3,6 +3,17 @@
|
||||
What each version changes for the church, in plain language (read by the Hub like Cross Events'
|
||||
WHATS-NEW.md; a section shows once its version is tagged).
|
||||
|
||||
## 1.7.0
|
||||
|
||||
- **Choose your church's fonts and corners.** Admin → Church profile → **Brand style** has 8 font
|
||||
pairings, each shown in its own fonts, and sharp, soft or round corners. Your sign-in pages use
|
||||
them now, and your new Church Website and Cross Events' public pages will too, so all your sites
|
||||
look like one church. Until you pick, nothing changes.
|
||||
- **A footer with your church's details** under the sign-in pages: service times, address, contact
|
||||
details and links to your church's other sites, from the church profile.
|
||||
- Getting ready for the **Church Website**: its admins will be able to change your service times,
|
||||
logo and contact details from the website, and they'll change everywhere at once.
|
||||
|
||||
## 1.6.0
|
||||
|
||||
- **You're told about each sign-in.** After someone signs in, they get an email saying when, roughly
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@crosscode/accounts-backend",
|
||||
"version": "1.6.0",
|
||||
"version": "1.7.0",
|
||||
"description": "Cross Code Accounts: the church's sign-in (OpenID Connect provider), account pages API and admin API",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
|
||||
@@ -69,10 +69,37 @@ export class ProfileError extends Error {
|
||||
}
|
||||
}
|
||||
|
||||
/** Saves an admin's changes (merged onto what's there), and tells the linked products. */
|
||||
export async function updateProfile(ctx: Ctx, input: unknown): Promise<Church> {
|
||||
/** The profile changed since the editor loaded it (`church.update` with `ifUpdatedAt`). */
|
||||
export class ProfileChangedError extends Error {
|
||||
constructor(public updatedAt: string) {
|
||||
super('The church profile was changed by someone else since you opened it.');
|
||||
}
|
||||
}
|
||||
|
||||
const isObject = (v: unknown): v is Record<string, unknown> => !!v && typeof v === 'object' && !Array.isArray(v);
|
||||
|
||||
/**
|
||||
* The fields given replace what's there; `branding` is merged field by field (1.7.0), so a form
|
||||
* that doesn't know `branding.style` (or sends only the style) never drops the rest.
|
||||
*/
|
||||
export function mergeProfile(base: Record<string, unknown>, input: unknown): Record<string, unknown> {
|
||||
if (!isObject(input)) return { ...base };
|
||||
const next: Record<string, unknown> = { ...base, ...input };
|
||||
if (isObject(input.branding)) next.branding = { ...(isObject(base.branding) ? base.branding : {}), ...input.branding };
|
||||
return next;
|
||||
}
|
||||
|
||||
/**
|
||||
* Saves changes (merged onto what's there) from an admin here or a product (`church.update`),
|
||||
* and tells the linked products. With `ifUpdatedAt`, refuses if someone saved since.
|
||||
*/
|
||||
export async function updateProfile(ctx: Ctx, input: unknown, opts: { ifUpdatedAt?: string } = {}): Promise<Church> {
|
||||
const current = await storedProfile(ctx);
|
||||
const next = { ...DEFAULTS(ctx), ...current, ...(input && typeof input === 'object' ? input : {}) };
|
||||
if (opts.ifUpdatedAt) {
|
||||
const now = current.updatedAt ?? new Date(0).toISOString();
|
||||
if (new Date(now).getTime() !== new Date(opts.ifUpdatedAt).getTime()) throw new ProfileChangedError(now);
|
||||
}
|
||||
const next = mergeProfile({ ...DEFAULTS(ctx), ...current }, input);
|
||||
const check = profileInputSchema.safeParse(next);
|
||||
if (!check.success) {
|
||||
const fields = Object.fromEntries(check.error.issues.map((i) => [i.path.join('.'), i.message]));
|
||||
@@ -92,6 +119,7 @@ export async function branding(ctx: Ctx) {
|
||||
shortName: c.shortName,
|
||||
logoUrl: c.branding.logoUrl,
|
||||
colours: c.branding.colours,
|
||||
style: { fontPairing: c.branding.style?.fontPairing ?? null, corners: c.branding.style?.corners ?? null },
|
||||
signupEnabled: await ctx.settings.bool('signup_enabled', true),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -31,6 +31,10 @@ import { emailProblem, normaliseEmail, profileChanged, profileOf, setNewsConsent
|
||||
import { turnOff } from '../accounts/twoFactor.js';
|
||||
import { signOutEverywhere } from '../oidc/sessions.js';
|
||||
import { anonymise } from '../privacy/deletion.js';
|
||||
import { ProfileChangedError, ProfileError, updateProfile } from '../church/profile.js';
|
||||
|
||||
/** Products that may change the church profile with church.update (1.7.0, WEBSITE-1.0-PLAN decision 10). */
|
||||
const PROFILE_EDITORS = new Set(['website']);
|
||||
|
||||
/** A demo person's address (contracts DEMO_EMAIL_DOMAIN, reserved: no real person has one). */
|
||||
export const isDemoEmail = (email: string) => email.toLowerCase().endsWith(`@${DEMO_EMAIL_DOMAIN}`);
|
||||
@@ -319,6 +323,22 @@ async function handle(ctx: Ctx, provider: Provider, link: ProductLink, secret: s
|
||||
await logRequest(ctx, link, r, 'people_checked_by_product', null, req, { checked: people.length, deleted: count('deleted'), unknown: count('unknown') });
|
||||
return reply({ people });
|
||||
}
|
||||
case 'church.update': {
|
||||
// The product checked the person's role (Accounts doesn't know the Website's); Accounts
|
||||
// checks it's the Website, that the person signs in through it, and audits it as theirs.
|
||||
if (!PROFILE_EDITORS.has(link.product)) throw new RequestError("Only the church's Website changes the church profile from outside Accounts.", 'WRONG_PRODUCT', 403);
|
||||
const known = await ctx.db.productPerson.findFirst({ where: { linkId: link.installId, accountId: r.actor } });
|
||||
if (!known) throw new RequestError("The person making the change isn't someone who signs in to this product.", 'NOT_ALLOWED', 403);
|
||||
try {
|
||||
const church = await updateProfile(ctx, r.church, { ifUpdatedAt: r.ifUpdatedAt });
|
||||
await logRequest(ctx, link, r, 'church_profile_changed_by_product', null, req, { fields: Object.keys(r.church) });
|
||||
return reply({ church });
|
||||
} catch (e) {
|
||||
if (e instanceof ProfileChangedError) throw new RequestError(e.message, 'PROFILE_CHANGED', 409);
|
||||
if (e instanceof ProfileError) throw new RequestError(`${e.message} ${Object.entries(e.fields).map(([k, v]) => `${k}: ${v}`).join('; ')}`.trim(), 'INVALID_REQUEST', 400);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
case 'church.branding': {
|
||||
const changed = await applyLook(ctx, r.church, r.overwrite);
|
||||
await logRequest(ctx, link, r, 'church_look_from_product', null, req, { changed, overwrite: r.overwrite });
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
// church.update (contracts 1.17.0, Accounts 1.7.0, WEBSITE-1.0-PLAN decision 10): the Website's
|
||||
// admin changes shared profile facts through Accounts, and the brand style is kept by every save.
|
||||
import assert from 'node:assert/strict';
|
||||
import crypto from 'node:crypto';
|
||||
import { after, before, describe, test } from 'node:test';
|
||||
import { ACCOUNTS_REQUEST_PATH, IDENTITY_REQUEST_SCHEMA } from '@crosscode/contracts';
|
||||
import { ed25519PublicToPem, generateEd25519, LINK_HEADERS, newLinkSecret, signedHeaders } from '@crosscode/contracts/signing';
|
||||
import { startHarness, type Harness } from './support/harness.js';
|
||||
import { church, mergeProfile, updateProfile } from '../src/church/profile.js';
|
||||
|
||||
const WEBSITE_ID = '7e2a1c3d-9b4f-4d6e-8f70-2b3c4d5e6f70';
|
||||
const EVENTS_ID = '8f3b2d4e-0c5a-4e7f-9a81-3c4d5e6f7a81';
|
||||
let h: Harness;
|
||||
const secrets: Record<string, string> = {};
|
||||
let editor: string;
|
||||
|
||||
before(async () => {
|
||||
h = await startHarness();
|
||||
for (const [id, product] of [[WEBSITE_ID, 'website'], [EVENTS_ID, 'events']] as const) {
|
||||
secrets[id] = newLinkSecret();
|
||||
await h.db.productLink.create({
|
||||
data: { installId: id, product, url: `https://${product}.hope.test`, publicKey: ed25519PublicToPem(generateEd25519().publicKey), secret: h.ctx.secrets.encrypt(secrets[id]!), connectedAt: new Date() },
|
||||
});
|
||||
}
|
||||
const a = await h.makeAccount({ email: 'editor@hope.test' });
|
||||
editor = a.id as string;
|
||||
for (const linkId of [WEBSITE_ID, EVENTS_ID]) await h.db.productPerson.create({ data: { linkId, accountId: editor, via: 'sign_in', createdAt: new Date() } });
|
||||
await updateProfile(h.ctx, { name: 'Hope Family Church', branding: { logoUrl: null, iconUrl: null, colours: { primary: '#1f4e79', accent: '#f2a900' } } });
|
||||
});
|
||||
after(async () => { await h.close(); });
|
||||
|
||||
async function ask(body: Record<string, unknown>, from = WEBSITE_ID) {
|
||||
const raw = JSON.stringify({ schema: IDENTITY_REQUEST_SCHEMA, requestId: crypto.randomUUID(), actor: editor, type: 'church.update', ...body });
|
||||
const headers = signedHeaders(LINK_HEADERS, { senderId: from, secret: secrets[from]!, rawBody: raw });
|
||||
const res = await fetch(`${h.publicUrl}${ACCOUNTS_REQUEST_PATH}`, { method: 'POST', body: raw, headers: { 'content-type': 'application/json', ...headers } });
|
||||
return { status: res.status, body: (await res.json()) as Record<string, unknown> };
|
||||
}
|
||||
|
||||
describe('church.update from the Website', () => {
|
||||
test('changes only the style, keeps the colours and logo, and goes live at once', async () => {
|
||||
const res = await ask({ church: { branding: { style: { fontPairing: 'warm', corners: 'round' } } } });
|
||||
assert.equal(res.status, 200, JSON.stringify(res.body));
|
||||
const c = await church(h.ctx);
|
||||
assert.deepEqual(c.branding.style, { fontPairing: 'warm', corners: 'round' });
|
||||
assert.equal(c.branding.colours.primary, '#1f4e79');
|
||||
assert.equal(c.name, 'Hope Family Church');
|
||||
assert.deepEqual((res.body.church as { branding: unknown }).branding, c.branding);
|
||||
});
|
||||
|
||||
test('tells every linked product the profile changed, and audits it as the editor', async () => {
|
||||
const before = await h.db.delivery.count();
|
||||
const res = await ask({ church: { shortName: 'Hope Family' } });
|
||||
assert.equal(res.status, 200, JSON.stringify(res.body));
|
||||
assert.ok((await h.db.delivery.count()) > before);
|
||||
const log = await h.db.auditLog.findFirst({ where: { action: 'church_profile_changed_by_product' }, orderBy: { createdAt: 'desc' } });
|
||||
assert.equal(log?.actorId, editor);
|
||||
});
|
||||
|
||||
test('refuses another product, someone who doesn\'t sign in through the Website, and a stale edit', async () => {
|
||||
const events = await ask({ church: { name: 'Hijacked' } }, EVENTS_ID);
|
||||
assert.equal(events.status, 403);
|
||||
assert.equal(events.body.code, 'WRONG_PRODUCT');
|
||||
|
||||
const stranger = await h.makeAccount({ email: 'stranger@hope.test' });
|
||||
const notKnown = await ask({ actor: stranger.id as string, church: { name: 'Hijacked' } });
|
||||
assert.equal(notKnown.status, 403);
|
||||
assert.equal(notKnown.body.code, 'NOT_ALLOWED');
|
||||
|
||||
const stale = await ask({ ifUpdatedAt: '2020-01-01T00:00:00.000Z', church: { name: 'Hijacked' } });
|
||||
assert.equal(stale.status, 409);
|
||||
assert.equal(stale.body.code, 'PROFILE_CHANGED');
|
||||
assert.equal((await church(h.ctx)).name, 'Hope Family Church');
|
||||
});
|
||||
|
||||
test('takes an edit made on the current version', async () => {
|
||||
const current = await church(h.ctx);
|
||||
const res = await ask({ ifUpdatedAt: current.updatedAt, church: { serviceTimes: [{ day: 'sunday', time: '09:00', label: null, campus: null, note: null }] } });
|
||||
assert.equal(res.status, 200, JSON.stringify(res.body));
|
||||
assert.equal((await church(h.ctx)).serviceTimes.length, 1);
|
||||
});
|
||||
|
||||
test('an invalid value is refused with what\'s wrong', async () => {
|
||||
const res = await ask({ church: { contact: { email: null, phone: '016 123', whatsapp: null, address: null } } });
|
||||
assert.equal(res.status, 400);
|
||||
assert.equal(res.body.code, 'INVALID_REQUEST');
|
||||
});
|
||||
});
|
||||
|
||||
describe('saving the profile keeps the brand style', () => {
|
||||
test('an admin form that sends branding without the style doesn\'t drop it', async () => {
|
||||
await updateProfile(h.ctx, { branding: { style: { fontPairing: 'classic', corners: 'sharp' } } });
|
||||
await updateProfile(h.ctx, { branding: { logoUrl: null, iconUrl: null, colours: { primary: '#204060', accent: null } } });
|
||||
const c = await church(h.ctx);
|
||||
assert.deepEqual(c.branding.style, { fontPairing: 'classic', corners: 'sharp' });
|
||||
assert.equal(c.branding.colours.primary, '#204060');
|
||||
});
|
||||
|
||||
test('mergeProfile replaces other fields whole and merges branding', () => {
|
||||
const merged = mergeProfile({ name: 'A', social: [1], branding: { logoUrl: 'x', colours: { primary: '#000000' } } }, { social: [], branding: { colours: { primary: '#ffffff' } } });
|
||||
assert.deepEqual(merged, { name: 'A', social: [], branding: { logoUrl: 'x', colours: { primary: '#ffffff' } } });
|
||||
});
|
||||
|
||||
test('the sign-in pages get the style', async () => {
|
||||
const res = await fetch(`${h.publicUrl}/api/v2/branding`);
|
||||
const b = (await res.json()) as { style: unknown };
|
||||
assert.deepEqual(b.style, { fontPairing: 'classic', corners: 'sharp' });
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,43 @@
|
||||
import AxeBuilder from "@axe-core/playwright";
|
||||
import { expect, test } from "@playwright/test";
|
||||
|
||||
// 1.7.0 (WEBSITE-1.0-PLAN §3, §9): the church's brand style and shared footer on Accounts' public
|
||||
// pages. The e2e church (e2e/server.ts) has the "warm" pairing, round corners and service times.
|
||||
const PRODUCT = "http://localhost:5211";
|
||||
|
||||
test("the sign-in page uses the church's fonts and corners, and shows its footer", async ({ page }) => {
|
||||
await page.goto(`${PRODUCT}/start?returnTo=/`);
|
||||
await expect(page.getByRole("heading", { name: "Sign in to Hope Family Church" })).toBeVisible();
|
||||
await expect(page.locator("html")).toHaveAttribute("data-cc-fonts", "warm");
|
||||
await expect(page.locator("html")).toHaveAttribute("data-cc-corners", "round");
|
||||
|
||||
const heading = page.getByRole("heading", { name: "Sign in to Hope Family Church" });
|
||||
expect(await heading.evaluate((el) => getComputedStyle(el).fontFamily)).toContain("CC Fraunces");
|
||||
expect(await page.locator("body").evaluate((el) => getComputedStyle(el).fontFamily)).toContain("CC Nunito Sans");
|
||||
// The font files themselves load from this site (self-hosted), not from anyone else.
|
||||
await page.evaluate(() => document.fonts.ready);
|
||||
expect(await page.evaluate(() => document.fonts.check('600 20px "CC Fraunces"'))).toBe(true);
|
||||
expect(await page.getByRole("button", { name: "Sign in" }).evaluate((el) => getComputedStyle(el).borderRadius)).toBe("9999px");
|
||||
|
||||
const footer = page.locator("footer");
|
||||
await expect(footer.getByRole("heading", { name: "Service times" })).toBeVisible();
|
||||
await expect(footer).toContainText("Sundays 09:00");
|
||||
await expect(footer.getByRole("link", { name: "office@hope.test" })).toHaveAttribute("href", "mailto:office@hope.test");
|
||||
await expect(footer.getByRole("link", { name: "Website" })).toHaveAttribute("href", PRODUCT);
|
||||
await expect(footer.getByRole("link", { name: "Privacy notice" })).toHaveAttribute("href", "/privacy");
|
||||
});
|
||||
|
||||
test("fonts never come from another site", async ({ page }) => {
|
||||
const foreign: string[] = [];
|
||||
page.on("request", (r) => { if (/\.(woff2?|ttf|otf)(\?|$)/.test(r.url()) && !r.url().startsWith("http://localhost:3210/")) foreign.push(r.url()); });
|
||||
await page.goto(`${PRODUCT}/start?returnTo=/`);
|
||||
await page.evaluate(() => document.fonts.ready);
|
||||
expect(foreign).toEqual([]);
|
||||
});
|
||||
|
||||
test("the sign-in page with the footer passes axe (WCAG 2.2 AA)", async ({ page }) => {
|
||||
await page.goto(`${PRODUCT}/start?returnTo=/`);
|
||||
await expect(page.locator("footer")).toBeVisible();
|
||||
const results = await new AxeBuilder({ page }).withTags(["wcag2a", "wcag2aa", "wcag21a", "wcag21aa", "wcag22aa"]).analyze();
|
||||
expect(results.violations.map((v) => `${v.id}: ${v.nodes.map((n) => n.target.join(" ")).join(", ")}`)).toEqual([]);
|
||||
});
|
||||
@@ -29,7 +29,13 @@ const messenger = new MemoryMessenger();
|
||||
const ctx = createCtx(loadConfig({ ACCOUNTS_URL: WEB, NODE_ENV: 'test', JOBS_ENABLED: 'false', LINKS_ALLOW_PRIVATE: 'true', HUB_URL: 'http://127.0.0.1:1', TRUST_PROXY: 'true' }), db as never, { messenger });
|
||||
await ctx.settings.setMany({
|
||||
hub_install_id: '9a4c2f1e-7b3d-4e5a-8c6f-0d1e2f3a4b5c',
|
||||
church_profile: JSON.stringify({ name: 'Hope Family Church', shortName: 'Hope', branding: { logoUrl: null, iconUrl: null, colours: { primary: '#7c2d12', accent: '#f2a900' } } }),
|
||||
// 1.7.0: a brand style, service times and contact details, so the pages show the church's fonts and footer.
|
||||
church_profile: JSON.stringify({
|
||||
name: 'Hope Family Church', shortName: 'Hope',
|
||||
branding: { logoUrl: null, iconUrl: null, colours: { primary: '#7c2d12', accent: '#f2a900' }, style: { fontPairing: 'warm', corners: 'round' } },
|
||||
serviceTimes: [{ day: 'sunday', time: '09:00', label: 'Morning service', campus: null, note: null }],
|
||||
contact: { email: 'office@hope.test', phone: '+27161234567', whatsapp: null, address: null },
|
||||
}),
|
||||
});
|
||||
const linkSecret = newLinkSecret();
|
||||
await db.productLink.create({ data: { installId: PRODUCT_ID, product: 'website', url: PRODUCT, publicKey: ed25519PublicToPem(generateEd25519().publicKey), secret: ctx.secrets.encrypt(linkSecret), connectedAt: new Date() } });
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@crosscode/accounts-frontend",
|
||||
"version": "1.6.0",
|
||||
"version": "1.7.0",
|
||||
"private": true,
|
||||
"description": "Cross Code Accounts: the church's sign-in pages, the account page and admin",
|
||||
"scripts": {
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
import Link from "next/link";
|
||||
import { useState } from "react";
|
||||
import { Card, Heading, Notice, Shell } from "@crosscode/ui";
|
||||
import { Card, Heading, Notice } from "@crosscode/ui";
|
||||
import { PublicShell } from "@/components/PublicShell";
|
||||
import { useBranding } from "@/components/BrandingProvider";
|
||||
import { call, selfSignIn } from "@/lib/api";
|
||||
import { useExternalEffect } from "@/lib/hooks";
|
||||
@@ -20,12 +21,12 @@ export function ConfirmEmail({ token }: { token: string }) {
|
||||
return () => { alive = false; };
|
||||
}, [token]);
|
||||
return (
|
||||
<Shell branding={branding}>
|
||||
<PublicShell>
|
||||
<Card>
|
||||
<Heading>Your email address</Heading>
|
||||
{state ? <Notice tone={state.ok ? "success" : "error"}>{state.text}</Notice> : <p className="text-gray-600">Confirming…</p>}
|
||||
<Link href="/account" className="text-brand underline">Back to your account</Link>
|
||||
</Card>
|
||||
</Shell>
|
||||
</PublicShell>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import { Card, Heading } from "@/components/Panel";
|
||||
import { call, selfSignIn } from "@/lib/api";
|
||||
import { useExternalEffect } from "@/lib/hooks";
|
||||
import { ADMIN_SECTIONS, type AdminSection } from "@/lib/sections";
|
||||
import { BrandStyle } from "./BrandStyle";
|
||||
|
||||
|
||||
const when = (iso: string | null | undefined) => (iso ? new Date(iso).toLocaleString("en-ZA", { day: "numeric", month: "short", year: "numeric", hour: "2-digit", minute: "2-digit" }) : "—");
|
||||
@@ -55,7 +56,7 @@ export function Admin({ section = "people" }: { section?: AdminSection }) {
|
||||
{section === "people" && <People flash={flash} />}
|
||||
<div className="max-w-3xl">
|
||||
{section === "deletions" && <Deletions flash={flash} />}
|
||||
{section === "church" && <Church flash={flash} />}
|
||||
{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"]} />}
|
||||
|
||||
@@ -0,0 +1,98 @@
|
||||
"use client";
|
||||
|
||||
import React, { useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { CORNERS, FONT_PAIRING_IDS, FONT_PAIRINGS, type Corners, type FontPairing } from "@crosscode/contracts";
|
||||
import { Button } from "@crosscode/ui";
|
||||
import { Card, Heading } from "@/components/Panel";
|
||||
import { call } from "@/lib/api";
|
||||
import { useExternalEffect } from "@/lib/hooks";
|
||||
|
||||
type Style = { fontPairing: FontPairing | null; corners: Corners | null };
|
||||
type ChurchStyle = { branding: { style?: Style } };
|
||||
|
||||
const CORNER_LABELS: Record<Corners, { name: string; radius: string }> = {
|
||||
sharp: { name: "Sharp", radius: "0" },
|
||||
soft: { name: "Soft", radius: "0.5rem" },
|
||||
round: { name: "Round", radius: "9999px" },
|
||||
};
|
||||
|
||||
/**
|
||||
* The church's brand style (1.7.0, WEBSITE-1.0-PLAN §3): a font pairing and corners, shared by
|
||||
* Accounts' pages, the Website and Cross Events. Each option is shown in its own fonts (fonts.css
|
||||
* is loaded on every page; a pairing's files download only when shown).
|
||||
*/
|
||||
export function BrandStyle({ flash }: { flash: (tone: "success" | "error", text: string) => void }) {
|
||||
const router = useRouter();
|
||||
const [saved, setSaved] = useState<Style | null>(null);
|
||||
const [style, setStyle] = useState<Style>({ fontPairing: null, corners: null });
|
||||
const [busy, setBusy] = useState(false);
|
||||
useExternalEffect(() => {
|
||||
let alive = true;
|
||||
call<ChurchStyle>("GET", "/admin/church").then((r) => {
|
||||
if (!alive || !r.ok) return;
|
||||
const s = { fontPairing: r.data.branding.style?.fontPairing ?? null, corners: r.data.branding.style?.corners ?? null };
|
||||
setSaved(s);
|
||||
setStyle(s);
|
||||
});
|
||||
return () => { alive = false; };
|
||||
}, []);
|
||||
if (!saved) return null;
|
||||
const changed = saved.fontPairing !== style.fontPairing || saved.corners !== style.corners;
|
||||
|
||||
const option = (selected: boolean) => `block cursor-pointer rounded-xl border p-4 transition focus-within:ring-2 focus-within:ring-brand/50 ${selected ? "border-brand bg-brand/5 ring-1 ring-brand" : "border-gray-200 hover:border-gray-300"}`;
|
||||
|
||||
return (
|
||||
<Card className="mt-6">
|
||||
<Heading sub="How the church's sites look: these sign-in pages, the website and Cross Events' public pages. Colours and logo are above.">Brand style</Heading>
|
||||
<form onSubmit={async (e) => {
|
||||
e.preventDefault();
|
||||
setBusy(true);
|
||||
const r = await call<ChurchStyle>("PUT", "/admin/church", { branding: { style } });
|
||||
setBusy(false);
|
||||
if (r.ok) {
|
||||
setSaved(style);
|
||||
flash("success", "Saved. The church's sites use the new style.");
|
||||
router.refresh();
|
||||
} else flash("error", r.error.message);
|
||||
}}>
|
||||
<fieldset className="mb-6">
|
||||
<legend className="mb-1 text-sm font-semibold text-gray-900">Fonts</legend>
|
||||
<p className="mb-3 text-sm text-gray-600">A font for headings and one for text. The website's template recommends three, but any works.</p>
|
||||
<div className="grid gap-3 sm:grid-cols-2">
|
||||
<label className={option(style.fontPairing === null)}>
|
||||
<input type="radio" name="fontPairing" className="sr-only" checked={style.fontPairing === null} onChange={() => setStyle({ ...style, fontPairing: null })} />
|
||||
<span className="block text-lg font-semibold [font-family:ui-sans-serif,system-ui,sans-serif]">Device fonts</span>
|
||||
<span className="mt-1 block text-sm text-gray-600 [font-family:ui-sans-serif,system-ui,sans-serif]">Each phone and computer's own. The website uses its template's fonts.</span>
|
||||
</label>
|
||||
{FONT_PAIRING_IDS.map((id) => {
|
||||
const p = FONT_PAIRINGS[id];
|
||||
return (
|
||||
<label key={id} className={option(style.fontPairing === id)} data-cc-fonts={id}>
|
||||
<input type="radio" name="fontPairing" className="sr-only" checked={style.fontPairing === id} onChange={() => setStyle({ ...style, fontPairing: id })} />
|
||||
<span className="block text-lg font-semibold [font-family:var(--cc-font-heading)] [font-variation-settings:var(--cc-heading-variation,normal)]">{p.name}: Welcome home</span>
|
||||
<span className="mt-1 block text-sm text-gray-700 [font-family:var(--cc-font-body)]">{p.feel}. <em>Sundays at 09:00.</em></span>
|
||||
<span className="mt-2 block text-xs text-gray-500 [font-family:ui-sans-serif,system-ui,sans-serif]">{p.heading.family}{p.body.family !== p.heading.family && ` and ${p.body.family}`}</span>
|
||||
</label>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset className="mb-6">
|
||||
<legend className="mb-1 text-sm font-semibold text-gray-900">Corners</legend>
|
||||
<p className="mb-3 text-sm text-gray-600">Of buttons, cards, photos and fields.</p>
|
||||
<div className="grid grid-cols-3 gap-3">
|
||||
{CORNERS.map((id) => (
|
||||
<label key={id} className={option((style.corners ?? "soft") === id)}>
|
||||
<input type="radio" name="corners" className="sr-only" checked={(style.corners ?? "soft") === id} onChange={() => setStyle({ ...style, corners: id })} />
|
||||
<span className="mb-2 block h-8 w-full bg-brand" style={{ borderRadius: CORNER_LABELS[id].radius }} aria-hidden />
|
||||
<span className="block text-sm font-medium">{CORNER_LABELS[id].name}</span>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
</fieldset>
|
||||
<Button type="submit" busy={busy} disabled={!changed}>Save</Button>
|
||||
</form>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
import { KeyRound } from "lucide-react";
|
||||
import React, { useState } from "react";
|
||||
import { Button, Card, Field, Heading, Notice, Shell } from "@crosscode/ui";
|
||||
import { Button, Card, Field, Heading, Notice } from "@crosscode/ui";
|
||||
import { PublicShell } from "@/components/PublicShell";
|
||||
import { useBranding } from "@/components/BrandingProvider";
|
||||
import { call } from "@/lib/api";
|
||||
|
||||
@@ -12,7 +13,7 @@ export function Forgot({ uid }: { uid: string | null }) {
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
return (
|
||||
<Shell branding={branding}>
|
||||
<PublicShell>
|
||||
<Card>
|
||||
<Heading icon={<KeyRound className="h-5 w-5" />} sub="We'll email you a link to choose a new one.">Forgot your password?</Heading>
|
||||
{sent ? (
|
||||
@@ -32,6 +33,6 @@ export function Forgot({ uid }: { uid: string | null }) {
|
||||
)}
|
||||
{uid && <p className="mt-4 text-sm"><a href={`/signin?uid=${encodeURIComponent(uid)}`} className="text-brand underline">Back to sign in</a></p>}
|
||||
</Card>
|
||||
</Shell>
|
||||
</PublicShell>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -10,4 +10,11 @@
|
||||
|
||||
body {
|
||||
@apply bg-gray-50 text-gray-900 antialiased;
|
||||
/* 1.7.0: the church's font pairing when it has one (@crosscode/ui fonts.css), else the system font. */
|
||||
font-family: var(--cc-font-body, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");
|
||||
}
|
||||
|
||||
h1, h2, h3 {
|
||||
font-family: var(--cc-font-heading, inherit);
|
||||
font-variation-settings: var(--cc-heading-variation, normal);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import type { Metadata } from "next";
|
||||
import { headers } from "next/headers";
|
||||
import "@crosscode/ui/fonts.css";
|
||||
import "./globals.css";
|
||||
import { brandAttributes } from "@crosscode/ui";
|
||||
import { BrandingProvider } from "@/components/BrandingProvider";
|
||||
import { loadBranding, rgbVars } from "@/lib/branding";
|
||||
import { loadBranding, loadChurch, rgbVars } from "@/lib/branding";
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const b = await loadBranding();
|
||||
@@ -12,15 +14,16 @@ export async function generateMetadata(): Promise<Metadata> {
|
||||
|
||||
export default async function RootLayout({ children }: { children: React.ReactNode }) {
|
||||
const nonce = (await headers()).get("x-nonce") ?? undefined;
|
||||
const b = await loadBranding();
|
||||
const [b, church] = await Promise.all([loadBranding(), loadChurch()]);
|
||||
const vars = rgbVars(b.colours.primary);
|
||||
// 1.7.0: the church's font pairing and corners (fonts.css), shared with its other sites.
|
||||
return (
|
||||
<html lang="en-ZA">
|
||||
<html lang="en-ZA" {...brandAttributes(b.style)}>
|
||||
<head>
|
||||
<style nonce={nonce}>{`:root{--brand:${vars.brand};--brand-dark:${vars.dark}}`}</style>
|
||||
</head>
|
||||
<body>
|
||||
<BrandingProvider value={{ name: b.name, shortName: b.shortName, logoUrl: b.logoUrl, signupEnabled: b.signupEnabled, setupNeeded: b.setupNeeded }}>
|
||||
<BrandingProvider value={{ name: b.name, shortName: b.shortName, logoUrl: b.logoUrl, signupEnabled: b.signupEnabled, setupNeeded: b.setupNeeded, church }}>
|
||||
{children}
|
||||
</BrandingProvider>
|
||||
</body>
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
import { KeyRound } from "lucide-react";
|
||||
import React, { useState } from "react";
|
||||
import { Button, Card, Field, Heading, Notice, Shell } from "@crosscode/ui";
|
||||
import { Button, Card, Field, Heading, Notice } from "@crosscode/ui";
|
||||
import { PublicShell } from "@/components/PublicShell";
|
||||
import { useBranding } from "@/components/BrandingProvider";
|
||||
import { call, selfSignIn } from "@/lib/api";
|
||||
|
||||
@@ -11,7 +12,7 @@ export function Reset({ token }: { token: string | null }) {
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
return (
|
||||
<Shell branding={branding}>
|
||||
<PublicShell>
|
||||
<Card>
|
||||
<Heading icon={<KeyRound className="h-5 w-5" />} sub="At least 8 characters.">Choose a new password</Heading>
|
||||
{error && <Notice tone="error">{error}</Notice>}
|
||||
@@ -29,6 +30,6 @@ export function Reset({ token }: { token: string | null }) {
|
||||
<Button type="submit" busy={busy} className="w-full">Save and sign in</Button>
|
||||
</form>
|
||||
</Card>
|
||||
</Shell>
|
||||
</PublicShell>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
"use client";
|
||||
|
||||
import { LogOut } from "lucide-react";
|
||||
import { Card, Heading, Shell } from "@crosscode/ui";
|
||||
import { Card, Heading } from "@crosscode/ui";
|
||||
import { PublicShell } from "@/components/PublicShell";
|
||||
import { useBranding } from "@/components/BrandingProvider";
|
||||
import { selfSignIn } from "@/lib/api";
|
||||
|
||||
export default function SignedOutPage() {
|
||||
const branding = useBranding();
|
||||
return (
|
||||
<Shell branding={branding}>
|
||||
<PublicShell>
|
||||
<Card>
|
||||
<Heading icon={<LogOut className="h-5 w-5" />} sub={`You've been signed out of all of ${branding.name}'s sites.`}>You're signed out</Heading>
|
||||
<a href={selfSignIn("/account")} className="text-brand underline">Sign in again</a>
|
||||
</Card>
|
||||
</Shell>
|
||||
</PublicShell>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
import { AlertTriangle, FileText, KeyRound, LogIn, Mail, Megaphone, ShieldCheck, UserPlus } from "lucide-react";
|
||||
import React, { useState } from "react";
|
||||
import QRCode from "qrcode";
|
||||
import { Button, Card, Checkbox, Field, Heading, Notice, Shell } from "@crosscode/ui";
|
||||
import { Button, Card, Checkbox, Field, Heading, Notice } from "@crosscode/ui";
|
||||
import { PublicShell } from "@/components/PublicShell";
|
||||
import { useBranding } from "@/components/BrandingProvider";
|
||||
import { NoticeText } from "@/components/NoticeText";
|
||||
import { call, type ApiError } from "@/lib/api";
|
||||
@@ -82,7 +83,7 @@ export function SignIn({ uid }: { uid: string }) {
|
||||
return r;
|
||||
};
|
||||
|
||||
const frame = (children: React.ReactNode) => <Shell branding={branding}><Card>{children}</Card></Shell>;
|
||||
const frame = (children: React.ReactNode) => <PublicShell><Card>{children}</Card></PublicShell>;
|
||||
|
||||
if (codes) {
|
||||
return frame(<RecoveryCodes codes={codes.codes} onDone={() => { const next = codes.next; setCodes(null); go(next); }} />);
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
"use client";
|
||||
|
||||
import React, { createContext, useContext } from "react";
|
||||
import type { FooterChurch } from "@crosscode/ui";
|
||||
|
||||
export type ClientBranding = { name: string; shortName: string | null; logoUrl: string | null; signupEnabled: boolean; setupNeeded: boolean };
|
||||
/** `church` (1.7.0): the profile for the shared footer, null when it couldn't be loaded. */
|
||||
export type ClientBranding = { name: string; shortName: string | null; logoUrl: string | null; signupEnabled: boolean; setupNeeded: boolean; church?: FooterChurch | null };
|
||||
|
||||
const Ctx = createContext<ClientBranding>({ name: "Sign in", shortName: null, logoUrl: null, signupEnabled: true, setupNeeded: false });
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import { ChurchFooter, Shell } from "@crosscode/ui";
|
||||
import { useBranding } from "@/components/BrandingProvider";
|
||||
|
||||
/**
|
||||
* The frame of the public pages (sign in, forgot, reset, signed out, confirm email) with the
|
||||
* church's shared footer (1.7.0, WEBSITE-1.0-PLAN §9): its service times, contact and links to its
|
||||
* other sites, as on the Website and Cross Events.
|
||||
*/
|
||||
export function PublicShell({ children }: { children: React.ReactNode }) {
|
||||
const branding = useBranding();
|
||||
const footer = branding.church ? <ChurchFooter church={branding.church} current="accounts" privacyUrl="/privacy" /> : undefined;
|
||||
return <Shell branding={branding} footer={footer}>{children}</Shell>;
|
||||
}
|
||||
@@ -1,9 +1,13 @@
|
||||
import type { FooterChurch } from "@crosscode/ui";
|
||||
|
||||
/** The church's branding from the backend, for the server-rendered frame of every page. */
|
||||
export type BrandingData = {
|
||||
name: string;
|
||||
shortName: string | null;
|
||||
logoUrl: string | null;
|
||||
colours: { primary: string; accent: string | null };
|
||||
/** 1.7.0: the font pairing and corners (null: not picked). */
|
||||
style?: { fontPairing: string | null; corners: string | null };
|
||||
signupEnabled: boolean;
|
||||
setupNeeded: boolean;
|
||||
};
|
||||
@@ -20,6 +24,17 @@ export async function loadBranding(): Promise<BrandingData> {
|
||||
return { name: "Sign in", shortName: null, logoUrl: null, colours: { primary: "#1f4e79", accent: null }, signupEnabled: true, setupNeeded: false };
|
||||
}
|
||||
|
||||
/** The church profile (`crosscode.church/1`) for the shared footer (1.7.0), or null while it can't be had. */
|
||||
export async function loadChurch(): Promise<FooterChurch | null> {
|
||||
try {
|
||||
const res = await fetch(`${api}/api/church/v1`, { next: { revalidate: 60 } });
|
||||
if (res.ok) return (await res.json()) as FooterChurch;
|
||||
} catch {
|
||||
// As loadBranding: the page works without it.
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/** "#1f4e79" → "31 78 121" (Tailwind's rgb(var(--brand) / alpha)), and a darker shade for hover. */
|
||||
export function rgbVars(hex: string): { brand: string; dark: string } {
|
||||
const m = /^#([0-9a-f]{6})$/i.exec(hex) ?? ["", "1f4e79"];
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
# What's new in the server agent
|
||||
|
||||
What each version of the Cross Code server agent changes, for whoever runs the Hub. The Hub shows
|
||||
these notes on its Releases page and when you pick a version under Update agent.
|
||||
|
||||
<!--
|
||||
How this file is used: the Cross Code Hub reads it from main every 15 minutes (release source
|
||||
"Server agent", tags agent@1.2.3) and shows a section only once its version is tagged, so write it
|
||||
before tagging; fixes to old sections show straight away. Each version is a "## 1.2.3" heading; add
|
||||
"— urgent" (or "security") to the heading for a security or serious bug fix. Under it, lines
|
||||
starting with "- " show as a list and other lines as paragraphs.
|
||||
Write for the person updating servers: what the agent can now do from the Hub, and which Hub or
|
||||
contracts version needs it. The developer log is the commit history of apps/agent.
|
||||
-->
|
||||
|
||||
## 1.5.0
|
||||
|
||||
- **One product of a church at a time.** Uninstall, export and purge jobs can name products: only
|
||||
those go, and the church keeps the others. Naming every product it still has removes the whole
|
||||
church, so the last product to go takes the church with it. Before, uninstalling a church's Cross
|
||||
Events also removed its Accounts.
|
||||
- The Hub (2.12.0 and later) uninstalls one product only on servers with this agent; older agents
|
||||
can only remove the whole church.
|
||||
|
||||
## 1.4.0
|
||||
|
||||
- **frp's config from the Hub.** The agent finds frps's config (central server) or frpc's (church
|
||||
server) wherever it is: the path set on the Hub, the `-c` in the systemd unit, or the usual places.
|
||||
It reads INI and TOML.
|
||||
- **Changing it from the Hub:** the agent checks the new file with `frp* verify`, keeps a backup,
|
||||
restarts frp if asked, and puts the old file back if frp doesn't start. Secret values never leave
|
||||
the server.
|
||||
- **Ports checked before an install:** the Hub asks this server and the central server which ports
|
||||
are free, so a new install gets ports free on both.
|
||||
- Needed for frp config on a server's page and port checks (Hub 2.11.0).
|
||||
|
||||
## 1.3.1
|
||||
|
||||
- **Fix:** 1.3.0 reported itself as 1.2.0, so the Hub refused its .env jobs. It now reports its
|
||||
real version. Install this instead of 1.3.0.
|
||||
|
||||
## 1.3.0
|
||||
|
||||
- **A site's .env from the Hub.** The agent reads an install's .env (secret values hidden) and
|
||||
changes it: one file at a time, rebuilding the site when its frontend settings changed,
|
||||
restarting it, and putting the old file back if the site doesn't answer.
|
||||
- Needed for the Settings (.env) tab on an install's page (Hub 2.8.0).
|
||||
|
||||
## 1.2.0
|
||||
|
||||
- **Demo data from the Hub.** The agent loads a demo profile onto a site marked as a demo: a backup
|
||||
first, then the demo data, keeping one admin account.
|
||||
- Needed for demo sites (Hub 2.4.0).
|
||||
|
||||
## 1.1.1
|
||||
|
||||
- **Fix:** the server's stats now keep going while a long job runs. Before, a 30-minute install
|
||||
stopped them and the Hub alerted that the server was down.
|
||||
- **Fix:** 1.1.0 reported itself as 1.0.1; it now reports its real version.
|
||||
|
||||
## 1.1.0
|
||||
|
||||
- **Accounts installs.** The agent installs Accounts, and adds a product next to a church's others
|
||||
on the same server (with the ports and release the Hub chose).
|
||||
|
||||
## 1.0.1
|
||||
|
||||
- **Fix:** on the central server, Check status failed (it has no `crosscode` script). It now answers
|
||||
with its own stats, including whether frps is running.
|
||||
|
||||
## 1.0.0
|
||||
|
||||
- **The first server agent.** It polls the Hub every 30 seconds for signed jobs, runs the
|
||||
`crosscode` script for them (install, update, status, export, uninstall), sends the results, and
|
||||
sends the server's stats every minute. It listens on no port: every request goes out to the Hub.
|
||||
@@ -5,6 +5,38 @@ 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.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
|
||||
|
||||
@@ -12,6 +12,14 @@ 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.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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@crosscode/events-backend",
|
||||
"version": "3.6.1",
|
||||
"version": "3.7.0",
|
||||
"description": "Event Management System Backend",
|
||||
"main": "src/index.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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)));
|
||||
|
||||
@@ -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() };
|
||||
},
|
||||
});
|
||||
@@ -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');
|
||||
});
|
||||
});
|
||||
@@ -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");
|
||||
});
|
||||
});
|
||||
@@ -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; });
|
||||
|
||||
@@ -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' }],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@crosscode/events-frontend",
|
||||
"version": "3.6.1",
|
||||
"version": "3.7.0",
|
||||
"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>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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,6 +1,6 @@
|
||||
{
|
||||
"name": "@crosscode/events",
|
||||
"version": "3.6.1",
|
||||
"version": "3.7.0",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"dev:backend": "cd backend && npm run dev",
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
# this install's PM2 config (made from ecosystem.config.example.cjs by the crosscode script)
|
||||
/ecosystem.config.cjs
|
||||
@@ -0,0 +1,10 @@
|
||||
# Changelog — Church Website
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### 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`.
|
||||
+18
-1
@@ -1,3 +1,20 @@
|
||||
# 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:** skeleton (2026-11-25). Not released; `website@1.0.0` is tagged when the plan is built.
|
||||
|
||||
- `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).
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
# 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).
|
||||
@@ -0,0 +1,7 @@
|
||||
node_modules/
|
||||
dist/
|
||||
src/generated/
|
||||
.env
|
||||
uploads/
|
||||
exports/
|
||||
/backups/
|
||||
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"name": "@crosscode/website-backend",
|
||||
"version": "0.1.0",
|
||||
"description": "Church Website: the public site's content API, the admin API, publishing and uploads",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
"scripts": {
|
||||
"start": "node dist/index.js",
|
||||
"dev": "tsx watch src/index.ts",
|
||||
"build": "tsc -p tsconfig.build.json && node -e \"require('fs').writeFileSync('dist/build.json', JSON.stringify({ version: require('./package.json').version, builtAt: new Date().toISOString() }))\"",
|
||||
"typecheck": "tsc -p tsconfig.json --noEmit",
|
||||
"test": "node --import tsx --test --test-reporter=spec \"tests/**/*.test.ts\"",
|
||||
"postinstall": "prisma generate",
|
||||
"prisma:generate": "prisma generate",
|
||||
"prisma:deploy": "prisma migrate deploy && prisma generate",
|
||||
"prisma:status": "prisma migrate status"
|
||||
},
|
||||
"dependencies": {
|
||||
"@crosscode/contracts": "*",
|
||||
"@prisma/adapter-pg": "^7.10.1",
|
||||
"@prisma/client": "^7.10.1",
|
||||
"dotenv": "^16.3.1",
|
||||
"express": "^5.3.0",
|
||||
"zod": "^4.6.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/express": "^5.0.6",
|
||||
"@types/node": "^20.19.43",
|
||||
"@types/supertest": "^7.2.1",
|
||||
"prisma": "^7.10.1",
|
||||
"supertest": "^7.3.1",
|
||||
"tsx": "^4.23.15",
|
||||
"typescript": "^5.9.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=22"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// Prisma CLI config (migrate, generate). Prisma 7 doesn't load .env or read the URL from the schema.
|
||||
import 'dotenv/config';
|
||||
import { defineConfig } from 'prisma/config';
|
||||
|
||||
export default defineConfig({
|
||||
schema: 'prisma/schema.prisma',
|
||||
migrations: { path: 'prisma/migrations' },
|
||||
// process.env, so `prisma generate` works on a machine with no DATABASE_URL (it never connects).
|
||||
datasource: { url: process.env.DATABASE_URL ?? '' },
|
||||
});
|
||||
@@ -0,0 +1,289 @@
|
||||
-- Church Website 1.0.0: the first schema (docs/WEBSITE-1.0-PLAN.md §1, §2, §4).
|
||||
|
||||
-- CreateSchema
|
||||
CREATE SCHEMA IF NOT EXISTS "public";
|
||||
|
||||
-- CreateEnum
|
||||
CREATE TYPE "WebsiteRole" AS ENUM ('owner', 'admin', 'editor', 'ministry_leader', 'viewer');
|
||||
|
||||
-- CreateEnum
|
||||
CREATE TYPE "PageKind" AS ENUM ('home', 'visit', 'about', 'leadership', 'ministries', 'events', 'messages', 'give', 'contact', 'terms', 'safeguarding', 'custom');
|
||||
|
||||
-- CreateEnum
|
||||
CREATE TYPE "MessageSource" AS ENUM ('youtube_feed', 'youtube', 'spotify');
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "SiteDesign" (
|
||||
"id" INTEGER NOT NULL DEFAULT 1,
|
||||
"template" TEXT NOT NULL,
|
||||
"variants" JSONB NOT NULL,
|
||||
"home" JSONB NOT NULL,
|
||||
"style" JSONB NOT NULL,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
"updatedBy" TEXT,
|
||||
|
||||
CONSTRAINT "SiteDesign_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "Page" (
|
||||
"id" TEXT NOT NULL,
|
||||
"kind" "PageKind" NOT NULL,
|
||||
"slug" TEXT NOT NULL,
|
||||
"title" TEXT NOT NULL,
|
||||
"seoTitle" TEXT,
|
||||
"description" TEXT,
|
||||
"navLabel" TEXT,
|
||||
"inNav" BOOLEAN NOT NULL DEFAULT true,
|
||||
"position" INTEGER NOT NULL DEFAULT 0,
|
||||
"imageId" TEXT,
|
||||
"archivedAt" TIMESTAMP(3),
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
"updatedBy" TEXT,
|
||||
|
||||
CONSTRAINT "Page_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "Section" (
|
||||
"id" TEXT NOT NULL,
|
||||
"pageId" TEXT NOT NULL,
|
||||
"type" TEXT NOT NULL,
|
||||
"variant" TEXT,
|
||||
"position" INTEGER NOT NULL DEFAULT 0,
|
||||
"hidden" BOOLEAN NOT NULL DEFAULT false,
|
||||
"data" JSONB NOT NULL,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
"updatedBy" TEXT,
|
||||
|
||||
CONSTRAINT "Section_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "Ministry" (
|
||||
"id" TEXT NOT NULL,
|
||||
"slug" TEXT NOT NULL,
|
||||
"name" TEXT NOT NULL,
|
||||
"summary" TEXT,
|
||||
"body" TEXT,
|
||||
"imageId" TEXT,
|
||||
"position" INTEGER NOT NULL DEFAULT 0,
|
||||
"archivedAt" TIMESTAMP(3),
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
"updatedBy" TEXT,
|
||||
|
||||
CONSTRAINT "Ministry_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "Leader" (
|
||||
"id" TEXT NOT NULL,
|
||||
"name" TEXT NOT NULL,
|
||||
"role" TEXT,
|
||||
"bio" TEXT,
|
||||
"photoId" TEXT,
|
||||
"position" INTEGER NOT NULL DEFAULT 0,
|
||||
"archivedAt" TIMESTAMP(3),
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
"updatedBy" TEXT,
|
||||
|
||||
CONSTRAINT "Leader_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "MessageSeries" (
|
||||
"id" TEXT NOT NULL,
|
||||
"slug" TEXT NOT NULL,
|
||||
"title" TEXT NOT NULL,
|
||||
"summary" TEXT,
|
||||
"imageId" TEXT,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "MessageSeries_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "Message" (
|
||||
"id" TEXT NOT NULL,
|
||||
"slug" TEXT NOT NULL,
|
||||
"title" TEXT NOT NULL,
|
||||
"date" TIMESTAMP(3) NOT NULL,
|
||||
"source" "MessageSource" NOT NULL,
|
||||
"mediaUrl" TEXT NOT NULL,
|
||||
"externalId" TEXT,
|
||||
"thumbnailUrl" TEXT,
|
||||
"speaker" TEXT,
|
||||
"passage" TEXT,
|
||||
"notes" TEXT,
|
||||
"seriesId" TEXT,
|
||||
"hidden" BOOLEAN NOT NULL DEFAULT false,
|
||||
"publishedAt" TIMESTAMP(3),
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
"updatedBy" TEXT,
|
||||
|
||||
CONSTRAINT "Message_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "SimpleEvent" (
|
||||
"id" TEXT NOT NULL,
|
||||
"slug" TEXT NOT NULL,
|
||||
"title" TEXT NOT NULL,
|
||||
"startsAt" TIMESTAMP(3) NOT NULL,
|
||||
"endsAt" TIMESTAMP(3),
|
||||
"allDay" BOOLEAN NOT NULL DEFAULT false,
|
||||
"timezone" TEXT NOT NULL DEFAULT 'Africa/Johannesburg',
|
||||
"location" TEXT,
|
||||
"description" TEXT,
|
||||
"imageId" TEXT,
|
||||
"link" TEXT,
|
||||
"cancelled" BOOLEAN NOT NULL DEFAULT false,
|
||||
"publishedAt" TIMESTAMP(3),
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
"updatedBy" TEXT,
|
||||
|
||||
CONSTRAINT "SimpleEvent_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "ImportedEvent" (
|
||||
"id" TEXT NOT NULL,
|
||||
"originProduct" TEXT NOT NULL,
|
||||
"originId" TEXT NOT NULL,
|
||||
"startsAt" TIMESTAMP(3) NOT NULL,
|
||||
"data" JSONB NOT NULL,
|
||||
"syncedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "ImportedEvent_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "MediaAsset" (
|
||||
"id" TEXT NOT NULL,
|
||||
"filename" TEXT NOT NULL,
|
||||
"mime" TEXT NOT NULL,
|
||||
"bytes" INTEGER NOT NULL,
|
||||
"width" INTEGER,
|
||||
"height" INTEGER,
|
||||
"alt" TEXT NOT NULL DEFAULT '',
|
||||
"sizes" JSONB,
|
||||
"uploadedBy" TEXT,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "MediaAsset_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "SiteVersion" (
|
||||
"id" TEXT NOT NULL,
|
||||
"number" INTEGER NOT NULL,
|
||||
"snapshot" JSONB NOT NULL,
|
||||
"note" TEXT,
|
||||
"publishedBy" TEXT NOT NULL,
|
||||
"publishedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "SiteVersion_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "PreviewLink" (
|
||||
"id" TEXT NOT NULL,
|
||||
"tokenHash" TEXT NOT NULL,
|
||||
"createdBy" TEXT NOT NULL,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"expiresAt" TIMESTAMP(3) NOT NULL,
|
||||
"revokedAt" TIMESTAMP(3),
|
||||
|
||||
CONSTRAINT "PreviewLink_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "WebsiteUser" (
|
||||
"id" TEXT NOT NULL,
|
||||
"email" TEXT NOT NULL,
|
||||
"name" TEXT NOT NULL,
|
||||
"role" "WebsiteRole" NOT NULL,
|
||||
"ministryId" TEXT,
|
||||
"lastSignInAt" TIMESTAMP(3),
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "WebsiteUser_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "AuditLog" (
|
||||
"id" TEXT NOT NULL,
|
||||
"actorId" TEXT,
|
||||
"actorRole" TEXT NOT NULL,
|
||||
"action" TEXT NOT NULL,
|
||||
"targetType" TEXT NOT NULL,
|
||||
"targetId" TEXT,
|
||||
"metadata" JSONB,
|
||||
"ip" TEXT,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "AuditLog_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "AppSetting" (
|
||||
"key" TEXT NOT NULL,
|
||||
"value" TEXT NOT NULL,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
|
||||
CONSTRAINT "AppSetting_pkey" PRIMARY KEY ("key")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "Page_slug_key" ON "Page"("slug");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "Page_kind_idx" ON "Page"("kind");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "Section_pageId_position_idx" ON "Section"("pageId", "position");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "Ministry_slug_key" ON "Ministry"("slug");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "MessageSeries_slug_key" ON "MessageSeries"("slug");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "Message_slug_key" ON "Message"("slug");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "Message_externalId_key" ON "Message"("externalId");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "Message_date_idx" ON "Message"("date");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "SimpleEvent_slug_key" ON "SimpleEvent"("slug");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "SimpleEvent_startsAt_idx" ON "SimpleEvent"("startsAt");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "ImportedEvent_startsAt_idx" ON "ImportedEvent"("startsAt");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "ImportedEvent_originProduct_originId_key" ON "ImportedEvent"("originProduct", "originId");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "SiteVersion_number_key" ON "SiteVersion"("number");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "PreviewLink_tokenHash_key" ON "PreviewLink"("tokenHash");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "AuditLog_createdAt_idx" ON "AuditLog"("createdAt");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Section" ADD CONSTRAINT "Section_pageId_fkey" FOREIGN KEY ("pageId") REFERENCES "Page"("id") ON DELETE CASCADE ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "Message" ADD CONSTRAINT "Message_seriesId_fkey" FOREIGN KEY ("seriesId") REFERENCES "MessageSeries"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "WebsiteUser" ADD CONSTRAINT "WebsiteUser_ministryId_fkey" FOREIGN KEY ("ministryId") REFERENCES "Ministry"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
@@ -0,0 +1,3 @@
|
||||
# Please do not edit this file manually
|
||||
# It should be added in your version-control system (e.g., Git)
|
||||
provider = "postgresql"
|
||||
@@ -0,0 +1,262 @@
|
||||
// Church Website 1.0.0 (docs/WEBSITE-1.0-PLAN.md). One database per church.
|
||||
//
|
||||
// The content tables are the **working copy** the admin edits (§4). Publishing writes an immutable
|
||||
// snapshot of them to SiteVersion; visitors always see the latest SiteVersion, the preview sees the
|
||||
// working copy. Shared facts (name, logo, colours, service times, contact, the brand style) are the
|
||||
// church profile's, in Accounts (§2), and are never stored here.
|
||||
|
||||
generator client {
|
||||
provider = "prisma-client"
|
||||
// Its own output, so hoisted clients of other apps never overwrite it (EVENTS-2.2-PLAN §2).
|
||||
output = "../src/generated/prisma"
|
||||
moduleFormat = "esm"
|
||||
importFileExtension = "js"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
}
|
||||
|
||||
/// Website roles (§10). Held here, per product: an Events role gives nothing in the Website.
|
||||
enum WebsiteRole {
|
||||
owner
|
||||
admin
|
||||
editor
|
||||
ministry_leader
|
||||
viewer
|
||||
}
|
||||
|
||||
enum PageKind {
|
||||
home
|
||||
visit
|
||||
about
|
||||
leadership
|
||||
ministries
|
||||
events
|
||||
messages
|
||||
give
|
||||
contact
|
||||
terms
|
||||
safeguarding
|
||||
custom
|
||||
}
|
||||
|
||||
enum MessageSource {
|
||||
youtube_feed
|
||||
youtube
|
||||
spotify
|
||||
}
|
||||
|
||||
/// The site's design in the working copy (one row, id 1): template, section variants, homepage
|
||||
/// order and the Website-only style settings (src/site/variants.ts). Fonts and corners are shared.
|
||||
model SiteDesign {
|
||||
id Int @id @default(1)
|
||||
template String
|
||||
variants Json
|
||||
home Json
|
||||
style Json
|
||||
updatedAt DateTime @updatedAt
|
||||
updatedBy String?
|
||||
}
|
||||
|
||||
/// A page: the fixed ones (§6) and custom pages built from blocks.
|
||||
model Page {
|
||||
id String @id @default(uuid())
|
||||
kind PageKind
|
||||
slug String @unique
|
||||
title String
|
||||
/// Per-page SEO (ROADMAP-v3 §11); null uses the generated one.
|
||||
seoTitle String?
|
||||
description String?
|
||||
navLabel String?
|
||||
inNav Boolean @default(true)
|
||||
position Int @default(0)
|
||||
imageId String?
|
||||
archivedAt DateTime?
|
||||
updatedAt DateTime @updatedAt
|
||||
updatedBy String?
|
||||
sections Section[]
|
||||
|
||||
@@index([kind])
|
||||
}
|
||||
|
||||
/// A section or block on a page. `data` is validated with the zod schema for its `type`; `variant`
|
||||
/// is one of that type's ids. Content is never tied to a template (§2).
|
||||
model Section {
|
||||
id String @id @default(uuid())
|
||||
pageId String
|
||||
page Page @relation(fields: [pageId], references: [id], onDelete: Cascade)
|
||||
type String
|
||||
variant String?
|
||||
position Int @default(0)
|
||||
hidden Boolean @default(false)
|
||||
data Json
|
||||
updatedAt DateTime @updatedAt
|
||||
updatedBy String?
|
||||
|
||||
@@index([pageId, position])
|
||||
}
|
||||
|
||||
model Ministry {
|
||||
id String @id @default(uuid())
|
||||
slug String @unique
|
||||
name String
|
||||
summary String?
|
||||
body String?
|
||||
imageId String?
|
||||
position Int @default(0)
|
||||
archivedAt DateTime?
|
||||
updatedAt DateTime @updatedAt
|
||||
updatedBy String?
|
||||
leaders WebsiteUser[]
|
||||
}
|
||||
|
||||
model Leader {
|
||||
id String @id @default(uuid())
|
||||
name String
|
||||
role String?
|
||||
bio String?
|
||||
photoId String?
|
||||
position Int @default(0)
|
||||
archivedAt DateTime?
|
||||
updatedAt DateTime @updatedAt
|
||||
updatedBy String?
|
||||
}
|
||||
|
||||
model MessageSeries {
|
||||
id String @id @default(uuid())
|
||||
slug String @unique
|
||||
title String
|
||||
summary String?
|
||||
imageId String?
|
||||
createdAt DateTime @default(now())
|
||||
messages Message[]
|
||||
}
|
||||
|
||||
/// A message (sermon), from the YouTube feed or added by hand (§7). Published on its own, not with
|
||||
/// the site's Publish (decision 9). Audio and video are linked, never uploaded.
|
||||
model Message {
|
||||
id String @id @default(uuid())
|
||||
slug String @unique
|
||||
title String
|
||||
date DateTime
|
||||
source MessageSource
|
||||
mediaUrl String
|
||||
/// The YouTube video id or Spotify episode id: one message per video, whichever way it came in.
|
||||
externalId String? @unique
|
||||
thumbnailUrl String?
|
||||
speaker String?
|
||||
passage String?
|
||||
notes String?
|
||||
seriesId String?
|
||||
series MessageSeries? @relation(fields: [seriesId], references: [id], onDelete: SetNull)
|
||||
hidden Boolean @default(false)
|
||||
publishedAt DateTime?
|
||||
updatedAt DateTime @updatedAt
|
||||
updatedBy String?
|
||||
|
||||
@@index([date])
|
||||
}
|
||||
|
||||
/// A simple event made in the Website (§8). Registrations and payments are only Cross Events'.
|
||||
model SimpleEvent {
|
||||
id String @id @default(uuid())
|
||||
slug String @unique
|
||||
title String
|
||||
startsAt DateTime
|
||||
endsAt DateTime?
|
||||
allDay Boolean @default(false)
|
||||
timezone String @default("Africa/Johannesburg")
|
||||
location String?
|
||||
description String?
|
||||
imageId String?
|
||||
link String?
|
||||
cancelled Boolean @default(false)
|
||||
publishedAt DateTime?
|
||||
updatedAt DateTime @updatedAt
|
||||
updatedBy String?
|
||||
|
||||
@@index([startsAt])
|
||||
}
|
||||
|
||||
/// A read-only copy of a sibling's event from the feed (crosscode.event/1, ROADMAP-v3 §4).
|
||||
model ImportedEvent {
|
||||
id String @id @default(uuid())
|
||||
originProduct String
|
||||
originId String
|
||||
startsAt DateTime
|
||||
data Json
|
||||
syncedAt DateTime @default(now())
|
||||
|
||||
@@unique([originProduct, originId])
|
||||
@@index([startsAt])
|
||||
}
|
||||
|
||||
/// An upload: counted towards storage (§10) until neither the working copy nor the last 10
|
||||
/// published versions use it.
|
||||
model MediaAsset {
|
||||
id String @id @default(uuid())
|
||||
filename String
|
||||
mime String
|
||||
bytes Int
|
||||
width Int?
|
||||
height Int?
|
||||
alt String @default("")
|
||||
/// The resized files (WebP and JPEG per width) and their sizes, counted with `bytes`.
|
||||
sizes Json?
|
||||
uploadedBy String?
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
|
||||
/// A published version: an immutable snapshot of the working copy (§4). Restore copies one back.
|
||||
model SiteVersion {
|
||||
id String @id @default(uuid())
|
||||
number Int @unique
|
||||
snapshot Json
|
||||
note String?
|
||||
publishedBy String
|
||||
publishedAt DateTime @default(now())
|
||||
}
|
||||
|
||||
/// A shared preview link (§4): the token is stored hashed, expires after 7 days or when revoked.
|
||||
model PreviewLink {
|
||||
id String @id @default(uuid())
|
||||
tokenHash String @unique
|
||||
createdBy String
|
||||
createdAt DateTime @default(now())
|
||||
expiresAt DateTime
|
||||
revokedAt DateTime?
|
||||
}
|
||||
|
||||
/// Someone who can use the admin: keyed by their account's `sub` from Accounts.
|
||||
model WebsiteUser {
|
||||
id String @id
|
||||
email String
|
||||
name String
|
||||
role WebsiteRole
|
||||
/// A Ministry leader edits only their own ministry.
|
||||
ministryId String?
|
||||
ministry Ministry? @relation(fields: [ministryId], references: [id], onDelete: SetNull)
|
||||
lastSignInAt DateTime?
|
||||
createdAt DateTime @default(now())
|
||||
}
|
||||
|
||||
model AuditLog {
|
||||
id String @id @default(uuid())
|
||||
actorId String?
|
||||
actorRole String
|
||||
action String
|
||||
targetType String
|
||||
targetId String?
|
||||
metadata Json?
|
||||
ip String?
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
@@index([createdAt])
|
||||
}
|
||||
|
||||
model AppSetting {
|
||||
key String @id
|
||||
value String
|
||||
updatedAt DateTime @updatedAt
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* The Express app (docs/WEBSITE-1.0-PLAN.md §1). Everything is under /api, so the site and its API
|
||||
* share one address (as Events and Accounts): nginx sends /api to this backend and the rest to Next.js.
|
||||
*
|
||||
* /api/health version and database, for monitoring, `crosscode deploy` and the Hub
|
||||
* /api/v1/site/… the public site (what visitors see: the latest published version)
|
||||
*
|
||||
* To come (§1): /api/v1/admin/… (content, publish, preview links), /api/uploads/…, the event feed
|
||||
* (/api/links/v1/*, as Events 2.4) and the Hub client.
|
||||
*/
|
||||
import express from 'express';
|
||||
import type { Ctx } from './context.js';
|
||||
import { handle, sendError } from './http.js';
|
||||
import { appVersion } from './lib/version.js';
|
||||
import { siteStatus } from './site/status.js';
|
||||
|
||||
async function dbUp(ctx: Ctx): Promise<boolean> {
|
||||
try {
|
||||
await ctx.db.$queryRaw`SELECT 1`;
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export function createApp(ctx: Ctx) {
|
||||
const app = express();
|
||||
app.disable('x-powered-by');
|
||||
if (ctx.config.trustProxySetting !== false) app.set('trust proxy', ctx.config.trustProxySetting);
|
||||
|
||||
app.use((_req, res, next) => {
|
||||
res.setHeader('X-Content-Type-Options', 'nosniff');
|
||||
res.setHeader('Referrer-Policy', 'strict-origin-when-cross-origin');
|
||||
// The API is never a page of its own in search results; the public pages are (ROADMAP-v3 §11).
|
||||
res.setHeader('X-Robots-Tag', 'noindex');
|
||||
next();
|
||||
});
|
||||
|
||||
app.get('/api/health', async (_req, res) => {
|
||||
const db = await dbUp(ctx);
|
||||
res.status(db ? 200 : 503).json({ status: db ? 'ok' : 'error', product: 'website', version: appVersion(), db });
|
||||
});
|
||||
|
||||
const site = express.Router();
|
||||
site.get('/status', handle(() => siteStatus(ctx)));
|
||||
app.use('/api/v1/site', site);
|
||||
|
||||
app.use('/api', (_req, res) => {
|
||||
res.status(404).json({ error: { code: 'NOT_FOUND', message: 'There is no such API endpoint.' } });
|
||||
});
|
||||
|
||||
app.use((err: unknown, _req: express.Request, res: express.Response, next: express.NextFunction) => {
|
||||
if (res.headersSent) return next(err);
|
||||
return sendError(res, err);
|
||||
});
|
||||
return app;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* Everything a request handler or job needs, passed in rather than imported, so tests can run the
|
||||
* app against a stand-in database.
|
||||
*/
|
||||
import type { PrismaClient } from './generated/prisma/client.js';
|
||||
import type { Config } from './lib/config.js';
|
||||
|
||||
export type Db = PrismaClient;
|
||||
|
||||
export type Ctx = {
|
||||
config: Config;
|
||||
db: Db;
|
||||
now: () => Date;
|
||||
};
|
||||
|
||||
export function createCtx(config: Config, db: Db, opts: { now?: () => Date } = {}): Ctx {
|
||||
return { config, db, now: opts.now ?? (() => new Date()) };
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Shared bits for the API: errors as `{ error: { code, message, fields? } }` (as Accounts and
|
||||
* Events' /api/v2) and async handlers.
|
||||
*/
|
||||
import type { Request, RequestHandler, Response } from 'express';
|
||||
|
||||
export class ApiError extends Error {
|
||||
constructor(public status: number, public code: string, message: string, public fields?: Record<string, string>) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
|
||||
/** Known errors carry a status and code; anything else is a 500. */
|
||||
export function sendError(res: Response, e: unknown) {
|
||||
if (e instanceof ApiError) {
|
||||
return res.status(e.status).json({ error: { code: e.code, message: e.message, ...(e.fields ? { fields: e.fields } : {}) } });
|
||||
}
|
||||
console.error('[api]', e);
|
||||
return res.status(500).json({ error: { code: 'INTERNAL', message: 'Something went wrong. Please try again.' } });
|
||||
}
|
||||
|
||||
export const handle = (fn: (req: Request, res: Response) => Promise<unknown>): RequestHandler => (req, res) => {
|
||||
fn(req, res).then((out) => {
|
||||
if (out !== undefined && !res.headersSent) res.json(out);
|
||||
}).catch((e) => sendError(res, e));
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
/**
|
||||
* Starts the Church Website's backend: database and HTTP server. Jobs (YouTube feed, storage count,
|
||||
* sitemap, feed sync) and the Hub client come with their features (docs/WEBSITE-1.0-PLAN.md §1).
|
||||
*/
|
||||
import 'dotenv/config';
|
||||
import { PrismaPg } from '@prisma/adapter-pg';
|
||||
import { PrismaClient } from './generated/prisma/client.js';
|
||||
import { createApp } from './app.js';
|
||||
import { createCtx } from './context.js';
|
||||
import { loadConfig } from './lib/config.js';
|
||||
|
||||
async function main() {
|
||||
const config = loadConfig();
|
||||
const url = process.env.DATABASE_URL;
|
||||
if (!url) throw new Error('DATABASE_URL isn\'t set.');
|
||||
const db = new PrismaClient({ adapter: new PrismaPg({ connectionString: url, connectionTimeoutMillis: 5000 }) });
|
||||
const ctx = createCtx(config, db);
|
||||
const app = createApp(ctx);
|
||||
const server = app.listen(config.port, () => console.log(`[website] Listening on ${config.port} (${config.publicUrl}).`));
|
||||
|
||||
const stop = async () => {
|
||||
server.close();
|
||||
await db.$disconnect();
|
||||
process.exit(0);
|
||||
};
|
||||
process.on('SIGTERM', stop);
|
||||
process.on('SIGINT', stop);
|
||||
}
|
||||
|
||||
main().catch((e) => {
|
||||
console.error('[website] Failed to start:', e);
|
||||
process.exit(1);
|
||||
});
|
||||
@@ -0,0 +1,55 @@
|
||||
/**
|
||||
* The server's settings, from the environment (`.env`, built from `env.template.json`). Read once;
|
||||
* tests pass their own with `loadConfig({...})`.
|
||||
*/
|
||||
export type TrustProxy = false | number | string | string[];
|
||||
|
||||
export type Config = {
|
||||
/** The public address, e.g. https://www.hopefamily.co.za (no trailing slash). */
|
||||
publicUrl: string;
|
||||
port: number;
|
||||
/** Signs preview links and cookies, encrypts stored secrets. Generated on the server, never sent anywhere. */
|
||||
secret: string;
|
||||
production: boolean;
|
||||
/** Express's "trust proxy" (TRUST_PROXY, read as Accounts reads it), or false when off. */
|
||||
trustProxySetting: TrustProxy;
|
||||
hubUrl: string;
|
||||
hubLicenceKey: string | null;
|
||||
hubPublicKey: string | null;
|
||||
timezone: string;
|
||||
jobsEnabled: boolean;
|
||||
/** Where uploads go; default backend/uploads. */
|
||||
uploadDir: string | null;
|
||||
};
|
||||
|
||||
const bool = (v: string | undefined, def: boolean) => (v === undefined || v === '' ? def : String(v).toLowerCase() === 'true');
|
||||
|
||||
/** As Accounts' trustProxyFrom: `loopback`, a hop count, addresses, `true` (one hop) or `false`. */
|
||||
export function trustProxyFrom(v: string | undefined, production: boolean): TrustProxy {
|
||||
const raw = (v ?? '').trim();
|
||||
if (raw === '') return production ? 1 : false;
|
||||
const lower = raw.toLowerCase();
|
||||
if (lower === 'true') return 1;
|
||||
if (lower === 'false') return false;
|
||||
if (/^\d+$/.test(raw)) return Number(raw) || false;
|
||||
return raw.includes(',') ? raw.split(',').map((s) => s.trim()).filter(Boolean) : raw;
|
||||
}
|
||||
|
||||
export function loadConfig(env: Record<string, string | undefined> = process.env): Config {
|
||||
const production = env.NODE_ENV === 'production';
|
||||
const secret = env.WEBSITE_SECRET || '';
|
||||
if (production && secret.length < 32) throw new Error('WEBSITE_SECRET must be set (at least 32 characters) in production.');
|
||||
return {
|
||||
publicUrl: String(env.WEBSITE_URL || 'http://localhost:3300').replace(/\/+$/, ''),
|
||||
port: Number(env.PORT || 5300),
|
||||
secret: secret || 'development-only-secret-change-me-0123456789',
|
||||
production,
|
||||
trustProxySetting: trustProxyFrom(env.TRUST_PROXY, production),
|
||||
hubUrl: String(env.HUB_URL || 'https://hub.crosscode.co.za').replace(/\/+$/, ''),
|
||||
hubLicenceKey: env.HUB_LICENCE_KEY?.trim() || null,
|
||||
hubPublicKey: env.HUB_PUBLIC_KEY?.trim() || null,
|
||||
timezone: env.APP_TIMEZONE || 'Africa/Johannesburg',
|
||||
jobsEnabled: bool(env.JOBS_ENABLED, true),
|
||||
uploadDir: env.UPLOAD_DIR?.trim() || null,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* The running version, from the backend's package.json (src/lib → ../../package.json in development,
|
||||
* dist/lib → ../../package.json when built), so /api/health tells `crosscode deploy` the truth
|
||||
* however the process was started (PM2 doesn't set npm_package_version).
|
||||
*/
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
||||
let cached: string | null = null;
|
||||
|
||||
export function appVersion(): string {
|
||||
if (!cached) {
|
||||
try {
|
||||
const file = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..', 'package.json');
|
||||
cached = (JSON.parse(fs.readFileSync(file, 'utf8')) as { version: string }).version;
|
||||
} catch {
|
||||
cached = '0.0.0';
|
||||
}
|
||||
}
|
||||
return cached;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
/**
|
||||
* What the public site shows right now: Coming soon until the first publish (§5, decision 3), then
|
||||
* the latest published version. After the first publish there's no going back to Coming soon.
|
||||
*/
|
||||
import { WEBSITE_TEMPLATES, type WebsiteTemplate } from '@crosscode/contracts';
|
||||
import type { Ctx } from '../context.js';
|
||||
|
||||
export type SiteStatus =
|
||||
| { mode: 'coming-soon' }
|
||||
| { mode: 'published'; version: number; publishedAt: string; template: WebsiteTemplate | null };
|
||||
|
||||
export async function siteStatus(ctx: Ctx): Promise<SiteStatus> {
|
||||
const latest = await ctx.db.siteVersion.findFirst({ orderBy: { number: 'desc' }, select: { number: true, publishedAt: true, snapshot: true } });
|
||||
if (!latest) return { mode: 'coming-soon' };
|
||||
const t = (latest.snapshot as { design?: { template?: unknown } } | null)?.design?.template;
|
||||
const template = (WEBSITE_TEMPLATES as readonly unknown[]).includes(t) ? (t as WebsiteTemplate) : null;
|
||||
return { mode: 'published', version: latest.number, publishedAt: latest.publishedAt.toISOString(), template };
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
/**
|
||||
* Section variants per template (docs/WEBSITE-1.0-PLAN.md §3, "Section variants per template",
|
||||
* decision 16, confirmed 2026-11-25).
|
||||
*
|
||||
* Every template draws every variant, so nothing is ever unavailable and a template switch never
|
||||
* needs a fallback. A template only sets which variant each section starts with, which ones it
|
||||
* recommends, its header options, its homepage order and its style defaults.
|
||||
*
|
||||
* The ids are stored on each section (`hero.variant = "photo"`), so **an id never changes or goes
|
||||
* away** once released, like the font pairing ids in `@crosscode/contracts`.
|
||||
*/
|
||||
import { z } from 'zod';
|
||||
import type { Corners, WebsiteTemplate } from '@crosscode/contracts';
|
||||
|
||||
/** The homepage section types and their variant ids. */
|
||||
export const SECTION_VARIANTS = {
|
||||
hero: ['photo', 'video', 'collage', 'split', 'text'],
|
||||
serviceTimes: ['panel', 'strip', 'map'],
|
||||
welcome: ['text', 'image-text', 'pastor'],
|
||||
ministries: ['cards', 'list', 'bands'],
|
||||
team: ['faces', 'list', 'featured'],
|
||||
events: ['cards', 'list', 'calendar'],
|
||||
latestMessage: ['video', 'card', 'compact'],
|
||||
invitation: ['banner', 'centred', 'image'],
|
||||
} as const;
|
||||
|
||||
export type SectionType = keyof typeof SECTION_VARIANTS;
|
||||
export type Variant<S extends SectionType = SectionType> = (typeof SECTION_VARIANTS)[S][number];
|
||||
export const SECTION_TYPES = Object.keys(SECTION_VARIANTS) as [SectionType, ...SectionType[]];
|
||||
export const sectionTypeSchema = z.enum(SECTION_TYPES);
|
||||
|
||||
/** Whether `variant` is one of `section`'s ids. */
|
||||
export function isVariant<S extends SectionType>(section: S, variant: string): variant is Variant<S> {
|
||||
return (SECTION_VARIANTS[section] as readonly string[]).includes(variant);
|
||||
}
|
||||
|
||||
/** Per section: the default first, then the other recommended variants. */
|
||||
type Recommendations = { [S in SectionType]: readonly [Variant<S>, ...Variant<S>[]] };
|
||||
|
||||
export const TEMPLATE_VARIANTS: Record<WebsiteTemplate, Recommendations> = {
|
||||
heritage: {
|
||||
hero: ['photo', 'split', 'text'],
|
||||
serviceTimes: ['panel', 'map'],
|
||||
welcome: ['pastor', 'text'],
|
||||
ministries: ['list', 'cards'],
|
||||
team: ['featured', 'faces'],
|
||||
events: ['list', 'calendar'],
|
||||
latestMessage: ['card', 'video'],
|
||||
invitation: ['centred', 'banner'],
|
||||
},
|
||||
bold: {
|
||||
hero: ['video', 'photo', 'split'],
|
||||
serviceTimes: ['strip', 'map'],
|
||||
welcome: ['image-text', 'pastor'],
|
||||
ministries: ['bands', 'cards'],
|
||||
team: ['faces', 'featured'],
|
||||
events: ['cards', 'calendar'],
|
||||
latestMessage: ['video', 'card'],
|
||||
invitation: ['image', 'banner'],
|
||||
},
|
||||
community: {
|
||||
hero: ['collage', 'photo', 'split'],
|
||||
serviceTimes: ['map', 'panel'],
|
||||
welcome: ['pastor', 'image-text'],
|
||||
ministries: ['cards', 'bands'],
|
||||
team: ['faces', 'featured'],
|
||||
events: ['cards', 'calendar'],
|
||||
latestMessage: ['card', 'video'],
|
||||
invitation: ['banner', 'image'],
|
||||
},
|
||||
clean: {
|
||||
hero: ['text', 'split', 'photo'],
|
||||
serviceTimes: ['strip', 'panel'],
|
||||
welcome: ['text', 'image-text'],
|
||||
ministries: ['list', 'cards'],
|
||||
team: ['list', 'faces'],
|
||||
events: ['list', 'calendar'],
|
||||
latestMessage: ['compact', 'card'],
|
||||
invitation: ['centred', 'banner'],
|
||||
},
|
||||
};
|
||||
|
||||
export function defaultVariant<S extends SectionType>(template: WebsiteTemplate, section: S): Variant<S> {
|
||||
return (TEMPLATE_VARIANTS[template][section] as readonly Variant<S>[])[0]!;
|
||||
}
|
||||
|
||||
export function isRecommended(template: WebsiteTemplate, section: SectionType, variant: string): boolean {
|
||||
return (TEMPLATE_VARIANTS[template][section] as readonly string[]).includes(variant);
|
||||
}
|
||||
|
||||
/** The "Header" style setting: each template's options, default first. */
|
||||
export const TEMPLATE_HEADERS = {
|
||||
heritage: ['centred', 'centred-top-bar'],
|
||||
bold: ['transparent', 'solid'],
|
||||
community: ['logo-left-button', 'logo-left-tinted'],
|
||||
clean: ['small', 'small-menu'],
|
||||
} as const satisfies Record<WebsiteTemplate, readonly [string, ...string[]]>;
|
||||
|
||||
/**
|
||||
* The transparent header only sits over a photo, video or collage hero; on any other first section
|
||||
* it's drawn solid, so it never puts white text on white.
|
||||
*/
|
||||
export function headerIsTransparent(template: WebsiteTemplate, header: string, heroVariant: Variant<'hero'> | null): boolean {
|
||||
return template === 'bold' && header === 'transparent' && heroVariant !== null && ['photo', 'video', 'collage'].includes(heroVariant);
|
||||
}
|
||||
|
||||
/** A homepage entry: the section and whether it shows. */
|
||||
export type HomeEntry = { section: SectionType; hidden: boolean };
|
||||
|
||||
const order = (shown: SectionType[], hidden: SectionType[] = []): HomeEntry[] => [
|
||||
...shown.map((section) => ({ section, hidden: false })),
|
||||
...hidden.map((section) => ({ section, hidden: true })),
|
||||
];
|
||||
|
||||
/** The default homepage order (the church can reorder, hide and show). Every section is listed once. */
|
||||
export const TEMPLATE_HOME_ORDER: Record<WebsiteTemplate, HomeEntry[]> = {
|
||||
heritage: order(['hero', 'serviceTimes', 'welcome', 'latestMessage', 'ministries', 'team', 'events', 'invitation']),
|
||||
bold: order(['hero', 'serviceTimes', 'welcome', 'events', 'latestMessage', 'ministries', 'invitation'], ['team']),
|
||||
community: order(['hero', 'welcome', 'serviceTimes', 'ministries', 'team', 'events', 'latestMessage', 'invitation']),
|
||||
clean: order(['hero', 'serviceTimes', 'welcome', 'events', 'latestMessage', 'invitation'], ['ministries', 'team']),
|
||||
};
|
||||
|
||||
/** The Website-only style settings (§3, "Style settings"). Fonts and corners are the church's, shared. */
|
||||
export const SECTION_COLOURS = ['light', 'tinted', 'mixed'] as const;
|
||||
export const SPACINGS = ['airy', 'compact'] as const;
|
||||
export const BUTTONS = ['solid', 'outline', 'pill'] as const;
|
||||
export const IMAGE_TREATMENTS = ['natural', 'mono', 'duotone'] as const;
|
||||
|
||||
export type SiteStyle = {
|
||||
sectionColour: (typeof SECTION_COLOURS)[number];
|
||||
spacing: (typeof SPACINGS)[number];
|
||||
buttons: (typeof BUTTONS)[number];
|
||||
images: (typeof IMAGE_TREATMENTS)[number];
|
||||
header: string;
|
||||
};
|
||||
|
||||
export const TEMPLATE_STYLE: Record<WebsiteTemplate, SiteStyle & { suggestedCorners: Corners }> = {
|
||||
heritage: { sectionColour: 'light', spacing: 'airy', buttons: 'outline', images: 'natural', header: 'centred', suggestedCorners: 'sharp' },
|
||||
bold: { sectionColour: 'mixed', spacing: 'compact', buttons: 'solid', images: 'natural', header: 'transparent', suggestedCorners: 'sharp' },
|
||||
community: { sectionColour: 'tinted', spacing: 'airy', buttons: 'pill', images: 'natural', header: 'logo-left-button', suggestedCorners: 'round' },
|
||||
clean: { sectionColour: 'light', spacing: 'airy', buttons: 'outline', images: 'natural', header: 'small', suggestedCorners: 'soft' },
|
||||
};
|
||||
|
||||
const STYLE_KEYS = ['sectionColour', 'spacing', 'buttons', 'images', 'header'] as const;
|
||||
|
||||
/** The site's design: what a template switch changes. Content is never part of it. */
|
||||
export type SiteDesign = {
|
||||
template: WebsiteTemplate;
|
||||
variants: { [S in SectionType]: Variant<S> };
|
||||
home: HomeEntry[];
|
||||
style: SiteStyle;
|
||||
};
|
||||
|
||||
/** A fresh site on `template`: every default. */
|
||||
export function defaultDesign(template: WebsiteTemplate): SiteDesign {
|
||||
const variants = Object.fromEntries(SECTION_TYPES.map((s) => [s, defaultVariant(template, s)])) as SiteDesign['variants'];
|
||||
const { suggestedCorners: _c, ...style } = TEMPLATE_STYLE[template];
|
||||
return { template, variants, home: TEMPLATE_HOME_ORDER[template].map((e) => ({ ...e })), style };
|
||||
}
|
||||
|
||||
export type DesignChange = { what: string; from: string; to: string };
|
||||
|
||||
const sameOrder = (a: HomeEntry[], b: HomeEntry[]) =>
|
||||
a.length === b.length && a.every((e, i) => e.section === b[i]!.section && e.hidden === b[i]!.hidden);
|
||||
|
||||
/**
|
||||
* Switching template (§3, "Switching template"): anything still on the old template's default
|
||||
* moves to the new template's default; anything the church chose stays. Returns the new design and
|
||||
* what moved, for the Publish screen ("Hero: Collage → Text only, Clean's default").
|
||||
*/
|
||||
export function switchTemplate(current: SiteDesign, to: WebsiteTemplate): { design: SiteDesign; changes: DesignChange[] } {
|
||||
if (current.template === to) return { design: current, changes: [] };
|
||||
const from = current.template;
|
||||
const target = defaultDesign(to);
|
||||
const changes: DesignChange[] = [{ what: 'template', from, to }];
|
||||
|
||||
const variants = { ...current.variants } as Record<SectionType, string>;
|
||||
for (const s of SECTION_TYPES) {
|
||||
const next = target.variants[s];
|
||||
if (current.variants[s] === defaultVariant(from, s) && next !== current.variants[s]) {
|
||||
changes.push({ what: `${s}.variant`, from: current.variants[s], to: next });
|
||||
variants[s] = next;
|
||||
}
|
||||
}
|
||||
|
||||
const homeUntouched = sameOrder(current.home, TEMPLATE_HOME_ORDER[from]);
|
||||
const home = homeUntouched ? target.home : current.home.map((e) => ({ ...e }));
|
||||
if (homeUntouched && !sameOrder(current.home, target.home)) changes.push({ what: 'home', from: `${from} order`, to: `${to} order` });
|
||||
|
||||
const style = { ...current.style };
|
||||
const oldStyle = TEMPLATE_STYLE[from];
|
||||
for (const k of STYLE_KEYS) {
|
||||
// A header from the old template's options means nothing in the new one, so it always moves.
|
||||
const untouched = current.style[k] === oldStyle[k] || (k === 'header' && !(TEMPLATE_HEADERS[to] as readonly string[]).includes(current.style.header));
|
||||
if (untouched && current.style[k] !== target.style[k]) {
|
||||
changes.push({ what: `style.${k}`, from: current.style[k], to: target.style[k] });
|
||||
(style as Record<string, string>)[k] = target.style[k];
|
||||
}
|
||||
}
|
||||
|
||||
return { design: { template: to, variants: variants as SiteDesign['variants'], home, style }, changes };
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
import { describe, it } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import request from 'supertest';
|
||||
import { createApp } from '../src/app.js';
|
||||
import { createCtx, type Db } from '../src/context.js';
|
||||
import { loadConfig } from '../src/lib/config.js';
|
||||
import { appVersion } from '../src/lib/version.js';
|
||||
|
||||
type Version = { number: number; publishedAt: Date; snapshot: unknown };
|
||||
|
||||
/** Just what the app uses so far: a ping and the latest published version. */
|
||||
function fakeDb(opts: { up?: boolean; versions?: Version[] } = {}): Db {
|
||||
const versions = opts.versions ?? [];
|
||||
return {
|
||||
$queryRaw: async () => {
|
||||
if (opts.up === false) throw new Error('down');
|
||||
return [{ '?column?': 1 }];
|
||||
},
|
||||
siteVersion: {
|
||||
findFirst: async () => [...versions].sort((a, b) => b.number - a.number)[0] ?? null,
|
||||
},
|
||||
} as unknown as Db;
|
||||
}
|
||||
|
||||
const app = (db: Db) => createApp(createCtx(loadConfig({}), db));
|
||||
|
||||
describe('the app', () => {
|
||||
it('answers /api/health with the product and version', async () => {
|
||||
const res = await request(app(fakeDb())).get('/api/health');
|
||||
assert.equal(res.status, 200);
|
||||
assert.deepEqual(res.body, { status: 'ok', product: 'website', version: appVersion(), db: true });
|
||||
});
|
||||
|
||||
it('says 503 when the database is down', async () => {
|
||||
const res = await request(app(fakeDb({ up: false }))).get('/api/health');
|
||||
assert.equal(res.status, 503);
|
||||
assert.equal(res.body.db, false);
|
||||
});
|
||||
|
||||
it('shows Coming soon until the first publish', async () => {
|
||||
const res = await request(app(fakeDb())).get('/api/v1/site/status');
|
||||
assert.deepEqual(res.body, { mode: 'coming-soon' });
|
||||
});
|
||||
|
||||
it('shows the latest published version after it', async () => {
|
||||
const at = new Date('2026-12-01T08:00:00Z');
|
||||
const res = await request(app(fakeDb({ versions: [
|
||||
{ number: 1, publishedAt: new Date('2026-11-30T08:00:00Z'), snapshot: { design: { template: 'heritage' } } },
|
||||
{ number: 2, publishedAt: at, snapshot: { design: { template: 'clean' } } },
|
||||
] }))).get('/api/v1/site/status');
|
||||
assert.deepEqual(res.body, { mode: 'published', version: 2, publishedAt: at.toISOString(), template: 'clean' });
|
||||
});
|
||||
|
||||
it('answers unknown API paths with a JSON 404 and keeps the API out of search', async () => {
|
||||
const res = await request(app(fakeDb())).get('/api/nothing');
|
||||
assert.equal(res.status, 404);
|
||||
assert.equal(res.body.error.code, 'NOT_FOUND');
|
||||
assert.equal(res.headers['x-robots-tag'], 'noindex');
|
||||
assert.equal(res.headers['x-powered-by'], undefined);
|
||||
});
|
||||
});
|
||||
|
||||
describe('config', () => {
|
||||
it('refuses production without a secret', () => {
|
||||
assert.throws(() => loadConfig({ NODE_ENV: 'production' }), /WEBSITE_SECRET/);
|
||||
});
|
||||
|
||||
it('defaults to the development ports', () => {
|
||||
const c = loadConfig({});
|
||||
assert.equal(c.port, 5300);
|
||||
assert.equal(c.publicUrl, 'http://localhost:3300');
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,103 @@
|
||||
import { describe, it } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { WEBSITE_TEMPLATES } from '@crosscode/contracts';
|
||||
import {
|
||||
SECTION_TYPES, SECTION_VARIANTS, TEMPLATE_HEADERS, TEMPLATE_HOME_ORDER, TEMPLATE_STYLE, TEMPLATE_VARIANTS,
|
||||
defaultDesign, defaultVariant, headerIsTransparent, isRecommended, isVariant, switchTemplate,
|
||||
} from '../src/site/variants.js';
|
||||
|
||||
describe('section variants (WEBSITE-1.0-PLAN §3, decision 16)', () => {
|
||||
it('has the 26 confirmed variant ids', () => {
|
||||
assert.equal(Object.values(SECTION_VARIANTS).flat().length, 26);
|
||||
assert.deepEqual(SECTION_VARIANTS.hero, ['photo', 'video', 'collage', 'split', 'text']);
|
||||
});
|
||||
|
||||
it('every template recommends only real variants, without repeats, with a default for every section', () => {
|
||||
for (const t of WEBSITE_TEMPLATES) {
|
||||
for (const s of SECTION_TYPES) {
|
||||
const rec = TEMPLATE_VARIANTS[t][s] as readonly string[];
|
||||
assert.ok(rec.length >= 2, `${t}.${s}`);
|
||||
assert.equal(new Set(rec).size, rec.length, `${t}.${s} repeats`);
|
||||
for (const v of rec) assert.ok(isVariant(s, v), `${t}.${s}: ${v}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it('has the confirmed defaults', () => {
|
||||
assert.equal(defaultVariant('heritage', 'hero'), 'photo');
|
||||
assert.equal(defaultVariant('bold', 'hero'), 'video');
|
||||
assert.equal(defaultVariant('community', 'hero'), 'collage');
|
||||
assert.equal(defaultVariant('clean', 'hero'), 'text');
|
||||
assert.equal(defaultVariant('clean', 'latestMessage'), 'compact');
|
||||
assert.ok(isRecommended('heritage', 'team', 'faces'));
|
||||
assert.ok(!isRecommended('heritage', 'team', 'list'));
|
||||
});
|
||||
|
||||
it('lists every section once in each homepage order; Bold hides Team, Clean hides Ministries and Team', () => {
|
||||
for (const t of WEBSITE_TEMPLATES) {
|
||||
assert.deepEqual([...TEMPLATE_HOME_ORDER[t].map((e) => e.section)].sort(), [...SECTION_TYPES].sort(), t);
|
||||
}
|
||||
const hidden = (t: keyof typeof TEMPLATE_HOME_ORDER) => TEMPLATE_HOME_ORDER[t].filter((e) => e.hidden).map((e) => e.section);
|
||||
assert.deepEqual(hidden('heritage'), []);
|
||||
assert.deepEqual(hidden('bold'), ['team']);
|
||||
assert.deepEqual(hidden('community'), []);
|
||||
assert.deepEqual(hidden('clean'), ['ministries', 'team']);
|
||||
});
|
||||
|
||||
it("each template's default header is the first of its options", () => {
|
||||
for (const t of WEBSITE_TEMPLATES) assert.equal(TEMPLATE_STYLE[t].header, TEMPLATE_HEADERS[t][0]);
|
||||
});
|
||||
|
||||
it('suggests the confirmed corners', () => {
|
||||
assert.deepEqual(WEBSITE_TEMPLATES.map((t) => TEMPLATE_STYLE[t].suggestedCorners), ['sharp', 'sharp', 'round', 'soft']);
|
||||
});
|
||||
|
||||
it('only makes the header transparent over a photo, video or collage hero', () => {
|
||||
assert.ok(headerIsTransparent('bold', 'transparent', 'video'));
|
||||
assert.ok(!headerIsTransparent('bold', 'transparent', 'text'));
|
||||
assert.ok(!headerIsTransparent('bold', 'transparent', 'split'));
|
||||
assert.ok(!headerIsTransparent('bold', 'solid', 'photo'));
|
||||
assert.ok(!headerIsTransparent('bold', 'transparent', null));
|
||||
});
|
||||
});
|
||||
|
||||
describe('switching template', () => {
|
||||
it('moves an untouched site to every default of the new template', () => {
|
||||
const { design, changes } = switchTemplate(defaultDesign('community'), 'clean');
|
||||
assert.deepEqual(design, defaultDesign('clean'));
|
||||
assert.ok(changes.some((c) => c.what === 'hero.variant' && c.from === 'collage' && c.to === 'text'));
|
||||
assert.ok(changes.some((c) => c.what === 'home'));
|
||||
assert.equal(changes[0]!.what, 'template');
|
||||
});
|
||||
|
||||
it("keeps the church's own choices", () => {
|
||||
const start = defaultDesign('heritage');
|
||||
start.variants.hero = 'video';
|
||||
start.style.buttons = 'pill';
|
||||
start.home = [...start.home].reverse();
|
||||
const { design, changes } = switchTemplate(start, 'clean');
|
||||
assert.equal(design.template, 'clean');
|
||||
assert.equal(design.variants.hero, 'video');
|
||||
assert.equal(design.style.buttons, 'pill');
|
||||
assert.deepEqual(design.home, start.home);
|
||||
assert.equal(design.variants.team, 'list', 'an untouched section still moves');
|
||||
assert.ok(!changes.some((c) => c.what === 'hero.variant' || c.what === 'home' || c.what === 'style.buttons'));
|
||||
});
|
||||
|
||||
it("moves a header the new template doesn't have", () => {
|
||||
const start = defaultDesign('bold');
|
||||
start.style.header = 'solid';
|
||||
const { design } = switchTemplate(start, 'heritage');
|
||||
assert.equal(design.style.header, 'centred');
|
||||
});
|
||||
|
||||
it('changes nothing when the template stays', () => {
|
||||
const d = defaultDesign('bold');
|
||||
assert.deepEqual(switchTemplate(d, 'bold'), { design: d, changes: [] });
|
||||
});
|
||||
|
||||
it('round-trips an untouched site', () => {
|
||||
const there = switchTemplate(defaultDesign('heritage'), 'bold').design;
|
||||
assert.deepEqual(switchTemplate(there, 'heritage').design, defaultDesign('heritage'));
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": { "rootDir": "src", "outDir": "dist" },
|
||||
"include": ["src"]
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
// ES modules throughout, as Accounts (docs/WEBSITE-1.0-PLAN.md §1).
|
||||
"compilerOptions": {
|
||||
"target": "ES2023",
|
||||
"module": "nodenext",
|
||||
"moduleResolution": "nodenext",
|
||||
"lib": ["ES2023"],
|
||||
"strict": true,
|
||||
"noImplicitOverride": true,
|
||||
"noFallthroughCasesInSwitch": true,
|
||||
"esModuleInterop": true,
|
||||
"resolveJsonModule": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"sourceMap": true,
|
||||
"rootDir": ".",
|
||||
"outDir": "dist",
|
||||
"types": ["node"]
|
||||
},
|
||||
"include": ["src", "tests", "scripts", "prisma.config.ts"]
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// PM2 config template. Each install keeps its own copy as ecosystem.config.cjs (not in git, so
|
||||
// deploys never change it); crosscode creates it from this file the first time with the church's
|
||||
// PM2 names and ports.
|
||||
module.exports = {
|
||||
apps: [
|
||||
{
|
||||
name: 'website-backend',
|
||||
cwd: __dirname + '/backend',
|
||||
script: 'dist/index.js',
|
||||
env: { NODE_ENV: 'production' },
|
||||
max_memory_restart: '400M',
|
||||
},
|
||||
{
|
||||
name: 'website-frontend',
|
||||
cwd: __dirname + '/frontend',
|
||||
script: 'npm',
|
||||
args: 'start -- -p 3300',
|
||||
env: { NODE_ENV: 'production' },
|
||||
max_memory_restart: '400M',
|
||||
},
|
||||
],
|
||||
};
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"schema": "crosscode.env-template/1",
|
||||
"product": "website",
|
||||
"files": {
|
||||
"backend/.env": [
|
||||
{ "name": "NODE_ENV", "layer": "generated", "required": true, "description": "production" },
|
||||
{ "name": "PORT", "layer": "install", "from": "{apiPort}", "required": true, "description": "The backend's port (from the Hub's port list)" },
|
||||
{ "name": "DATABASE_URL", "layer": "generated", "required": true, "description": "Made on the server with a new password; never leaves it" },
|
||||
{ "name": "WEBSITE_SECRET", "layer": "generated", "required": true, "description": "Signs preview links and cookies, encrypts stored secrets: never change it" },
|
||||
{ "name": "WEBSITE_URL", "layer": "install", "from": "https://{domain}", "required": true, "description": "The public address (www. or the Cross Code address)" },
|
||||
{ "name": "TRUST_PROXY", "layer": "server", "required": true, "description": "Behind frp: loopback" },
|
||||
{ "name": "APP_TIMEZONE", "layer": "install", "default": "Africa/Johannesburg" },
|
||||
{ "name": "HUB_URL", "layer": "defaults", "default": "https://hub.crosscode.co.za" },
|
||||
{ "name": "HUB_PUBLIC_KEY", "layer": "defaults", "description": "Only for a Hub other than production" },
|
||||
{ "name": "HUB_LICENCE_KEY", "layer": "install", "description": "A Hub install registers by itself with this (CCW-…)" },
|
||||
{ "name": "JOBS_ENABLED", "layer": "defaults", "default": "true" }
|
||||
],
|
||||
"frontend/.env.production": [
|
||||
{ "name": "WEBSITE_API_URL", "layer": "install", "from": "http://127.0.0.1:{apiPort}", "required": true, "description": "Where the pages reach the backend on this server" }
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
node_modules/
|
||||
.next/
|
||||
next-env.d.ts
|
||||
.env*
|
||||
@@ -0,0 +1,9 @@
|
||||
<!-- BEGIN:nextjs-agent-rules -->
|
||||
|
||||
## This is NOT the Next.js you know
|
||||
|
||||
This version has breaking changes — APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in `node_modules/next/dist/docs/` (resolved from this file's directory; in monorepos the `next` package may not be visible from the repo root) before writing any code. Heed deprecation notices.
|
||||
|
||||
This block is written and re-added by `next dev` — verify at `node_modules/next/dist/server/lib/generate-agent-files.js`. Removing it from a diff only re-creates the uncommitted change; committing it with your work keeps the tree clean.
|
||||
|
||||
<!-- END:nextjs-agent-rules -->
|
||||
@@ -0,0 +1,10 @@
|
||||
import { defineConfig, globalIgnores } from "eslint/config";
|
||||
import nextVitals from "eslint-config-next/core-web-vitals";
|
||||
import nextTs from "eslint-config-next/typescript";
|
||||
|
||||
// Next.js 16's own flat configs, as Accounts. Run with `npm run lint`.
|
||||
export default defineConfig([
|
||||
...nextVitals,
|
||||
...nextTs,
|
||||
globalIgnores([".next/**", "out/**", "next-env.d.ts"]),
|
||||
]);
|
||||
@@ -0,0 +1,29 @@
|
||||
import type { NextConfig } from "next";
|
||||
|
||||
// Everything under /api is the backend (docs/WEBSITE-1.0-PLAN.md §1). On a server nginx sends it
|
||||
// there; in development (and when Next is reached directly) this rewrite does.
|
||||
const api = (process.env.WEBSITE_API_URL || "http://127.0.0.1:5300").replace(/\/+$/, "");
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
poweredByHeader: false,
|
||||
transpilePackages: ["@crosscode/ui"],
|
||||
async rewrites() {
|
||||
return [{ source: "/api/:path*", destination: `${api}/api/:path*` }];
|
||||
},
|
||||
async headers() {
|
||||
// The public site is indexed (ROADMAP-v3 §11); the admin and shared previews never are.
|
||||
const common = [
|
||||
{ key: "Referrer-Policy", value: "strict-origin-when-cross-origin" },
|
||||
{ key: "X-Content-Type-Options", value: "nosniff" },
|
||||
];
|
||||
const noindex = { key: "X-Robots-Tag", value: "noindex, nofollow" };
|
||||
return [
|
||||
{ source: "/:path*", headers: common },
|
||||
{ source: "/admin/:path*", headers: [noindex] },
|
||||
{ source: "/admin", headers: [noindex] },
|
||||
{ source: "/preview/:path*", headers: [noindex] },
|
||||
];
|
||||
},
|
||||
};
|
||||
|
||||
export default nextConfig;
|
||||
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "@crosscode/website-frontend",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"description": "Church Website: the church's public site in its template, and the admin",
|
||||
"scripts": {
|
||||
"dev": "next dev -p 3300",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "eslint src",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@crosscode/contracts": "*",
|
||||
"@crosscode/ui": "*",
|
||||
"next": "^16.4.6",
|
||||
"react": "^19.3.1",
|
||||
"react-dom": "^19.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/eslintrc": "^3",
|
||||
"@types/node": "^20",
|
||||
"@types/react": "^19.3.0",
|
||||
"@types/react-dom": "^19.3.0",
|
||||
"autoprefixer": "^10.4.21",
|
||||
"eslint": "^10.13.0",
|
||||
"eslint-config-next": "^16.4.6",
|
||||
"postcss": "^8.5.6",
|
||||
"tailwindcss": "3.4",
|
||||
"typescript": "^5"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
module.exports = { plugins: { tailwindcss: {}, autoprefixer: {} } };
|
||||
@@ -0,0 +1,13 @@
|
||||
import type { Metadata } from "next";
|
||||
|
||||
export const metadata: Metadata = { title: "Admin", robots: { index: false, follow: false } };
|
||||
|
||||
// The admin (docs/WEBSITE-1.0-PLAN.md §10), signed in through the church's Accounts, comes next.
|
||||
export default function Admin() {
|
||||
return (
|
||||
<main className="mx-auto max-w-xl px-4 py-16">
|
||||
<h1 className="text-2xl font-semibold">Website admin</h1>
|
||||
<p className="mt-2 text-gray-600">Not built yet.</p>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
|
||||
/* Defaults until the church profile's colour is set (layout.tsx overrides them per request). */
|
||||
:root {
|
||||
--brand: 31 78 121;
|
||||
--brand-dark: 21 55 85;
|
||||
}
|
||||
|
||||
body {
|
||||
@apply bg-white text-gray-900 antialiased;
|
||||
/* The church's font pairing (@crosscode/ui fonts.css); the template's default until it picks one. */
|
||||
font-family: var(--cc-font-body, ui-sans-serif, system-ui, sans-serif);
|
||||
}
|
||||
|
||||
h1, h2, h3 {
|
||||
font-family: var(--cc-font-heading, inherit);
|
||||
font-variation-settings: var(--cc-heading-variation, normal);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import type { Metadata } from "next";
|
||||
import "@crosscode/ui/fonts.css";
|
||||
import "./globals.css";
|
||||
import { brandAttributes } from "@crosscode/ui";
|
||||
|
||||
// The church's name, colours, fonts and corners come from its profile in Accounts once the Website
|
||||
// is linked (docs/WEBSITE-1.0-PLAN.md §2); until then, plain defaults.
|
||||
export const metadata: Metadata = {
|
||||
title: { default: "Church Website", template: "%s" },
|
||||
};
|
||||
|
||||
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
||||
return (
|
||||
<html lang="en-ZA" {...brandAttributes(null)}>
|
||||
<body>{children}</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
import type { Metadata } from "next";
|
||||
import { loadStatus } from "@/lib/site";
|
||||
|
||||
// Rendered per request from the backend's status; the published site is cached once it exists (§1).
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export async function generateMetadata(): Promise<Metadata> {
|
||||
const status = await loadStatus();
|
||||
// Coming soon is a real page (HTTP 200) but never indexed (§5, decision 14).
|
||||
return status.mode === "coming-soon" ? { title: "Coming soon", robots: { index: false, follow: true } } : { title: "Home" };
|
||||
}
|
||||
|
||||
export default async function Home() {
|
||||
const status = await loadStatus();
|
||||
if (status.mode === "coming-soon") {
|
||||
// The full Coming soon page (logo, service times, contact, links to Events) comes with the
|
||||
// church profile (§5).
|
||||
return (
|
||||
<main className="mx-auto flex min-h-screen max-w-xl flex-col items-center justify-center gap-4 px-4 text-center">
|
||||
<h1 className="text-3xl font-semibold text-brand">Coming soon</h1>
|
||||
<p className="text-gray-600">Our new website is on its way.</p>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<main className="mx-auto max-w-3xl px-4 py-16">
|
||||
<h1 className="text-3xl font-semibold">Welcome</h1>
|
||||
<p className="mt-2 text-gray-600">Published version {status.version}. The templates come next (§3).</p>
|
||||
</main>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import type { MetadataRoute } from "next";
|
||||
|
||||
// The public site is indexed; the admin, previews and API never are (ROADMAP-v3 §11). The sitemap
|
||||
// comes with the published pages.
|
||||
export default function robots(): MetadataRoute.Robots {
|
||||
return { rules: [{ userAgent: "*", allow: "/", disallow: ["/admin", "/preview", "/api"] }] };
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
/** What the public site shows right now, from the backend (src/site/status.ts there). */
|
||||
export type SiteStatus =
|
||||
| { mode: "coming-soon" }
|
||||
| { mode: "published"; version: number; publishedAt: string; template: string | null };
|
||||
|
||||
const api = (process.env.WEBSITE_API_URL || "http://127.0.0.1:5300").replace(/\/+$/, "");
|
||||
|
||||
export async function loadStatus(): Promise<SiteStatus> {
|
||||
try {
|
||||
const res = await fetch(`${api}/api/v1/site/status`, { next: { revalidate: 30 } });
|
||||
if (res.ok) return (await res.json()) as SiteStatus;
|
||||
} catch {
|
||||
// The backend is starting or down: Coming soon is the safe thing to show.
|
||||
}
|
||||
return { mode: "coming-soon" };
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
/** @type {import('tailwindcss').Config} */
|
||||
// The church's colours are CSS variables set per request in layout.tsx (from the church profile).
|
||||
module.exports = {
|
||||
content: ["./src/**/*.{ts,tsx}", "../../../packages/ui/src/**/*.{ts,tsx}"],
|
||||
theme: {
|
||||
extend: {
|
||||
colors: {
|
||||
brand: { DEFAULT: "rgb(var(--brand) / <alpha-value>)", dark: "rgb(var(--brand-dark) / <alpha-value>)" },
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [],
|
||||
};
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2020",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"allowJs": false,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
"noEmit": true,
|
||||
"esModuleInterop": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "bundler",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"jsx": "react-jsx",
|
||||
"incremental": true,
|
||||
"plugins": [{ "name": "next" }],
|
||||
"paths": { "@/*": ["./src/*"] }
|
||||
},
|
||||
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts", ".next/dev/types/**/*.ts"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
@@ -2,5 +2,5 @@
|
||||
"name": "@crosscode/website",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"description": "Placeholder: Church Website, built in phase 5 (ROADMAP-v3 §6)"
|
||||
"description": "Church Website (ROADMAP-v3 §6, phase 5): backend/ and frontend/ are the workspaces"
|
||||
}
|
||||
|
||||
+31
-14
@@ -1,6 +1,6 @@
|
||||
# Handover — Cross Code, all products
|
||||
|
||||
Last updated: 2026-11-21. **The plan is [ROADMAP-v3.md](./ROADMAP-v3.md)** (decided 2026-11-03,
|
||||
Last updated: 2026-11-25. **The plan is [ROADMAP-v3.md](./ROADMAP-v3.md)** (decided 2026-11-03,
|
||||
decisions table near the end). This file says where each phase stands and what comes next.
|
||||
Product-specific notes (where the code lives, known gaps) stay with each product: Cross Events'
|
||||
are in [`apps/events/docs/HANDOVER.md`](../apps/events/docs/HANDOVER.md), and the Hub's are in
|
||||
@@ -25,18 +25,33 @@ every release).
|
||||
|
||||
| Phase | What | State |
|
||||
|-------|------|-------|
|
||||
| 0 | contracts 1.0.0 → 1.14.0 | **Released and in use.** Not published to a registry (decision 22): the Hub gets a packed release committed to its repo (`backend/vendor/`) |
|
||||
| 1 | Hub 2.0 → 2.10.0 | **Released, deployed and tested** (Hub `v2.10.0`) |
|
||||
| 0 | contracts 1.0.0 → 1.17.0 | **Released and in use.** Not published to a registry (decision 22): the Hub gets a packed release committed to its repo (`backend/vendor/`) |
|
||||
| 1 | Hub 2.0 → 2.20.0 | **Released, deployed and tested** (Hub `v2.20.0`) |
|
||||
| 1b | Cross Events 2.2.0: moved here as `apps/events`, the `crosscode` script | **Released, rolled out and tested.** Every install adopted onto the monorepo |
|
||||
| 1c | Cross Events 2.3.x: authenticator app 2FA | **Released and rolled out** (carried into Accounts in phase 4) |
|
||||
| 1d | Agent 1.x + Hub 2.1+ | **Released, rolled out and tested** (agent `1.3.1` on every server; from agent 1.4.0 the central server's agent can also read and change frps's config from the Hub) |
|
||||
| 1d | Agent 1.x + Hub 2.1+ | **Released, rolled out and tested** (agent `1.5.0` on every server: from 1.4.0 the Hub reads and changes frps's / frpc's config and probes ports before an install; from 1.5.0 one product of a church can be uninstalled, exported or purged) |
|
||||
| 2 | Cross Events 2.4.0: protocol v2, Linked products, event feed, `packages/seo` | **Released, rolled out and tested** ([EVENTS-2.4-PLAN.md](./EVENTS-2.4-PLAN.md)) |
|
||||
| 3 | Accounts 1.0.0 | **Released, rolled out and tested** (now `accounts@1.6.0`; [ACCOUNTS-1.0-PLAN.md](./ACCOUNTS-1.0-PLAN.md)) |
|
||||
| 4 | Cross Events 3.0.0: sign-in through Accounts | **Released, rolled out and tested** (now `events@3.6.1`; [EVENTS-3.0-PLAN.md](./EVENTS-3.0-PLAN.md)). Churches sign in through their Accounts; crosscode-site `v1.6.0` deployed |
|
||||
| 4+ | Running it: jobs from the dashboard, styled emails, .env from the Hub, sign-in health, the nightly people check | **Released, deployed and tested** 2026-11-20 (below) |
|
||||
| 5 | Church Website 1.0.0 | **Planned** 2026-11-21: [WEBSITE-1.0-PLAN.md](./WEBSITE-1.0-PLAN.md) (all decisions confirmed). Not started |
|
||||
| 4 | Cross Events 3.0.0: sign-in through Accounts | **Released, rolled out and tested** (now `events@3.7.0`; [EVENTS-3.0-PLAN.md](./EVENTS-3.0-PLAN.md)). Churches sign in through their Accounts; crosscode-site `v1.6.0` deployed |
|
||||
| 4+ | Running it: jobs from the dashboard, styled emails, .env from the Hub, sign-in health, the nightly people check; then frp config and one-product uninstalls, and the Hub's popups, pickers and port list | **Released, deployed and tested** 2026-11-20 and 2026-11-23 (below) |
|
||||
| 5 | Church Website 1.0.0 | **Planned** 2026-11-21: [WEBSITE-1.0-PLAN.md](./WEBSITE-1.0-PLAN.md) (all decisions confirmed). Font pairings confirmed 2026-11-24, section variants per template 2026-11-25 (§3). `contracts@1.17.0`, `accounts@1.7.0` and `events@3.7.0` released 2026-11-24, Hub `v2.21.0` 2026-11-25 (the Hub deployed 2026-11-25; the others not rolled out yet); `website@1.0.0` next |
|
||||
| 6–7 | App 1.0.0 → App 1.x | Not started |
|
||||
|
||||
## Released 2026-11-23
|
||||
|
||||
All tagged, pushed and deployed on 2026-11-23. Details in [VERSIONS.md](./VERSIONS.md) and the Hub's
|
||||
CHANGELOG.
|
||||
|
||||
| Release | What |
|
||||
|---------|------|
|
||||
| `agent@1.4.0`, `contracts@1.15.0`, Hub `v2.11.0` | The agent finds frps's / frpc's config wherever it is (TOML too); each server's Hub page reads and changes it (secrets stay on the server, verify, backup, put back if frp doesn't start, two-factor). New installs probe their ports on the central and church server first (`probe-ports`) |
|
||||
| `agent@1.5.0`, `contracts@1.16.0`, Hub `v2.12.0`, `crosscode` script | Uninstall, export and purge **one product** of a church (`crosscode uninstall|export|purge <church> [product …]`); the last one removes the church; Accounts goes last. Stale installs removable from the Hub; customers archivable; several emails per customer |
|
||||
| Hub `v2.13.0` | Alerts cleared by hand; billing tables sortable |
|
||||
| Hub `v2.14.0` – `v2.17.0` | Customer and install pages as a header, tiles and tabs; every add and edit in a popup (frontend only) |
|
||||
| Hub `v2.18.0`, `v2.19.0` | Releases picked from a list; the server agent's own releases on the Releases page and in Update agent (migration `AgentRelease`) |
|
||||
| Hub `v2.20.0` | The port list says what each port is for; frps's allow_ports checked against it |
|
||||
| crosscode.co.za `v1.6.1` | Clearer web address choices on the Cross Events page |
|
||||
|
||||
## Released 2026-11-20
|
||||
|
||||
All tagged, pushed, deployed and tested (confirmed by Joshua 2026-11-21). Details in [CHANGELOG.md](../CHANGELOG.md), the apps' CHANGELOGs
|
||||
@@ -80,15 +95,17 @@ before that need the change by hand, and so does the Hub's own site (`events-hub
|
||||
|
||||
## Next up
|
||||
|
||||
Everything up to and including the 2026-11-20 releases is deployed, rolled out and tested
|
||||
(VERSIONS.md, "Deployed / rolled out").
|
||||
Everything up to and including the 2026-11-23 releases is deployed (VERSIONS.md, "Deployed / rolled
|
||||
out").
|
||||
|
||||
1. **Phase 5, Church Website 1.0.0** (ROADMAP §6, §9). Planned in
|
||||
[WEBSITE-1.0-PLAN.md](./WEBSITE-1.0-PLAN.md): decisions all confirmed 2026-11-21. Order:
|
||||
contracts 1.17.0 → Accounts 1.7.0 → Events 3.7.0 (shared fonts and footer) → Hub 2.13.0 →
|
||||
`website@1.0.0` → Hope Family Church → a second church → crosscode-site 1.7.0.
|
||||
2. **Archive `hope-events`** if it isn't yet (every install now reports 2.2.0 or later;
|
||||
EVENTS-2.2-PLAN §7).
|
||||
[WEBSITE-1.0-PLAN.md](./WEBSITE-1.0-PLAN.md): decisions all confirmed 2026-11-21. Font pairings
|
||||
confirmed 2026-11-24 (§3). Order: ~~contracts 1.17.0~~ → ~~Accounts 1.7.0~~ (both released 2026-11-24; Accounts
|
||||
ships with contracts because it answers the new `church.update`) → ~~Events 3.7.0~~ (shared fonts and footer; released 2026-11-24) → ~~Hub 2.21.0~~ (released
|
||||
and deployed 2026-11-25; the plan said 2.13.0) → **`website@1.0.0`** (skeleton in `apps/website` 2026-11-25: backend, frontend, content model, the section variants in `src/site/variants.ts`) → Hope Family Church → a second
|
||||
church → crosscode-site 1.7.0.
|
||||
Done (confirmed by Joshua 2026-11-25): `hope-events` is archived, and every FastPanel site set up
|
||||
before Hub 2.10.0, and the Hub's own site, has `location ^~ /api/`.
|
||||
|
||||
## The VM test (2026-11-17)
|
||||
|
||||
|
||||
+1
-1
@@ -641,7 +641,7 @@ Planned in [AGENT-1.0-PLAN.md](./AGENT-1.0-PLAN.md). In short:
|
||||
| 2 | **Cross Events 2.4.0** | Reports `product: "events"` (protocol v2), **Linked products**, the event feed (publish + show events from siblings), `packages/seo` (§11) with canonical links for imported events. **Planned and built 2026-11-18:** [EVENTS-2.4-PLAN.md](./EVENTS-2.4-PLAN.md) (also needs contracts 1.4.0 and Hub 2.2.0, for a public key in the v2 heartbeat); not tagged yet | Small; ready for when the Website exists |
|
||||
| 3 | **Accounts 1.0.0** | OIDC provider, sign-in, 2FA (email, WhatsApp, authenticator app), password reset, consent and notice, export / delete fan-out, admin, install script. [ACCOUNTS-1.0-PLAN.md](./ACCOUNTS-1.0-PLAN.md) (with contracts 1.5.0, `packages/auth-client`, Hub 2.3.0). **Released 2026-11-18** (`accounts@1.0.0`, 1.0.1 on 2026-11-19); the VM test and a run on real Postgres are still to do before a church gets it | Every later product signs in through it |
|
||||
| 4 | **Cross Events 3.0.0** | Sign-in moves to Accounts; user migration keeping password hashes; migration guide. **Planned 2026-11-19:** [EVENTS-3.0-PLAN.md](./EVENTS-3.0-PLAN.md) (with contracts 1.8.0, Accounts 1.1.0, Hub 2.5.0; decisions confirmed 2026-11-19) | Breaking change, so a major version. **Moved before the Website on 2026-11-19** (decision 38): Events is the product churches use today, so Accounts is proven on real users first, and the Website then starts with a church whose people already have accounts |
|
||||
| 5 | **Church Website 1.0.0** | Public site with the **four templates** (§6), admin, simple events + feed, SEO (§11), Hope Family Church as the first church, then a second test church on a different template to prove it repeats. **Planned 2026-11-21:** [WEBSITE-1.0-PLAN.md](./WEBSITE-1.0-PLAN.md) (with contracts 1.17.0, Accounts 1.7.0, Events 3.7.0 for the shared fonts and footer, Hub 2.13.0) | More churches need a website than an app; it also covers the "website only" case. Built on Accounts from day one |
|
||||
| 5 | **Church Website 1.0.0** | Public site with the **four templates** (§6), admin, simple events + feed, SEO (§11), Hope Family Church as the first church, then a second test church on a different template to prove it repeats. **Planned 2026-11-21:** [WEBSITE-1.0-PLAN.md](./WEBSITE-1.0-PLAN.md) (with contracts 1.17.0, Accounts 1.7.0, Events 3.7.0 for the shared fonts and footer, Hub 2.21.0) | More churches need a website than an app; it also covers the "website only" case. Built on Accounts from day one |
|
||||
| 6 | **Church App 1.0.0** | Foundation (PWA, branding, Accounts), House of Prayer, announcements, devotionals, events (simple + feed) | Starts with shared users and the feed already in place |
|
||||
| 7 | Church App 1.x | Reading plans, sermons, groups, pastoral care, serving, giving links, directory | After House of Prayer is in use |
|
||||
|
||||
|
||||
+78
-12
@@ -1,6 +1,6 @@
|
||||
# Versions — the latest release of everything
|
||||
|
||||
Last updated: 2026-11-23. Taken from the git tags, which is what a release is here (branch → merge →
|
||||
Last updated: 2026-11-24. Taken from the git tags, which is what a release is here (branch → merge →
|
||||
tag → push, see [HANDOVER.md](./HANDOVER.md) "Releasing"). **Update this file with every release.**
|
||||
|
||||
"Released" means tagged and pushed. Whether a release is **deployed** or rolled out is recorded
|
||||
@@ -10,12 +10,12 @@ separately below; the two often differ.
|
||||
|
||||
| What | Repo | Latest | Tag | Released |
|
||||
|------|------|--------|-----|----------|
|
||||
| Cross Events | `crosscode-platform` (`apps/events`) | **3.6.1** | `events@3.6.1` | 2026-11-20 |
|
||||
| Accounts | `crosscode-platform` (`apps/accounts`) | **1.6.0** | `accounts@1.6.0` | 2026-11-20 |
|
||||
| Cross Events | `crosscode-platform` (`apps/events`) | **3.7.0** | `events@3.7.0` | 2026-11-24 |
|
||||
| Accounts | `crosscode-platform` (`apps/accounts`) | **1.7.0** | `accounts@1.7.0` | 2026-11-24 |
|
||||
| Server agent | `crosscode-platform` (`apps/agent`) | **1.5.0** | `agent@1.5.0` | 2026-11-23 |
|
||||
| Contracts | `crosscode-platform` (`packages/contracts`) | **1.16.0** | `contracts@1.16.0` | 2026-11-23 |
|
||||
| Cross Code Hub | `events-hub` | **2.12.0** | `v2.12.0` | 2026-11-23 |
|
||||
| crosscode.co.za | `crosscode-site` | **1.6.0** | `v1.6.0` | 2026-11-19 |
|
||||
| Contracts | `crosscode-platform` (`packages/contracts`) | **1.17.0** | `contracts@1.17.0` | 2026-11-24 |
|
||||
| Cross Code Hub | `events-hub` | **2.21.0** | `v2.21.0` | 2026-11-25 |
|
||||
| crosscode.co.za | `crosscode-site` | **1.6.1** | `v1.6.1` | 2026-11-23 |
|
||||
| `crosscode` script | `crosscode-platform` (`scripts/`) | `main` | none | 2026-11-23 (last change: uninstall, export and purge one product of a church) |
|
||||
|
||||
The `crosscode` script has no version: every server's copy (`/opt/crosscode/tools`) pulls `main`
|
||||
@@ -28,8 +28,8 @@ 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.1.0 |
|
||||
| Website | `apps/website` | 0.0.0 (phase 5, being planned) |
|
||||
| `@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` | 0.1.0 (phase 5, being built: skeleton 2026-11-25; backend and frontend workspaces) |
|
||||
| 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
|
||||
@@ -37,6 +37,72 @@ need their own tags until something outside this repo depends on them.
|
||||
|
||||
## What each latest release was for
|
||||
|
||||
- **Hub 2.21.0 (2026-11-25):** New install offers the Church Website (Accounts first, at
|
||||
`accounts.<its address>`); the FastPanel email sends a `www.` site's bare domain to `www.` with a
|
||||
301. Extra Website storage is bought in 5 GB steps on the licence (Edit → Extra storage), sent to
|
||||
the site as its limit (`limits.storageBytes`) and billed on the steps bought, no longer on usage.
|
||||
Vendors contracts 1.17.0. **Migration:** `Licence.extraStorageSteps`. "Get more storage" comes
|
||||
with the Website (contracts 1.18.0). **Deployed 2026-11-25.**
|
||||
- **Events 3.7.0 (2026-11-24):** the public pages use the church's fonts, corners and the shared
|
||||
church footer from its profile in Accounts (`GET /api/v2/church`, kept 10 minutes), with links to
|
||||
its other sites in the header; `church.changed` from Accounts is now accepted (it answered 404
|
||||
before). The dashboard and setup screens are unchanged. `@crosscode/ui` 0.3.0. No migrations.
|
||||
Requires Accounts 1.7.0 (the Hub updates it first). **Not deployed yet.**
|
||||
- **Contracts 1.17.0 + Accounts 1.7.0 (2026-11-24):** the first piece of the Church Website. Contracts:
|
||||
the 8 font pairings, corner styles and template ids (`./style`), an optional `branding.style` on the
|
||||
church profile, `church.update` (the Website changes shared profile facts), an optional `website`
|
||||
part of the church export and an optional `limits.storageBytes` on the licence. Accounts: Brand
|
||||
style under Church profile, the church's fonts, corners and shared footer on its pages, and
|
||||
`church.update`. No migrations. The Hub vendors contracts 1.17.0 with 2.21.0. **Not deployed yet.**
|
||||
- **Hub 2.20.0 (2026-11-23):** the port list says what each port is for (church, product, web or API,
|
||||
linked to the install); a church server's hand-written frpc tunnels are listed as taken on each frp
|
||||
config read. frps's allow_ports is checked against the port list (the Hub's range plus listed ports
|
||||
outside it): an alert and Edit → Use the Hub's allow_ports when it leaves ports out. No migration.
|
||||
Deployed 2026-11-23.
|
||||
- **Hub 2.19.0 (2026-11-23):** the server agent's releases: a release source for the Server agent (in
|
||||
the defaults: `agent@` tags, notes in `apps/agent/WHATS-NEW.md`), shown on the Releases page with how
|
||||
many servers run each. Update agent picks a release (Latest by default, with its notes); the
|
||||
Servers pages say when a newer agent is out. **Migration** (`AgentRelease`): run `prisma migrate
|
||||
deploy`. A saved list of sources gets an "Add the agent's source" button.
|
||||
Deployed 2026-11-23.
|
||||
- **Hub 2.18.0 (2026-11-23):** releases are picked from a list, not typed: New install and Move onto
|
||||
the monorepo (Events from 2.2.0) as well as an install's Update and the Updates page. Latest first,
|
||||
then the newest 10, with Show older versions for the rest. Plan for agent releases (2.19.0) in the
|
||||
Hub's `docs/VERSION-PICKERS-PLAN.md`. Frontend only: no migration, no API changes.
|
||||
Deployed 2026-11-23.
|
||||
- **Hub 2.17.0 (2026-11-23):** popups on the remaining pages: a server's configuration and Update
|
||||
agent, the frp config (read-only on the card, Edit with the two-factor code), install defaults and
|
||||
Mark as taken (Ports & defaults), Clear public key and notes on an install, and an invoice's lines
|
||||
(Edit for drafts and approved ones; Void and Refund instead of the browser's prompt). Settings
|
||||
forms that are the page itself stay as they are. Frontend only: no migration, no API changes.
|
||||
Deployed 2026-11-23.
|
||||
- **Hub 2.16.0 (2026-11-23):** every add and edit on the list pages is a popup like the customer
|
||||
and install pages: Add server (the join command in the same popup), Add customer, New install,
|
||||
Link existing, notices and releases (new and edit), release sources (a table; Edit opens the rows
|
||||
and the token) and One-off invoice on Billing (with a church picker; `/billing/invoices/new` opens
|
||||
it). Plan for the rest in the Hub's `docs/POPUPS-PLAN.md`. Frontend only: no migration, no API changes.
|
||||
Deployed 2026-11-23.
|
||||
- **Hub 2.15.0 (2026-11-23):** an install's page (Servers → Installs → one install) is a header
|
||||
(status, Schedule update, a ⋯ menu for move onto the monorepo, demo site, uninstall and the two
|
||||
removals) with tiles for the site, version, server, ports and last heartbeat, then tabs: Jobs,
|
||||
Settings (.env), Exports. Every action is a popup like the customer page's, the .env files too
|
||||
(the tab shows the values, Edit opens a file). Banners for not registered, no heartbeat and a
|
||||
planned uninstall. Confirmations unchanged. Frontend only: no migration, no API changes.
|
||||
Deployed 2026-11-23.
|
||||
- **Hub 2.14.0 (2026-11-23):** the customer page is a summary header (products, owing, next invoice
|
||||
with its estimate, address, AI) and three tabs: Overview, Products, Invoices and payments. Every
|
||||
add and edit is a popup; each product is one card (licence and billing, one Save, suspend/revoke/
|
||||
release in a ⋯ menu); contact and billing details are one form; the history is one timeline with
|
||||
a filter. Record payment is a popup on Billing too. Frontend only: no migration, no API changes.
|
||||
Deployed 2026-11-23.
|
||||
- **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.
|
||||
- **Hub 2.13.0 (2026-11-23):** alerts can be cleared by hand (one, or Clear all); a cleared alert
|
||||
stays away until its problem is fixed and comes back, and isn't emailed again meanwhile. Billing
|
||||
invoices, payments and churches, and a customer's invoices and payments, can be sorted by column
|
||||
(remembered per browser). Fixed a stray scrollbar beside tab rows. Migration
|
||||
`20261123120000_alert_cleared`.
|
||||
- **Agent 1.5.0 + contracts 1.16.0 + Hub 2.12.0 + `crosscode` script (2026-11-23):** uninstalling
|
||||
one product no longer removes the whole church (it removed cross-events-demo's Accounts with its
|
||||
Events, which the Hub still showed as live). `crosscode uninstall|export|purge <church>
|
||||
@@ -157,9 +223,9 @@ you deploy one.
|
||||
|
||||
| What | Running | Since | Notes |
|
||||
|------|---------|-------|-------|
|
||||
| Hub | 2.11.0 | 2026-11-21 | Migration `20261121110000_server_frp_config` applied |
|
||||
| Agent on church-server1 | 1.4.0 | 2026-11-21 | |
|
||||
| Agent on the central server | 1.4.0 | 2026-11-21 | Reads and changes frps's config from the Hub (no longer read-only; decision 35 superseded) |
|
||||
| Hub | 2.21.0 | 2026-11-25 | Church Website in New install; `www.` redirect in the FastPanel email; extra Website storage on the licence (migration `Licence.extraStorageSteps`); vendors contracts 1.17.0 |
|
||||
| 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 | |
|
||||
| crosscode.co.za | 1.6.0 | 2026-11-20 | |
|
||||
| crosscode.co.za | 1.6.1 | 2026-11-23 | Clearer web address choices on the Cross Events page |
|
||||
|
||||
+196
-7
@@ -2,7 +2,14 @@
|
||||
|
||||
Phase **5** of [ROADMAP-v3.md](./ROADMAP-v3.md) (§6, §9, §10, §11; decisions 19, 20, 40–47).
|
||||
Written 2026-11-21. **All decisions confirmed by Joshua on 2026-11-21** (12 changed: a full
|
||||
storage stops uploads). Not started.
|
||||
storage stops uploads). **Being built:** the skeleton is in `apps/website` (2026-11-25).
|
||||
|
||||
**Updated 2026-11-24:** the Hub release is **2.21.0**, not 2.13.0 (the Hub reached 2.20.0 on
|
||||
2026-11-23 with other work). The 8 font pairings in §3 ("Font pairings") were **confirmed by Joshua
|
||||
on 2026-11-24** (decision 15).
|
||||
|
||||
**Updated 2026-11-25:** the **section variants per template** in §3 were confirmed by Joshua
|
||||
(decision 16).
|
||||
|
||||
**What the Website is:** the church's public site at `www.<church's address>` (or
|
||||
`<church>.crosscode.co.za` on the Cross Code address), plus its admin at `/admin`. Admins sign in
|
||||
@@ -17,7 +24,7 @@ prove it repeats. Then it goes on sale (crosscode-site, ROADMAP §9).
|
||||
|
||||
**Done when:**
|
||||
|
||||
- `website@1.0.0`, `contracts@1.17.0`, `accounts@1.7.0`, `events@3.7.0` and Hub `v2.13.0` are
|
||||
- `website@1.0.0`, `contracts@1.17.0`, `accounts@1.7.0`, `events@3.7.0` and Hub `v2.21.0` are
|
||||
tagged; the Hub installs the Website from New install (after Accounts) and lists its releases.
|
||||
- All four templates pass the same checks (§13) at phone, tablet and desktop sizes: layout, axe, the
|
||||
§11 SEO checks, and Lighthouse (SEO 100, accessibility 95+, performance 90+).
|
||||
@@ -156,6 +163,176 @@ in 1.x (they're part of the product, ROADMAP §1 rule 3).
|
||||
heroes). The duotone treatment makes uneven photos look consistent. Every image needs alt text.
|
||||
Uploads are resized into responsive sizes (WebP and JPEG).
|
||||
|
||||
### Font pairings (confirmed 2026-11-24)
|
||||
|
||||
Eight pairings, a heading font and a body font each. All are **SIL Open Font License 1.1** (free to
|
||||
self-host and bundle; the licence text ships with them), all are **variable fonts** (one file per
|
||||
style covers every weight) and all cover **Latin Extended** (Afrikaans ê, ë, ô and names from other
|
||||
languages). The id is what `branding.style.fontPairing` stores, so ids never change once released;
|
||||
names and fonts shown to churches can.
|
||||
|
||||
| Id | Shown as | Headings | Body | Feel | Recommended for |
|
||||
|----|----------|----------|------|------|-----------------|
|
||||
| `classic` | Classic | Lora | Source Sans 3 | Traditional serif headings, a plain readable body | Heritage, Clean |
|
||||
| `scholarly` | Scholarly | EB Garamond | EB Garamond | Old-style book type throughout; dignified | Heritage |
|
||||
| `editorial` | Editorial | Playfair Display | Inter | High-contrast magazine headlines over a neutral body | Heritage, Bold |
|
||||
| `impact` | Impact | Oswald | Source Sans 3 | Tall condensed headlines, uppercase-friendly; loud over photos | Bold |
|
||||
| `contemporary` | Contemporary | Outfit | DM Sans | Geometric, modern, light-handed | Bold, Community, Clean |
|
||||
| `friendly` | Friendly | Nunito | Nunito | Rounded ends throughout; warm and informal | Community |
|
||||
| `warm` | Warm | Fraunces (soft) | Nunito Sans | A soft, characterful serif with a gentle sans | Community |
|
||||
| `modern` | Modern | Inter | Inter | One neutral sans, tight headings; lets colour and photos lead | Clean |
|
||||
|
||||
Each template recommends three (its first is the default when a church picks that template):
|
||||
|
||||
| Template | Recommended (default first) |
|
||||
|----------|-----------------------------|
|
||||
| Heritage | `classic`, `scholarly`, `editorial` |
|
||||
| Bold | `impact`, `contemporary`, `editorial` |
|
||||
| Community | `friendly`, `warm`, `contemporary` |
|
||||
| Clean | `modern`, `classic`, `contemporary` |
|
||||
|
||||
**Why these:** two each of traditional serif, display serif, strong sans and soft sans, so every
|
||||
template has a real choice of mood; every pairing is recommended at least once. Avoided: script and
|
||||
handwritten faces (hard to read, poor in long text), fonts that only exist as static weights (many
|
||||
files, slower), and very thin display faces (fail contrast at small sizes).
|
||||
|
||||
**How they're served** (`packages/ui`):
|
||||
|
||||
- From the `@fontsource-variable/*` npm packages, pinned in the lockfile and copied into each app's
|
||||
build; no request leaves the church's site (decision 13).
|
||||
- Only the Latin and Latin Extended subsets, `woff2` only. A pairing is at most four files (heading
|
||||
and body, upright and italic; one family = two). Budget: **≤ 160 KB per pairing** for the files a
|
||||
page actually uses; checked in CI.
|
||||
- The heading font is preloaded; the body font is not. `font-display: swap` with a metric-matched
|
||||
fallback (`size-adjust`, `ascent-override`) on Georgia or Arial, so swapping doesn't shift the
|
||||
layout (CLS, the Lighthouse target in §13).
|
||||
- CSS variables `--cc-font-heading` and `--cc-font-body` from the profile, next to the colours and
|
||||
`--cc-radius` (corners).
|
||||
|
||||
**A church without a `fontPairing`** (every church today): the Website uses its template's default;
|
||||
Events and Accounts keep the system fonts they use now, so Events 3.7 and Accounts 1.7 look the same
|
||||
until an admin picks a pairing. `corners` missing means `soft`.
|
||||
|
||||
### Section variants per template (confirmed 2026-11-25)
|
||||
|
||||
Answers "Still open: the exact section variants per template". The rule from the table above stays:
|
||||
**every template renders every variant**, so no choice is ever greyed out and switching template
|
||||
never needs a fallback. What a template adds is (a) which variant each section **starts with**,
|
||||
(b) which variants it **recommends** (shown first, marked "Suits Heritage"), and (c) **how it draws**
|
||||
each one. Variant ids are stored on the section (`hero.variant = "photo"`), so like the font ids
|
||||
they never change once released.
|
||||
|
||||
**Variant ids**
|
||||
|
||||
| Section | Ids |
|
||||
|---|---|
|
||||
| Hero | `photo` · `video` · `collage` · `split` · `text` |
|
||||
| Service times and location | `panel` · `strip` · `map` |
|
||||
| Welcome / introduction | `text` · `image-text` · `pastor` |
|
||||
| Ministries | `cards` · `list` · `bands` |
|
||||
| Team / leaders | `faces` · `list` · `featured` |
|
||||
| Upcoming events | `cards` · `list` · `calendar` |
|
||||
| Latest message | `video` · `card` · `compact` |
|
||||
| Invitation | `banner` · `centred` · `image` |
|
||||
|
||||
The mission line (ROADMAP §6's homepage order) is a field of the Welcome section, shown above the
|
||||
introduction in every variant, not a section of its own.
|
||||
|
||||
**Defaults and recommendations** (default first, then the other recommended ones; anything not listed
|
||||
still works)
|
||||
|
||||
| Section | Heritage | Bold | Community | Clean |
|
||||
|---|---|---|---|---|
|
||||
| Hero | **`photo`** (framed), `split`, `text` | **`video`**, `photo`, `split` | **`collage`**, `photo`, `split` | **`text`**, `split`, `photo` |
|
||||
| Service times | **`panel`**, `map` | **`strip`**, `map` | **`map`**, `panel` | **`strip`**, `panel` |
|
||||
| Welcome | **`pastor`**, `text` | **`image-text`**, `pastor` | **`pastor`**, `image-text` | **`text`**, `image-text` |
|
||||
| Ministries | **`list`**, `cards` | **`bands`**, `cards` | **`cards`**, `bands` | **`list`**, `cards` |
|
||||
| Team | **`featured`**, `faces` | **`faces`**, `featured` | **`faces`**, `featured` | **`list`**, `faces` |
|
||||
| Events | **`list`**, `calendar` | **`cards`**, `calendar` | **`cards`**, `calendar` | **`list`**, `calendar` |
|
||||
| Latest message | **`card`**, `video` | **`video`**, `card` | **`card`**, `video` | **`compact`**, `card` |
|
||||
| Invitation | **`centred`**, `banner` | **`image`**, `banner` | **`banner`**, `image` | **`centred`**, `banner` |
|
||||
|
||||
**How each template draws them**
|
||||
|
||||
- **Heritage** (traditional, single centred column, thin rules between sections):
|
||||
`photo` sits *inside* a frame below the centred logo and navigation, never full-bleed; `video` is
|
||||
framed the same way. `collage` is three framed photos in a row. `split` keeps the image in a
|
||||
frame with text on the cream side. `panel` is the formal service-times panel with a double rule.
|
||||
`cards` are bordered, square-ish, with serif titles; `bands` alternate within the column width
|
||||
rather than full-bleed. `faces` are circular portraits with names in small caps. `calendar` is a
|
||||
month list with dates set in the heading font.
|
||||
- **Bold** (full-bleed, large type, sticky header): `photo` and `video` fill the screen with the
|
||||
headline overlaid on a scrim (contrast checked against the image's dark-scrim colour, not the
|
||||
photo); `collage` is an edge-to-edge mosaic. `split` is 50/50 full-bleed. `strip` is a coloured
|
||||
band right under the hero. `bands` are full-bleed alternating image / text. `cards` are large,
|
||||
image-led, with the title on the image. `faces` are tall portrait crops. `text` hero is a huge
|
||||
headline on the primary colour.
|
||||
- **Community** (cards, soft shapes, tinted backgrounds, faces prominent): `collage` is overlapping
|
||||
rounded photos with a soft blob shape behind; `photo` gets a curved bottom edge. Every list-like
|
||||
section prefers a card grid; `list` still exists but with rounded rows and small thumbnails.
|
||||
`map` shows the map in a rounded card next to the times. `faces` are big, with role and a short
|
||||
line. Sections alternate light and tinted backgrounds by default (Section colour `tinted`).
|
||||
- **Clean** (small header, white space, narrow column, colour as accent): `text` hero is the church's
|
||||
headline in large type with the service time underneath, no image needed. `photo` is shown
|
||||
*below* the headline at column width, never behind text. `video` is a contained player, never
|
||||
autoplaying as a background. `strip` is one line of text with a thin accent rule. `cards` are
|
||||
borderless with a hairline separator. `collage` is a tidy three-image grid. `bands` become
|
||||
stacked image / text pairs within the column.
|
||||
|
||||
**Headers** (the "Header" style setting)
|
||||
|
||||
| Template | Options (default first) |
|
||||
|---|---|
|
||||
| Heritage | **Centred** (logo above, navigation below) · Centred with a top bar (service time and Plan your visit) |
|
||||
| Bold | **Transparent over the hero, solid on scroll** · Solid |
|
||||
| Community | **Logo left, navigation right, Plan your visit button** · Same with a tinted bar |
|
||||
| Clean | **Small, logo left, text navigation** · Small with navigation in a menu on every width |
|
||||
|
||||
Every header collapses to a menu button on phones; the transparent one only applies when the page
|
||||
starts with a `photo`, `video` or `collage` hero (otherwise it's solid, so it never sits on white
|
||||
text over white).
|
||||
|
||||
**Default homepage order** (the church can reorder, hide and show)
|
||||
|
||||
| Template | Order |
|
||||
|---|---|
|
||||
| Heritage | Hero · Service times · Welcome · Latest message · Ministries · Team · Events · Invitation |
|
||||
| Bold | Hero · Service times · Welcome · Events · Latest message · Ministries · Invitation (Team hidden) |
|
||||
| Community | Hero · Welcome · Service times · Ministries · Team · Events · Latest message · Invitation |
|
||||
| Clean | Hero · Service times · Welcome · Events · Latest message · Invitation (Ministries and Team hidden) |
|
||||
|
||||
**Style defaults when a template is picked** (the church changes them afterwards)
|
||||
|
||||
| Template | Section colour | Spacing | Buttons | Images | Corners (if the profile has none) |
|
||||
|---|---|---|---|---|---|
|
||||
| Heritage | Light | Airy | Outline | Natural | `sharp` |
|
||||
| Bold | Mixed with dark bands | Compact | Solid | Natural | `sharp` |
|
||||
| Community | Tinted | Airy | Pill | Natural | `round` |
|
||||
| Clean | Light | Airy | Outline | Natural | `soft` |
|
||||
|
||||
Corners and the font pairing are shared (roadmap decision 47), so picking a
|
||||
template only *suggests* them when the profile has none; it never overwrites a church's existing
|
||||
brand style without the admin saying yes ("Use Heritage's fonts and corners for all your sites?").
|
||||
|
||||
**Switching template** (§4, a pending change like any other):
|
||||
|
||||
- A section still on the **old template's default** moves to the **new template's default**, so a
|
||||
church that never touched variants gets the new template's intended look.
|
||||
- A section the church **chose a variant for** keeps it (every template draws every variant).
|
||||
- The homepage order and hidden sections are kept if the church changed them; otherwise the new
|
||||
template's default order applies.
|
||||
- Style settings follow the same rule: untouched ones take the new template's defaults, changed ones
|
||||
stay. The Publish screen lists what moved ("Hero: Collage → Text only, Clean's default").
|
||||
|
||||
**Blocks on custom pages** use the same ids where they overlap (image and text: `image-text`,
|
||||
people cards: `faces` / `list` / `featured`, call to action: `banner` / `centred` / `image`); the
|
||||
other blocks (text, gallery, quote, video, FAQ, map, divider) have one layout each, drawn in the
|
||||
template's style.
|
||||
|
||||
**Checks per variant:** the Playwright screenshots and axe run (§13) cover **every variant in every
|
||||
template** for the homepage sections (26 section variants × 4 templates × 3 widths = 312
|
||||
screenshots), using the demo church, plus a run with each template's defaults for Lighthouse.
|
||||
|
||||
## 4. Drafts, preview and publish
|
||||
|
||||
Decision 2: **one Publish for the whole site.**
|
||||
@@ -293,7 +470,7 @@ only freed when neither the working copy nor the last 10 published versions use
|
||||
- **Hub protocol v2, product `website`.** The heartbeat's `websiteStatsSchema` is already in the
|
||||
contracts (pages, messages, events, editors, storage). A Website licence needs the church's
|
||||
Accounts, installed first (as Events 3.x).
|
||||
- **Hub 2.13.0:** New install offers the Website; release sync for `website@` tags and
|
||||
- **Hub 2.21.0:** New install offers the Website; release sync for `website@` tags and
|
||||
`apps/website/WHATS-NEW.md`; its env template; the Website's price (R99) and the storage add-on
|
||||
(R20 per extra 5 GB, sent to the site with the licence as its storage limit, and the "Get more storage"
|
||||
request with its email to Joshua) in `frontend/src/lib/tiers.ts` and `backend/src/utils/billing/tiers.js`, in
|
||||
@@ -323,7 +500,7 @@ only freed when neither the working copy nor the last 10 published versions use
|
||||
| `crosscode-platform` `apps/accounts` | `branding.style` in the church profile, the shared fonts and footer, the Website's admins saving the profile | `accounts@1.7.0` |
|
||||
| `crosscode-platform` `apps/events` | Public pages with the shared fonts, corners and footer | `events@3.7.0` |
|
||||
| `crosscode-platform` `scripts/` | `products/website.sh`, `website.env.template.json`, bats tests | — |
|
||||
| `events-hub` | Website in New install, its releases, env template, prices and storage add-on, FastPanel email | Hub `v2.13.0` |
|
||||
| `events-hub` | Website in New install, its releases, env template, prices and storage add-on, FastPanel email | Hub `v2.21.0` |
|
||||
| `crosscode-site` | Church Website on sale (ROADMAP §9): its page, prices, a page per template, screenshots of the demo church, FAQ, `SoftwareApplication` JSON-LD | `v1.7.0` |
|
||||
|
||||
## 13. Testing
|
||||
@@ -350,7 +527,7 @@ only freed when neither the working copy nor the last 10 published versions use
|
||||
## 14. Releasing and rolling it out
|
||||
|
||||
1. `contracts@1.17.0`, then `accounts@1.7.0` (the profile's brand style), then `events@3.7.0`.
|
||||
2. Hub `v2.13.0` (vendored contracts 1.17.0) deployed.
|
||||
2. Hub `v2.21.0` (vendored contracts 1.17.0) deployed.
|
||||
3. `website@1.0.0` tagged after the e2e, Lighthouse and VM runs.
|
||||
4. **Hope Family Church:** Accounts 1.7.0 and Events 3.7.0 first, then New install → Website. The
|
||||
site shows Coming soon while the church builds it, and goes live with its first publish.
|
||||
@@ -391,9 +568,21 @@ Proposed and confirmed on 2026-11-21 (12 changed):
|
||||
pairings (§3).
|
||||
14. **Coming soon is a real page (HTTP 200) with `noindex`,** not a 503 (§5).
|
||||
|
||||
Confirmed on 2026-11-24:
|
||||
|
||||
15. **The 8 font pairings** in §3: `classic`, `scholarly`, `editorial`, `impact`, `contemporary`,
|
||||
`friendly`, `warm`, `modern`, three recommended per template. A church without one keeps
|
||||
the system fonts in Events and Accounts; `corners` defaults to `soft`.
|
||||
|
||||
Confirmed on 2026-11-25:
|
||||
|
||||
16. **Section variants per template** in §3: every template draws every variant (26 variant ids,
|
||||
fixed once released), with a default and recommendations per template; per-template headers,
|
||||
homepage order (Bold hides Team, Clean hides Ministries and Team) and style defaults; picking a
|
||||
template only suggests the shared fonts and corners; a template switch moves untouched sections
|
||||
and settings to the new defaults and keeps the church's own choices.
|
||||
|
||||
## Still open
|
||||
|
||||
- The 8 font pairings and the exact variants per template: settled with the template designs, early
|
||||
in the build.
|
||||
- Whether the App (phase 6) moves leaders, ministries and giving into `crosscode.church/1` or reads
|
||||
them from the Website. Decide with the App plan.
|
||||
|
||||
+2
-2
@@ -18,6 +18,6 @@ export default defineConfig([
|
||||
},
|
||||
},
|
||||
// Cross Events keeps its own lint (frontend/eslint.config.mjs, tsc for the backend) for now.
|
||||
// The Accounts frontend has its own Next lint (apps/accounts/frontend/eslint.config.mjs); Prisma's client is generated.
|
||||
globalIgnores(["**/node_modules/**", "**/dist/**", "**/coverage/**", "**/schemas/**", "apps/events/**", "apps/accounts/frontend/**", "**/src/generated/**", "**/.next/**"]),
|
||||
// The Accounts and Website frontends have their own Next lint (apps/*/frontend/eslint.config.mjs); Prisma's client is generated.
|
||||
globalIgnores(["**/node_modules/**", "**/dist/**", "**/coverage/**", "**/schemas/**", "apps/events/**", "apps/accounts/frontend/**", "apps/website/frontend/**", "**/src/generated/**", "**/.next/**"]),
|
||||
]);
|
||||
|
||||
Generated
+204
-11
@@ -12,10 +12,13 @@
|
||||
"apps/*",
|
||||
"!apps/events",
|
||||
"!apps/accounts",
|
||||
"!apps/website",
|
||||
"apps/events/backend",
|
||||
"apps/events/frontend",
|
||||
"apps/accounts/backend",
|
||||
"apps/accounts/frontend"
|
||||
"apps/accounts/frontend",
|
||||
"apps/website/backend",
|
||||
"apps/website/frontend"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@axe-core/playwright": "^4.14.0",
|
||||
@@ -46,7 +49,7 @@
|
||||
},
|
||||
"apps/accounts/backend": {
|
||||
"name": "@crosscode/accounts-backend",
|
||||
"version": "1.6.0",
|
||||
"version": "1.7.0",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"@crosscode/contracts": "*",
|
||||
@@ -83,7 +86,7 @@
|
||||
},
|
||||
"apps/accounts/frontend": {
|
||||
"name": "@crosscode/accounts-frontend",
|
||||
"version": "1.6.0",
|
||||
"version": "1.7.0",
|
||||
"dependencies": {
|
||||
"@crosscode/contracts": "*",
|
||||
"@crosscode/ui": "*",
|
||||
@@ -109,7 +112,7 @@
|
||||
},
|
||||
"apps/agent": {
|
||||
"name": "@crosscode/agent",
|
||||
"version": "1.4.0",
|
||||
"version": "1.5.0",
|
||||
"license": "UNLICENSED",
|
||||
"dependencies": {
|
||||
"@crosscode/contracts": "*",
|
||||
@@ -128,7 +131,7 @@
|
||||
},
|
||||
"apps/events/backend": {
|
||||
"name": "@crosscode/events-backend",
|
||||
"version": "3.6.1",
|
||||
"version": "3.7.0",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"@cj-tech-master/excelts": "^10.2.0",
|
||||
@@ -178,10 +181,11 @@
|
||||
},
|
||||
"apps/events/frontend": {
|
||||
"name": "@crosscode/events-frontend",
|
||||
"version": "3.6.1",
|
||||
"version": "3.7.0",
|
||||
"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",
|
||||
@@ -347,7 +351,58 @@
|
||||
},
|
||||
"apps/website": {
|
||||
"name": "@crosscode/website",
|
||||
"version": "0.0.0"
|
||||
"version": "0.0.0",
|
||||
"dev": true,
|
||||
"optional": true,
|
||||
"peer": true
|
||||
},
|
||||
"apps/website/backend": {
|
||||
"name": "@crosscode/website-backend",
|
||||
"version": "0.1.0",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"@crosscode/contracts": "*",
|
||||
"@prisma/adapter-pg": "^7.10.1",
|
||||
"@prisma/client": "^7.10.1",
|
||||
"dotenv": "^16.3.1",
|
||||
"express": "^5.3.0",
|
||||
"zod": "^4.6.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/express": "^5.0.6",
|
||||
"@types/node": "^20.19.43",
|
||||
"@types/supertest": "^7.2.1",
|
||||
"prisma": "^7.10.1",
|
||||
"supertest": "^7.3.1",
|
||||
"tsx": "^4.23.15",
|
||||
"typescript": "^5.9.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=22"
|
||||
}
|
||||
},
|
||||
"apps/website/frontend": {
|
||||
"name": "@crosscode/website-frontend",
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"@crosscode/contracts": "*",
|
||||
"@crosscode/ui": "*",
|
||||
"next": "^16.4.6",
|
||||
"react": "^19.3.1",
|
||||
"react-dom": "^19.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/eslintrc": "^3",
|
||||
"@types/node": "^20",
|
||||
"@types/react": "^19.3.0",
|
||||
"@types/react-dom": "^19.3.0",
|
||||
"autoprefixer": "^10.4.21",
|
||||
"eslint": "^10.13.0",
|
||||
"eslint-config-next": "^16.4.6",
|
||||
"postcss": "^8.5.6",
|
||||
"tailwindcss": "3.4",
|
||||
"typescript": "^5"
|
||||
}
|
||||
},
|
||||
"node_modules/@alloc/quick-lru": {
|
||||
"version": "5.3.0",
|
||||
@@ -952,6 +1007,23 @@
|
||||
"keyv": "^5.6.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@capsizecss/core": {
|
||||
"version": "4.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@capsizecss/core/-/core-4.1.3.tgz",
|
||||
"integrity": "sha512-d2sTTBwKuVioYxpwpU4URMp8VkFK+GI1VNGNawQcF8HBMHzCDa1FLcbeXJSzb5AJik7ZGv3aFVCTs7IS9MhvHg==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"csstype": "^3.1.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@capsizecss/metrics": {
|
||||
"version": "4.5.0",
|
||||
"resolved": "https://registry.npmjs.org/@capsizecss/metrics/-/metrics-4.5.0.tgz",
|
||||
"integrity": "sha512-BD0pz1JksZXEX9RLNtUCYYD72sQIVzOPIjaCAXPSz18lWdtPGmNbj6AVL2Q3n0trOLPOjZ9fnvtuAmSPv7yO1g==",
|
||||
"dev": true,
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@cj-tech-master/excelts": {
|
||||
"version": "10.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@cj-tech-master/excelts/-/excelts-10.2.0.tgz",
|
||||
@@ -1002,8 +1074,12 @@
|
||||
"resolved": "packages/ui",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@crosscode/website": {
|
||||
"resolved": "apps/website",
|
||||
"node_modules/@crosscode/website-backend": {
|
||||
"resolved": "apps/website/backend",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@crosscode/website-frontend": {
|
||||
"resolved": "apps/website/frontend",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@date-fns/tz": {
|
||||
@@ -1805,6 +1881,105 @@
|
||||
"integrity": "sha512-HpCo8tmWzLVad5s2d19EhAz5zqrrQ6s69qd6moPMQvkOuSwDT1YgRfWSVuc4ennqrgv3OHppiOGMQ7oC13yIww==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/@fontsource-variable/dm-sans": {
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@fontsource-variable/dm-sans/-/dm-sans-5.3.0.tgz",
|
||||
"integrity": "sha512-BpUG5bqePiDFMBM4ZtLSlPdAIOM990uB1dlXzIf4aw21yQR7BmykedLXXXMqGWsR18aMLOsbWccwJNh3ztTQaA==",
|
||||
"license": "OFL-1.1",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ayuhito"
|
||||
}
|
||||
},
|
||||
"node_modules/@fontsource-variable/eb-garamond": {
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@fontsource-variable/eb-garamond/-/eb-garamond-5.3.0.tgz",
|
||||
"integrity": "sha512-656OJsA9Vv24yhqRZFEzXnzS2AYgKdEILLgHJYLzzXndgcWFKfSXFqzbRI5/6Yk1Yt7UfWrUeppE5nRQPQMwlQ==",
|
||||
"license": "OFL-1.1",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ayuhito"
|
||||
}
|
||||
},
|
||||
"node_modules/@fontsource-variable/fraunces": {
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@fontsource-variable/fraunces/-/fraunces-5.3.0.tgz",
|
||||
"integrity": "sha512-9BYGySn4AHEJdgp9Z28tQ3X+laJMEOITXkQarZXeloWQZDq5oOvXJ3kDA8c7MGIfpogIaZfjrQBqmda8POOCKA==",
|
||||
"license": "OFL-1.1",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ayuhito"
|
||||
}
|
||||
},
|
||||
"node_modules/@fontsource-variable/inter": {
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@fontsource-variable/inter/-/inter-5.3.0.tgz",
|
||||
"integrity": "sha512-OupL48va4JNofb97w6NYeF9S7W/kHNKM0Er8Dem5nqi4jeOLrVJDoE8tZEpnMJmtkvNbB1EIPPwHcdkF6b1oUA==",
|
||||
"license": "OFL-1.1",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ayuhito"
|
||||
}
|
||||
},
|
||||
"node_modules/@fontsource-variable/lora": {
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@fontsource-variable/lora/-/lora-5.3.0.tgz",
|
||||
"integrity": "sha512-2ph8KiZ8Bn141hWuC3ErtpJ+Ui8p2MJQn8TJNRSRmLmnCIOCtHfiBM9R7WLRPeUG/q6hXyHOxWQ8DvRSX+ixvQ==",
|
||||
"license": "OFL-1.1",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ayuhito"
|
||||
}
|
||||
},
|
||||
"node_modules/@fontsource-variable/nunito": {
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@fontsource-variable/nunito/-/nunito-5.3.0.tgz",
|
||||
"integrity": "sha512-tw0ch7evIDSwoeUy+0XzocYHfbRWLeCRPJy22KgbrLjDLAbNw/fErBiil10Ssrs3Sjr55zaZrr36a975j8cBkQ==",
|
||||
"license": "OFL-1.1",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ayuhito"
|
||||
}
|
||||
},
|
||||
"node_modules/@fontsource-variable/nunito-sans": {
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@fontsource-variable/nunito-sans/-/nunito-sans-5.3.0.tgz",
|
||||
"integrity": "sha512-Vk1PSfckNDwgw2yGcsvJP3o/0zEW8Rp6KzbD8Ql/6iRHQshnhhAjt+cSIfAUyp5vQuSlleGHFW2LfYaaex0diw==",
|
||||
"license": "OFL-1.1",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ayuhito"
|
||||
}
|
||||
},
|
||||
"node_modules/@fontsource-variable/oswald": {
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@fontsource-variable/oswald/-/oswald-5.3.0.tgz",
|
||||
"integrity": "sha512-sSZzcTeaQGNyZbTVlS4tNNHElK38UktFLqKd6NQDLFCBV27320rQC3kXSZVytYm1PPjKmPxqVaGwqj7LEKUWQw==",
|
||||
"license": "OFL-1.1",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ayuhito"
|
||||
}
|
||||
},
|
||||
"node_modules/@fontsource-variable/outfit": {
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@fontsource-variable/outfit/-/outfit-5.3.0.tgz",
|
||||
"integrity": "sha512-fPb5XnYK0k7SbR++HEmm4+ZqDszmLKQ+sPRUr8oQ/KNC0vy6r6hazJFe8iYozv4cqlHbvJ/JECkJWrfDodUMVQ==",
|
||||
"license": "OFL-1.1",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ayuhito"
|
||||
}
|
||||
},
|
||||
"node_modules/@fontsource-variable/playfair-display": {
|
||||
"version": "5.3.0",
|
||||
"resolved": "https://registry.npmjs.org/@fontsource-variable/playfair-display/-/playfair-display-5.3.0.tgz",
|
||||
"integrity": "sha512-IHdzTvE8eGIXHteZql7KXoqdc3Gfm+Zs1u4XlSC3MeplkwviT3sx/P6gI0tLwg/xIYLF4ZJYveZ5V+bl9cnDwA==",
|
||||
"license": "OFL-1.1",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ayuhito"
|
||||
}
|
||||
},
|
||||
"node_modules/@fontsource-variable/source-sans-3": {
|
||||
"version": "5.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@fontsource-variable/source-sans-3/-/source-sans-3-5.3.1.tgz",
|
||||
"integrity": "sha512-u0p5Z/PM2e1uxYOMiodLM6NVzxHwULcB6Oi7QSr2WU/sdoLBFP/BeOZ3YYHeJ6rHsjPZA1nZweZVaV7sf2MAyQ==",
|
||||
"license": "OFL-1.1",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ayuhito"
|
||||
}
|
||||
},
|
||||
"node_modules/@humanfs/core": {
|
||||
"version": "0.19.2",
|
||||
"resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.2.tgz",
|
||||
@@ -21276,7 +21451,7 @@
|
||||
},
|
||||
"packages/contracts": {
|
||||
"name": "@crosscode/contracts",
|
||||
"version": "1.15.0",
|
||||
"version": "1.17.0",
|
||||
"license": "UNLICENSED",
|
||||
"dependencies": {
|
||||
"zod": "^4.6.7"
|
||||
@@ -21320,7 +21495,25 @@
|
||||
},
|
||||
"packages/ui": {
|
||||
"name": "@crosscode/ui",
|
||||
"version": "0.1.0",
|
||||
"version": "0.3.0",
|
||||
"dependencies": {
|
||||
"@fontsource-variable/dm-sans": "5.3.0",
|
||||
"@fontsource-variable/eb-garamond": "5.3.0",
|
||||
"@fontsource-variable/fraunces": "5.3.0",
|
||||
"@fontsource-variable/inter": "5.3.0",
|
||||
"@fontsource-variable/lora": "5.3.0",
|
||||
"@fontsource-variable/nunito": "5.3.0",
|
||||
"@fontsource-variable/nunito-sans": "5.3.0",
|
||||
"@fontsource-variable/oswald": "5.3.0",
|
||||
"@fontsource-variable/outfit": "5.3.0",
|
||||
"@fontsource-variable/playfair-display": "5.3.0",
|
||||
"@fontsource-variable/source-sans-3": "5.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@capsizecss/core": "4.1.3",
|
||||
"@capsizecss/metrics": "4.5.0",
|
||||
"@crosscode/contracts": "*"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=19"
|
||||
}
|
||||
|
||||
+4
-1
@@ -8,10 +8,13 @@
|
||||
"apps/*",
|
||||
"!apps/events",
|
||||
"!apps/accounts",
|
||||
"!apps/website",
|
||||
"apps/events/backend",
|
||||
"apps/events/frontend",
|
||||
"apps/accounts/backend",
|
||||
"apps/accounts/frontend"
|
||||
"apps/accounts/frontend",
|
||||
"apps/website/backend",
|
||||
"apps/website/frontend"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "npm run build --workspaces --if-present",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@crosscode/contracts",
|
||||
"version": "1.16.0",
|
||||
"version": "1.17.0",
|
||||
"description": "The shared JSON formats used by every Cross Code product: zod schemas, JSON Schema, TypeScript types and sample payloads",
|
||||
"license": "UNLICENSED",
|
||||
"type": "commonjs",
|
||||
|
||||
@@ -0,0 +1,171 @@
|
||||
{
|
||||
"schema": "crosscode.church-export/1",
|
||||
"exportedAt": "2026-12-10T12:00:00.000Z",
|
||||
"product": "website",
|
||||
"productVersion": "1.0.0",
|
||||
"church": {
|
||||
"name": "Grace Demo Church",
|
||||
"timezone": "Africa/Johannesburg"
|
||||
},
|
||||
"people": [
|
||||
{
|
||||
"ref": "p1",
|
||||
"name": "Thandi Example",
|
||||
"email": "thandi@example.org",
|
||||
"phone": null,
|
||||
"role": "editor",
|
||||
"createdAt": "2026-12-01T08:00:00.000Z",
|
||||
"consent": {
|
||||
"email": null,
|
||||
"whatsapp": null,
|
||||
"privacyNoticeAcceptedAt": null
|
||||
}
|
||||
}
|
||||
],
|
||||
"events": [],
|
||||
"registrations": [],
|
||||
"payments": [],
|
||||
"checkIns": [],
|
||||
"rosters": [],
|
||||
"settings": {
|
||||
"coming-soon.line": "Our new website is on its way"
|
||||
},
|
||||
"files": [
|
||||
{
|
||||
"path": "uploads/media/hero-sunday.jpg",
|
||||
"bytes": 482113
|
||||
},
|
||||
{
|
||||
"path": "uploads/media/carols.jpg",
|
||||
"bytes": 203877
|
||||
}
|
||||
],
|
||||
"website": {
|
||||
"template": "community",
|
||||
"firstPublishedAt": "2026-12-05T09:00:00.000Z",
|
||||
"style": {
|
||||
"sectionColour": "tinted",
|
||||
"spacing": "airy",
|
||||
"buttons": "pill",
|
||||
"imageTreatment": "natural",
|
||||
"header": "solid"
|
||||
},
|
||||
"pages": [
|
||||
{
|
||||
"ref": "g1",
|
||||
"title": "Home",
|
||||
"path": "/",
|
||||
"kind": "home",
|
||||
"inNavigation": true,
|
||||
"seo": {
|
||||
"title": null,
|
||||
"description": "A family church in Meyerton. Join us on Sundays at 09:00."
|
||||
},
|
||||
"sections": [
|
||||
{
|
||||
"type": "hero",
|
||||
"variant": "collage",
|
||||
"hidden": false,
|
||||
"content": {
|
||||
"headline": "You belong here",
|
||||
"images": [
|
||||
"uploads/media/hero-sunday.jpg"
|
||||
],
|
||||
"button": {
|
||||
"label": "Plan your visit",
|
||||
"href": "/visit"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "service-times",
|
||||
"variant": "panel",
|
||||
"hidden": false,
|
||||
"content": {}
|
||||
},
|
||||
{
|
||||
"type": "latest-message",
|
||||
"variant": "card",
|
||||
"hidden": true,
|
||||
"content": {}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"ref": "g2",
|
||||
"title": "Youth camp",
|
||||
"path": "/youth-camp",
|
||||
"kind": "custom",
|
||||
"inNavigation": false,
|
||||
"seo": {
|
||||
"title": "Youth camp 2027",
|
||||
"description": null
|
||||
},
|
||||
"sections": [
|
||||
{
|
||||
"type": "text",
|
||||
"variant": "text",
|
||||
"hidden": false,
|
||||
"content": {
|
||||
"heading": "Youth camp",
|
||||
"body": "Three days away for grades 8 to 12."
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"messages": [
|
||||
{
|
||||
"ref": "m1",
|
||||
"title": "Hope that holds",
|
||||
"date": "2026-12-07T07:00:00.000Z",
|
||||
"speaker": "Pastor Sam Example",
|
||||
"series": "Advent",
|
||||
"passage": "Romans 15:13",
|
||||
"notes": null,
|
||||
"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
|
||||
"source": "youtube-feed",
|
||||
"hidden": false
|
||||
}
|
||||
],
|
||||
"events": [
|
||||
{
|
||||
"ref": "w1",
|
||||
"title": "Carols by candlelight",
|
||||
"description": "Bring a blanket.",
|
||||
"startsAt": "2026-12-20T17:00:00.000Z",
|
||||
"endsAt": "2026-12-20T19:00:00.000Z",
|
||||
"location": "The church lawn",
|
||||
"link": null,
|
||||
"image": "uploads/media/carols.jpg",
|
||||
"published": true
|
||||
}
|
||||
],
|
||||
"versions": [
|
||||
{
|
||||
"number": 1,
|
||||
"publishedAt": "2026-12-05T09:00:00.000Z",
|
||||
"by": "Thandi Example",
|
||||
"note": "First version"
|
||||
},
|
||||
{
|
||||
"number": 2,
|
||||
"publishedAt": "2026-12-08T15:30:00.000Z",
|
||||
"by": "Thandi Example",
|
||||
"note": null
|
||||
}
|
||||
],
|
||||
"media": [
|
||||
{
|
||||
"path": "uploads/media/hero-sunday.jpg",
|
||||
"alt": "The congregation singing on a Sunday morning",
|
||||
"caption": null
|
||||
},
|
||||
{
|
||||
"path": "uploads/media/carols.jpg",
|
||||
"alt": "Candles on the church lawn",
|
||||
"caption": "Carols 2025"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
{
|
||||
"schema": "crosscode.identity-request/1",
|
||||
"church": {
|
||||
"schema": "crosscode.church/1",
|
||||
"customerId": "c7a1e2d3-4b5c-4d6e-8f70-81a2b3c4d5e6",
|
||||
"updatedAt": "2026-12-02T10:00:00.000Z",
|
||||
"name": "Hope Family Church",
|
||||
"shortName": "Hope Family",
|
||||
"timezone": "Africa/Johannesburg",
|
||||
"locale": "en-ZA",
|
||||
"branding": {
|
||||
"logoUrl": "https://www.hopefamily.co.za/uploads/logo.png",
|
||||
"iconUrl": "https://www.hopefamily.co.za/uploads/icon-512.png",
|
||||
"colours": {
|
||||
"primary": "#1f4e79",
|
||||
"accent": "#f2a900"
|
||||
},
|
||||
"style": {
|
||||
"fontPairing": "warm",
|
||||
"corners": "round"
|
||||
}
|
||||
},
|
||||
"campuses": [
|
||||
{
|
||||
"slug": "meyerton",
|
||||
"name": "Meyerton",
|
||||
"address": {
|
||||
"line1": "12 Church Street",
|
||||
"line2": null,
|
||||
"suburb": "Meyerton Central",
|
||||
"city": "Meyerton",
|
||||
"province": "Gauteng",
|
||||
"postalCode": "1961",
|
||||
"country": "ZA",
|
||||
"geo": {
|
||||
"lat": -26.5559,
|
||||
"lng": 28.0141
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"serviceTimes": [
|
||||
{
|
||||
"day": "sunday",
|
||||
"time": "09:00",
|
||||
"label": "Morning service",
|
||||
"campus": "meyerton",
|
||||
"note": "Kids church during the service"
|
||||
},
|
||||
{
|
||||
"day": "wednesday",
|
||||
"time": "18:30",
|
||||
"label": "Prayer evening",
|
||||
"campus": "meyerton",
|
||||
"note": null
|
||||
}
|
||||
],
|
||||
"contact": {
|
||||
"email": "office@hopefamily.co.za",
|
||||
"phone": "+27161234567",
|
||||
"whatsapp": "+27821234567",
|
||||
"address": null
|
||||
},
|
||||
"social": [
|
||||
{
|
||||
"network": "facebook",
|
||||
"url": "https://www.facebook.com/hopefamilychurch"
|
||||
},
|
||||
{
|
||||
"network": "youtube",
|
||||
"url": "https://www.youtube.com/@hopefamilychurch"
|
||||
}
|
||||
],
|
||||
"links": {
|
||||
"website": "https://www.hopefamily.co.za",
|
||||
"events": "https://events.hopefamily.co.za",
|
||||
"app": null,
|
||||
"accounts": "https://accounts.hopefamily.co.za"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"schema": "crosscode.identity-request/1",
|
||||
"actor": "6b2c3d4e-5f6a-4b7c-9d8e-0f1a2b3c4d5e",
|
||||
"requestId": "1f2e3d4c-5b6a-4978-8695-a4b3c2d1e0f9",
|
||||
"type": "church.update",
|
||||
"ifUpdatedAt": "2026-11-01T09:00:00.000Z",
|
||||
"church": {
|
||||
"branding": {
|
||||
"style": {
|
||||
"fontPairing": "warm",
|
||||
"corners": "round"
|
||||
}
|
||||
},
|
||||
"serviceTimes": [
|
||||
{
|
||||
"day": "sunday",
|
||||
"time": "09:00",
|
||||
"label": "Morning service",
|
||||
"campus": "meyerton",
|
||||
"note": "Kids church during the service"
|
||||
},
|
||||
{
|
||||
"day": "wednesday",
|
||||
"time": "18:30",
|
||||
"label": "Prayer evening",
|
||||
"campus": "meyerton",
|
||||
"note": null
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,8 @@
|
||||
"branding": {
|
||||
"logoUrl": "https://www.hopefamily.co.za/uploads/logo.png",
|
||||
"iconUrl": "https://www.hopefamily.co.za/uploads/icon-512.png",
|
||||
"colours": { "primary": "#1f4e79", "accent": "#f2a900" }
|
||||
"colours": { "primary": "#1f4e79", "accent": "#f2a900" },
|
||||
"style": { "fontPairing": "warm", "corners": "soft" }
|
||||
},
|
||||
"campuses": [
|
||||
{
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"v": 1,
|
||||
"licenceId": "5b6c7d8e-9f0a-4b1c-8d2e-3f4a5b6c7d8e",
|
||||
"installId": "6c7d8e9f-0a1b-4c2d-9e3f-4a5b6c7d8e9f",
|
||||
"customerId": "c7a1e2d3-4b5c-4d6e-8f70-81a2b3c4d5e6",
|
||||
"product": "website",
|
||||
"customer": "Hope Family Church",
|
||||
"plan": "website",
|
||||
"status": "active",
|
||||
"licenceExpiresAt": "2027-10-31T21:59:59.000Z",
|
||||
"graceDays": 14,
|
||||
"issuedAt": "2026-11-03T10:15:00.000Z",
|
||||
"validUntil": "2026-12-03T10:15:00.000Z",
|
||||
"limits": {
|
||||
"aiMonthlyCapCents": 0,
|
||||
"storageBytes": 10737418240
|
||||
}
|
||||
}
|
||||
@@ -656,6 +656,446 @@
|
||||
"bytes"
|
||||
]
|
||||
}
|
||||
},
|
||||
"website": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"template": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"heritage",
|
||||
"bold",
|
||||
"community",
|
||||
"clean"
|
||||
]
|
||||
},
|
||||
"firstPublishedAt": {
|
||||
"anyOf": [
|
||||
{
|
||||
"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))$"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"style": {
|
||||
"type": "object",
|
||||
"propertyNames": {
|
||||
"type": "string",
|
||||
"maxLength": 100
|
||||
},
|
||||
"additionalProperties": {
|
||||
"type": "string",
|
||||
"maxLength": 200
|
||||
}
|
||||
},
|
||||
"pages": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"ref": {
|
||||
"type": "string",
|
||||
"pattern": "^g[0-9]+$"
|
||||
},
|
||||
"title": {
|
||||
"type": "string",
|
||||
"maxLength": 300
|
||||
},
|
||||
"path": {
|
||||
"type": "string",
|
||||
"maxLength": 300,
|
||||
"pattern": "^\\/[a-z0-9/-]*$"
|
||||
},
|
||||
"kind": {
|
||||
"type": "string",
|
||||
"maxLength": 40
|
||||
},
|
||||
"inNavigation": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"seo": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"title": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"maxLength": 300
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"description": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"maxLength": 500
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"title",
|
||||
"description"
|
||||
]
|
||||
},
|
||||
"sections": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"type": {
|
||||
"type": "string",
|
||||
"maxLength": 60
|
||||
},
|
||||
"variant": {
|
||||
"type": "string",
|
||||
"maxLength": 60
|
||||
},
|
||||
"hidden": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"content": {
|
||||
"type": "object",
|
||||
"propertyNames": {
|
||||
"type": "string",
|
||||
"maxLength": 100
|
||||
},
|
||||
"additionalProperties": {
|
||||
"$ref": "#/$defs/__schema0"
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"type",
|
||||
"variant",
|
||||
"hidden",
|
||||
"content"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"ref",
|
||||
"title",
|
||||
"path",
|
||||
"kind",
|
||||
"inNavigation",
|
||||
"seo",
|
||||
"sections"
|
||||
]
|
||||
}
|
||||
},
|
||||
"messages": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"ref": {
|
||||
"type": "string",
|
||||
"pattern": "^m[0-9]+$"
|
||||
},
|
||||
"title": {
|
||||
"type": "string",
|
||||
"maxLength": 500
|
||||
},
|
||||
"date": {
|
||||
"anyOf": [
|
||||
{
|
||||
"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))$"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"speaker": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"maxLength": 300
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"series": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"maxLength": 300
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"passage": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"maxLength": 300
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"notes": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"maxLength": 20000
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"url": {
|
||||
"type": "string",
|
||||
"maxLength": 2048,
|
||||
"format": "uri"
|
||||
},
|
||||
"source": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"youtube-feed",
|
||||
"manual"
|
||||
]
|
||||
},
|
||||
"hidden": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"ref",
|
||||
"title",
|
||||
"date",
|
||||
"speaker",
|
||||
"series",
|
||||
"passage",
|
||||
"notes",
|
||||
"url",
|
||||
"source",
|
||||
"hidden"
|
||||
]
|
||||
}
|
||||
},
|
||||
"events": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"ref": {
|
||||
"type": "string",
|
||||
"pattern": "^w[0-9]+$"
|
||||
},
|
||||
"title": {
|
||||
"type": "string",
|
||||
"maxLength": 500
|
||||
},
|
||||
"description": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"maxLength": 20000
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"startsAt": {
|
||||
"anyOf": [
|
||||
{
|
||||
"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))$"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"endsAt": {
|
||||
"anyOf": [
|
||||
{
|
||||
"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))$"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"location": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"maxLength": 500
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"link": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"maxLength": 2048,
|
||||
"format": "uri"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"image": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"pattern": "^uploads\\/[A-Za-z0-9._/-]+$"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"published": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"ref",
|
||||
"title",
|
||||
"description",
|
||||
"startsAt",
|
||||
"endsAt",
|
||||
"location",
|
||||
"link",
|
||||
"image",
|
||||
"published"
|
||||
]
|
||||
}
|
||||
},
|
||||
"versions": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"number": {
|
||||
"type": "integer",
|
||||
"exclusiveMinimum": 0,
|
||||
"maximum": 9007199254740991
|
||||
},
|
||||
"publishedAt": {
|
||||
"anyOf": [
|
||||
{
|
||||
"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))$"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"by": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"maxLength": 300
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"note": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"maxLength": 1000
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"number",
|
||||
"publishedAt",
|
||||
"by",
|
||||
"note"
|
||||
]
|
||||
}
|
||||
},
|
||||
"media": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"path": {
|
||||
"type": "string",
|
||||
"pattern": "^uploads\\/[A-Za-z0-9._/-]+$"
|
||||
},
|
||||
"alt": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"maxLength": 500
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
},
|
||||
"caption": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string",
|
||||
"maxLength": 1000
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"path",
|
||||
"alt",
|
||||
"caption"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"template",
|
||||
"firstPublishedAt",
|
||||
"style",
|
||||
"pages",
|
||||
"messages",
|
||||
"events",
|
||||
"versions",
|
||||
"media"
|
||||
]
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
@@ -672,5 +1112,38 @@
|
||||
"rosters",
|
||||
"settings",
|
||||
"files"
|
||||
]
|
||||
],
|
||||
"$defs": {
|
||||
"__schema0": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "number"
|
||||
},
|
||||
{
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"type": "null"
|
||||
},
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/$defs/__schema0"
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"propertyNames": {
|
||||
"type": "string"
|
||||
},
|
||||
"additionalProperties": {
|
||||
"$ref": "#/$defs/__schema0"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user