Skip to content
This repository was archived by the owner on Nov 10, 2021. It is now read-only.

Commit a993f13

Browse files
committed
Guard against time-travellers messing with our past ;)
1 parent 2b22d91 commit a993f13

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,10 @@ app.use(cors({ origin: '*' }))
267267
app.get('/feed', async (req, res) => {
268268
var counter = req.query.counter
269269
var max_time = req.query.hasOwnProperty('time') ? customFloor(req.query.time, ONE_MINUTE_MILLIS) : null
270+
const now_time_qt = customFloor(Date.now(), ONE_MINUTE_MILLIS)
271+
if (max_time != null & max_time > now_time_qt) {
272+
max_time = null
273+
}
270274
await getFeed(counter, max_time, res)
271275
})
272276

0 commit comments

Comments
 (0)