secure-scuttlebot classic
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix cors so decent can upload blobs

+17 -2
+17 -2
lib/frontend.js
··· 74 74 return 75 75 } 76 76 77 + if (req.method === 'OPTIONS' && url === '/blobs/add') { 78 + res.writeHead(204, { 79 + 'Access-Control-Allow-Origin': '*', 80 + 'Access-Control-Allow-Methods': 'POST, OPTIONS', 81 + 'Access-Control-Allow-Headers': 'Content-Type' 82 + }) 83 + return res.end() 84 + } 85 + 77 86 if (req.method === 'POST' && url === '/blobs/add' && sbot.blobs && typeof sbot.blobs.add === 'function') { 78 87 return pull( 79 88 toPull.source(req), 80 89 sbot.blobs.add(function (err, hash) { 81 90 if (err) { 82 - res.writeHead(500, {'Content-Type': 'text/plain; charset=utf-8'}) 91 + res.writeHead(500, { 92 + 'Content-Type': 'text/plain; charset=utf-8', 93 + 'Access-Control-Allow-Origin': '*' 94 + }) 83 95 return res.end(err.message) 84 96 } 85 - res.writeHead(200, {'Content-Type': 'text/plain; charset=utf-8'}) 97 + res.writeHead(200, { 98 + 'Content-Type': 'text/plain; charset=utf-8', 99 + 'Access-Control-Allow-Origin': '*' 100 + }) 86 101 res.end(hash) 87 102 }) 88 103 )