Skip to content

Commit

Permalink
show spot in maps
Browse files Browse the repository at this point in the history
  • Loading branch information
lluisd committed May 13, 2024
1 parent 92788c4 commit a2eab4d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ mongoose.connect(config.database).then(() => {

app.use(express.static('public'))

app.get('/p/:id', (req, res) => {
const spotNumber = parseInt(req.params.id)
if (typeof spotNumber === 'number') {
TempsDeFlorsService.getTFSpot(config.twitch.roomId, spotNumber).then((spot) => {
res.redirect(`https://www.google.com/maps?q=${spot.coordinates}`)
})
}
});

app.get('/listado', function(req, res) {
TempsDeFlorsService.getTFSpots(config.twitch.roomId).then((spots) => {
res.render('pages/index',{
Expand Down
2 changes: 1 addition & 1 deletion handlers/tempsDeFlors.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class TempsDeFlors {
if (spot.visited) {
text = `${text} (✔️${this._getScreenshotText(spot)})`
} else {
text = `${text} (❌${this._getScreenshotText(spot)}) ${timetable}`
text = `${text} (❌${this._getScreenshotText(spot)}) (maps ${config.externalUrl}/p/${spot.number}) ${timetable}`
}
return text
}
Expand Down

0 comments on commit a2eab4d

Please sign in to comment.