tgdrive / teldrive

Telegram Drive
MIT License
1.83k stars 272 forks source link
drive golang rclone teldrive teledrive telegram telegram-bot telegramdrive

Telegram Drive

Telegram Drive is a powerful utility that enables you to organise your telegram files and much more.

Discord

Click on icon to join Discord Server

Features

Advantages Over Alternative Solutions

[!IMPORTANT] Teldrive functions as a wrapper over your Telegram account, simplifying file access. However, users must adhere to the limitations imposed by the Telegram API. Teldrive is not responsible for any consequences arising from non-compliance with these API limits.You will be banned instantly if you misuse telegram API.

demo

More Images ![demo2](./public/demo2.png) ![demo3](./public/demo3.png) ![demo5](./public/demo6.png) ![demo8](./public/demo8.png) ![demo7](./public/demo7.png) ![demo4](./public/demo4.png)


UI Repo

UI Library

File Browser Component

One Line Installer

Linux

curl -sSL https://instl.vercel.app/tgdrive/teldrive/linux | bash

Windows

iwr https://instl.vercel.app/tgdrive/teldrive/windows | iex

macOS

curl -sSL https://instl.vercel.app/tgdrive/teldrive/macos | bash

Deploy using docker-compose

Get compose files from docker directory in repository.

Prepare Config File

[db]
data-source = "postgres://<db username>:<db password>@<db host>/<db name>"

[jwt]
secret = "abcd"

[tg]
app-id = 
app-hash = "fwfwfwf"
[db]
data-source = "postgres://teldrive:secret@postgres_db/postgres"

Generate JWT

$ openssl rand -hex 64

You can generate secret from here.

docker network create postgres
touch session.db
docker compose -f postgres.yml up -d #Run this only if you want to use self-hosted db
docker compose -f teldrive.yml  up -d
#Image Resize Service
docker compose -f image-resizer.yml up -d

Use without docker

Follow Below Steps

teldrive run --tg-app-id="" --tg-app-hash="" --jwt-secret="" --db-data-source=""

Read more how to setup teldrive with rclone volume driver.

Follow this to open file links directly in VLC and PotPlayer.

Important

Advanced Configuration

cli options

teldrive run --help
Flag Name Description Required Default Value
--jwt-secret JWT secret key Yes ""
--db-data-source Database connection string Yes ""
--tg-app-id API ID for your Telegram account, which can be obtained from my.telegram.org. Yes 0
--tg-app-hash API HASH for your Telegram account, which can be obtained from my.telegram.org. Yes ""
--jwt-allowed-users Allow certain Telegram usernames, including yours, to access the app. No ""
--tg-uploads-encryption-key Encryption key for encrypting files. No ""
--config, -c Config file. No $HOME/.teldrive/config.toml
--server-port, -p Server port No 8080
--log-level Logging level

DebugLevel = -1
InfoLevel = 0
WarnLevel = 1
ErrorLevel = 2
No -1
--tg-rate-limit Enable rate limiting No true
--tg-rate-burst Limiting burst No 5
--tg-rate Limiting rate No 100
--tg-session-file Bot session file. No $HOME/.teldrive/session.db
--tg-bg-bots-limit Start at most this no of bots in the background to prevent connection recreation on every request.Increase this if you are streaming or downloading large no of files simultaneously. No 5
--tg-uploads-threads Concurrent Uploads threads for uploading file No 8
--tg-uploads-retention Uploads retention duration.Duration to keep failed uploaded chunks in db for resuming uploads. No 7d
--tg-proxy Socks5 or HTTP proxy for telegram client. No ""
--tg-pool-size Connection pool size for uploads.Greater pool size will result in more memory and cpu usage set it to 0 but it will lower upload speed significantly or reduce the no of concurrent uploads and transfers in rclone. No 8

You Can also set config values through env varibles.

[!WARNING] Keep your Password safe once generated teldrive uses same encryption as of rclone internally so you don't need to enable crypt in rclone.Teldrive generates random salt for each file part and saves in database so its more secure than rclone crypt whereas in rclone same salt value is used for all files which can be compromised easily. Enabling crypt in rclone makes UI redundant so encrypting files in teldrive internally is better way to encrypt files and more secure encryption than rclone.To encrypt files see more about teldrive rclone config.

For making use of Multi Bots

[!WARNING] Bots will be auto added as admin in channel if you set them from UI if it fails somehow add it manually.For newly logged session you have to wait 20-30 min to add bots to telegram channel.FRESH_CHANGE_ADMINS_FORBIDDEN error will be thrown if you try to add bots before that time frame.

Rclone Config Example

[teldrive]
type = teldrive
api_host = http://localhost:8080 # default host
access_token = #session token obtained from cookies
chunk_size = 500M
upload_concurrency = 4
encrypt_files = false # Enable this to encrypt files make sure encryption key is not empty in teldrive config file.
random_chunk_name= true # Use random chunk names when uploading files to channel instead of original filename.

See all options in rclone config command

Recognitions

divyam234%2Fteldrive | Trendshift

Best Practices for Using Teldrive

Dos:

Don'ts:

By following these guidelines, you contribute to the responsible and effective use of Telegram, maintaining a fair and equitable environment for all users.

Contributing

Feel free to contribute to this project if you have any further ideas.

Donate

If you like this project small contribution would be appreciated Paypal.