[relay] Attribution: GET /about serves the CPAL credit and the source URL (Ludus G9.130)

This commit is contained in:
Marek Novák
2026-11-24 07:37:11 +01:00
parent 6190a564c7
commit 3256adece3
7 changed files with 109 additions and 7 deletions
+33
View File
@@ -80,6 +80,39 @@ describe('GET /health', () => {
});
});
describe('GET /about', () => {
it('serves the CPAL Exhibit B credit and where the source is, on /about and on /', async () => {
for (const path of ['/about', '/']) {
const res = await fetch(url(path));
expect(res.status, path).toBe(200);
expect(await res.json(), path).toEqual({
ok: true,
name: 'LudusPublic league relay',
builtOn: 'Built on Domi',
attributionUrl: 'https://aula.marek-novak.cz',
copyright: 'Copyright (c) 2026 Marek Novák',
licence: 'CPAL-1.0',
source: 'https://gitea.marek-novak.cz/mnovak/LudusPublic'
});
}
});
it('names the source a self-hoster configured, because a modified relay owes its own', async () => {
const own = await startRelay({
store,
config: relayConfig({ sourceUrl: 'https://example.invalid/my-relay' }),
now: () => clock
});
try {
const body = await (await fetch(`http://127.0.0.1:${own.port}/about`)).json();
expect(body.source).toBe('https://example.invalid/my-relay');
expect(body.builtOn).toBe('Built on Domi');
} finally {
await own.close();
}
});
});
describe('POST /submit', () => {
it('accepts a signed submission and reports what was stored', async () => {
const { status, json } = await post('/submit', signedSubmission(keyFor(1)));