sign: only add stream if nostr=true on the user stream (still subject to change)
This commit is contained in:
parent
ce02f7d56c
commit
c14ebe6631
|
@ -6,6 +6,9 @@ const streamingController: AppController = (c) => {
|
|||
const upgrade = c.req.headers.get('upgrade');
|
||||
const token = c.req.headers.get('sec-websocket-protocol');
|
||||
|
||||
const stream = c.req.query('stream');
|
||||
const nostr = c.req.query('nostr');
|
||||
|
||||
if (upgrade?.toLowerCase() !== 'websocket') {
|
||||
return c.text('Please use websocket protocol', 400);
|
||||
}
|
||||
|
@ -24,8 +27,9 @@ const streamingController: AppController = (c) => {
|
|||
socket.addEventListener('close', () => console.log('websocket: connection closed'));
|
||||
socket.addEventListener('message', (e) => console.log('websocket message: ', e.data));
|
||||
|
||||
// FIXME: Only do this for nostr.sign events.
|
||||
signStreams.set(token, socket);
|
||||
if (stream === 'user' && nostr === 'true') {
|
||||
signStreams.set(token, socket);
|
||||
}
|
||||
|
||||
return response;
|
||||
};
|
||||
|
|
|
@ -34,7 +34,7 @@ async function signEvent<K extends number = number>(event: EventTemplate<K>, c:
|
|||
}
|
||||
});
|
||||
stream.send(JSON.stringify({ event: 'nostr.sign', payload: JSON.stringify(event) }));
|
||||
setTimeout(reject, 30000);
|
||||
setTimeout(reject, 60000);
|
||||
});
|
||||
} catch (_e) {
|
||||
throw new HTTPException(504, {
|
||||
|
|
Loading…
Reference in New Issue