diff --git a/lib/apiswagger.js b/lib/apiswagger.js index 8e1bfd7..c77c6b0 100644 --- a/lib/apiswagger.js +++ b/lib/apiswagger.js @@ -3,8 +3,8 @@ 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'), + StreamArray = require('stream-json/streamers/StreamArray'), + { parser } = require('stream-json'), { chain } = require('stream-chain'), clean = str => { return str.replace(/[/\\^$+?()`'¡¿¨!"·%&=;,\|\[\]{}]+/gmi, '') @@ -513,11 +513,13 @@ module.exports = (app, client) => { } }, { asStream: true, meta: false }), pipeline = chain([ - Pick.withParser({ filter: 'hits.hits' }), - streamArray(), - Pick.withParser({ filter: '_source' }), + parser(), + data => data.value.hits.hits, + StreamArray.withParser(), + data => data.value._source, + zlib.createGzip() ]) - result.pipe(pipeline).pipe(zlib.createGzip()).pipe(res, { end: true }) + result.pipe(pipeline).pipe(res) } catch (e) { console.error(e) res.status(404).end() diff --git a/public/index.html b/public/index.html index 88940e5..21bf747 100644 --- a/public/index.html +++ b/public/index.html @@ -31,9 +31,12 @@

Search in public instances - API docs - Git - -

+ + + + +