This commit is contained in:
parent
832ae9ea34
commit
1fcadc150d
@ -5,6 +5,7 @@ module.exports = (app, client) => {
|
|||||||
{ parser } = require('stream-json'),
|
{ parser } = require('stream-json'),
|
||||||
{ streamArray } = require('stream-json/streamers/StreamArray'),
|
{ streamArray } = require('stream-json/streamers/StreamArray'),
|
||||||
{ chain } = require('stream-chain'),
|
{ chain } = require('stream-chain'),
|
||||||
|
{ stringer } = require('stream-json/jsonl/Stringer'),
|
||||||
clean = str => {
|
clean = str => {
|
||||||
return str.replace(/[/\\^$+?()`'¡¿¨!"·%&=;,\|\[\]{}]+/gmi, '')
|
return str.replace(/[/\\^$+?()`'¡¿¨!"·%&=;,\|\[\]{}]+/gmi, '')
|
||||||
}
|
}
|
||||||
@ -472,9 +473,12 @@ module.exports = (app, client) => {
|
|||||||
parser(),
|
parser(),
|
||||||
pick({ filter: 'hits.hits' }),
|
pick({ filter: 'hits.hits' }),
|
||||||
streamArray(),
|
streamArray(),
|
||||||
data => ({ instance: data.value._source.instance, comment: data.value._source.blocks.find(block => block.domain === clean(req.params.instance)).comment })
|
data => ({ instance: data.value._source.instance, comment: data.value._source.blocks.find(block => block.domain === clean(req.params.instance)).comment }),
|
||||||
|
stringer()
|
||||||
])
|
])
|
||||||
result.pipe(pipeline).pipe(res, { end: true })
|
res.once('data', data => '[' + data.toString())
|
||||||
|
res.on('finish', () => res.end(']'))
|
||||||
|
result.pipe(pipeline).pipe(res)
|
||||||
} else {
|
} else {
|
||||||
res.status(404).end()
|
res.status(404).end()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user