braid-blob 0.0.8 → 0.0.10
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/index.js +9 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -31,12 +31,20 @@ braid_blob.serve = async (req, res, options = {}) => {
|
|
|
31
31
|
|
|
32
32
|
if (req.method === 'GET') {
|
|
33
33
|
// Handle GET request for binary files
|
|
34
|
-
res.setHeader('Current-Version', our_v != null ? `"${our_v}"` : '')
|
|
35
34
|
|
|
35
|
+
// Set Version header;
|
|
36
|
+
// but if this is a subscription,
|
|
37
|
+
// then we set Current-Version instead
|
|
38
|
+
res.setHeader((req.subscribe ? 'Current-' : '') + 'Version',
|
|
39
|
+
our_v != null ? `"${our_v}"` : '')
|
|
40
|
+
|
|
36
41
|
if (!req.subscribe)
|
|
37
42
|
return res.end(our_v != null ?
|
|
38
43
|
await fs.promises.readFile(filename) : '')
|
|
39
44
|
|
|
45
|
+
if (!res.hasHeader("editable"))
|
|
46
|
+
res.setHeader("Editable", "true")
|
|
47
|
+
|
|
40
48
|
// Start a subscription for future updates.
|
|
41
49
|
if (!key_to_subs[options.key]) key_to_subs[options.key] = new Map()
|
|
42
50
|
var peer = req.peer || Math.random().toString(36).slice(2)
|