pipeline parser
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
ale 2024-09-28 02:59:28 +02:00
parent 7a17c28735
commit 597c7ba005
2 changed files with 14 additions and 9 deletions

View File

@ -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()

View File

@ -31,9 +31,12 @@
<h3>Search in <a href="/api/stats" target="_blank"><span id="count"></span></a> public instances<span id="apigit"> -
<a href="api-docs" target="_blank">API docs</a> - <a
href="https://git.manalejandro.com/ale/fediblock-instance" target="_blank">Git</a>
<img
src="https://sonar.manalejandro.com/api/project_badges/measure?project=ale%3Afediblock-instance&metric=alert_status&token=sqb_b85f22162c314a3c5d781cf356e90ce304ce6a13" />
<img src="https://drone.manalejandro.com/api/badges/ale/fediblock-instance/status.svg" /></span></h3>
<a href="https://sonar.manalejandro.com/dashboard?id=ale%3Afediblock-instance">
<img
src="https://sonar.manalejandro.com/api/project_badges/measure?project=ale%3Afediblock-instance&metric=alert_status&token=sqb_b85f22162c314a3c5d781cf356e90ce304ce6a13" />
</a><a href="https://drone.manalejandro.com/ale/fediblock-instance">
<img src="https://drone.manalejandro.com/api/badges/ale/fediblock-instance/status.svg" />
</a></span></h3>
<section>
<input type="text" id="instance" name="instance" placeholder="Type the name of the instance" />
<button id="reverse" title="Reverse search...">Reverse</button>