aboutsummaryrefslogtreecommitdiffstats
path: root/CLAUDE.md
AgeCommit message (Collapse)AuthorFilesLines
4 daysfeat: log permanently failed downloads to failures.jsonDanilo M.1-2/+6
State advances past a download that exhausts MAX_RETRIES so one broken file cannot wedge the backup, which until now left a silent gap in the archive. Failures are appended to failures.json in the archive dir as JSONL, one {id, file, error} per line; appending is a single write, so a crash costs the last record rather than the file. download_with_retry now returns the last exception or None on success, replacing the True/False return, so the caller has an error to log. Nothing reads or prunes the file: it is a record, not a retry queue. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
4 daysfeat: incremental Telegram media backupDanilo M.1-0/+46
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>