openvibers/openvibe.live Commits

Go-live fan-out to Network uses Live's service token (network.notifications.push) with the internal key as fallback

OP OpenVibers committed 23 Sept 2026 · 07fb99cf85 · 2 files, +8 −5


Changes

ddiff --git a/server/net/network-principal.js b/server/net/network-principal.js
iindex 7bdc11f0..3c4a2a67 100644
---- a/server/net/network-principal.js
++++ b/server/net/network-principal.js
@@@ -18,7 +18,7 @@ const CLIENT_SECRET = process.env.OV_OAUTH_CLIENT_SECRET || '';
const PAUSE_MS = 5 * 60 * 1000;
// Network routes that accept a service token (OpenVibe.Network server/internal/routes.js TOKEN_ROUTES).
--const TOKEN_PATHS = new Set(['/internal/coins/credit', '/internal/coins/debit', '/internal/coins/transfer', '/internal/notifications/push', '/internal/notifications/push-bulk']);
++const TOKEN_PATHS = new Set(['/internal/coins/credit', '/internal/coins/debit', '/internal/coins/transfer', '/internal/notifications/push', '/internal/notifications/push-bulk', '/internal/events/stream-live']);
const _clients = new Map();
/** One cached client-credentials token client per audience (openvibe.network, openvibe.community, ...). */
ddiff --git a/server/streaming/golive-notify.js b/server/streaming/golive-notify.js
iindex 6543a8ed..d61ace53 100644
---- a/server/streaming/golive-notify.js
++++ b/server/streaming/golive-notify.js
@@@ -56,12 +56,15 @@ function notifyFollowersGoLive(streamer, stream, { force = false } = {}) {
follower_network_ids: followerNetworkIds,
};
-- if (!INTERNAL_API_KEY) { _fallback(streamer, stream, followerNetworkIds); return; }
-- fetch(`${OV_NETWORK_INTERNAL_URL}/internal/events/stream-live`, {
++ if (!INTERNAL_API_KEY && !process.env.OV_OAUTH_CLIENT_SECRET) { _fallback(streamer, stream, followerNetworkIds); return; }
++ // Service token (network.notifications.push) when Network grants it, the internal key otherwise.
++ const principal = require('../net/network-principal');
++ principal.headersFor('/internal/events/stream-live').then((auth) => fetch(`${OV_NETWORK_INTERNAL_URL}/internal/events/stream-live`, {
method: 'POST',
-- headers: { 'Content-Type': 'application/json', 'X-Internal-Key': INTERNAL_API_KEY },
++ headers: { 'Content-Type': 'application/json', ...auth },
body: JSON.stringify(payload),
-- }).then(async (r) => {
++ })).then(async (r) => {
++ if (r.status === 401) principal.tokenRejected('stream-live');
if (r.ok) {
let d = null; try { d = await r.json(); } catch { /* */ }
if (d && d.skipped) { console.log(`[GoLive] ${streamer.username}: network skipped announcement (${d.reason}${d.next_allowed_at ? `, next ${d.next_allowed_at}` : ''})`); return; }