Fix testnet connections

This commit is contained in:
koalasat
2025-05-23 12:20:38 +02:00
parent 795ed08c24
commit b8f19f38ac
3 changed files with 5 additions and 3 deletions

View File

@ -114,10 +114,11 @@ const EncryptedSocketChat: React.FC<Props> = ({
if (!slot?.token) return; if (!slot?.token) return;
const url = federation.getCoordinator(order.shortAlias).url; const url = federation.getCoordinator(order.shortAlias).url;
const protocol = url.includes('https') ? 'wss://' : 'ws://';
websocketClient websocketClient
.open( .open(
`${url.replace(/^https?:\/\//, 'ws://')}/ws/chat/${ `${url.replace(/^https?:\/\//, protocol)}/ws/chat/${
order.id order.id
}/?token_sha256_hex=${sha256(slot?.token)}`, }/?token_sha256_hex=${sha256(slot?.token)}`,
) )

View File

@ -59,12 +59,13 @@ export const SuccessfulPrompt = ({
const coordinatorPubKey = federation.getCoordinator(order.shortAlias)?.nostrHexPubkey; const coordinatorPubKey = federation.getCoordinator(order.shortAlias)?.nostrHexPubkey;
if (!coordinatorToken) { if (!coordinatorToken) {
console.error('Missing coordinator token');
setTokenError(true); setTokenError(true);
return; return;
} }
if (!slot?.nostrPubKey || !slot.nostrSecKey || !coordinatorPubKey || !order.id) { if (!slot?.nostrPubKey || !slot.nostrSecKey || !coordinatorPubKey || !order.id) {
setHostRating(0); console.error('Rating not valid');
return; return;
} }

View File

@ -137,7 +137,7 @@ class RoboPool {
const requestRatings = [ const requestRatings = [
'REQ', 'REQ',
`subscribeRatings${id}`, `subscribeRatings${id ?? ''}`,
{ kinds: [31986], '#p': pubkeys ?? defaultPubkeys, since: 1746316800 }, { kinds: [31986], '#p': pubkeys ?? defaultPubkeys, since: 1746316800 },
]; ];