Redesign admin peering settings and catalogs
This commit is contained in:
1 parent
492477f86a
commit
da40d73f02
16 files changed
+1037
-85
No files matched your search
@@ -67,6 +67,7 @@ test('mTLS pairing, opt-in catalog, peer queue publication, and revocation', { t
|
||||
const chapterDir = path.join(mangaDir, 'v01', 'c0001 [Local]');
|
||||
await fsp.mkdir(chapterDir, { recursive: true });
|
||||
await fsp.writeFile(path.join(mangaDir, 'manga.json'), JSON.stringify({ title: 'Sample Manga', direction: 'ltr' }));
|
||||
await fsp.writeFile(path.join(mangaDir, 'cover.png'), PNG);
|
||||
await fsp.writeFile(path.join(chapterDir, 'chapter.json'), JSON.stringify({ title: 'The first chapter', source: { name: 'Local' } }));
|
||||
await fsp.writeFile(path.join(chapterDir, '0001.png'), PNG);
|
||||
const ga = await gateway(dataA, libA, portA, path.join(root, 'usage-a.json'));
|
||||
@@ -88,9 +89,14 @@ test('mTLS pairing, opt-in catalog, peer queue publication, and revocation', { t
|
||||
const listing = await client.catalog(b, inB.id);
|
||||
assert.equal(listing.length, 1);
|
||||
assert.equal(listing[0].title, 'Sample Manga');
|
||||
assert.equal(listing[0].coverAvailable, true);
|
||||
assert.deepEqual(listing[0].tags, []);
|
||||
assert.equal(JSON.stringify(listing).includes('Sample Manga\\v01'), false);
|
||||
const remote = await client.manga(b, inB.id, listing[0].id);
|
||||
assert.equal(remote.chapters.length, 1);
|
||||
const cover = await client.cover(b, inB.id, listing[0].id);
|
||||
assert.equal(cover.mime, 'image/png');
|
||||
assert.deepEqual(cover.buffer, PNG, 'Catalog-only grants may browse approved covers');
|
||||
const remoteAccess = await client.access(b, inB.id);
|
||||
assert.equal(remoteAccess.grant.status, 'active');
|
||||
assert.deepEqual(remoteAccess.grant.scopes, ['catalog']);
|
||||
@@ -103,6 +109,8 @@ test('mTLS pairing, opt-in catalog, peer queue publication, and revocation', { t
|
||||
/Peer HTTP 403: Grant does not allow download/);
|
||||
a.updatePeer(inA.id, { grantScopes: ['catalog', 'download'] });
|
||||
assert.deepEqual((await client.access(b, inB.id)).grant.scopes, ['catalog', 'download'], 'Permission edits apply without exchanging a new token');
|
||||
a.updatePeer(inA.id, { grantScopes: ['download'] });
|
||||
assert.deepEqual((await client.access(b, inB.id)).grant.scopes, ['catalog', 'download'], 'Download always implies catalog in canonical order');
|
||||
await assert.rejects(() => client.jsonRequest(b, inB.id, '/peer/v1/manga/m000000000000000000000000'), /Peer HTTP 404/);
|
||||
await assert.rejects(() => client.jsonRequest(b, inB.id, '/peer/v1/catalog', { headers: { authorization: 'Bearer ' + 'x'.repeat(43) } }), /Peer HTTP 401/);
|
||||
const noCert = await new Promise((resolve, reject) => https.get({ hostname: '127.0.0.1', port: portA,
|
||||
|
||||
Reference in new issue
Block a user