openvibers/openvibe.live Commits
DM notifications link to /?dm=<conversation id>, which the messenger opens once someone is signed in (and drops from the address bar). They used to link to /dm/<id>, a page Live never had: it showed the home page and, since real 404s, Page not found. Links already sent redirect from /dm/<id>
Changes
@@@ -1193,6 +1193,27 @@// Hook into chat WebSocket message handler// The chat.js `handleChatMessage` will call `handleIncomingDm` for DM type messageswindow._messengerHandleDm = handleIncomingDm;++ openLinkedThread();++ }++++ // DM notifications (Network push, the notification centre) link to /?dm=<conversation id>:++ // open that thread once someone is signed in, and take the parameter out of the address bar.++ function openLinkedThread() {++ const params = new URLSearchParams(location.search);++ if (!params.has('dm')) return;++ const id = Number(params.get('dm'));++ params.delete('dm');++ const qs = params.toString();++ history.replaceState(history.state, '', location.pathname + (qs ? `?${qs}` : '') + location.hash);++ if (!Number.isSafeInteger(id) || id <= 0) return;++ const open = () => { if (!panelOpen) togglePanel(); openThread(id); };++ if (typeof currentUser !== 'undefined' && currentUser) return open();++ const onAuth = (e) => {++ if (!e.detail || !e.detail.user) return;++ window.removeEventListener('openvibe-auth-changed', onAuth);++ open();++ };++ window.addEventListener('openvibe-auth-changed', onAuth);}function resetMessengerStateForAuthChange(newUser) {@@@ -217,7 +217,7 @@ router.post('/conversations/:id/messages', (req, res) => {type: 'DIRECT_MESSAGE',title: `Message from ${senderName}`,message: preview,-- url: `https://openvibe.live/dm/${convId}`,++ url: `https://openvibe.live/?dm=${convId}`,...actorInfo(sender),});}@@@ -564,7 +564,7 @@ effectsRouter.post('/notify/dm', (req, res) => {type: 'DIRECT_MESSAGE',title: `Message from ${senderName}`,message: 'Sent you a message',-- url: `https://openvibe.live/dm/${convId}`,++ url: `https://openvibe.live/?dm=${convId}`,...actorInfo(sender),});}@@@ -886,6 +886,10 @@ app.get('/media/:username', (req, res) => {sendDocument(res, 'media-player.html');});++// DM notifications sent before 2026-09-23 linked to /dm/<conversation id>, a page Live never had;++// the messenger opens the thread from /?dm=<id> now.++app.get(/^\/dm\/(\d{1,12})\/?$/, (req, res) => res.redirect(302, `/?dm=${req.params[0]}`));++// ── Legal Pages ───────────────────────────────────────────────app.get('/dmca', (req, res) => {sendDocument(res, 'dmca.html');
@@ -1193,6 +1193,27 @@
@@ -1193,6 +1193,27 @@
// Hook into chat WebSocket message handler
// Hook into chat WebSocket message handler
// The chat.js `handleChatMessage` will call `handleIncomingDm` for DM type messages
// The chat.js `handleChatMessage` will call `handleIncomingDm` for DM type messages
window._messengerHandleDm = handleIncomingDm;
window._messengerHandleDm = handleIncomingDm;
+ openLinkedThread();
+ }
+
+ // DM notifications (Network push, the notification centre) link to /?dm=<conversation id>:
+ // open that thread once someone is signed in, and take the parameter out of the address bar.
+ function openLinkedThread() {
+ const params = new URLSearchParams(location.search);
+ if (!params.has('dm')) return;
+ const id = Number(params.get('dm'));
+ params.delete('dm');
+ const qs = params.toString();
+ history.replaceState(history.state, '', location.pathname + (qs ? `?${qs}` : '') + location.hash);
+ if (!Number.isSafeInteger(id) || id <= 0) return;
+ const open = () => { if (!panelOpen) togglePanel(); openThread(id); };
+ if (typeof currentUser !== 'undefined' && currentUser) return open();
+ const onAuth = (e) => {
+ if (!e.detail || !e.detail.user) return;
+ window.removeEventListener('openvibe-auth-changed', onAuth);
+ open();
+ };
+ window.addEventListener('openvibe-auth-changed', onAuth);
}
}
function resetMessengerStateForAuthChange(newUser) {
function resetMessengerStateForAuthChange(newUser) {
@@ -217,7 +217,7 @@ router.post('/conversations/:id/messages', (req, res) => {
@@ -217,7 +217,7 @@ router.post('/conversations/:id/messages', (req, res) => {
type: 'DIRECT_MESSAGE',
type: 'DIRECT_MESSAGE',
title: `Message from ${senderName}`,
title: `Message from ${senderName}`,
message: preview,
message: preview,
- url: `https://openvibe.live/dm/${convId}`,
+ url: `https://openvibe.live/?dm=${convId}`,
...actorInfo(sender),
...actorInfo(sender),
});
});
}
}
@@ -564,7 +564,7 @@ effectsRouter.post('/notify/dm', (req, res) => {
@@ -564,7 +564,7 @@ effectsRouter.post('/notify/dm', (req, res) => {
type: 'DIRECT_MESSAGE',
type: 'DIRECT_MESSAGE',
title: `Message from ${senderName}`,
title: `Message from ${senderName}`,
message: 'Sent you a message',
message: 'Sent you a message',
- url: `https://openvibe.live/dm/${convId}`,
+ url: `https://openvibe.live/?dm=${convId}`,
...actorInfo(sender),
...actorInfo(sender),
});
});
}
}
@@ -886,6 +886,10 @@ app.get('/media/:username', (req, res) => {
@@ -886,6 +886,10 @@ app.get('/media/:username', (req, res) => {
sendDocument(res, 'media-player.html');
sendDocument(res, 'media-player.html');
});
});
+// DM notifications sent before 2026-09-23 linked to /dm/<conversation id>, a page Live never had;
+// the messenger opens the thread from /?dm=<id> now.
+app.get(/^\/dm\/(\d{1,12})\/?$/, (req, res) => res.redirect(302, `/?dm=${req.params[0]}`));
+
// ── Legal Pages ───────────────────────────────────────────────
// ── Legal Pages ───────────────────────────────────────────────
app.get('/dmca', (req, res) => {
app.get('/dmca', (req, res) => {
sendDocument(res, 'dmca.html');
sendDocument(res, 'dmca.html');