fix: negentropy version check

This commit is contained in:
2024-09-20 10:26:33 +01:00
parent 153a76a855
commit ed694e5f5d
4 changed files with 11 additions and 3 deletions

View File

@ -996,6 +996,9 @@
"MI2jkA": { "MI2jkA": {
"defaultMessage": "Not available:" "defaultMessage": "Not available:"
}, },
"MKDHEa": {
"defaultMessage": "Join Room"
},
"MP54GY": { "MP54GY": {
"defaultMessage": "Wallet password", "defaultMessage": "Wallet password",
"description": "Wallet password input placeholder" "description": "Wallet password input placeholder"
@ -2426,5 +2429,8 @@
}, },
"zvCDao": { "zvCDao": {
"defaultMessage": "Automatically show latest notes" "defaultMessage": "Automatically show latest notes"
},
"zx0myy": {
"defaultMessage": "Participants"
} }
} }

View File

@ -330,6 +330,7 @@
"M6C/px": "Become a leader", "M6C/px": "Become a leader",
"MBAYRO": "Shows \"Copy ID\" and \"Copy Event JSON\" in the context menu on each message", "MBAYRO": "Shows \"Copy ID\" and \"Copy Event JSON\" in the context menu on each message",
"MI2jkA": "Not available:", "MI2jkA": "Not available:",
"MKDHEa": "Join Room",
"MP54GY": "Wallet password", "MP54GY": "Wallet password",
"MWTx65": "Default Page", "MWTx65": "Default Page",
"MYBYdJ": "Short Text Note", "MYBYdJ": "Short Text Note",
@ -805,5 +806,6 @@
"zi9MdS": "Chess (PGN)", "zi9MdS": "Chess (PGN)",
"zm6qS1": "{n} mins to read", "zm6qS1": "{n} mins to read",
"zonsdq": "Failed to load LNURL service", "zonsdq": "Failed to load LNURL service",
"zvCDao": "Automatically show latest notes" "zvCDao": "Automatically show latest notes",
"zx0myy": "Participants"
} }

View File

@ -18,5 +18,5 @@ export interface RelayInfo {
language_tags?: Array<string>; language_tags?: Array<string>;
tags?: Array<string>; tags?: Array<string>;
posting_policy?: string; posting_policy?: string;
negentropy?: string; negentropy?: number;
} }

View File

@ -14,7 +14,7 @@ export class DefaultSyncModule implements ConnectionSyncModule {
sync(c: Connection, item: SyncCommand, cb?: () => void) { sync(c: Connection, item: SyncCommand, cb?: () => void) {
const [_, id, eventSet, ...filters] = item; const [_, id, eventSet, ...filters] = item;
if (c.info?.negentropy === "v1") { if ((c.info?.negentropy ?? NaN) >= 1) {
const newFilters = filters; const newFilters = filters;
const neg = new NegentropyFlow(id, c, eventSet, newFilters); const neg = new NegentropyFlow(id, c, eventSet, newFilters);
neg.once("finish", filters => { neg.once("finish", filters => {