statebus 7.0.8 → 7.0.9
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-library.js +5 -2
package/package.json
CHANGED
package/server-library.js
CHANGED
|
@@ -145,8 +145,11 @@ function import_server (bus, make_statebus, options)
|
|
|
145
145
|
// If this requests knows about Braid then we presume the programmer
|
|
146
146
|
// knows that any client might make this cross-origin request.
|
|
147
147
|
if (req.headers.version || req.headers.parents || req.headers.subscribe
|
|
148
|
+
|| req.headers.peer || req.headers['put-order']
|
|
148
149
|
|| req.method === 'OPTIONS')
|
|
149
150
|
free_the_cors(req, res)
|
|
151
|
+
if (req.method === 'OPTIONS')
|
|
152
|
+
return
|
|
150
153
|
|
|
151
154
|
// Initialize new clients with an id. We put the client id on
|
|
152
155
|
// req.client, and also in a cookie for the browser to see.
|
|
@@ -258,7 +261,7 @@ function import_server (bus, make_statebus, options)
|
|
|
258
261
|
if (req.headers.peer) {
|
|
259
262
|
let peer = req.headers.peer,
|
|
260
263
|
key = obj.key
|
|
261
|
-
var cb = cbus.http_callbacks[
|
|
264
|
+
var cb = cbus.http_callbacks && cbus.http_callbacks[
|
|
262
265
|
JSON.stringify({peer, key})
|
|
263
266
|
]
|
|
264
267
|
if (cb) cb.has_seen(cbus, key, t.version)
|
|
@@ -2535,7 +2538,7 @@ function free_the_cors (req, res, next) {
|
|
|
2535
2538
|
var free_the_cors = {
|
|
2536
2539
|
"Access-Control-Allow-Origin": "*",
|
|
2537
2540
|
"Access-Control-Allow-Methods": "OPTIONS, HEAD, GET, PUT, UNSUBSCRIBE",
|
|
2538
|
-
"Access-Control-Allow-Headers": "subscribe, peer, version, parents, merge-type, content-type, patches, cache-control"
|
|
2541
|
+
"Access-Control-Allow-Headers": "subscribe, peer, version, parents, merge-type, content-type, patches, cache-control, put-order"
|
|
2539
2542
|
}
|
|
2540
2543
|
Object.entries(free_the_cors).forEach(x => res.setHeader(x[0], x[1]))
|
|
2541
2544
|
if (req.method === 'OPTIONS') {
|