Self-hosted Telegram downloader and archive manager.
146
https://github.com/shareur/TGHarbor
A self-hosted, recoverable Telegram downloader and shared archive manager.
TGHarbor accepts media sent or forwarded to a private Bot and individual Telegram message links that an independently authorized user account can already access. It persists download jobs in SQLite, downloads into a safe local Inbox, and lets authorized users organize a shared library through Bot commands and inline actions.
Early development: back up state before upgrades. Configuration and internal APIs may change before v1.0.
inbox/ and archive/ library with persistent keep, rename, archive, and
directory-creation actions.TGHarbor accepts media in two ways:
https://t.me/... link and send only the link to the Bot.Only configured authorized users can submit. Message links resolve through the operator's already-authorized Telegram user session, so only content that account already accesses is retrievable; TGHarbor does not bypass Telegram permissions.
Requirements: Python 3.15+, a Telegram application ID/hash, a BotFather token, and a Telegram user account for message-link access.
For a local Python process, copy and edit the YAML file, then install and run TGHarbor:
python3.15 -m venv .venv
.venv/bin/python -m pip install -e '.[dev]'
cp config.example.yaml config.yaml
.venv/bin/tgharbor login --config config.yaml
.venv/bin/tgharbor run --config config.yaml
For Docker Compose, copy the portable template and credential examples first:
cp compose.example.yaml compose.yaml
cp config.example.yaml config.yaml
cp .env.example .env
chmod 600 .env
chmod 644 config.yaml
docker compose pull
docker compose run --rm tgharbor login
docker compose up -d
chmod 600 .env keeps credentials private; chmod 644 config.yaml keeps the
host-owned file readable by the container's non-root UID/GID 10001.
The template pulls the published multi-platform image
shareur/tgharbor:0.2.1 and does not
build from the local checkout. The image entrypoint is tgharbor and its default
command is run; the login command above overrides it once to authorize the user
session. The template uses Docker-managed volumes for database/session state and
downloads, and contains no fixed host storage path. Never commit compose.yaml,
config.yaml, .env, Telegram sessions, SQLite databases, logs, or downloaded
content. Verify the resolved image digest and OCI labels before rollout as described
in the operations guide.
Published images are available on
Docker Hub as shareur/tgharbor. The
0.2.1 release targets linux/amd64 and linux/arm64 and publishes the aliases
0.2.1, 0.2, latest, and sha-13c5bc7645b9 for one multi-platform image index:
sha256:b40996ef4938f8545e5eaee86c91fc57b3d27f9b087353d02a97ae7548c5f560.
That index identifies source revision
13c5bc7645b9ba27ea9837be3697fa1388ffb44d at
https://github.com/shareur/TGHarbor.
Tags are mutable aliases. Pin 0.2.1 rather than latest, and compare the resolved
RepoDigest and the org.opencontainers.image.version, .revision, and .source
labels with this release record before deployment. The release workflow publishes
stable tags only after the exact tag-push CI run succeeds and records Buildx
provenance and an SBOM. Local source builds remain available for development and are
not release images.
https://t.me/... message link./status for active jobs and /history for terminal jobs./files, /dirs, and /stats.All authorized users may manage the shared file library; each rename, archive move, and directory creation records the acting Telegram user ID. Job lookup and cancellation remain requester-scoped.
Read CONTRIBUTING.md and CODE_OF_CONDUCT.md before contributing. Do not put credentials, sessions, private links, user content, or private deployment details in issues or pull requests. Follow SECURITY.md for vulnerability reporting and the release-security checklist before publishing a fork or release.
The v0.2 shared-library workflow is implemented and covered by credential-free automated tests. Live Telegram, container-image, migration-rehearsal, and deployment acceptance require operator-owned infrastructure and are tracked separately; they must not be inferred from unit-test results.
Apache License 2.0. TGHarbor is a clean-room, independent implementation inspired by
Telegram downloader workflows, including jsavargas/telethon_downloader; no reference
project code is copied.
Content type
Image
Digest
sha256:b40996ef4…
Size
50.9 MB
Last updated
3 days ago
docker pull shareur/tgharbor