mirror of
https://github.com/rommapp/romm.git
synced 2026-02-19 07:50:57 +01:00
[ROMM-1348] Log when a user downloads a game
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user