Compare commits

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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 16:18:46 +02:00
joshua 53e5de3f14 Merge branch 'feat/website-settings-seo' 2026-11-25 15:30:29 +02:00
18 changed files with 288 additions and 18 deletions
+10
View File
@@ -2,6 +2,16 @@
Each package and app has its own section and its own tags (`contracts@1.0.0`, `accounts@1.0.0`, …).
## contracts@1.18.0 - 2026-11-25
"Get more storage" for the Church Website (WEBSITE-1.0-PLAN §10, decision 12), with Hub 2.22.0.
Additive: products on 1.17.0 keep working.
- **`hub.storageRequestSchema` / `storageRequestResponseSchema`**: a Website asks the Hub for more
5 GB steps (`POST /api/installs/storage-request`, signed as the heartbeat), with what it uses,
its limit and who asked. `hub.STORAGE_STEP_BYTES`. New sample `hub-storage-request.json` and
JSON Schemas `hub-storage-request`, `hub-storage-request-response`.
## events@3.7.0 + @crosscode/ui 0.3.0 - 2026-11-24
Cross Events' public pages use the church's brand style and the shared footer (WEBSITE-1.0-PLAN §9).
+4
View File
@@ -96,6 +96,10 @@
church's own content: each template can be previewed on the real site before it's chosen.
- A simple event with an outside link still has its own page here, with a "More information"
button (its address in the event feed).
- **Get more storage** (§10, decision 12; contracts 1.18.0, Hub 2.22.0): an Owner or Admin asks
under Media library (5 GB steps); the request goes to the Hub, which emails Cross Code, and the
new limit arrives with a heartbeat. The heartbeat now reports the licence's storage limit, so the
Hub emails the church at 80% and when it's full.
- The admin page signs people in and out; `/auth/problem` explains a refused sign-in.
- **The church's export** (`scripts/export-church.ts`): `export.json` in
`crosscode.church-export/1` with its `website` part, for `crosscode export` and uninstall.
+29 -2
View File
@@ -17,6 +17,7 @@ import { defaultUploadDir } from '../demo/demoChurch.js';
import { INCLUDED_STORAGE_BYTES } from '../hub/client.js';
import { hubPublicKey, verifyToken } from '../hub/licence.js';
import { ApiError } from '../http.js';
import { audit } from '../lib/audit.js';
import { mediaUrl } from '../site/snapshot.js';
export const MAX_UPLOAD_BYTES = 15 * 1024 * 1024;
@@ -82,7 +83,7 @@ export async function upload(ctx: Ctx, body: Buffer, alt: string, by: string) {
if (!kind) throw new ApiError(415, 'NOT_AN_IMAGE', 'Upload a photo as JPEG, PNG or WebP.');
const s = await storage(ctx);
if (s.usedBytes + body.length > s.limitBytes) {
throw new ApiError(409, 'STORAGE_FULL', 'Your website\'s storage is full, so uploads have stopped. To get more (5 GB at a time), contact Cross Code; everything already uploaded keeps showing.');
throw new ApiError(409, 'STORAGE_FULL', 'Your website\'s storage is full, so uploads have stopped. An Owner or Admin can get more under Media library; everything already uploaded keeps showing.');
}
const now = ctx.now();
const base = `${now.getUTCFullYear()}/${String(now.getUTCMonth() + 1).padStart(2, '0')}/${crypto.randomUUID()}`;
@@ -92,7 +93,7 @@ export async function upload(ctx: Ctx, body: Buffer, alt: string, by: string) {
const bytes = made.files.reduce((t, f) => t + f.bytes, 0);
if (s.usedBytes + bytes > s.limitBytes) {
await Promise.all(made.files.map((f) => fs.rm(path.join(dir, path.dirname(base), f.name), { force: true })));
throw new ApiError(409, 'STORAGE_FULL', 'That photo doesn\'t fit in the storage that\'s left, so it wasn\'t added. To get more (5 GB at a time), contact Cross Code.');
throw new ApiError(409, 'STORAGE_FULL', 'That photo doesn\'t fit in the storage that\'s left, so it wasn\'t added. An Owner or Admin can get more under Media library.');
}
const filename = `${base}.${made.main.ext}`;
const row = await ctx.db.mediaAsset.create({
@@ -145,3 +146,29 @@ export async function processImage(body: Buffer, kind: Kind, basePath: string) {
}
return { main, width, height, sizes, files };
}
type StorageAsk = { at: string; steps: number; limitAtRequest: number };
/** The open "Get more storage" request, if any: open until the limit goes up. */
export async function storageRequestStatus(ctx: Ctx, limitBytes: number): Promise<StorageAsk | null> {
const ask = await ctx.settings.json<StorageAsk | null>('storage_request', null);
return ask && limitBytes <= ask.limitAtRequest ? ask : null;
}
/** "Get more storage": asks the Hub (Cross Code adds it to the licence and is paid R20 a month per step). */
export async function requestMoreStorage(ctx: Ctx, steps: number, by: { id: string; role: string }) {
if (!Number.isInteger(steps) || steps < 1 || steps > 10) throw new ApiError(400, 'VALIDATION', 'Ask for 1 to 10 steps of 5 GB.', { steps: '1 to 10' });
const s = await storage(ctx);
const user = await ctx.db.websiteUser.findUnique({ where: { id: by.id } });
const { requestStorage } = await import('../hub/client.js');
let reply;
try {
reply = await requestStorage(ctx, steps, user?.name ?? null, { usedBytes: s.usedBytes, limitBytes: s.limitBytes });
} catch (e) {
const err = e as { message?: string; code?: string; status?: number };
throw new ApiError(err.status && err.status < 500 ? err.status : 502, err.code ?? 'HUB_ERROR', err.message ?? 'The Hub could not take the request. Try again later.');
}
await ctx.settings.set('storage_request', JSON.stringify({ at: reply.requestedAt, steps: reply.steps, limitAtRequest: s.limitBytes } satisfies StorageAsk));
await audit(ctx, { actorId: by.id, actorRole: by.role, action: 'storage_requested', targetType: 'storage', targetId: null, metadata: { steps } });
return { ...reply, request: await storageRequestStatus(ctx, s.limitBytes) };
}
+5 -2
View File
@@ -22,7 +22,7 @@ import { syncYoutube } from '../site/youtube.js';
import { publishOn, syncLink } from '../feed/feed.js';
import { connectTo, disconnectFrom } from '../links/connect.js';
import { linkedProducts } from '../links/store.js';
import { MAX_UPLOAD_BYTES, storage, upload } from './media.js';
import { MAX_UPLOAD_BYTES, requestMoreStorage, storage, storageRequestStatus, upload } from './media.js';
import { createPreviewLink, listPreviewLinks, revokePreviewLink } from './previewLinks.js';
const who = (req: Request) => ({ id: req.signed!.user.id, role: req.signed!.user.role });
@@ -96,10 +96,13 @@ export function adminRouter(ctx: Ctx) {
// ─── Media library and storage ───
r.get('/media', handle(async () => {
const rows = await ctx.db.mediaAsset.findMany({ orderBy: { createdAt: 'desc' } });
return { storage: await storage(ctx), items: rows.map((m) => ({ id: m.id, url: mediaUrl(m.filename), alt: m.alt, width: m.width, height: m.height, bytes: m.bytes })) };
const s = await storage(ctx);
return { storage: s, request: await storageRequestStatus(ctx, s.limitBytes), items: rows.map((m) => ({ id: m.id, url: mediaUrl(m.filename), alt: m.alt, width: m.width, height: m.height, bytes: m.bytes })) };
}));
r.post('/media', editor, express.raw({ type: () => true, limit: MAX_UPLOAD_BYTES + 1 }), handle((req) =>
upload(ctx, Buffer.isBuffer(req.body) ? req.body : Buffer.alloc(0), String(req.query.alt ?? ''), who(req).id)));
// Get more storage: it costs the church, so an Owner or Admin asks (decision 12).
r.post('/storage-request', requireRole(ctx, 'admin'), json, handle((req) => requestMoreStorage(ctx, Number(req.body?.steps ?? 1), who(req))));
r.put('/media/:id', editor, json, handle(async (req) => {
const alt = String(req.body?.alt ?? '').trim().slice(0, 500);
const m = await ctx.db.mediaAsset.update({ where: { id: param(req, 'id') }, data: { alt } }).catch(() => null);
+20 -2
View File
@@ -14,6 +14,7 @@ import { appVersion } from '../lib/version.js';
import { connectAccountsIfListed } from '../links/connect.js';
import { keyPair, saveLinkedProducts } from '../links/store.js';
import { hubPublicKey, verifyToken } from './licence.js';
import { storage } from '../admin/media.js';
export const PROTOCOL_VERSION = 2;
const TIMEOUT_MS = 15000;
@@ -81,7 +82,7 @@ export async function stats(ctx: Ctx) {
ctx.db.simpleEvent.count({ where: { startsAt: { gte: now }, publishedAt: { not: null } } }),
ctx.db.importedEvent.count({ where: { startsAt: { gte: now } } }),
ctx.db.websiteUser.count({ where: { role: { not: 'viewer' } } }),
ctx.db.mediaAsset.aggregate({ _sum: { bytes: true } }),
storage(ctx),
]);
return {
// Until pages are published one by one, "published" is whether the site has been (0 or 1+ versions).
@@ -89,7 +90,9 @@ export async function stats(ctx: Ctx) {
messages: { total, last30d },
events: { upcomingSimple, imported },
editors,
storage: { usedBytes: media._sum.bytes ?? 0, includedBytes: INCLUDED_STORAGE_BYTES },
// The limit the licence gives (5 GB plus steps bought): the Hub emails the church's admin at
// 80% and 100% (decision 12).
storage: { usedBytes: media.usedBytes, includedBytes: media.limitBytes },
};
}
@@ -196,3 +199,18 @@ export function startHeartbeats(ctx: Ctx): () => void {
timer.unref?.();
return () => clearInterval(timer);
}
/**
* "Get more storage" (WEBSITE-1.0-PLAN §10, decision 12; contracts 1.18.0): asks the Hub for more
* 5 GB steps. The Hub emails Cross Code; the new limit arrives with a later heartbeat answer.
*/
export async function requestStorage(ctx: Ctx, steps: number, requestedBy: string | null, now: { usedBytes: number; limitBytes: number }) {
const installId = await ctx.settings.get('hub_install_id');
const secret = await ctx.settings.get('hub_install_secret');
if (!installId || !secret) throw new HubError('This site isn\'t connected to the Hub yet, so it can\'t ask for more storage.', 'NOT_CONNECTED', 503);
const body = hub.storageRequestSchema.parse({ protocolVersion: PROTOCOL_VERSION, steps, usedBytes: now.usedBytes, limitBytes: now.limitBytes, requestedBy });
const data = await post(ctx, '/api/installs/storage-request', body, { installId, secret });
const reply = hub.storageRequestResponseSchema.safeParse(data);
if (!reply.success) throw new HubError('The Hub answered in a way this site doesn\'t understand.', 'BAD_REPLY', 502);
return reply.data;
}
@@ -0,0 +1,74 @@
import { after, describe, it } from 'node:test';
import assert from 'node:assert/strict';
import crypto from 'node:crypto';
import http from 'node:http';
import type { AddressInfo } from 'node:net';
import express from 'express';
import request from 'supertest';
import { hub } from '@crosscode/contracts';
import { hashToken } from '../src/lib/crypto.js';
import { stats } from '../src/hub/client.js';
import { harness, SITE } from './support/harness.js';
const SECRET = 'install-secret-0123456789abcdef0123456789';
const closers: (() => Promise<unknown>)[] = [];
after(async () => { for (const c of closers) await c(); });
/** The Hub: checks the install's signature as installApi.js does, and records what it's asked. */
async function fakeHub() {
const asked: { installId: string; body: unknown }[] = [];
const app = express();
app.post('/api/installs/storage-request', express.text({ type: () => true }), (req, res) => {
const ts = String(req.get('X-Hub-Timestamp'));
const expected = crypto.createHmac('sha256', SECRET).update(`${ts}.${req.body}`).digest('hex');
if (req.get('X-Hub-Signature') !== expected) return res.status(401).json({ code: 'BAD_SIGNATURE', message: 'no' });
const body = JSON.parse(req.body);
if (!hub.storageRequestSchema.safeParse(body).success) return res.status(400).json({ code: 'INVALID_REQUEST', message: 'no' });
asked.push({ installId: String(req.get('X-Hub-Install')), body });
return res.status(201).json({ requestedAt: new Date().toISOString(), steps: body.steps, alreadyRequested: asked.length > 1 });
});
const server = http.createServer(app);
await new Promise<void>((r) => server.listen(0, '127.0.0.1', () => r()));
closers.push(() => new Promise((r) => server.close(r)));
return { url: `http://127.0.0.1:${(server.address() as AddressInfo).port}`, asked };
}
async function site(role: 'owner' | 'editor') {
const fake = await fakeHub();
const h = await harness({ env: { HUB_URL: fake.url } });
await h.ctx.settings.set('hub_install_secret', SECRET);
const id = '00000000-0000-4000-8000-000000000001';
await h.db.websiteUser.create({ data: { id, name: 'Pastor Sam', email: 'sam@hope.test', role } });
await h.db.session.create({ data: { tokenHash: hashToken('t'), userId: id, expiresAt: new Date(Date.now() + 864e5) } });
const go = (m: 'get' | 'post', p: string, b?: object) => {
const r = request(h.app)[m](`/api/v1/admin${p}`).set('Cookie', 'ccw_session=t').set('Origin', SITE);
return b ? r.send(b) : r;
};
return { ...h, fake, go };
}
describe('Get more storage (decision 12)', () => {
it('asks the Hub, signed, with who asked and what is used; shows the request open until the limit goes up', async () => {
const { go, fake, db } = await site('owner');
await db.mediaAsset.create({ data: { filename: 'a.jpg', mime: 'image/jpeg', bytes: 4_500_000_000 } });
const r = await go('post', '/storage-request', { steps: 2 });
assert.equal(r.status, 200);
assert.equal(fake.asked.length, 1);
assert.deepEqual(fake.asked[0]!.body, { protocolVersion: 2, steps: 2, usedBytes: 4_500_000_000, limitBytes: 5 * 1024 ** 3, requestedBy: 'Pastor Sam' });
const media = (await go('get', '/media')).body;
assert.equal(media.request.steps, 2);
assert.equal((await go('post', '/storage-request', { steps: 11 })).status, 400);
});
it('is an Owner\'s or Admin\'s to ask (it costs the church)', async () => {
const { go } = await site('editor');
assert.equal((await go('post', '/storage-request', { steps: 1 })).status, 403);
});
it('reports the licence\'s limit in the heartbeat, so the Hub can email at 80% and 100%', async () => {
const { ctx } = await site('owner');
const s = await stats(ctx);
assert.equal(s.storage.includedBytes, 5 * 1024 ** 3);
assert.ok(hub.websiteStatsSchema.safeParse(s).success);
});
});
+1 -1
View File
@@ -82,7 +82,7 @@ export function ImagePicker({ value, onChange, label }: { value: string | null;
</div>
<div className="mt-6 border-t border-gray-200 pt-4">
<h3 className="mb-2 font-semibold">Upload a new one</h3>
{data?.storage.full && <Notice tone="warning">Your storage is full, so uploads have stopped. To get more (5 GB at a time), contact Cross Code.</Notice>}
{data?.storage.full && <Notice tone="warning">Your storage is full, so uploads have stopped. An Owner or Admin can get more under Media library.</Notice>}
<Uploader disabled={data?.storage.full} onUploaded={(m) => { reload(); onChange(m.id); setOpen(false); }} />
</div>
</div>
@@ -3,14 +3,17 @@
import { useState } from "react";
import { api } from "@/admin/api";
import { gb, StorageMeter, Uploader, type MediaItem, type Storage } from "@/admin/media";
import { Btn, inputClass, Loading, Notice, Panel, Title, useAction, useAdmin } from "@/admin/ui";
import { Btn, inputClass, Loading, Notice, Panel, Title, useAction, useAdmin, when } from "@/admin/ui";
/** The media library (§10): uploads, what each photo shows (alt text), and storage used. */
export default function Media() {
const { data, error, reload } = useAdmin<{ storage: Storage; items: MediaItem[] }>("/media");
const { data, error, reload } = useAdmin<{ storage: Storage; request: { at: string; steps: number } | null; items: MediaItem[] }>("/media");
const me = useAdmin<{ user: { role: string } }>("/me");
const [alts, setAlts] = useState<Record<string, string>>({});
const [steps, setSteps] = useState(1);
const { busy, message, run } = useAction();
if (!data) return <Loading error={error} />;
const manager = ["owner", "admin"].includes(me.data?.user.role ?? "");
const s = data.storage;
return (
<>
@@ -38,7 +41,22 @@ export default function Media() {
<div className="space-y-6">
<Panel title="Storage">
<StorageMeter s={s} />
{s.percent >= 80 && <div className="mt-3"><Notice tone={s.full ? "error" : "warning"}>{s.full ? "Storage is full: uploads have stopped until more storage is added." : "Storage is nearly full."} More comes in 5 GB steps (R20 a month each): contact Cross Code.</Notice></div>}
{s.percent >= 80 && <div className="mt-3"><Notice tone={s.full ? "error" : "warning"}>{s.full ? "Storage is full: uploads have stopped until more storage is added." : "Storage is nearly full."} Everything already uploaded keeps showing.</Notice></div>}
<div className="mt-4 border-t border-gray-200 pt-4">
<h3 className="font-semibold">Get more storage</h3>
<p className="mt-1 text-sm text-gray-600">In steps of 5 GB, R20 a month each, added to your church&apos;s account.</p>
{data.request ? (
<div className="mt-3"><Notice tone="info">You asked for {data.request.steps * 5} GB more on {when(data.request.at)}. Cross Code adds it to your account; uploads work again within a minute of that.</Notice></div>
) : manager ? (
<div className="mt-3 flex flex-wrap items-center gap-2">
<label className="text-sm" htmlFor="steps">Add</label>
<select id="steps" className={`${inputClass} w-28`} value={steps} onChange={(e) => setSteps(Number(e.target.value))}>
{[1, 2, 3, 4].map((n) => <option key={n} value={n}>{n * 5} GB</option>)}
</select>
<Btn kind="primary" busy={busy} onClick={() => run(async () => { await api("/storage-request", { body: { steps } }); await reload(); }, "Asked: Cross Code will add it.")}>Ask for it</Btn>
</div>
) : <p className="mt-2 text-sm text-gray-600">Your website&apos;s Owner or an Admin can ask for it.</p>}
</div>
</Panel>
<Panel title="Upload a photo">
{s.full ? <Notice tone="warning">Uploads have stopped: your storage is full.</Notice> : <Uploader onUploaded={() => reload()} />}
+2 -2
View File
@@ -34,7 +34,7 @@ every release).
| 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.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 |
| 5 | Church Website 1.0.0 | **Being built** (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). `contracts@1.18.0` and Hub `v2.22.0` (Get more storage) released 2026-11-25, not deployed. `apps/website` being built (0.1.0); `website@1.0.0` next |
| 6–7 | App 1.0.0 → App 1.x | Not started |
## Released 2026-11-23
@@ -102,7 +102,7 @@ out").
[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`** (being built in `apps/website` since 2026-11-25: signing in, the four templates and public site, the admin with preview, publish and restore, people and roles, messages with the YouTube feed, simple events, responsive photo sizes without metadata, the event feed both ways, church details through Accounts, settings, audit log, search engine data and redirects; next: Get more storage, Lighthouse, the VM test) → Hope Family Church → a second
and deployed 2026-11-25; the plan said 2.13.0) → **`website@1.0.0`** (being built in `apps/website` since 2026-11-25: signing in, the four templates and public site, the admin with preview, publish and restore, people and roles, messages with the YouTube feed, simple events, responsive photo sizes without metadata, the event feed both ways, church details through Accounts, settings, audit log, search engine data and redirects, Get more storage (with `contracts@1.18.0` and Hub `v2.22.0`, released 2026-11-25, Hub not deployed); next: screenshot comparison, Lighthouse, axe on every variant, a real-Postgres run, the release checks and the VM test) → 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/`.
+11 -5
View File
@@ -1,6 +1,6 @@
# Versions — the latest release of everything
Last updated: 2026-11-24. Taken from the git tags, which is what a release is here (branch → merge →
Last updated: 2026-11-25. 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
@@ -13,8 +13,8 @@ separately below; the two often differ.
| 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.17.0** | `contracts@1.17.0` | 2026-11-24 |
| Cross Code Hub | `events-hub` | **2.21.0** | `v2.21.0` | 2026-11-25 |
| Contracts | `crosscode-platform` (`packages/contracts`) | **1.18.0** | `contracts@1.18.0` | 2026-11-25 |
| Cross Code Hub | `events-hub` | **2.22.0** | `v2.22.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) |
@@ -29,7 +29,7 @@ on each run, so merging to `main` and pushing releases it. Its changes are liste
| `@crosscode/auth-client` | `packages/auth-client` | 1.1.0 (released with Events 3.0.0 and Accounts 1.1.0) |
| `@crosscode/seo` | `packages/seo` | 1.0.0 (released with Events 2.4.0) |
| `@crosscode/ui` | `packages/ui` | 0.3.0 (fonts, `ChurchFooter`; 0.2.0 with Accounts 1.7.0, 0.3.0 with Events 3.7.0) |
| Website | `apps/website` | 0.1.0 (phase 5, being built: skeleton 2026-11-25; backend and frontend workspaces) |
| Website | `apps/website` | 0.1.0 (phase 5, being built; `website@1.0.0` after the Lighthouse, real-Postgres and VM runs. Built so far: signing in through Accounts, the four templates and public site, the admin with drafts, preview, publish and restore, people and roles, messages with the YouTube feed, simple events, the event feed both ways, church details, settings, audit log, search engine data, Get more storage; HANDOVER "Next up") |
| 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,12 +37,18 @@ need their own tags until something outside this repo depends on them.
## What each latest release was for
- **Contracts 1.18.0 + Hub 2.22.0 (2026-11-25):** "Get more storage" for the Church Website (WEBSITE-1.0-PLAN
§10, decision 12). Contracts: `hub.storageRequestSchema` and its reply. Hub: `POST
/api/installs/storage-request` (shown on the install, Joshua emailed once, closed when the licence
gets more extra storage steps), and the church emailed once at 80% and once when full, from the
Website's heartbeat. The Hub vendors contracts 1.18.0. No migration. **Not deployed yet** (the Hub
still runs 2.21.0 below); nothing uses it until the Website is installed.
- **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.**
with the Website (contracts 1.18.0, Hub 2.22.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
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@crosscode/contracts",
"version": "1.17.0",
"version": "1.18.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,7 @@
{
"protocolVersion": 2,
"steps": 1,
"usedBytes": 5100000000,
"limitBytes": 5368709120,
"requestedBy": "Pastor Sam"
}
@@ -0,0 +1,25 @@
{
"$id": "https://c-git.crosscode.co.za/joshua/crosscode-platform/raw/branch/main/packages/contracts/schemas/hub-storage-request-response.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"requestedAt": {
"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))$"
},
"steps": {
"type": "integer",
"minimum": 1,
"maximum": 10
},
"alreadyRequested": {
"type": "boolean"
}
},
"required": [
"requestedAt",
"steps",
"alreadyRequested"
]
}
@@ -0,0 +1,44 @@
{
"$id": "https://c-git.crosscode.co.za/joshua/crosscode-platform/raw/branch/main/packages/contracts/schemas/hub-storage-request.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"protocolVersion": {
"type": "number",
"const": 2
},
"steps": {
"type": "integer",
"minimum": 1,
"maximum": 10
},
"usedBytes": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"limitBytes": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"requestedBy": {
"anyOf": [
{
"type": "string",
"maxLength": 200
},
{
"type": "null"
}
]
}
},
"required": [
"protocolVersion",
"steps",
"usedBytes",
"limitBytes",
"requestedBy"
]
}
@@ -35,6 +35,8 @@ function contracts(c) {
"hub-update-request-response": c.hub.updateRequestResponseSchema,
"hub-update-request-cancel": c.hub.updateRequestCancelSchema,
"hub-update-request-cancel-response": c.hub.updateRequestCancelResponseSchema,
"hub-storage-request": c.hub.storageRequestSchema,
"hub-storage-request-response": c.hub.storageRequestResponseSchema,
"hub-ai-status-request": c.hub.aiStatusRequestSchema,
"hub-ai-status": c.hub.aiStatusSchema,
"hub-ai-complete-request": c.hub.aiCompleteRequestSchema,
+30
View File
@@ -294,6 +294,36 @@ export const updateRequestResponseSchema = z.object({
export const updateRequestCancelSchema = z.object({ protocolVersion });
export const updateRequestCancelResponseSchema = z.object({ cancelled: z.boolean() });
// ---------------------------------------------------------------------------------------------
// More storage (contracts 1.18.0, WEBSITE-1.0-PLAN §10, decision 12): a Website's admin presses
// "Get more storage". `POST /api/installs/storage-request`, signed as the heartbeat. The Hub records
// it and emails Joshua; he adds the steps to the licence, and the new limit reaches the site with
// the next heartbeat answer (`limits.storageBytes`). Asking again while a request is open changes
// its number of steps; nobody is emailed twice for the same request.
// ---------------------------------------------------------------------------------------------
/** One step is 5 GB (ROADMAP-v3 §10: R20 a month each). */
export const STORAGE_STEP_BYTES = 5 * 1024 ** 3;
export const storageRequestSchema = z.object({
protocolVersion,
/** How many 5 GB steps to add. */
steps: z.int().min(1).max(10),
/** What the site uses and may use now, for the email. */
usedBytes: z.int().nonnegative(),
limitBytes: z.int().nonnegative(),
/** Who asked (their name in the Website's admin), for the email. */
requestedBy: z.string().trim().max(200).nullable(),
});
export type StorageRequest = z.infer<typeof storageRequestSchema>;
export const storageRequestResponseSchema = z.object({
requestedAt: dateTimeSchema,
steps: z.int().min(1).max(10),
alreadyRequested: z.boolean(),
});
export type StorageRequestResponse = z.infer<typeof storageRequestResponseSchema>;
// ---------------------------------------------------------------------------------------------
// AI (as v1; usage is recorded per product on the Hub, the cap stays per customer)
// ---------------------------------------------------------------------------------------------
@@ -34,6 +34,7 @@ const SAMPLE_SCHEMA: Record<string, string> = {
"hub-heartbeat-app.json": "hub-heartbeat-request",
"hub-heartbeat-accounts.json": "hub-heartbeat-request",
"hub-heartbeat-response.json": "hub-heartbeat-response",
"hub-storage-request.json": "hub-storage-request",
"hub-licence-payload.json": "hub-licence-payload",
"hub-licence-payload-website.json": "hub-licence-payload",
"church-export.json": "church-export",
+1
View File
@@ -40,6 +40,7 @@ const SCHEMAS: Record<string, z.ZodType> = {
"hub-register-response.json": hub.registerResponseSchema,
"hub-heartbeat-events.json": hub.heartbeatRequestSchema,
"hub-heartbeat-website.json": hub.heartbeatRequestSchema,
"hub-storage-request.json": hub.storageRequestSchema,
"hub-heartbeat-app.json": hub.heartbeatRequestSchema,
"hub-heartbeat-accounts.json": hub.heartbeatRequestSchema,
"hub-heartbeat-response.json": hub.heartbeatResponseSchema,