mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
feat: add ditto:relay in /relay - sticky notes
This commit is contained in:
parent
70e27b04f4
commit
1a1adc1654
1 changed files with 4 additions and 1 deletions
|
|
@ -1,3 +1,4 @@
|
||||||
|
import Debug from '@soapbox/stickynotes/debug';
|
||||||
import TTLCache from '@isaacs/ttlcache';
|
import TTLCache from '@isaacs/ttlcache';
|
||||||
import {
|
import {
|
||||||
NostrClientCLOSE,
|
NostrClientCLOSE,
|
||||||
|
|
@ -29,6 +30,8 @@ const limiter = new TTLCache<string, number>();
|
||||||
/** Connections for metrics purposes. */
|
/** Connections for metrics purposes. */
|
||||||
const connections = new Set<WebSocket>();
|
const connections = new Set<WebSocket>();
|
||||||
|
|
||||||
|
const debug = Debug('ditto:relay');
|
||||||
|
|
||||||
/** Set up the Websocket connection. */
|
/** Set up the Websocket connection. */
|
||||||
function connectStream(socket: WebSocket, ip: string | undefined) {
|
function connectStream(socket: WebSocket, ip: string | undefined) {
|
||||||
const controllers = new Map<string, AbortController>();
|
const controllers = new Map<string, AbortController>();
|
||||||
|
|
@ -141,7 +144,7 @@ function connectStream(socket: WebSocket, ip: string | undefined) {
|
||||||
send(['OK', event.id, false, e.message]);
|
send(['OK', event.id, false, e.message]);
|
||||||
} else {
|
} else {
|
||||||
send(['OK', event.id, false, 'error: something went wrong']);
|
send(['OK', event.id, false, 'error: something went wrong']);
|
||||||
console.error(e);
|
debug(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue