adding timestamp

pull/921/head
Adrian Maraj 2024-06-19 12:00:29 +02:00
parent 0965fa63a2
commit 800d489781
1 changed files with 5 additions and 4 deletions

View File

@ -777,8 +777,9 @@ class CaptureHide(Resource): # type: ignore[misc]
return {'info': f'Capture {capture_uuid} successfully hidden.'} return {'info': f'Capture {capture_uuid} successfully hidden.'}
@api.route('/json/recent_captures') @api.route('/json/recent_captures/<string:timestamp>')
@api.doc(description='Get uuids of the most recent captures.') @api.doc(description='Get uuids of the most recent captures.',
params={'timestamp': 'The timestamp up to which we want to have the current captures'})
class RecentCaptures(Resource): # type: ignore[misc] class RecentCaptures(Resource): # type: ignore[misc]
def get(self) -> list: def get(self, timestamp: str) -> list:
return lookyloo.redis.zrange('recent_captures',0, -1) return lookyloo.redis.zrangebyscore('recent_captures', timestamp, '+inf')