download index
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
ale 2024-09-22 01:30:52 +02:00
parent 6ce68b15c5
commit ec97d51ab0

View File

@ -499,7 +499,7 @@ module.exports = (app, client) => {
* application/octect-stream
*/
app.use('/api/download_index', async (req, res) => {
if (req.params.instance && req.params.instance.length > 0) {
try {
const result = await client.search({
index: constant.index,
size: 9999,
@ -512,7 +512,8 @@ module.exports = (app, client) => {
'Content-disposition': 'attachment; filename=fediblock-index.json.gz'
})
result.pipe(zlib.createGzip()).pipe(res, { end: true })
} else {
} catch (e) {
console.error(e)
res.status(404).end()
}
})