Added tracking for uploading and downloading files

This commit is contained in:
2025-08-17 00:47:10 +02:00
parent 91fb6c62aa
commit 496f9140a1
8 changed files with 65 additions and 1 deletions

View File

@@ -6,6 +6,7 @@ import (
"path/filepath"
"github.com/gin-gonic/gin"
"fitra-backend/utils"
)
func HandleFileDownload(c *gin.Context) {
@@ -23,6 +24,9 @@ func HandleFileDownload(c *gin.Context) {
return
}
// Send analytics event
utils.SendAnalyticsEvent("file_download", "/api/download/"+fileID+"/"+filename, "File Download", c.GetHeader("User-Agent"), c.ClientIP())
c.Header("Content-Description", "File Transfer")
c.Header("Content-Transfer-Encoding", "binary")
c.Header("Content-Disposition", "attachment; filename="+filename)