openvibers/openrestream Commits

/llms-full.txt (SEO-33): the site in full (#198)

OP OpenVibers committed 10 days ago · 17c4a4c08d · 2 files, +31 −3

It answered 404. /llms-full.txt now holds what llms.txt says in full: an About section
with the summary and details, then every page llms.txt lists with what it holds (from
the same descriptor), or for Connect, llms.txt followed by its README.

Changes

ddiff --git a/server/discovery.js b/server/discovery.js
iindex 0eb99f6..c09648b 100644
---- a/server/discovery.js
++++ b/server/discovery.js
@@@ -30,8 +30,8 @@ function createDiscoveryRoutes({ config, releaseLastmod }) {
router.get('/sitemap.xml', (_req, res) => res.type('application/xml').set('Cache-Control', cache.htmlHeaders()).send(
seo.sitemapXml(PUBLIC_PATHS.map((loc) => ({ loc: abs(loc), lastmod: releaseLastmod })))));
-- router.get('/llms.txt', (_req, res) => res.type('text/plain').set('Cache-Control', cache.htmlHeaders()).send(
-- seo.llmsTxt({
++ // The site as llms.txt describes it, shared by /llms.txt and /llms-full.txt (SEO-33).
++ const llmsSite = () => ({
name: 'OpenRestream',
summary: 'OpenRestream (openre.stream) is an open restreaming platform: send one stream from OBS or any RTMP encoder and it goes to Twitch, YouTube, Kick and any RTMP, RTMPS or SRT server at the same time, with the person\'s OpenVibe Live channel on by default. It is free and open source, with no follower minimum. With no OBS, people go live from their browser on OpenVibe.Live (openvibe.live, the Go Live button).',
details: [
@@@ -59,7 +59,20 @@ function createDiscoveryRoutes({ config, releaseLastmod }) {
{ title: 'robots.txt', url: abs('/robots.txt') },
] },
],
-- })));
++ });
++ router.get('/llms.txt', (_req, res) => res.type('text/plain').set('Cache-Control', cache.htmlHeaders()).send(
++ seo.llmsTxt(llmsSite())));
++ // The same, in full (SEO-33): what the site is, then every page llms.txt lists with what it holds.
++ router.get('/llms-full.txt', (_req, res) => {
++ const d = llmsSite();
++ res.type('text/plain').set('Cache-Control', cache.htmlHeaders()).send(seo.llmsFull({
++ site: d.name, summary: d.summary, base: abs('/'),
++ sections: [
++ { title: 'About', pages: [{ title: d.name, url: abs('/'), text: [d.summary, Array.isArray(d.details) ? d.details.join('\n') : d.details].filter(Boolean).join('\n\n') }] },
++ ...(d.sections || []).map((x) => ({ title: x.title, pages: (x.links || []).map((l) => ({ title: l.title, url: l.url, text: l.note || '' })) })),
++ ],
++ }));
++ });
return router;
}
ddiff --git a/test/discovery.test.js b/test/discovery.test.js
iindex c0ff1f4..ab4105e 100644
---- a/test/discovery.test.js
++++ b/test/discovery.test.js
@@@ -67,6 +67,21 @@ t('llms.txt is plain text, leads with open restreaming (OpenVibe Live on by defa
}
});
++t('llms-full.txt (SEO-33): the site in full, from the same descriptor as llms.txt', async () => {
++ const api = await bootApi({});
++ try {
++ const r = await request(api.base, 'GET', '/llms-full.txt');
++ assert.strictEqual(r.status, 200);
++ assert.match(r.headers.get('content-type'), /^text\/plain/);
++ assert.ok(r.text.startsWith('# OpenRestream\n'));
++ assert.ok(r.text.length > 500, `${r.text.length} characters`);
++ assert.match(r.text, /## About\n\n### OpenRestream\n/);
++ assert.match(r.text, /OpenRestream is also the ingest and restream engine of the OpenVibe network/, 'the details, joined as lines');
++ } finally {
++ await api.close();
++ }
++});
++
t('the front page leads with open restreaming, links to Live for browser go-live, and says what runs here', async () => {
const api = await bootApi({ env: { BASE_URL: 'https://openre.stream' } });
try {