diff --git a/lib/apiswagger.js b/lib/apiswagger.js index 0422a15..dd94694 100644 --- a/lib/apiswagger.js +++ b/lib/apiswagger.js @@ -3,9 +3,6 @@ const nodeinfo = require('activitypub-express/pub/nodeinfo') module.exports = (app, client) => { const constant = require('./constant'), zlib = require('zlib'), - Pick = require('stream-json/filters/Pick'), - { streamArray } = require('stream-json/streamers/StreamArray'), - { chain } = require('stream-chain'), clean = str => { return str.replace(/[/\\^$+?()`'¡¿¨!"·%&=;,\|\[\]{}]+/gmi, '') } @@ -511,14 +508,8 @@ module.exports = (app, client) => { query: { match_all: {} } - }, { asStream: true, meta: false }), - pipeline = chain([ - Pick.withParser({ filter: 'hits.hits' }), - streamArray(), - data => data.value._source, - zlib.createGzip() - ]) - result.pipe(pipeline).pipe(res) + }, { asStream: true, meta: false }) + result.pipe(zlib.createGzip()).pipe(res) } catch (e) { console.error(e) res.status(404).end() diff --git a/lib/fediblock.js b/lib/fediblock.js index 03f526d..a4a9aee 100644 --- a/lib/fediblock.js +++ b/lib/fediblock.js @@ -19,7 +19,7 @@ module.exports = async (client, apex, app) => { requestPart = async uri => { const ac = new AbortController(), timeout = setTimeout(() => { - ac.abort() + setImmediate(ac.abort()) }, constant.abort_timeout), response = await fetch(uri, { headers: { 'User-Agent': constant.agent }, @@ -27,7 +27,7 @@ module.exports = async (client, apex, app) => { keepalive: false, timeout: constant.timeout, }) - clearTimeout(timeout) + setImmediate(clearTimeout(timeout)) return await response.json() }, scanInstance = async instance => { diff --git a/package.json b/package.json index d89f769..aa1501c 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,6 @@ "node-schedule": "^2.1.1", "parcel": "^2.12.0", "rotating-file-stream": "^3.2.5", - "stream-json": "^1.8.0", "swagger-jsdoc": "^6.2.8", "swagger-ui-express": "^5.0.1" }