Skip to content

Unlimited Private Drive for Multiple Users via Telegram API

License

Notifications You must be signed in to change notification settings

AbissoHub/Telegram-Drive

Repository files navigation

Telegram Drive by AbissoHub

Unlimited private cloud storage solution using Telegram's API

Overview

Telegram Drive is a Python-based application that uses Telegram’s APIs to provide a secure and scalable cloud storage solution designed for multiple users. By utilizing a single valid Telegram account, you can create an unlimited and secure cloud storage system where each participant is assigned unique username and password credentials.

Features

  • Unlimited Storage Capacity: Utilize Telegram's storage infrastructure to store files of any size.
  • Data Security and Protection: Ensure data integrity and security through Telegram's end-to-end encryption.
  • Multi-User Accessibility: Allow multiple users to access the drive with unique credentials.

Module dependencies

  • Quart: Asynchronous python web framework for handling HTTPS requests.
  • PyMongo: Official MongoDB driver for Python.
  • Telethon: Python library for interacting with Telegram's API.
  • MongoDB: Used to store file metadata and manage user information, minimizing direct interactions with Telegram's API.

Project Structure

Telegram-Drive/
├── api/
│   ├── discord/          # Modules for Discord integration (not yet implemented)
│   ├── mongodb/          # Modules for MongoDB integration
│   └── telegram/         # Abstraction layers for Telegram API interactions
├── server/               # HTTPS server implementation using Quart
├── format/               # Modules for formatting media objects (files, images, audio)
├── userManagement/       # User management module (register / changePw / etc...)
├── utils/                # Utility modules for reusable and maintainable code functions
├── README.md
└── LICENSE

Installation

  1. Clone the Repository:

    git clone https://github.com/AbissoHub/Telegram-Drive
    cd Telegram-Drive
  2. Install Dependencies: Ensure you have python then install the required Python packages:

    pip install -r requirements.txt
  3. Set Up Environment Variables: Create a .env file in the root directory and configure environment variables as outlined in the Configuration section.

  4. Register Users Using module user_management.py register user you want in storage (you can do this later, but you won't be able to access the drive properly)

  5. Run the Server:

python main.py

Configuration

Create a .env file in the root directory with the following variables:

  • API_ID: Your Telegram API ID. Check here
  • API_HASH: Your Telegram API Hash. Check here
  • PHONE: The phone number associated with your Telegram account in international format (e.g., +1234567890).
  • MONGO_URL: MongoDB connection string. Check here
  • SERVER_PORT: Port number for the Quart server. If you leave blank will be select default port
  • DISCORD_TOKEN_URL: Param for discord login, you can leave blank
  • DISCORD_AUTH_URL: Param for discord login, you can leave blank
  • SECRET_KEY: A secret key generated by the script in .utils/ folder. DO NOT SHARE IT
  • NAME_CLUSTER: Cluster name in mongo DB to storage metadata

example:

API_ID=your_api_id
API_HASH=your_api_hash
PHONE="+1234567890"
MONGO_URL="your_mongodb_connection_string"
DISCORD_TOKEN_URL=""
DISCORD_AUTH_URL=""
SECRET_KEY="your_secret_key"
PORT=5000
NAME_CLUSTER="Telegramdrive"

Ensure all required environment variables are properly set before deploying the service.

Get Telegram ID/Hash

Before working with Telegram’s API, you need to get your own API ID and hash:

  1. Log in to your Telegram account with the phone number of the developer account you intend to use.
  2. Go to API Development tools.
  3. A Create new application window will appear. Fill in your application details. There is no need to enter any URL, and only the first two fields (App title and Short name) can currently be changed later.
  4. Click on Create application at the end.

Note
Remember that your API hash is secret, and Telegram won’t let you revoke it. Don’t share it publicly!

First Launch

After configuring the .env file, registering users, and launching main.py, follow the terminal instructions to properly set up your Telegram account. Typically, the interface should appear as shown below:

[INFO] Starting server on ***.***.*.**:5000
 * Serving Quart app 'server.server'
 * Debug mode: False
 * Please use an ASGI server (e.g. Hypercorn) directly in production
 * Running on http://***.***.*.**:5000 (CTRL + C to quit)
[INFO] Connected to MongoDB
Please enter the code you received: 

You will receive an OTP message from telegram, remember to enter it and do not share it.

At the end of this process the clusters for each registered user should be created automatically, and you can use the service correctly. If this step was performed before registering the users there is no problem, but you will have to restart the server

Enjoy :)

Database structure

The database is structured with two main types of root folders: shared and private.

  • Shared: This folder is accessible to ALL users registered to the service.
  • Private: This folder is exclusive to the individual user. For syntactic reasons, including integration with Telegram, private and shared files are stored in separate logical spaces to ensure the highest possible syntactic privacy. Additionally, it is not possible to move files between private and shared folders, or vice versa, to maintain this privacy.

There is a trash folder where all items are initially moved when deleted. A second deletion from the trash folder results in the PERMANENT removal of the object.

Current Version & Limitations

Current Version: 0.1.0

Limitations:

  • File Size Upload: Restrictions on the maximum file size that can be uploaded due to Telegram API limitations.
  • Chunked Uploads: Currently does not support chunked uploads, limiting the ability to upload very large files seamlessly.

Note
Being the first version, the presence of bugs is likely, crashes should be well managed but total uptime is not guaranteed. Thanks for your understanding

Planned Improvements:

  • Implement chunked upload functionality.
  • Optimize system performance to handle increased data loads.

GUI

Abisso Drive offers a user-friendly GUI developed with React, allowing users to manage their files, upload/download content, and navigate through their storage effortlessly. The GUI communicates with the backend server through predefined endpoints, enabling customization and integration into various workflows.

Repository

preview_gui

📖 Documentation

The documentation for Telegram-Drive can be found here. available soon

📄 License

This project is licensed under the MIT License. You are free to use, modify, and distribute the software as per the terms of this license.