braid-text 0.3.4 → 0.3.6
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/package.json +1 -1
- package/server.js +11 -7
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -476,16 +476,20 @@ function create_braid_text() {
|
|
|
476
476
|
accept_encoding:
|
|
477
477
|
req.headers['x-accept-encoding'] ??
|
|
478
478
|
req.headers['accept-encoding'],
|
|
479
|
-
subscribe:
|
|
479
|
+
subscribe: update => {
|
|
480
480
|
|
|
481
481
|
// this is a sanity/rhobustness check..
|
|
482
482
|
// ..this digest is checked on the client..
|
|
483
|
-
if (
|
|
484
|
-
|
|
483
|
+
if (update.version && v_eq(update.version, resource.version))
|
|
484
|
+
update["Repr-Digest"] = get_digest(resource.val)
|
|
485
485
|
|
|
486
|
-
|
|
486
|
+
if (update.patches && update.patches.length === 1) {
|
|
487
|
+
update.patch = update.patches[0]
|
|
488
|
+
delete update.patches
|
|
489
|
+
}
|
|
490
|
+
res.sendVersion(update)
|
|
487
491
|
},
|
|
488
|
-
write: (
|
|
492
|
+
write: (update) => res.write(update)
|
|
489
493
|
}
|
|
490
494
|
|
|
491
495
|
res.startSubscription({
|
|
@@ -3018,11 +3022,11 @@ class cursor_state {
|
|
|
3018
3022
|
for (var sub of this.subscribers)
|
|
3019
3023
|
if (sub.peer !== exclude_peer)
|
|
3020
3024
|
try { sub.res.sendUpdate({
|
|
3021
|
-
|
|
3025
|
+
patch: {
|
|
3022
3026
|
unit: 'json',
|
|
3023
3027
|
range: '[' + JSON.stringify(peer_id) + ']',
|
|
3024
3028
|
content: content
|
|
3025
|
-
}
|
|
3029
|
+
}
|
|
3026
3030
|
}) } catch (e) {}
|
|
3027
3031
|
}
|
|
3028
3032
|
|