From 613b5817009c5e04e22e8a7bea324ce41797dffc Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Sun, 8 Dec 2024 21:40:41 -0500 Subject: [PATCH] [ROMM-1348] Log when a user downloads a game --- backend/endpoints/rom.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/endpoints/rom.py b/backend/endpoints/rom.py index a253fb25f..debae84b2 100644 --- a/backend/endpoints/rom.py +++ b/backend/endpoints/rom.py @@ -245,6 +245,7 @@ async def get_rom_content( ZipResponse: Returns a response for nginx to serve a Zip file for multi-part roms """ + current_user = request.user rom = db_rom_handler.get_rom(id) if not rom: @@ -254,12 +255,14 @@ async def get_rom_content( files_to_download = sorted(files or [r["filename"] for r in rom.files]) if not rom.multi: + log.info(f"User {current_user.username} is downloading {rom.file_name}") return FileRedirectResponse( download_path=Path(f"/library/{rom.full_path}"), filename=rom.file_name, ) if len(files_to_download) == 1: + log.info(f"User {current_user.username} is downloading {rom.file_name}") return FileRedirectResponse( download_path=Path(f"/library/{rom.full_path}/{files_to_download[0]}"), ) @@ -284,6 +287,7 @@ async def get_rom_content( filename=f"{file_name}.m3u", ) + log.info(f"User {current_user.username} is downloading {rom.file_name}") return ZipResponse( content_lines=content_lines + [m3u_line], filename=f"{quote(file_name)}.zip",