openvibers/openvibe.mediahub Commits

/.well-known/agent.json on openvibe.pics (SEO-2) (#276)

OP OpenVibers committed 10 days ago · 137ba22dfe · 3 files, +22 −0

It answered 404. The Pics host serves its own manifest (server/pics/agent-descriptor.js):
its purpose from its llms.txt, the OpenAPI document the host already serves, its auth.

Changes

ddiff --git a/server/pics/agent-descriptor.js b/server/pics/agent-descriptor.js
nnew file mode 100644
iindex 0000000..a917793
---- /dev/null
++++ b/server/pics/agent-descriptor.js
@@@ -0,0 +1,14 @@
++'use strict';
++// What openvibe.pics tells an agent about itself (openvibe-shared/agent-layer): /.well-known/agent.json (SEO-2).
++// Every field is something the Pics host really serves; the purpose is its own llms.txt summary.
++module.exports = {
++ id: 'pics',
++ name: 'OpenVibe.Pics',
++ purpose: 'Picture hosting on the OpenVibe network: upload a picture, get a link to share or embed, albums, any size or format. Pictures are unlisted and re-encoded with their metadata removed.',
++ home: 'https://openvibe.pics',
++ site: 'openvibe.pics',
++ openapi: '/openapi.json',
++ policy: {
++ auth: ['none', 'Network OIDC'],
++ },
++};
ddiff --git a/server/pics/pages.js b/server/pics/pages.js
iindex d4e9494..344197f 100644
---- a/server/pics/pages.js
++++ b/server/pics/pages.js
@@@ -637,6 +637,9 @@ ${row.state === 'hidden' ? html`<button class="ovp-btn" name="action" value="res
] },
],
});
++ // /.well-known/agent.json on the Pics host (SEO-2): its own manifest, not the drive's or the video host's.
++ r.get('/.well-known/agent.json', (_req, res) => res.type('application/json').set('Cache-Control', 'public, max-age=3600')
++ .send(JSON.stringify(require('openvibe-shared/agent-layer').agentManifest(require('./agent-descriptor')))));
r.get('/llms.txt', (_req, res) => res.type('text/plain').set('Cache-Control', cache.htmlHeaders({ maxAge: 3600 })).send(seo.llmsTxt(llmsSite())));
// The same, in full (SEO-33): what the site is, then every page llms.txt lists with what it holds.
r.get('/llms-full.txt', (_req, res) => {
ddiff --git a/test/pics-policy.test.js b/test/pics-policy.test.js
iindex 456bcf4..19e14fb 100644
---- a/test/pics-policy.test.js
++++ b/test/pics-policy.test.js
@@@ -103,6 +103,11 @@ const PAGES = ['/exif', '/content-policy', '/ai-training'];
for (const path of PAGES) assert.ok(map.includes(`<loc>https://openvibe.pics${path}</loc>`), `the sitemap lists ${path}`);
const llms = (await t.get('/llms.txt', { headers: PICS })).text;
for (const path of PAGES) assert.ok(llms.includes(`https://openvibe.pics${path}`), `llms.txt names ${path}`);
++ // SEO-2: the Pics host's own agent manifest.
++ const agent = await t.get('/.well-known/agent.json', { headers: PICS });
++ assert.strictEqual(agent.status, 200);
++ const m = JSON.parse(agent.text);
++ assert.deepStrictEqual([m.network, m.id, m.home, m.openapi], ['OpenVibe', 'pics', 'https://openvibe.pics', 'https://openvibe.pics/openapi.json']);
// SEO-33: llms-full.txt answers on the pics host, from the same descriptor.
const full = await t.get('/llms-full.txt', { headers: PICS });
assert.strictEqual(full.status, 200);