mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #5606] [MERGED] feat(backup): prefix backup filenames with date and time #5924
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#5924
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/5606
Author: @NikanZeyaei
Created: 6/27/2026
Status: ✅ Merged
Merged: 6/27/2026
Merged by: @MHSanaei
Base:
main← Head:feature/backup-date-prefix📝 Commits (3)
7ad0876feat(backup): add YYYY-MM-DD_ date prefix to backup filenames546cb11feat(backup): prefix backup filenames with date and time380c75cfix(backup): put host before date in backup filename📊 Changes
2 files changed (+47 additions, -7 deletions)
View changed files
📝
internal/web/service/backup_filename_test.go(+30 -0)📝
internal/web/service/server.go(+17 -7)📄 Description
Summary
Prepends a
YYYY-MM-DD_date prefix to database backup filenames (e.g.2026-06-27_panel.example.com.db) so backups accumulated in Telegram chat history or downloads are chronologically sortable and distinguishable without opening them.Why
Backups sent via Telegram DM and panel downloads share identical filenames (
<domain>.db), making a fresh backup indistinguishable from an old one without downloading. The date prefix lets admins sort and identify backups at a glance.Refs #5584
Type of change
Areas affected
How was this tested?
TestBackupDatePrefixininternal/web/service/backup_filename_test.goverifies the prefix format (^\d{4}-\d{2}-\d{2}_$) against fixedtime.Timeinputs (UTC midnight, year-end, single-digit month/day padding) and asserts it satisfies the controller's^[a-zA-Z0-9_\-.]+$filename safety regex.TestSanitizeBackupHoststill passes.go vet ./internal/web/service/...clean.go build ./...succeeds.go test -run 'TestBackup|TestSanitizeBackupHost' -count=1 ./internal/web/service/...→ 13 passed./backupor equivalent bot command) and confirm the received file is named2026-06-27_<host>.db(.dumpon PostgreSQL).Screenshots / recordings
N/A — no UI changes.
Breaking changes
None. No restore/import path reads the filename (restore uses uploaded bytes), so prefixing is non-breaking. Existing backup files on disk are unaffected.
Checklist
go build ./...and the test suite pass locally.npm run lint,npm run typecheck, andnpm run buildpass.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.