list-fetch
Advanced tools
Comparing version 30.0.4 to 30.0.5
34
index.js
@@ -89,18 +89,2 @@ module.exports = async function makeBTFetch (opts = {}) { | ||
function idFromHost(hn, hs, sp) { | ||
if (hn.mainQuery) { | ||
if (hs.has('x-update') || sp.has('x-update')) { | ||
if (JSON.parse(hs.get('x-update') || sp.get('x-update'))) { | ||
return { address: null, secret: null } | ||
} else { | ||
return { infohash: null } | ||
} | ||
} else { | ||
return null | ||
} | ||
} else { | ||
return hn.mainId | ||
} | ||
} | ||
function formatReq (hostname, pathname, extra) { | ||
@@ -291,6 +275,16 @@ | ||
const useData = idFromHost(mid, reqHeaders, searchParams) | ||
if (!useData) { | ||
return sendTheData(signal, { status: 400, headers: mainRes, body: mainReq ? `<html><head><title>${mid.mainLink}</title></head><body><div><p>invalid data</p></div></body></html>` : JSON.stringify('invalid data') }) | ||
if (mid.mainQuery) { | ||
if (reqHeaders.has('x-update') || searchParams.has('x-update')) { | ||
if (JSON.parse(reqHeaders.get('x-update') || searchParams.get('x-update'))) { | ||
mid.mainId = { address: null, secret: null } | ||
} else { | ||
mid.mainId = { infohash: null } | ||
} | ||
} else { | ||
return sendTheData(signal, { status: 400, headers: mainRes, body: mainReq ? `<html><head><title>${mid.mainLink}</title></head><body><div><p>invalid data</p></div></body></html>` : JSON.stringify('invalid data') }) | ||
} | ||
} else { | ||
return mid.mainId | ||
} | ||
const useOpt = reqHeaders.has('x-opt') || searchParams.has('x-opt') ? JSON.parse(reqHeaders.get('x-opt') || decodeURIComponent(searchParams.get('x-opt'))) : {} | ||
@@ -302,3 +296,3 @@ const useOpts = { | ||
const useBody = reqHeaders.has('content-type') && reqHeaders.get('content-type').includes('multipart/form-data') ? handleFormData(await request.formData()) : body | ||
const torrentData = await app.publishTorrent(useData, mid.mainPath, useBody, useOpts) | ||
const torrentData = await app.publishTorrent(mid.mainId, mid.mainPath, useBody, useOpts) | ||
const useHeaders = {} | ||
@@ -305,0 +299,0 @@ for (const test of ['sequence', 'name', 'infohash', 'dir', 'pair', 'secret', 'address']) { |
{ | ||
"name": "list-fetch", | ||
"version": "30.0.4", | ||
"version": "30.0.5", | ||
"description": "coming soon", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25119
343