list-fetch
Advanced tools
Comparing version 28.0.1 to 28.0.2
14
index.js
@@ -257,3 +257,5 @@ module.exports = async function makeBTFetch (opts = {}) { | ||
} | ||
return sendTheData(signal, {status: 200, headers: {'X-Link': `bt://${mid.mainHost}${mid.mainPath}`, 'Link': `<bt://${mid.mainHost}${mid.mainPath}>; rel="canonical"`, 'Content-Length': String(torrentData.length), 'Content-Type': mainRes, ...useHeaders}, body: mainReq ? `<html><head><title>${mid.mainLink}</title></head><body><div>${JSON.stringify(torrentData.saved)}</div></body></html>` : JSON.stringify(torrentData.saved)}) | ||
useHeaders['X-Link'] = `bt://${torrentData.address || torrentData.infohash}${mid.mainPath}` | ||
useHeaders['Link'] = `<${useHeaders['X-Link']}>; rel="canonical"` | ||
return sendTheData(signal, {status: 200, headers: {'Content-Length': String(torrentData.length), 'Content-Type': mainRes, ...useHeaders}, body: mainReq ? `<html><head><title>${mid.mainLink}</title></head><body><div>${JSON.stringify(torrentData.saved)}</div></body></html>` : JSON.stringify(torrentData.saved)}) | ||
} else { | ||
@@ -272,3 +274,5 @@ const useOpts = { | ||
} | ||
return sendTheData(signal, { status: 200, headers: { 'X-Link': `bt://${mid.mainHost}${mid.mainPath}`, 'Link': `<bt://${mid.mainHost}${mid.mainPath}>; rel="canonical"`, 'Content-Length': String(torrentData.length), 'Content-Type': mainRes, ...useHeaders }, body: mainReq ? `<html><head><title>${mid.mainLink}</title></head><body><div>${JSON.stringify(torrentData.saved)}</div></body></html>` : JSON.stringify(torrentData.saved) }) | ||
useHeaders['X-Link'] = `bt://${torrentData.address || torrentData.infohash}${mid.mainPath}` | ||
useHeaders['Link'] = `<${useHeaders['X-Link']}>; rel="canonical"` | ||
return sendTheData(signal, { status: 200, headers: { 'Content-Length': String(torrentData.length), 'Content-Type': mainRes, ...useHeaders }, body: mainReq ? `<html><head><title>${mid.mainLink}</title></head><body><div>${JSON.stringify(torrentData.saved)}</div></body></html>` : JSON.stringify(torrentData.saved) }) | ||
} | ||
@@ -296,7 +300,9 @@ } | ||
const useHead = {} | ||
for (const test of ['id', 'path', 'infohash', 'dir', 'name', 'sequence', 'pair', 'address']) { | ||
for (const test of ['id', 'path', 'infohash', 'dir', 'name', 'sequence', 'pair', 'address', 'secret']) { | ||
if (torrentData[test]) { | ||
useHead[test] = torrentData[test] | ||
useHead['X-' + test.charAt(0).toUpperCase() + test.slice(1)] = torrentData[test] | ||
} | ||
} | ||
useHead['X-Link'] = `bt://${torrentData.address || torrentData.infohash || torrentData.id}${mid.mainPath}` | ||
useHead['Link'] = `<${useHead['X-Link']}>; rel="canonical"` | ||
@@ -303,0 +309,0 @@ return sendTheData(signal, {status: 200, headers: {'Content-Type': mainRes, ...useHead}, body: mainReq ? `<html><head><title>${mid.mainLink}</title></head><body><div>${JSON.stringify(torrentData)}</div></body></html>` : JSON.stringify(torrentData)}) |
{ | ||
"name": "list-fetch", | ||
"version": "28.0.1", | ||
"version": "28.0.2", | ||
"description": "coming soon", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
20846
311