From e024de4869b8c20a0e8be8349985df513fb633de Mon Sep 17 00:00:00 2001 From: Lluis Date: Mon, 8 Apr 2024 12:28:37 +0200 Subject: [PATCH] use /i/ prefix for images --- README.md | 2 +- app.js | 8 +------- handlers/stream.js | 2 +- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index c0953c4..03c6ea4 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ Take a screenshot of the current stream and send it to the chat. ```javascript !foto -//result: https://external.url/images/cclj35.png +//result: https://external.url/i/cclj35.jpg ``` ## Birthday diff --git a/app.js b/app.js index 445ea0f..98737c2 100644 --- a/app.js +++ b/app.js @@ -14,16 +14,10 @@ mongoose.connect(config.database).then(() => { app.use(express.static('public')) app.use('/images', express.static('images')) - app.get('/status', function (req, res) { - res.redirect(config.statusUrl) - }); - - app.get('/:id', (req, res) => { + app.get('/i/:id', (req, res) => { res.sendFile(__dirname + `/public/images/${req.params.id}.jpg`) }); - - const listener = app.listen(process.env.PORT, ()=> { console.log('Listening on port ', + listener.address().port) app.get('/', (req, res) => res.send('Live!')) diff --git a/handlers/stream.js b/handlers/stream.js index e883c69..940f408 100644 --- a/handlers/stream.js +++ b/handlers/stream.js @@ -17,7 +17,7 @@ class Stream { const image = await BrowserService.getScreenshot().catch(() => { console.error('getScreenshot on captureScreenshot')}) if (image) { - await bot.say(target, `Captura de ${displayName}: ${config.externalUrl}/${image.fileName}`) + await bot.say(target, `Captura de ${displayName}: ${config.externalUrl}/i/${image.fileName}`) const channel = await TwitchService.getChannel() await ScreenshotService.addScreenshot(image.fileName, channel.streamId, displayName, roomId)