Skip to content

Commit

Permalink
Revert "capture png screenshots instead of jpeg"
Browse files Browse the repository at this point in the history
This reverts commit d4d0f45.
  • Loading branch information
lluisd committed Apr 2, 2024
1 parent d4d0f45 commit 4fd9db0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ mongoose.connect(config.database).then(() => {
});

app.get('/:id', (req, res) => {
res.sendFile(__dirname + `/public/images/${req.params.id}.png`)
res.sendFile(__dirname + `/public/images/${req.params.id}.jpg`)
});


Expand Down
4 changes: 2 additions & 2 deletions handlers/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class Stream {
const photos = chunk.map(s =>(
{
type: "photo",
media: `${config.externalUrl}/images/${s.name}.png`,
media: `${config.externalUrl}/images/${s.name}.jpg`,
caption: `Captura de *${s.capturedBy}*`,
parse_mode: 'Markdown'
}));
Expand All @@ -116,7 +116,7 @@ class Stream {
})(index, photos);
}
} else if (screenshots && screenshots.length === 1) {
await telegramBot.sendPhoto(config.telegram.chatId, `${config.externalUrl}/images/${screenshots[0].name}.png`, {
await telegramBot.sendPhoto(config.telegram.chatId, `${config.externalUrl}/images/${screenshots[0].name}.jpg`, {
caption: `Captura de *${screenshots[0].capturedBy}*`,
parse_mode: 'Markdown'
})
Expand Down
3 changes: 2 additions & 1 deletion helpers/browserApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ class PuppeteerApi {
if (this.svgImage) {
return await this.svgImage.screenshot({
path: path,
type: "png",
type: "jpeg",
quality: 100,
captureBeyondViewport: false
})
}
Expand Down
2 changes: 1 addition & 1 deletion services/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ async function getScreenshot() {
}
const name = nanoid()
try {
bufferImage = await browserApi.takeScreenshot(`public/images/${name}.png`)
bufferImage = await browserApi.takeScreenshot(`public/images/${name}.jpg`)
} catch (error) {
console.log(error)
return null
Expand Down

0 comments on commit 4fd9db0

Please sign in to comment.