This commit is contained in:
parent
3cf8f296cd
commit
8356295433
@ -500,18 +500,15 @@ module.exports = (app, client) => {
|
|||||||
*/
|
*/
|
||||||
app.use('/api/download_index', async (req, res) => {
|
app.use('/api/download_index', async (req, res) => {
|
||||||
try {
|
try {
|
||||||
res.writeHead(200, {
|
res.header('Content-Type', 'application/x-gzip')
|
||||||
'Content-Type': 'application/x-gzip',
|
res.header('Content-disposition', 'attachment; filename=fediblock-index.json.gz')
|
||||||
'Content-disposition': 'attachment; filename=fediblock-index.json.gz'
|
(await client.search({
|
||||||
})
|
index: constant.index,
|
||||||
const result = await client.search({
|
size: 9999,
|
||||||
index: constant.index,
|
query: {
|
||||||
size: 9999,
|
match_all: {}
|
||||||
query: {
|
}
|
||||||
match_all: {}
|
}, { asStream: true })).pipe(zlib.createGzip()).pipe(res, { end: true })
|
||||||
}
|
|
||||||
}, { asStream: true })
|
|
||||||
result.pipe(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