| … | … | @@ -18,7 +18,7 @@ |
| 18 | 18 | * tracker.localKey // exchange via P2P for addWriter on the inviter |
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | | import { Room, createRoomPairing, joinRoomPairing, decodeRoomPairingInvite } from 'hyper-rooms' |
| 21 | import { Room, createRoomPairing, joinRoomPairing, resumeRoomPairing, decodeRoomPairingInvite } from 'hyper-rooms' |
| 22 | 22 | import { issuesSchema, DEFAULT_LABELS } from './schema.js' |
| 23 | 23 | |
| 24 | 24 | export class HyperIssues { |
| … | … | @@ -118,7 +118,21 @@ export class HyperIssues { |
| 118 | 118 | meta: { kind: 'repo', name: opts.name || null } |
| 119 | 119 | }) |
| 120 | 120 | this._pairings.set(pairing.invite, pairing) |
| 121 | | return { invitation: pairing.invite, close: pairing.close } |
| 121 | // descriptor lets the daemon persist + re-register this invite on restart. |
| 122 | return { invitation: pairing.invite, descriptor: pairing.descriptor, close: pairing.close } |
| 123 | } |
| 124 | |
| 125 | /** |
| 126 | * Re-register a persisted repo-invite pairing member after a restart so an |
| 127 | * already-shared invite keeps working. |
| 128 | * @param {object} descriptor from a prior createInvite() |
| 129 | * @param {object} swarm shared Hyperswarm (injected) |
| 130 | */ |
| 131 | resumePairing (descriptor, swarm) { |
| 132 | if (!swarm) throw new Error('resumePairing requires { swarm }') |
| 133 | const pairing = resumeRoomPairing(this._room, descriptor, swarm) |
| 134 | this._pairings.set(descriptor.invitation || ('repo:' + descriptor.discoveryKey), pairing) |
| 135 | return pairing |
| 122 | 136 | } |
| 123 | 137 | |
| 124 | 138 | async getWriter (userId) { |