mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5584] Telegram backup: add date prefix to backup filename #3902
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#3902
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?
Originally created by @acidmsg on GitHub (Jun 26, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5584
Originally assigned to: @NikanZeyaei on GitHub.
Problem:
The bot sends database backups via DM. Over time, backup files accumulate with identical filenames (
<domain>.dborx-ui.db). It is impossible to distinguish a fresh backup from an old one without downloading — filenames contain no date.Proposed solution:
Add a
YYYY-MM-DD_prefix to the filename. Example:2026-06-25_<domain>.db.Where to change:
internal/web/service/server.go—BackupFilename().Possible implementation (verified against current v3.4.0 code):
timeis already imported in the package. The function signature and all call sites remain compatible.Alternatively, this could be made configurable via panel settings (
tgBotBackupPrefix: "datetime" | "none") for backward compatibility.@github-actions[bot] commented on GitHub (Jun 26, 2026):
The technical analysis in this report is accurate. Here is what the source confirms:
Current behavior (verified in source)
internal/web/service/server.go:1307-1313—BackupFilenamecurrently returns<host>.db(SQLite) or<host>.dump(PostgreSQL) with no temporal component. The host portion is derived from the request host, configured listen domain, or resolved public IP viabackupHost().Proposed change is viable as written
timeis already imported at line 27 ofinternal/web/service/server.go.time.Now().Format("2006-01-02")contains only digits and hyphens; combined with the_separator, the resulting prefix2026-06-26_matches the filename safety regex^[a-zA-Z0-9_\-.]+$enforced atinternal/web/controller/server.go:22. No validation change is needed.internal/web/controller/server.go:326) and the Telegram bot (internal/web/service/tgbot/tgbot_report.go:405) — pass throughBackupFilenameunchanged; function signature is unmodified.One point to consider before submitting a PR
The Telegram bot (tgbot_report.go:405) passes
""asrequestHost, so the backup message already includes the timestamp in its text body (tgbot.messages.backupTime, line 399). Adding the date to the filename is still useful for distinguishing files in the chat history, but it is worth noting in the PR description so maintainers can weigh the duplication.The configurable prefix alternative mentioned in the report (
"datetime" | "none") would add a settings schema entry, migration, and UI work. A simpler unconditional prefix is a reasonable starting point and easier to review; the configurable variant could follow as a separate request if demand exists.A PR implementing the single-line change to
BackupFilenamecan be submitted againstmain.This reply was generated automatically; a maintainer may follow up.