feat(backup): prefer browser request host for backup filename

Name downloaded DB backups after the host shown in the panel title (c.Request.Host) when available, falling back to the configured web domain and then the public IP. Telegram-sent backups have no request context and keep the domain/IP behavior.
This commit is contained in:
MHSanaei
2026-06-23 01:13:09 +02:00
parent b11c51e736
commit dabd3f5d2b
3 changed files with 20 additions and 15 deletions
+1 -1
View File
@@ -298,7 +298,7 @@ func (a *ServerController) getDb(c *gin.Context) {
return
}
filename := a.serverService.BackupFilename()
filename := a.serverService.BackupFilename(c.Request.Host)
if !filenameRegex.MatchString(filename) {
c.AbortWithError(http.StatusBadRequest, fmt.Errorf("invalid filename"))
return