@celljs/ta-relay 4.19.0 → 4.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/common/index.d.ts +1 -0
- package/esm/common/index.js +1 -0
- package/esm/common/relay-account-client.d.ts +4 -0
- package/esm/common/relay-account-client.js +13 -3
- package/esm/common/relay-account.d.ts +17 -2
- package/esm/common/relay-account.js +15 -6
- package/esm/common/relay-accounts.d.ts +2 -0
- package/esm/common/relay-accounts.js +16 -2
- package/esm/common/relay-group-invites.d.ts +6 -2
- package/esm/common/relay-group-invites.js +6 -5
- package/esm/common/relay-hub-charter.d.ts +74 -0
- package/esm/common/relay-hub-charter.js +149 -0
- package/esm/common/relay-hub-epochs.d.ts +43 -0
- package/esm/common/relay-hub-epochs.js +92 -0
- package/esm/common/relay-hub-util.d.ts +39 -7
- package/esm/common/relay-hub-util.js +46 -15
- package/esm/common/relay-hub.d.ts +13 -0
- package/esm/common/relay-hub.js +81 -18
- package/esm/common/relay-hubs-admins.d.ts +27 -0
- package/esm/common/relay-hubs-admins.js +91 -0
- package/esm/common/relay-hubs-connection.d.ts +21 -63
- package/esm/common/relay-hubs-connection.js +103 -87
- package/esm/common/relay-hubs-identity.d.ts +29 -1
- package/esm/common/relay-hubs-identity.js +109 -1
- package/esm/common/relay-hubs-live.d.ts +58 -0
- package/esm/common/relay-hubs-live.js +27 -0
- package/esm/common/relay-hubs-protocol.d.ts +10 -0
- package/esm/common/relay-hubs-util.d.ts +9 -0
- package/esm/common/relay-hubs-util.js +23 -1
- package/esm/common/relay-hubs.d.ts +12 -15
- package/esm/common/relay-hubs.js +60 -57
- package/esm/common/relay-identity.d.ts +7 -0
- package/esm/common/relay-identity.js +8 -0
- package/esm/common/relay-protocol.d.ts +21 -3
- package/esm/common/relay-protocol.js +8 -1
- package/esm/common/relay-room-chat.d.ts +6 -1
- package/esm/common/relay-room-chat.js +1 -0
- package/esm/node/relay-server-accounts.d.ts +1 -1
- package/esm/node/relay-server-accounts.js +1 -1
- package/lib/common/index.d.ts +1 -0
- package/lib/common/index.js +1 -0
- package/lib/common/relay-account-client.d.ts +4 -0
- package/lib/common/relay-account-client.js +13 -3
- package/lib/common/relay-account.d.ts +17 -2
- package/lib/common/relay-account.js +15 -6
- package/lib/common/relay-accounts.d.ts +2 -0
- package/lib/common/relay-accounts.js +16 -2
- package/lib/common/relay-group-invites.d.ts +6 -2
- package/lib/common/relay-group-invites.js +6 -5
- package/lib/common/relay-hub-charter.d.ts +75 -0
- package/lib/common/relay-hub-charter.js +152 -0
- package/lib/common/relay-hub-epochs.d.ts +44 -0
- package/lib/common/relay-hub-epochs.js +95 -0
- package/lib/common/relay-hub-util.d.ts +39 -7
- package/lib/common/relay-hub-util.js +46 -15
- package/lib/common/relay-hub.d.ts +13 -0
- package/lib/common/relay-hub.js +81 -18
- package/lib/common/relay-hubs-admins.d.ts +28 -0
- package/lib/common/relay-hubs-admins.js +95 -0
- package/lib/common/relay-hubs-connection.d.ts +21 -63
- package/lib/common/relay-hubs-connection.js +109 -94
- package/lib/common/relay-hubs-identity.d.ts +29 -1
- package/lib/common/relay-hubs-identity.js +109 -1
- package/lib/common/relay-hubs-live.d.ts +59 -0
- package/lib/common/relay-hubs-live.js +31 -0
- package/lib/common/relay-hubs-protocol.d.ts +10 -0
- package/lib/common/relay-hubs-util.d.ts +9 -0
- package/lib/common/relay-hubs-util.js +23 -1
- package/lib/common/relay-hubs.d.ts +12 -15
- package/lib/common/relay-hubs.js +66 -63
- package/lib/common/relay-identity.d.ts +7 -0
- package/lib/common/relay-identity.js +8 -0
- package/lib/common/relay-protocol.d.ts +21 -3
- package/lib/common/relay-protocol.js +9 -2
- package/lib/common/relay-room-chat.d.ts +6 -1
- package/lib/common/relay-room-chat.js +1 -0
- package/lib/node/relay-server-accounts.d.ts +1 -1
- package/lib/node/relay-server-accounts.js +1 -1
- package/package.json +3 -3
- package/viewer/join.html +6 -6
- package/viewer/page.html +12 -12
- package/viewer/room.html +15 -15
|
@@ -1,55 +1,9 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import
|
|
1
|
+
import { type RelayHubCharterBody } from './relay-hub-charter';
|
|
2
|
+
import { type RelayHubAskBody, type RelayHubMember } from './relay-hub-util';
|
|
3
|
+
import { type Live, type MessageBody } from './relay-hubs-live';
|
|
4
|
+
import type { RelayHubsOptions, RelayRoomEvent, RelayRoomRecord, RelayRoomRequest, RelayRoomStatus } from './relay-hubs-protocol';
|
|
3
5
|
import { type RelayIdentity, type RelayPublicIdentity } from './relay-identity';
|
|
4
|
-
import { type RelayHubEntry, type RelayHubFailure, type RelayHubRequest } from './relay-protocol';
|
|
5
|
-
/** What a member sends in a message, signed and sealed: data of an extension, or a word of Ta itself. */
|
|
6
|
-
export interface MessageBody {
|
|
7
|
-
d?: unknown;
|
|
8
|
-
/** A member's new name, for the owner to put in the roster; with its look (RelayPublicIdentity.look), '' for none. */
|
|
9
|
-
name?: string;
|
|
10
|
-
look?: string;
|
|
11
|
-
/** Asks the one it is sent to to be friends: the link of the sender's room of friends (RelayFriends.offer). */
|
|
12
|
-
friend?: string;
|
|
13
|
-
}
|
|
14
|
-
export interface StateBody {
|
|
15
|
-
key: string;
|
|
16
|
-
value: unknown;
|
|
17
|
-
}
|
|
18
|
-
/** How long a call waits for the room to be connected, or for the relay to answer. */
|
|
19
|
-
export declare const READY_MS = 15000;
|
|
20
|
-
export declare const OPEN = 1;
|
|
21
|
-
/** A room as this Ta holds it while it runs: its connection and what it knows of the room. */
|
|
22
|
-
export declare class Live {
|
|
23
|
-
record: RelayRoomRecord;
|
|
24
|
-
socket?: WebSocket;
|
|
25
|
-
keys?: RelayHubKeys;
|
|
26
|
-
synced: boolean;
|
|
27
|
-
online: Set<string>;
|
|
28
|
-
roster?: RelayHubRosterBody;
|
|
29
|
-
readonly state: Map<string, RelayRoomValue>;
|
|
30
|
-
/** Asks to join, with the invitation each came with. */
|
|
31
|
-
readonly asks: Map<string, {
|
|
32
|
-
body: RelayHubAskBody;
|
|
33
|
-
invite: string;
|
|
34
|
-
}>;
|
|
35
|
-
readonly done: Map<number, (result: {
|
|
36
|
-
ok: boolean;
|
|
37
|
-
v: number;
|
|
38
|
-
error?: RelayHubFailure;
|
|
39
|
-
}) => void>;
|
|
40
|
-
readonly ready: Array<() => void>;
|
|
41
|
-
attempts: number;
|
|
42
|
-
/** Connect again at once, whatever the close said. */
|
|
43
|
-
retry: boolean;
|
|
44
|
-
timer?: ReturnType<typeof setTimeout>;
|
|
45
|
-
pingTimer?: ReturnType<typeof setInterval>;
|
|
46
|
-
awaitingPong: boolean;
|
|
47
|
-
/** The look this Ta last sent the owner, for the roster to say: once, whatever the owner does with it. */
|
|
48
|
-
toldLook?: string;
|
|
49
|
-
/** Events are handled one after another: opening them is async. */
|
|
50
|
-
chain: Promise<void>;
|
|
51
|
-
constructor(record: RelayRoomRecord);
|
|
52
|
-
}
|
|
6
|
+
import { type RelayHubEntry, type RelayHubFailure, type RelayHubRequest, type RelayHubRoster } from './relay-protocol';
|
|
53
7
|
/**
|
|
54
8
|
* The half of {@link RelayHubs} that keeps a connection to the hub of each room and reads what comes over it:
|
|
55
9
|
* connecting again, the welcome, the roster, the state and the messages, each opened and checked against the
|
|
@@ -74,12 +28,15 @@ export declare abstract class RelayHubsConnection {
|
|
|
74
28
|
protected ready(live: Live): Promise<void>;
|
|
75
29
|
protected request(live: Live, request: RelayHubRequest): void;
|
|
76
30
|
protected sendBody(live: Live, body: MessageBody, to?: string): Promise<void>;
|
|
77
|
-
/**
|
|
78
|
-
protected
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
31
|
+
/** Whether this Ta lets in, takes out and invites: the owner, or an admin of the charter. */
|
|
32
|
+
protected manages(live: Live): boolean;
|
|
33
|
+
protected isAdmin(live: Live, member: string): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* The roster with `change` made, its version one more, signed by this Ta (the owner, or an admin). The owner's
|
|
36
|
+
* carries `charter` when it changes it, else the charter of before, its admins still members; an admin's, the one it has.
|
|
37
|
+
*/
|
|
38
|
+
protected nextRoster(live: Live, change: (members: RelayHubMember[]) => RelayHubMember[], charter?: RelayHubCharterBody, rekey?: boolean): Promise<RelayHubRoster>;
|
|
39
|
+
protected writeRoster(live: Live, change: (members: RelayHubMember[]) => RelayHubMember[], charter?: RelayHubCharterBody, rekey?: boolean): Promise<void>;
|
|
83
40
|
protected connect(live: Live): void;
|
|
84
41
|
protected hello(live: Live, socket: WebSocket): Promise<void>;
|
|
85
42
|
protected closed(live: Live, code: number): void;
|
|
@@ -96,16 +53,17 @@ export declare abstract class RelayHubsConnection {
|
|
|
96
53
|
protected heardMembers(_members: RelayPublicIdentity[]): void;
|
|
97
54
|
/** A member asks the user to be friends, by the link of its room of friends. */
|
|
98
55
|
protected offered(_live: Live, _from: RelayPublicIdentity, _link: string): void;
|
|
99
|
-
protected readRoster(live: Live,
|
|
100
|
-
/**
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
protected keepLook(live: Live): Promise<void>;
|
|
56
|
+
protected readRoster(live: Live, roster: RelayHubRoster): Promise<void>;
|
|
57
|
+
/** The roster says this Ta as it is now: its look (RelayHubsIdentity). */
|
|
58
|
+
protected keepLook(_live: Live): Promise<void>;
|
|
59
|
+
/** The state of the room has this Ta's picture as it is now (RelayHubs). */
|
|
60
|
+
protected keepPicture(_live: Live): Promise<void>;
|
|
105
61
|
protected guestOf(live: Live, member: string): boolean;
|
|
106
62
|
protected signOf(live: Live): (member: string) => string | undefined;
|
|
107
63
|
protected readEntry(live: Live, entry: RelayHubEntry, tell: boolean): Promise<void>;
|
|
108
64
|
protected readMessage(live: Live, from: string, sealed: string): Promise<void>;
|
|
65
|
+
/** A member set a key naming another: the owner clears it (RelayHubs). */
|
|
66
|
+
protected foreignSet(_live: Live, _key: string): void;
|
|
109
67
|
/** Ids of those the user chose as friends. */
|
|
110
68
|
protected friendIds(): Set<string>;
|
|
111
69
|
protected readRooms(): RelayRoomRecord[];
|
|
@@ -1,38 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RelayHubsConnection =
|
|
3
|
+
exports.RelayHubsConnection = void 0;
|
|
4
4
|
const relay_friends_1 = require("./relay-friends");
|
|
5
5
|
const relay_hub_1 = require("./relay-hub");
|
|
6
|
+
const relay_hub_charter_1 = require("./relay-hub-charter");
|
|
7
|
+
const relay_hub_epochs_1 = require("./relay-hub-epochs");
|
|
6
8
|
const relay_hub_util_1 = require("./relay-hub-util");
|
|
9
|
+
const relay_hubs_live_1 = require("./relay-hubs-live");
|
|
10
|
+
const relay_hubs_util_1 = require("./relay-hubs-util");
|
|
7
11
|
const relay_identity_1 = require("./relay-identity");
|
|
8
12
|
const relay_pairing_1 = require("./relay-pairing");
|
|
9
13
|
const relay_protocol_1 = require("./relay-protocol");
|
|
10
14
|
const relay_room_chat_1 = require("./relay-room-chat");
|
|
11
|
-
const MAX_RECONNECT_MS = 30000;
|
|
12
|
-
const SKEW_MS = 5 * 60 * 1000;
|
|
13
|
-
/** How long a call waits for the room to be connected, or for the relay to answer. */
|
|
14
|
-
exports.READY_MS = 15000;
|
|
15
|
-
exports.OPEN = 1;
|
|
16
|
-
/** A room as this Ta holds it while it runs: its connection and what it knows of the room. */
|
|
17
|
-
class Live {
|
|
18
|
-
constructor(record) {
|
|
19
|
-
this.record = record;
|
|
20
|
-
this.synced = false;
|
|
21
|
-
this.online = new Set();
|
|
22
|
-
this.state = new Map();
|
|
23
|
-
/** Asks to join, with the invitation each came with. */
|
|
24
|
-
this.asks = new Map();
|
|
25
|
-
this.done = new Map();
|
|
26
|
-
this.ready = [];
|
|
27
|
-
this.attempts = 0;
|
|
28
|
-
/** Connect again at once, whatever the close said. */
|
|
29
|
-
this.retry = false;
|
|
30
|
-
this.awaitingPong = false;
|
|
31
|
-
/** Events are handled one after another: opening them is async. */
|
|
32
|
-
this.chain = Promise.resolve();
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
exports.Live = Live;
|
|
36
15
|
/**
|
|
37
16
|
* The half of {@link RelayHubs} that keeps a connection to the hub of each room and reads what comes over it:
|
|
38
17
|
* connecting again, the welcome, the roster, the state and the messages, each opened and checked against the
|
|
@@ -85,11 +64,11 @@ class RelayHubsConnection {
|
|
|
85
64
|
/** Resolves once the room is connected and has its state; rejects after a while. */
|
|
86
65
|
ready(live) {
|
|
87
66
|
var _a;
|
|
88
|
-
if (((_a = live.socket) === null || _a === void 0 ? void 0 : _a.readyState) ===
|
|
67
|
+
if (((_a = live.socket) === null || _a === void 0 ? void 0 : _a.readyState) === relay_hubs_live_1.OPEN && live.synced) {
|
|
89
68
|
return Promise.resolve();
|
|
90
69
|
}
|
|
91
70
|
return new Promise((resolve, reject) => {
|
|
92
|
-
const timer = setTimeout(() => reject(new Error('The room cannot be reached now.')),
|
|
71
|
+
const timer = setTimeout(() => reject(new Error('The room cannot be reached now.')), relay_hubs_live_1.READY_MS);
|
|
93
72
|
live.ready.push(() => {
|
|
94
73
|
clearTimeout(timer);
|
|
95
74
|
resolve();
|
|
@@ -98,7 +77,7 @@ class RelayHubsConnection {
|
|
|
98
77
|
}
|
|
99
78
|
request(live, request) {
|
|
100
79
|
var _a;
|
|
101
|
-
if (((_a = live.socket) === null || _a === void 0 ? void 0 : _a.readyState) !==
|
|
80
|
+
if (((_a = live.socket) === null || _a === void 0 ? void 0 : _a.readyState) !== relay_hubs_live_1.OPEN) {
|
|
102
81
|
throw new Error('The room cannot be reached now.');
|
|
103
82
|
}
|
|
104
83
|
live.socket.send(JSON.stringify(request));
|
|
@@ -106,22 +85,51 @@ class RelayHubsConnection {
|
|
|
106
85
|
async sendBody(live, body, to) {
|
|
107
86
|
await this.ready(live);
|
|
108
87
|
const identity = await this.identityOf(live);
|
|
109
|
-
const d = await relay_hub_util_1.RelayHubUtil.
|
|
88
|
+
const d = await relay_hub_util_1.RelayHubUtil.sealIn(live.keys, identity, live.record.member, body);
|
|
110
89
|
this.request(live, { t: 'send', d, ...(to ? { to } : {}) });
|
|
111
90
|
}
|
|
112
|
-
/**
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
91
|
+
/** Whether this Ta lets in, takes out and invites: the owner, or an admin of the charter. */
|
|
92
|
+
manages(live) {
|
|
93
|
+
return live.record.own || this.isAdmin(live, live.record.member);
|
|
94
|
+
}
|
|
95
|
+
isAdmin(live, member) {
|
|
96
|
+
var _a;
|
|
97
|
+
return !!((_a = live.charter) === null || _a === void 0 ? void 0 : _a.admins.some(admin => admin.member === member));
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* The roster with `change` made, its version one more, signed by this Ta (the owner, or an admin). The owner's
|
|
101
|
+
* carries `charter` when it changes it, else the charter of before, its admins still members; an admin's, the one it has.
|
|
102
|
+
*/
|
|
103
|
+
async nextRoster(live, change, charter, rekey = false) {
|
|
104
|
+
var _a, _b, _c, _d;
|
|
105
|
+
var _e, _f, _g;
|
|
116
106
|
const identity = await this.identityOf(live);
|
|
117
|
-
const
|
|
118
|
-
|
|
107
|
+
const members = change((_e = (_a = live.roster) === null || _a === void 0 ? void 0 : _a.members) !== null && _e !== void 0 ? _e : []);
|
|
108
|
+
let sealed = (_b = live.roster) === null || _b === void 0 ? void 0 : _b.charter;
|
|
109
|
+
if (live.record.own) {
|
|
110
|
+
const base = charter !== null && charter !== void 0 ? charter : live.charter;
|
|
111
|
+
const admins = base === null || base === void 0 ? void 0 : base.admins.filter(admin => members.some(member => member.member === admin.member && member.id === admin.id && !member.guest));
|
|
112
|
+
if (base && admins && (charter || admins.length !== base.admins.length)) {
|
|
113
|
+
const next = { ...base, admins, v: Math.max(base.v, (_f = (_c = live.charter) === null || _c === void 0 ? void 0 : _c.v) !== null && _f !== void 0 ? _f : 0) + 1 };
|
|
114
|
+
sealed = await relay_hub_charter_1.RelayHubCharterUtil.seal(identity, next);
|
|
115
|
+
live.charter = next;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
const body = { v: ((_g = (_d = live.roster) === null || _d === void 0 ? void 0 : _d.v) !== null && _g !== void 0 ? _g : 0) + 1, members, ...(sealed ? { charter: sealed } : {}) };
|
|
119
|
+
// A new epoch once one is taken out or leaves (docs/design/ta-link.md 8.7): taken on when the roster comes back.
|
|
120
|
+
const { record } = live;
|
|
121
|
+
const epochs = rekey ? relay_hub_epochs_1.RelayHubEpochs.next(record.epochs) : record.epochs;
|
|
122
|
+
const keys = rekey ? await relay_hub_util_1.RelayHubUtil.keys(record.key, epochs) : live.keys;
|
|
123
|
+
const d = await relay_hub_util_1.RelayHubUtil.sealIn(keys, identity, record.member, body);
|
|
124
|
+
const k = epochs && relay_hub_epochs_1.RelayHubEpochs.latest(epochs)
|
|
125
|
+
? await relay_hub_epochs_1.RelayHubEpochs.seal(identity, record.member, record.id, epochs, members, live.sealedEpochs)
|
|
126
|
+
: undefined;
|
|
119
127
|
live.roster = body;
|
|
120
|
-
return { v: body.v, d };
|
|
128
|
+
return { v: body.v, d, ...(k ? { k } : {}) };
|
|
121
129
|
}
|
|
122
|
-
async writeRoster(live, change) {
|
|
130
|
+
async writeRoster(live, change, charter, rekey = false) {
|
|
123
131
|
await this.ready(live);
|
|
124
|
-
this.request(live, { t: 'roster', roster: await this.nextRoster(live, change) });
|
|
132
|
+
this.request(live, { t: 'roster', roster: await this.nextRoster(live, change, charter, rekey) });
|
|
125
133
|
}
|
|
126
134
|
connect(live) {
|
|
127
135
|
if (this.stopped) {
|
|
@@ -182,10 +190,10 @@ class RelayHubsConnection {
|
|
|
182
190
|
};
|
|
183
191
|
}
|
|
184
192
|
else {
|
|
185
|
-
(_a = live.keys) !== null && _a !== void 0 ? _a : (live.keys = await relay_hub_util_1.RelayHubUtil.keys(record.key));
|
|
193
|
+
(_a = live.keys) !== null && _a !== void 0 ? _a : (live.keys = await relay_hub_util_1.RelayHubUtil.keys(record.key, record.epochs));
|
|
186
194
|
request = { t: record.own && !record.made ? 'create' : 'auth', member: record.member, token: record.token };
|
|
187
195
|
}
|
|
188
|
-
if (socket.readyState ===
|
|
196
|
+
if (socket.readyState === relay_hubs_live_1.OPEN) {
|
|
189
197
|
socket.send(JSON.stringify(request));
|
|
190
198
|
}
|
|
191
199
|
}
|
|
@@ -211,7 +219,7 @@ class RelayHubsConnection {
|
|
|
211
219
|
if (record.status !== 'member' && record.status !== 'waiting') {
|
|
212
220
|
return;
|
|
213
221
|
}
|
|
214
|
-
const delay = Math.min(((_a = this.options.reconnectDelayMs) !== null && _a !== void 0 ? _a : 1000) * 2 ** live.attempts, MAX_RECONNECT_MS);
|
|
222
|
+
const delay = Math.min(((_a = this.options.reconnectDelayMs) !== null && _a !== void 0 ? _a : 1000) * 2 ** live.attempts, relay_hubs_live_1.MAX_RECONNECT_MS);
|
|
215
223
|
live.attempts++;
|
|
216
224
|
clearTimeout(live.timer);
|
|
217
225
|
live.timer = setTimeout(() => this.connect(live), delay);
|
|
@@ -243,7 +251,7 @@ class RelayHubsConnection {
|
|
|
243
251
|
live.online = new Set(event.online);
|
|
244
252
|
live.asks.clear();
|
|
245
253
|
if (event.roster) {
|
|
246
|
-
await this.readRoster(live, event.roster
|
|
254
|
+
await this.readRoster(live, event.roster);
|
|
247
255
|
}
|
|
248
256
|
for (const ask of (_b = event.asks) !== null && _b !== void 0 ? _b : []) {
|
|
249
257
|
await this.asked(live, ask.d, false);
|
|
@@ -282,7 +290,7 @@ class RelayHubsConnection {
|
|
|
282
290
|
this.emit({ type: 'rooms' });
|
|
283
291
|
return;
|
|
284
292
|
case 'roster':
|
|
285
|
-
await this.readRoster(live, event.roster
|
|
293
|
+
await this.readRoster(live, event.roster);
|
|
286
294
|
this.emit({ type: 'rooms' });
|
|
287
295
|
return;
|
|
288
296
|
case 'asked':
|
|
@@ -290,8 +298,9 @@ class RelayHubsConnection {
|
|
|
290
298
|
return;
|
|
291
299
|
case 'left':
|
|
292
300
|
live.online.delete(event.member);
|
|
293
|
-
|
|
294
|
-
|
|
301
|
+
// An admin's roster keeps every admin: one who left goes from it when the owner writes it.
|
|
302
|
+
if (record.own || (this.manages(live) && !this.isAdmin(live, event.member))) {
|
|
303
|
+
await this.writeRoster(live, members => members.filter(member => member.member !== event.member), undefined, true).catch(() => undefined);
|
|
295
304
|
}
|
|
296
305
|
this.emit({ type: 'rooms' });
|
|
297
306
|
return;
|
|
@@ -335,6 +344,7 @@ class RelayHubsConnection {
|
|
|
335
344
|
live.record = { ...live.record, status, ...(reason ? { reason } : {}) };
|
|
336
345
|
if (status !== 'member' && status !== 'waiting') {
|
|
337
346
|
delete live.record.key;
|
|
347
|
+
delete live.record.epochs;
|
|
338
348
|
delete live.record.invite;
|
|
339
349
|
this.disconnect(live);
|
|
340
350
|
}
|
|
@@ -351,9 +361,11 @@ class RelayHubsConnection {
|
|
|
351
361
|
this.setStatus(live, 'gone', 'invite');
|
|
352
362
|
return;
|
|
353
363
|
}
|
|
364
|
+
const epochs = relay_hub_epochs_1.RelayHubEpochs.kept(opened.body.epochs && typeof opened.body.epochs === 'object' ? opened.body.epochs : {});
|
|
354
365
|
live.record = {
|
|
355
366
|
...record,
|
|
356
367
|
key: opened.body.key,
|
|
368
|
+
...(Object.keys(epochs).length ? { epochs } : {}),
|
|
357
369
|
kind: relay_friends_1.RelayFriendsUtil.kindOf(String(opened.body.kind)),
|
|
358
370
|
title: String(opened.body.title).slice(0, 80),
|
|
359
371
|
...(opened.body.view ? { view: String(opened.body.view) } : {}),
|
|
@@ -364,7 +376,7 @@ class RelayHubsConnection {
|
|
|
364
376
|
};
|
|
365
377
|
delete live.record.invite;
|
|
366
378
|
delete live.record.asked;
|
|
367
|
-
live.keys = await relay_hub_util_1.RelayHubUtil.keys(opened.body.key);
|
|
379
|
+
live.keys = await relay_hub_util_1.RelayHubUtil.keys(opened.body.key, live.record.epochs);
|
|
368
380
|
this.save();
|
|
369
381
|
this.emit({ type: 'rooms' });
|
|
370
382
|
}
|
|
@@ -392,63 +404,58 @@ class RelayHubsConnection {
|
|
|
392
404
|
heardMembers(_members) { }
|
|
393
405
|
/** A member asks the user to be friends, by the link of its room of friends. */
|
|
394
406
|
offered(_live, _from, _link) { }
|
|
395
|
-
async readRoster(live,
|
|
407
|
+
async readRoster(live, roster) {
|
|
396
408
|
var _a;
|
|
397
|
-
|
|
398
|
-
const
|
|
409
|
+
var _b, _c, _d, _e;
|
|
410
|
+
const { record } = live;
|
|
411
|
+
const owner = record.owner;
|
|
412
|
+
const keys = (_b = live.keys) !== null && _b !== void 0 ? _b : (record.key ? await relay_hub_util_1.RelayHubUtil.keys(record.key, record.epochs) : undefined);
|
|
399
413
|
if (!keys || !owner.sign) {
|
|
400
414
|
return;
|
|
401
415
|
}
|
|
402
416
|
live.keys = keys;
|
|
403
|
-
//
|
|
404
|
-
|
|
405
|
-
const
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
});
|
|
409
|
-
if (!
|
|
417
|
+
// Sealed in an epoch this Ta lacks: its keys, sealed for it by the one who wrote the roster (docs/design/ta-link.md 8.7).
|
|
418
|
+
const epoch = relay_hub_epochs_1.RelayHubEpochs.epochOf(roster.d);
|
|
419
|
+
const taken = keys.ring.has(epoch) ? undefined : await relay_hub_epochs_1.RelayHubEpochs.open(await this.identityOf(live), record.member, record.id, epoch, roster.k);
|
|
420
|
+
const tried = taken ? await relay_hub_util_1.RelayHubUtil.keys(record.key, { ...record.epochs, ...taken.epochs }) : keys;
|
|
421
|
+
// Signed by the owner, or by an admin its charter names for a change of members alone.
|
|
422
|
+
const opened = await relay_hub_charter_1.RelayHubCharterUtil.openRoster(tried, roster.d, { id: owner.id, sign: owner.sign }, record.id);
|
|
423
|
+
if (!opened ||
|
|
424
|
+
opened.body.v < Math.max((_c = (_a = live.roster) === null || _a === void 0 ? void 0 : _a.v) !== null && _c !== void 0 ? _c : 0, (_d = record.rosterV) !== null && _d !== void 0 ? _d : 0) ||
|
|
425
|
+
(live.charter && opened.charter && opened.charter.v < live.charter.v) ||
|
|
426
|
+
(opened.byAdmin && !relay_hub_charter_1.RelayHubCharterUtil.adminMay(opened, live.roster && { members: live.roster.members, charter: live.charter })) ||
|
|
427
|
+
(taken && !relay_hub_epochs_1.RelayHubEpochs.sealedBy(taken.sealer, opened))) {
|
|
410
428
|
return;
|
|
411
429
|
}
|
|
412
|
-
const members =
|
|
413
|
-
|
|
414
|
-
|
|
430
|
+
const members = opened.body.members;
|
|
431
|
+
live.roster = opened.body;
|
|
432
|
+
live.charter = opened.charter;
|
|
433
|
+
if (taken || ((_e = record.rosterV) !== null && _e !== void 0 ? _e : 0) < opened.body.v) {
|
|
434
|
+
record.rosterV = opened.body.v;
|
|
435
|
+
if (taken) {
|
|
436
|
+
record.epochs = relay_hub_epochs_1.RelayHubEpochs.kept({ ...record.epochs, ...taken.epochs });
|
|
437
|
+
live.keys = tried;
|
|
438
|
+
}
|
|
439
|
+
this.save();
|
|
440
|
+
}
|
|
441
|
+
if (record.own && opened.byAdmin) {
|
|
442
|
+
// Signed again by the owner: a Ta of before checks the roster against the owner alone.
|
|
443
|
+
void this.writeRoster(live, same => same).catch(() => undefined);
|
|
415
444
|
}
|
|
416
|
-
live.roster = { v: signed.b.v, members };
|
|
417
445
|
const own = (await this.identityOf(live)).id;
|
|
418
446
|
this.heardMembers(members.filter(member => member.id !== own && !member.guest));
|
|
419
|
-
if (!members.some(member => member.member ===
|
|
447
|
+
if (!members.some(member => member.member === record.member) && !record.own && record.status === 'member') {
|
|
420
448
|
this.setStatus(live, 'gone', 'removed');
|
|
421
449
|
return;
|
|
422
450
|
}
|
|
423
451
|
// Not awaited: what it sends waits for the room to be ready, which may wait for this event.
|
|
424
452
|
void this.keepLook(live);
|
|
453
|
+
void this.keepPicture(live).catch(() => undefined);
|
|
425
454
|
}
|
|
426
|
-
/**
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
async keepLook(live) {
|
|
431
|
-
var _a, _b;
|
|
432
|
-
if (live.record.status !== 'member' || live.record.identity || !live.roster) {
|
|
433
|
-
return;
|
|
434
|
-
}
|
|
435
|
-
const identity = await this.identity();
|
|
436
|
-
const look = (_a = identity.look) !== null && _a !== void 0 ? _a : '';
|
|
437
|
-
const self = live.roster.members.find(member => member.member === live.record.member);
|
|
438
|
-
if (!self || ((_b = self.look) !== null && _b !== void 0 ? _b : '') === look) {
|
|
439
|
-
return;
|
|
440
|
-
}
|
|
441
|
-
if (live.record.own) {
|
|
442
|
-
await this.writeRoster(live, members => members.map(member => (member.member === self.member ? relay_identity_1.RelayIdentityUtil.withLook(member, look) : member))).catch(() => undefined);
|
|
443
|
-
return;
|
|
444
|
-
}
|
|
445
|
-
const owner = live.roster.members.find(member => member.owner);
|
|
446
|
-
if (owner && live.toldLook !== look) {
|
|
447
|
-
await this.sendBody(live, { name: identity.name, look }, owner.member).then(() => {
|
|
448
|
-
live.toldLook = look;
|
|
449
|
-
}, () => undefined);
|
|
450
|
-
}
|
|
451
|
-
}
|
|
455
|
+
/** The roster says this Ta as it is now: its look (RelayHubsIdentity). */
|
|
456
|
+
async keepLook(_live) { }
|
|
457
|
+
/** The state of the room has this Ta's picture as it is now (RelayHubs). */
|
|
458
|
+
async keepPicture(_live) { }
|
|
452
459
|
guestOf(live, member) {
|
|
453
460
|
var _a, _b;
|
|
454
461
|
return !!((_b = (_a = live.roster) === null || _a === void 0 ? void 0 : _a.members.find(other => other.member === member)) === null || _b === void 0 ? void 0 : _b.guest);
|
|
@@ -457,11 +464,12 @@ class RelayHubsConnection {
|
|
|
457
464
|
return member => { var _a, _b; return (_b = (_a = live.roster) === null || _a === void 0 ? void 0 : _a.members.find(other => other.member === member)) === null || _b === void 0 ? void 0 : _b.sign; };
|
|
458
465
|
}
|
|
459
466
|
async readEntry(live, entry, tell) {
|
|
460
|
-
var _a
|
|
467
|
+
var _a;
|
|
468
|
+
var _b, _c, _d;
|
|
461
469
|
if (!live.keys) {
|
|
462
470
|
return;
|
|
463
471
|
}
|
|
464
|
-
const signed = await relay_hub_util_1.RelayHubUtil.
|
|
472
|
+
const signed = await relay_hub_util_1.RelayHubUtil.openIn(live.keys, entry.d, this.signOf(live));
|
|
465
473
|
if (!signed || signed.m !== entry.by || typeof signed.b.key !== 'string' || (await relay_hub_util_1.RelayHubUtil.keyId(live.keys, signed.b.key)) !== entry.k) {
|
|
466
474
|
return;
|
|
467
475
|
}
|
|
@@ -469,9 +477,14 @@ class RelayHubsConnection {
|
|
|
469
477
|
if (before && before.version >= entry.v) {
|
|
470
478
|
return;
|
|
471
479
|
}
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
480
|
+
const foreign = relay_hubs_util_1.RelayHubsUtil.foreign((_b = (_a = live.roster) === null || _a === void 0 ? void 0 : _a.members) !== null && _b !== void 0 ? _b : [], signed.b.key, entry.by, signed.b.value);
|
|
481
|
+
if (foreign || (this.guestOf(live, entry.by) && !signed.b.key.startsWith(relay_room_chat_1.RELAY_CHAT_KEY))) {
|
|
482
|
+
// A guest only chats; a key naming a member is theirs alone (docs/design/ta-link.md 8.8): what else was set is
|
|
483
|
+
// not taken, its version kept, so that setting it again goes on that. The owner clears another's write there.
|
|
484
|
+
live.state.set(signed.b.key, { value: (_c = before === null || before === void 0 ? void 0 : before.value) !== null && _c !== void 0 ? _c : null, version: entry.v, by: (_d = before === null || before === void 0 ? void 0 : before.by) !== null && _d !== void 0 ? _d : entry.by });
|
|
485
|
+
if (foreign && live.record.own && signed.b.value !== null) {
|
|
486
|
+
this.foreignSet(live, signed.b.key);
|
|
487
|
+
}
|
|
475
488
|
return;
|
|
476
489
|
}
|
|
477
490
|
live.state.set(signed.b.key, { value: signed.b.value, version: entry.v, by: entry.by });
|
|
@@ -485,7 +498,7 @@ class RelayHubsConnection {
|
|
|
485
498
|
if (!live.keys) {
|
|
486
499
|
return;
|
|
487
500
|
}
|
|
488
|
-
const signed = await relay_hub_util_1.RelayHubUtil.
|
|
501
|
+
const signed = await relay_hub_util_1.RelayHubUtil.openIn(live.keys, sealed, this.signOf(live), { skewMs: relay_hubs_live_1.SKEW_MS });
|
|
489
502
|
if (!signed || signed.m !== from) {
|
|
490
503
|
return;
|
|
491
504
|
}
|
|
@@ -511,6 +524,8 @@ class RelayHubsConnection {
|
|
|
511
524
|
}
|
|
512
525
|
this.emit({ type: 'message', room: live.record.id, from, name: (_b = sender === null || sender === void 0 ? void 0 : sender.name) !== null && _b !== void 0 ? _b : '', data: signed.b.d });
|
|
513
526
|
}
|
|
527
|
+
/** A member set a key naming another: the owner clears it (RelayHubs). */
|
|
528
|
+
foreignSet(_live, _key) { }
|
|
514
529
|
/** Ids of those the user chose as friends. */
|
|
515
530
|
friendIds() {
|
|
516
531
|
return new Set();
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type RelayFriends } from './relay-friends';
|
|
2
2
|
import { RelayHubsConnection } from './relay-hubs-connection';
|
|
3
|
+
import { Live } from './relay-hubs-live';
|
|
3
4
|
import type { RelayIdentityBundle, RelayIdentityImport, RelayRoomRecord } from './relay-hubs-protocol';
|
|
4
5
|
import { type RelayIdentity, type RelayPublicIdentity } from './relay-identity';
|
|
5
6
|
export declare abstract class RelayHubsIdentity extends RelayHubsConnection {
|
|
6
7
|
protected abstract readonly book: RelayFriends;
|
|
8
|
+
abstract setState(roomId: string, key: string, value: unknown, version?: number): Promise<{
|
|
9
|
+
ok: boolean;
|
|
10
|
+
version: number;
|
|
11
|
+
}>;
|
|
7
12
|
/** The name others see; the owners of rooms this Ta is in hear it. */
|
|
8
13
|
setName(name: string): Promise<RelayPublicIdentity>;
|
|
9
14
|
/**
|
|
@@ -11,6 +16,29 @@ export declare abstract class RelayHubsIdentity extends RelayHubsConnection {
|
|
|
11
16
|
* look that is none. The owners of rooms this Ta is in hear it, as a name.
|
|
12
17
|
*/
|
|
13
18
|
setLook(look: string | undefined): Promise<RelayPublicIdentity>;
|
|
19
|
+
/**
|
|
20
|
+
* The picture others see of the user (RelayIdentity.picture), or with null none, the dinosaur of the look again: put
|
|
21
|
+
* in the rooms this Ta is in now, and in those it connects to later.
|
|
22
|
+
*/
|
|
23
|
+
setPicture(picture: string | null): Promise<RelayIdentity>;
|
|
24
|
+
/**
|
|
25
|
+
* The roster says this Ta as it is now: its look, set while the room was away or the owner offline. The owner writes it,
|
|
26
|
+
* a member tells the owner, once a connection. A room joined with another identity keeps that one's.
|
|
27
|
+
*/
|
|
28
|
+
protected keepLook(live: Live): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Puts this Ta's picture (RelayIdentity.picture) in the state of a room it is in, or clears it there, once the room is
|
|
31
|
+
* ready: in a room of friends only its own, where its friends read it; not in a room joined with another identity.
|
|
32
|
+
*/
|
|
33
|
+
protected keepPicture(live: Live): Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* The pictures of the Ta this one knows from its rooms, by the id of each (RelayIdentity.picture), its own among them:
|
|
36
|
+
* what each member put in a room under its member id, the one a Ta put in a room it owns (its room of friends) first.
|
|
37
|
+
*/
|
|
38
|
+
pictures(): Promise<{
|
|
39
|
+
self: string;
|
|
40
|
+
pictures: Record<string, string>;
|
|
41
|
+
}>;
|
|
14
42
|
/** Keeps the identity with a new name or look, and tells the rooms this Ta is in. */
|
|
15
43
|
protected changeSelf(identity: RelayIdentity): Promise<RelayPublicIdentity>;
|
|
16
44
|
/** What makes this Ta who it is in rooms, private keys and all (RelayIdentityBundle): for the user's own computers alone. */
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RelayHubsIdentity = void 0;
|
|
4
|
+
const relay_friends_1 = require("./relay-friends");
|
|
4
5
|
const relay_hubs_connection_1 = require("./relay-hubs-connection");
|
|
6
|
+
const relay_hubs_live_1 = require("./relay-hubs-live");
|
|
5
7
|
const relay_hubs_util_1 = require("./relay-hubs-util");
|
|
6
8
|
const relay_identity_1 = require("./relay-identity");
|
|
9
|
+
const relay_protocol_1 = require("./relay-protocol");
|
|
7
10
|
class RelayHubsIdentity extends relay_hubs_connection_1.RelayHubsConnection {
|
|
8
11
|
/** The name others see; the owners of rooms this Ta is in hear it. */
|
|
9
12
|
async setName(name) {
|
|
@@ -22,6 +25,111 @@ class RelayHubsIdentity extends relay_hubs_connection_1.RelayHubsConnection {
|
|
|
22
25
|
const next = relay_identity_1.RelayIdentityUtil.withLook(identity, look);
|
|
23
26
|
return next.look === identity.look ? relay_identity_1.RelayIdentityUtil.publicOf(identity) : this.changeSelf(next);
|
|
24
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* The picture others see of the user (RelayIdentity.picture), or with null none, the dinosaur of the look again: put
|
|
30
|
+
* in the rooms this Ta is in now, and in those it connects to later.
|
|
31
|
+
*/
|
|
32
|
+
async setPicture(picture) {
|
|
33
|
+
var _a;
|
|
34
|
+
if (picture !== null && !relay_identity_1.RelayIdentityUtil.isPicture(picture)) {
|
|
35
|
+
throw new Error('A picture is a data URL of a PNG, JPEG, WebP or SVG, of 16 KB at most.');
|
|
36
|
+
}
|
|
37
|
+
const identity = { ...(await this.identity()) };
|
|
38
|
+
if (((_a = identity.picture) !== null && _a !== void 0 ? _a : null) !== picture) {
|
|
39
|
+
if (picture === null) {
|
|
40
|
+
delete identity.picture;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
identity.picture = picture;
|
|
44
|
+
}
|
|
45
|
+
this.options.store.write('identity', identity);
|
|
46
|
+
this.own = identity;
|
|
47
|
+
// The pages draw the user by it, and read it again.
|
|
48
|
+
this.emit({ type: 'rooms' });
|
|
49
|
+
}
|
|
50
|
+
for (const live of this.live.values()) {
|
|
51
|
+
void this.keepPicture(live).catch(() => undefined);
|
|
52
|
+
}
|
|
53
|
+
return identity;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The roster says this Ta as it is now: its look, set while the room was away or the owner offline. The owner writes it,
|
|
57
|
+
* a member tells the owner, once a connection. A room joined with another identity keeps that one's.
|
|
58
|
+
*/
|
|
59
|
+
async keepLook(live) {
|
|
60
|
+
var _a, _b;
|
|
61
|
+
if (live.record.status !== 'member' || live.record.identity || !live.roster) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const identity = await this.identity();
|
|
65
|
+
const look = (_a = identity.look) !== null && _a !== void 0 ? _a : '';
|
|
66
|
+
const self = live.roster.members.find(member => member.member === live.record.member);
|
|
67
|
+
if (!self || ((_b = self.look) !== null && _b !== void 0 ? _b : '') === look) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (live.record.own) {
|
|
71
|
+
await this.writeRoster(live, members => members.map(member => (member.member === self.member ? relay_identity_1.RelayIdentityUtil.withLook(member, look) : member))).catch(() => undefined);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const owner = live.roster.members.find(member => member.owner);
|
|
75
|
+
if (owner && live.toldLook !== look) {
|
|
76
|
+
await this.sendBody(live, { name: identity.name, look }, owner.member).then(() => {
|
|
77
|
+
live.toldLook = look;
|
|
78
|
+
}, () => undefined);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Puts this Ta's picture (RelayIdentity.picture) in the state of a room it is in, or clears it there, once the room is
|
|
83
|
+
* ready: in a room of friends only its own, where its friends read it; not in a room joined with another identity.
|
|
84
|
+
*/
|
|
85
|
+
async keepPicture(live) {
|
|
86
|
+
var _a, _b, _c;
|
|
87
|
+
const { record } = live;
|
|
88
|
+
if (record.status !== 'member' || record.identity || (relay_friends_1.RelayFriendsUtil.isKind(record.kind) && !record.own)) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
await this.ready(live);
|
|
92
|
+
const picture = (_a = (await this.identity()).picture) !== null && _a !== void 0 ? _a : null;
|
|
93
|
+
const key = relay_protocol_1.RELAY_PICTURE_KEY + record.member;
|
|
94
|
+
const kept = live.state.get(key);
|
|
95
|
+
if (live.record.status !== 'member' || ((_b = kept === null || kept === void 0 ? void 0 : kept.value) !== null && _b !== void 0 ? _b : null) === picture) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
await this.setState(record.id, key, picture, (_c = kept === null || kept === void 0 ? void 0 : kept.version) !== null && _c !== void 0 ? _c : 0);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* The pictures of the Ta this one knows from its rooms, by the id of each (RelayIdentity.picture), its own among them:
|
|
102
|
+
* what each member put in a room under its member id, the one a Ta put in a room it owns (its room of friends) first.
|
|
103
|
+
*/
|
|
104
|
+
async pictures() {
|
|
105
|
+
const own = await this.identity();
|
|
106
|
+
const pictures = {};
|
|
107
|
+
const owned = new Set();
|
|
108
|
+
for (const live of this.live.values()) {
|
|
109
|
+
if (live.record.status !== 'member' || !live.roster) {
|
|
110
|
+
continue;
|
|
111
|
+
}
|
|
112
|
+
for (const member of live.roster.members) {
|
|
113
|
+
const kept = live.state.get(relay_protocol_1.RELAY_PICTURE_KEY + member.member);
|
|
114
|
+
if (member.guest || (kept === null || kept === void 0 ? void 0 : kept.by) !== member.member || !relay_identity_1.RelayIdentityUtil.isPicture(kept.value) || owned.has(member.id)) {
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
if (!(member.id in pictures) || member.owner) {
|
|
118
|
+
pictures[member.id] = kept.value;
|
|
119
|
+
}
|
|
120
|
+
if (member.owner) {
|
|
121
|
+
owned.add(member.id);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (own.picture) {
|
|
126
|
+
pictures[own.id] = own.picture;
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
delete pictures[own.id];
|
|
130
|
+
}
|
|
131
|
+
return { self: own.id, pictures };
|
|
132
|
+
}
|
|
25
133
|
/** Keeps the identity with a new name or look, and tells the rooms this Ta is in. */
|
|
26
134
|
async changeSelf(identity) {
|
|
27
135
|
var _a;
|
|
@@ -114,7 +222,7 @@ class RelayHubsIdentity extends relay_hubs_connection_1.RelayHubsConnection {
|
|
|
114
222
|
}
|
|
115
223
|
const live = this.live.get(record.id);
|
|
116
224
|
if (!live) {
|
|
117
|
-
const added = new
|
|
225
|
+
const added = new relay_hubs_live_1.Live({ ...record });
|
|
118
226
|
this.live.set(record.id, added);
|
|
119
227
|
if (record.status === 'member' || record.status === 'waiting') {
|
|
120
228
|
this.connect(added);
|