openvibers/openvibe.live Commits
Docs pages share with the site's card (og:image, twitter:card), and the API docs install openvibe-sdk v0.54.0 (#275)
Changes
@@@ -288,7 +288,7 @@ const { stream, endpoint } = await fetch('https://openvibe.live/api/streams', {console.log(endpoint.whipUrlBase); // POST your SDP offer here (see WebRTC tab)</code></pre><h3>The same with openvibe-sdk</h3>--<p>In Node, <code>npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.52.0</code> and use <code>openvibe-sdk/live</code>: who is live, channels, slots, going live, the session, the content feeds and WHIP, with errors as <code>OpenVibeError</code> (<a href="https://github.com/OpenVibers/OpenVibe.SDK#readme" target="_blank" rel="noopener">SDK README</a>).</p>++<p>In Node, <code>npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.54.0</code> and use <code>openvibe-sdk/live</code>: who is live, channels, slots, going live, the session, the content feeds and WHIP, with errors as <code>OpenVibeError</code> (<a href="https://github.com/OpenVibers/OpenVibe.SDK#readme" target="_blank" rel="noopener">SDK README</a>).</p><pre><code>const { createClient } = require('openvibe-sdk');const { createLiveClient } = require('openvibe-sdk/live');const live = createLiveClient(createClient({ token: TOKEN })); // openvibe.live is found through the network registry@@@ -16,6 +16,7 @@ const express = require('express');const fs = require('fs');const path = require('path');const cache = require('openvibe-shared/cache-policy');++const social = require('openvibe-shared/social');const router = express.Router();// Through OV_APP_ROOT (the `current` release symlink) when set, so doc edits go live without a restart.@@@ -256,7 +257,9 @@ function renderPage({ name, title, html, headings }) {<meta property="og:site_name" content="OpenVibe.Live"><meta property="og:title" content="${escapeHtml(title || 'OpenVibe.Live Docs')}"><meta property="og:description" content="${escapeHtml(description)}">-- <meta property="og:url" content="${escapeHtml(canonical)}">` : ''}++ <meta property="og:url" content="${escapeHtml(canonical)}">++ <meta property="og:image" content="${escapeHtml(new URL(social.url('live') || '/og-image.png', canonical).href)}">++ <meta name="twitter:card" content="summary_large_image">` : ''}<style>:root { --bg: #0d0d0f; --bg-2: #16161a; --bg-3: #1e1e24; --text: #e8e6e3; --text-2: #9a9a9a; --muted: #666;--accent: #8b5cf6; --accent-light: #a78bfa; --border: #2a2a32; }@@@ -94,6 +94,9 @@ assert.ok(renderPage({ name: 'README', title: '', html: '', headings: [] }).inclconst described = renderPage({ name: 'go-live-in-your-browser', title: 'Go live', html: '<h1>Go live</h1>\n<p>Start in your <strong>browser</strong> & go.</p><p>later</p>', headings: [] });assert.ok(described.includes('<meta name="description" content="Start in your browser & go.">'), described.slice(0, 900));assert.ok(described.includes('<meta property="og:url" content="https://openvibe.live/docs/go-live-in-your-browser">'));++// A shared docs link has the site's card (openvibe-shared/social), not a bare preview.++assert.match(described, /<meta property="og:image" content="https:\/\/openvibe\.live\/shared\/social\/live\.jpg\?v=[0-9a-f]+">/);++assert.ok(described.includes('<meta name="twitter:card" content="summary_large_image">'));assert.ok(!renderPage({ name: 'x', title: 'X', html: '<h2>no paragraph</h2>', headings: [] }).includes('name="description"'), 'no paragraph, no description');assert.ok(shell.includes('<link rel="icon" type="image/svg+xml" href="/assets/logo.svg">'));assert.ok(fs.existsSync(path.join(__dirname, '..', 'public', 'assets', 'logo.svg')), 'the icon file exists');
@@ -288,7 +288,7 @@ const { stream, endpoint } = await fetch('https://openvibe.live/api/streams', {
@@ -288,7 +288,7 @@ const { stream, endpoint } = await fetch('https://openvibe.live/api/streams', {
console.log(endpoint.whipUrlBase); // POST your SDP offer here (see WebRTC tab)
console.log(endpoint.whipUrlBase); // POST your SDP offer here (see WebRTC tab)
</code></pre>
</code></pre>
<h3>The same with openvibe-sdk</h3>
<h3>The same with openvibe-sdk</h3>
-<p>In Node, <code>npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.52.0</code> and use <code>openvibe-sdk/live</code>: who is live, channels, slots, going live, the session, the content feeds and WHIP, with errors as <code>OpenVibeError</code> (<a href="https://github.com/OpenVibers/OpenVibe.SDK#readme" target="_blank" rel="noopener">SDK README</a>).</p>
+<p>In Node, <code>npm install https://codeload.github.com/OpenVibers/OpenVibe.SDK/tar.gz/refs/tags/v0.54.0</code> and use <code>openvibe-sdk/live</code>: who is live, channels, slots, going live, the session, the content feeds and WHIP, with errors as <code>OpenVibeError</code> (<a href="https://github.com/OpenVibers/OpenVibe.SDK#readme" target="_blank" rel="noopener">SDK README</a>).</p>
<pre><code>const { createClient } = require('openvibe-sdk');
<pre><code>const { createClient } = require('openvibe-sdk');
const { createLiveClient } = require('openvibe-sdk/live');
const { createLiveClient } = require('openvibe-sdk/live');
const live = createLiveClient(createClient({ token: TOKEN })); // openvibe.live is found through the network registry
const live = createLiveClient(createClient({ token: TOKEN })); // openvibe.live is found through the network registry
@@ -16,6 +16,7 @@ const express = require('express');
@@ -16,6 +16,7 @@ const express = require('express');
const fs = require('fs');
const fs = require('fs');
const path = require('path');
const path = require('path');
const cache = require('openvibe-shared/cache-policy');
const cache = require('openvibe-shared/cache-policy');
+const social = require('openvibe-shared/social');
const router = express.Router();
const router = express.Router();
// Through OV_APP_ROOT (the `current` release symlink) when set, so doc edits go live without a restart.
// Through OV_APP_ROOT (the `current` release symlink) when set, so doc edits go live without a restart.
@@ -256,7 +257,9 @@ function renderPage({ name, title, html, headings }) {
@@ -256,7 +257,9 @@ function renderPage({ name, title, html, headings }) {
<meta property="og:site_name" content="OpenVibe.Live">
<meta property="og:site_name" content="OpenVibe.Live">
<meta property="og:title" content="${escapeHtml(title || 'OpenVibe.Live Docs')}">
<meta property="og:title" content="${escapeHtml(title || 'OpenVibe.Live Docs')}">
<meta property="og:description" content="${escapeHtml(description)}">
<meta property="og:description" content="${escapeHtml(description)}">
- <meta property="og:url" content="${escapeHtml(canonical)}">` : ''}
+ <meta property="og:url" content="${escapeHtml(canonical)}">
+ <meta property="og:image" content="${escapeHtml(new URL(social.url('live') || '/og-image.png', canonical).href)}">
+ <meta name="twitter:card" content="summary_large_image">` : ''}
<style>
<style>
:root { --bg: #0d0d0f; --bg-2: #16161a; --bg-3: #1e1e24; --text: #e8e6e3; --text-2: #9a9a9a; --muted: #666;
:root { --bg: #0d0d0f; --bg-2: #16161a; --bg-3: #1e1e24; --text: #e8e6e3; --text-2: #9a9a9a; --muted: #666;
--accent: #8b5cf6; --accent-light: #a78bfa; --border: #2a2a32; }
--accent: #8b5cf6; --accent-light: #a78bfa; --border: #2a2a32; }
@@ -94,6 +94,9 @@ assert.ok(renderPage({ name: 'README', title: '', html: '', headings: [] }).incl
@@ -94,6 +94,9 @@ assert.ok(renderPage({ name: 'README', title: '', html: '', headings: [] }).incl
const described = renderPage({ name: 'go-live-in-your-browser', title: 'Go live', html: '<h1>Go live</h1>\n<p>Start in your <strong>browser</strong> & go.</p><p>later</p>', headings: [] });
const described = renderPage({ name: 'go-live-in-your-browser', title: 'Go live', html: '<h1>Go live</h1>\n<p>Start in your <strong>browser</strong> & go.</p><p>later</p>', headings: [] });
assert.ok(described.includes('<meta name="description" content="Start in your browser & go.">'), described.slice(0, 900));
assert.ok(described.includes('<meta name="description" content="Start in your browser & go.">'), described.slice(0, 900));
assert.ok(described.includes('<meta property="og:url" content="https://openvibe.live/docs/go-live-in-your-browser">'));
assert.ok(described.includes('<meta property="og:url" content="https://openvibe.live/docs/go-live-in-your-browser">'));
+// A shared docs link has the site's card (openvibe-shared/social), not a bare preview.
+assert.match(described, /<meta property="og:image" content="https:\/\/openvibe\.live\/shared\/social\/live\.jpg\?v=[0-9a-f]+">/);
+assert.ok(described.includes('<meta name="twitter:card" content="summary_large_image">'));
assert.ok(!renderPage({ name: 'x', title: 'X', html: '<h2>no paragraph</h2>', headings: [] }).includes('name="description"'), 'no paragraph, no description');
assert.ok(!renderPage({ name: 'x', title: 'X', html: '<h2>no paragraph</h2>', headings: [] }).includes('name="description"'), 'no paragraph, no description');
assert.ok(shell.includes('<link rel="icon" type="image/svg+xml" href="/assets/logo.svg">'));
assert.ok(shell.includes('<link rel="icon" type="image/svg+xml" href="/assets/logo.svg">'));
assert.ok(fs.existsSync(path.join(__dirname, '..', 'public', 'assets', 'logo.svg')), 'the icon file exists');
assert.ok(fs.existsSync(path.join(__dirname, '..', 'public', 'assets', 'logo.svg')), 'the icon file exists');