Telegram Drive
Find a file
2023-09-15 01:33:02 +05:30
.github update actions 2023-09-08 16:36:59 +05:30
.vscode update 2023-08-16 03:24:51 +05:30
cache initial commit 2023-08-07 01:02:46 +05:30
database changes related to upload check 2023-09-11 13:44:13 +05:30
models added 2fa support 2023-08-22 20:30:14 +05:30
public chnaged package name 2023-08-16 03:23:02 +05:30
routes added embedded ui and migrations 2023-09-08 16:08:20 +05:30
schemas added 2fa support 2023-08-22 20:30:14 +05:30
services set default mimtype 2023-09-14 12:47:55 +05:30
types added 2fa support 2023-08-22 20:30:14 +05:30
ui update ref 2023-09-13 11:34:16 +05:30
utils added acl 2023-09-08 20:21:54 +05:30
.gitignore update schema 2023-08-17 21:02:40 +05:30
.gitmodules added embedded ui and migrations 2023-09-08 16:08:20 +05:30
.goreleaser.yaml update releaser 2023-09-08 10:59:19 +00:00
docker-compose.yml Update docker-compose.yml 2023-09-09 18:11:39 +05:30
Dockerfile added embedded ui and migrations 2023-09-08 16:08:20 +05:30
go.mod added embedded ui and migrations 2023-09-08 16:08:20 +05:30
go.sum added embedded ui and migrations 2023-09-08 16:08:20 +05:30
LICENSE Update LICENSE 2023-08-19 15:12:56 +05:30
main.go add etag modified headers 2023-09-14 12:40:14 +05:30
Makefile changes in Makefile 2023-09-08 18:45:47 +05:30
README.md Update README.md 2023-09-15 01:33:02 +05:30

Telegram Drive

Telegram Drive is a powerful utility that enables you to create your own cloud storage service using Telegram as the backend.

Discord

Table of Contents
  1. Setting up things

Features

  • UI: Based on Material You to create nice looking UI themes.
  • Secure: Your data is secured using Telegram's robust encryption.
  • Flexible Deployment: Use Docker Compose or deploy without Docker.

Demo

demo

UI Repo

Deploy using docker-compose

First clone the repository

git clone https://github.com/divyam234/teldrive
cd teldrive

Follow Below Steps

  • Create the .env or teldrive.env file with your variables and start your container.
docker compose up -d
  • Go to http://localhost:8080

  • Uploads from UI will be slower due to limitations of browser use Teldrive Uploader for faster uploads.Make sure to use Multi Client mode if you are using uploader.

  • If you intend to share download links with others, ensure that you enable multi-client mode with bots.

Use without docker

Follow Below Steps

  • Download the release binary of Teldrive from the releases section.

  • Add same env file as above.

  • Now, run the Teldrive executable binary directly.

Setting up things

If you're locally or remotely hosting, create a file named .env or teldrive.env in the root directory and add all the variables there. An example of .env file:

APP_ID=1234
APP_HASH=abc
CHANNEL_ID=1234
HTTPS=false
COOKIE_SAME_SITE=true
JWT_SECRET=abc
DATABASE_URL=abc
RATE_LIMIT=true
TG_CLIENT_DEVICE_MODEL="Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/116.0" # Any valid  browser user agent here
MULTI_CLIENT=false
MULTI_TOKEN1=""
MULTI_TOKEN2=""
MULTI_TOKEN3=""

Use strong JWT secret instead of pure guessable string.You can use openssl to generate it.

$ openssl rand -base64 32

Multi-Client Mode is recommended to avoid flood errors and enable maximum download speed, especially if you are using downloaders like IDM and aria2c which use multiple connections for downloads.

Mandatory Vars

Before running the bot, you will need to set up the following mandatory variables:

  • APP_ID : Use official ones as mentioned above.

  • APP_HASH : Use official ones as mentioned above.

  • JWT_SECRET : Used for signing jwt tokens

  • DATABASE_URL : Connection String obtained from Postgres DB (you can use Neon db as free alternative fro postgres)

  • CHANNEL_ID : This is the channel ID for the log channel where app will store files . To obtain a channel ID, create a new telegram channel (public or private), post something in the channel, forward the message to @JsonDumpBot . Copy the forwarded channel ID and paste it into the this field and remove -100 from the start.

Optional Vars

In addition to the mandatory variables, you can also set the following optional variables:

  • HTTPS : Only needed when frontend is deployed on vercel.
  • PORT : Change listen port default is 8080
  • ALLOWED_USERS : Allow certain telegram usernames including yours to access the app.Enter comma seperated telegram usernames here.Its needed when your instance is on public cloud and you want to restrict other people to access you app.
  • COOKIE_SAME_SITE : Only needed when frontend is deployed on vercel.
  • MULTI_CLIENT : Enable or Disable Multi Token mode. If true you have pass atleast one Multi Token
  • MULTI_TOKEN[1....] : Recommended to add atleast 10-12 tokens

For making use of Multi-Client support

Note

What it multi-client feature and what it does?
This feature shares the Telegram API requests between other bots to avoid getting floodwaited (A kind of rate limiting that Telegram does in the backend to avoid flooding their servers) and to make the server handle more requests.

To enable multi-client, generate new bot tokens and add it as your environmental variables with the following key names.

MULTI_TOKEN1: Add your first bot token here.

MULTI_TOKEN2: Add your second bot token here.

you may also add as many as bots you want. (max limit is not tested yet) MULTI_TOKEN3, MULTI_TOKEN4, etc.

Warning

Don't forget to add all these bots to the CHANNEL_ID as admin for the proper functioning

FAQ

  • How to get Postgres DB url ?

You can set up a local Postgres instance, but it's not recommended due to backup and data transfer hassles. The recommended approach is to use a free cloud-based Postgres DB like Neon DB.

Contributing

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