diff options
| author | Danilo M. <danix@danix.xyz> | 2026-07-30 20:38:19 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-07-30 20:43:13 +0200 |
| commit | 1b7325fec54a419b7773b31e1032717279713b29 (patch) | |
| tree | fc76df00c2838c2be851d0197e4c6743e71520c1 /.gitignore | |
| download | tg_backup-1b7325fec54a419b7773b31e1032717279713b29.tar.gz tg_backup-1b7325fec54a419b7773b31e1032717279713b29.zip | |
feat: incremental Telegram media backup
Single-file tool that downloads photos and documents from a Telegram
chat and resumes where it left off.
Durability:
- process oldest-to-newest and persist last_id after every message, so
an interrupted run resumes instead of rescanning
- write state.json via temp file + rename; a torn write would otherwise
leave unparseable JSON and block the next run
- download to a .part file and rename on success, so a killed run cannot
leave a truncated file that the exists() check treats as complete
- retry transient errors with exponential backoff alongside the existing
FloodWait handling, and skip permanently failed files rather than
stalling the run
Usability:
- share one session across all archive dirs, so a login covers every
chat instead of one per directory; migrate an existing per-archive
session in place rather than forcing re-authentication
- create the config template before argument parsing, since --target was
required but unknowable before the API keys were set
- add --list-chats to print dialog IDs and usernames
- convert numeric targets to int; Telethon resolves a numeric string as
a username and never consults the entity cache
Hardening:
- strip path components from sender-controlled filenames
- create config and session files 0600 in a 0700 directory
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Diffstat (limited to '.gitignore')
| -rw-r--r-- | .gitignore | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f59898a --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +# Telegram session files are account credentials. Never commit them. +*.session +*.session-journal + +# Default archive dir, plus its media and resume state +tg_archive/ +state.json + +__pycache__/ +*.pyc |
