This commit is contained in:
parent
df2902613d
commit
755e88ba07
@ -5,7 +5,7 @@ module.exports = (app, client) => {
|
|||||||
zlib = require('zlib'),
|
zlib = require('zlib'),
|
||||||
{ chain } = require('stream-chain'),
|
{ chain } = require('stream-chain'),
|
||||||
{ parser } = require('stream-json'),
|
{ parser } = require('stream-json'),
|
||||||
{ streamValues } = require('stream-json/streamers/StreamValues'),
|
{ stringer } = require('stream-json/jsonl/Stringer'),
|
||||||
{ streamArray } = require('stream-json/streamers/StreamArray'),
|
{ streamArray } = require('stream-json/streamers/StreamArray'),
|
||||||
clean = str => {
|
clean = str => {
|
||||||
return str.replace(/[\/\\^$+?()`'¡¿¨!"·%&=;,\|\[\]{}]+/gmi, '')
|
return str.replace(/[\/\\^$+?()`'¡¿¨!"·%&=;,\|\[\]{}]+/gmi, '')
|
||||||
@ -516,7 +516,6 @@ module.exports = (app, client) => {
|
|||||||
chain([
|
chain([
|
||||||
result,
|
result,
|
||||||
parser(),
|
parser(),
|
||||||
streamValues(),
|
|
||||||
data => data.value.hits.hits,
|
data => data.value.hits.hits,
|
||||||
streamArray(),
|
streamArray(),
|
||||||
data => ({
|
data => ({
|
||||||
@ -526,9 +525,9 @@ module.exports = (app, client) => {
|
|||||||
last: data.value._source.last,
|
last: data.value._source.last,
|
||||||
nodeinfo: data.value._source.nodeinfo
|
nodeinfo: data.value._source.nodeinfo
|
||||||
}),
|
}),
|
||||||
zlib.createGzip(),
|
stringer(),
|
||||||
res
|
zlib.createGzip()
|
||||||
])
|
]).pipe(res, { end: true })
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
res.status(404).end()
|
res.status(404).end()
|
||||||
|
Loading…
Reference in New Issue
Block a user