aboutsummaryrefslogtreecommitdiffstats
path: root/CLAUDE.md
AgeCommit message (Collapse)AuthorFilesLines
4 daysfeat: add bash completionHEADmasterDanilo M.1-1/+3
Completes the flags, and directories for --archive-dir in both the --opt value and --opt=value forms. --target offers only "me": real chat handles would need a network round-trip inside a tab press, and --list-chats already answers that question. Installed by hand, nothing automates it. A new flag has to be added to opts in the completion as well. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
4 daysfeat: refuse to back up a different chat into an existing archive dirDanilo M.1-1/+1
last_id is a high-water mark for one specific chat. Applied as min_id to a different one it silently skips that chat's history and the run still reports success. Compare the requested target against the one saved in state.json and exit before any network work when they differ. The comparison is textual, ignoring case and a leading @; resolving a username to its numeric ID would need a logged-in client, so switching between the two forms of the same chat also refuses. --force-target overrides and keeps the existing resume position. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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>