openvibers/openvibe.chat Commits

The /paste chat command links the paste on OpenVibe.Community directly; SITE_URL removed (#22)

OP OpenVibers committed 5 Oct 2026 · 360bb4ebca · 6 files, +7 −10

* The /paste chat command links the paste on OpenVibe.Community directly; SITE_URL removed

- `server/chat/chat-server.js:24` — import `config` from `../config`.
- `server/chat/chat-server.js:1815-1822` — `/paste` now links `${config.web.communityUrl}/p/${encodeURIComponent(paste.slug)}`, preferring an absolute `https:` `paste.url`; `process.env.SITE_URL` read removed.
- `server/config.js:200` — dropped the stale SITE_URL comment.
- `.env.example:83-84` — removed the now-unused `SITE_URL` entry.
- `docs/cutover.md:124` — removed `SITE_URL` from the chat.env deployment checklist (historical evidence doc `docs/cutover-evidence-t3.md` left as a record).
- `test/helpers.js:303` — replaced `SITE_URL` with `OV_COMMUNITY_URL: 'https://community.test'` in the harness env.
- `test/ws-protocol.test.js:284-288` — `/paste` test asserts the broadcast carries `${process.env.OV_COMMUNITY_URL}/p/abc123`.

Test results: `ov test test/ws-protocol.test.js` → **1 passed** (26.0 s), then re-run reported green/unchanged (nothing to run; no other test references SITE_URL). `ctx.effects.createPaste` resolves to `r.paste` from Live's effect, which currently returns `{ slug }` only, so the Community-base fallback is the active path.

Note: I did not commit or push.

* The /paste link is always built from the Community base, never taken from the effect's response (review)

* Tests keep the default Community base; the /paste assertion reads it from config

Changes

ddiff --git a/.env.example b/.env.example
iindex c892d47..eb0cc7a 100644
---- a/.env.example
++++ b/.env.example
@@@ -80,9 +80,6 @@ LIVE_MIRROR=0
# Where Events delivers (default http://127.0.0.1:$PORT/internal/events)
#CHAT_EVENTS_ENDPOINT=http://127.0.0.1:4400/internal/events
--# Public origin used in /paste links (Live's SITE_URL)
--SITE_URL=https://openvibe.live
--
# Channel sounds: the SAME directory as Live's (stored rows hold absolute paths into it and Live's
# donation alerts read alert sounds from it). Production: /opt/openvibe.live/data/sounds
SOUNDS_PATH=./data/sounds
ddiff --git a/docs/cutover.md b/docs/cutover.md
iindex bc29626..c3946c1 100644
---- a/docs/cutover.md
++++ b/docs/cutover.md
@@@ -121,7 +121,7 @@ Live data maintained by `live-context` (never authority), `events_outbox`, `live
`/etc/openvibe/live.env`.
4. **Chat.** `git clone … /opt/openvibe.chat && cd /opt/openvibe.chat && npm ci --omit=dev`;
`/etc/openvibe/chat.env` from `.env.example` (0600): `OV_LIVE_INTERNAL_URL`, Network URLs,
-- `SITE_URL=https://openvibe.live`, `BASE_URL=https://openvibe.live`, `LIVE_MIRROR=1`, and
++ `BASE_URL=https://openvibe.live`, `LIVE_MIRROR=1`, and
`EVENTS_URL` if OpenVibe.Events is deployed. The unit sets `CHAT_DB_PATH`, `CHAT_CACHE_DIR`,
`SOUNDS_PATH=/opt/openvibe.live/data/sounds` and allows writes there. ffmpeg/ffprobe and
espeak-ng are the host's (Live uses the same).
ddiff --git a/server/chat/chat-server.js b/server/chat/chat-server.js
iindex 21591e4..3945adb 100644
---- a/server/chat/chat-server.js
++++ b/server/chat/chat-server.js
@@@ -21,6 +21,7 @@ const WebSocket = require('ws');
const fs = require('fs');
const crypto = require('crypto');
const db = require('../db/database');
++const config = require('../config');
const ctx = require('../live-context');
const { extractWsTokenFrom, countWsCookieUse, wsCookieReliance, authenticateWs } = require('../auth/auth');
const session = require('../auth/network-session');
@@@ -1813,8 +1814,9 @@ class ChatServer {
user_id: userId || undefined,
stream_id: client.streamId || undefined,
}).then(async (paste) => {
-- const siteUrl = process.env.SITE_URL || '';
-- const pasteUrl = `${siteUrl}/p/${paste.slug}`;
++ // Pastes live on OpenVibe.Community; link there (Chat's configured Community
++ // base), not at a Live-origin SITE_URL that only 301s.
++ const pasteUrl = `${config.web.communityUrl}/p/${encodeURIComponent(paste.slug)}`;
// Show link to everyone in stream
await this._broadcastToRoom(client, {
type: 'system',
ddiff --git a/server/config.js b/server/config.js
iindex 25255ff..27e853d 100644
---- a/server/config.js
++++ b/server/config.js
@@@ -197,5 +197,4 @@ module.exports = {
},
// Where Chat keeps its own caches (101soundboards clips, TTS preview clips).
cacheDir: process.env.CHAT_CACHE_DIR || path.join(path.dirname(process.env.CHAT_DB_PATH || './data/chat.db'), 'cache'),
-- // (SITE_URL — the public origin in /paste links — is read where Live read it, as in Live.)
};
ddiff --git a/test/helpers.js b/test/helpers.js
iindex 262ae29..4063ea1 100644
---- a/test/helpers.js
++++ b/test/helpers.js
@@@ -300,7 +300,6 @@ async function boot({ env = {} } = {}) {
OV_LIVE_INTERNAL_URL: `http://127.0.0.1:${livePort}`,
LIVE_MIRROR: '0',
EVENTS_URL: '',
-- SITE_URL: 'https://openvibe.live',
...env,
});
ddiff --git a/test/ws-protocol.test.js b/test/ws-protocol.test.js
iindex 286adc6..d9dcea2 100644
---- a/test/ws-protocol.test.js
++++ b/test/ws-protocol.test.js
@@@ -281,11 +281,11 @@ t('/tts broadcasts the line to the room', async () => {
assert.strictEqual(m.core_username, 'alice');
});
--t('/paste creates the paste through Live and announces it', async () => {
++t('/paste creates the paste through Live and announces the Community link', async () => {
await h.sleep(1100);
aliceWs.sendJson({ type: 'chat', message: '/paste const x = 1;' });
const m = await bobWs.next((x) => x.type === 'system' && /shared a paste/.test(x.message));
-- assert.strictEqual(m.message, '📋 Anonymous shared a paste: https://openvibe.live/p/abc123');
++ assert.strictEqual(m.message, `📋 Anonymous shared a paste: ${require('../server/config').web.communityUrl}/p/abc123`);
const fx = h.live.effects.find((e) => e.name === 'paste');
assert.strictEqual(fx.body.content, 'const x = 1;');
assert.strictEqual(fx.body.user_id, alice.id);