Skip to content

A Google Drive website clone, Uses telegram for storage

License

Notifications You must be signed in to change notification settings

kjeymax/TGDrive

 
 

Repository files navigation

TGDrive - A Google Drive Clone with Telegram Storage

Welcome to TGDrive! This web application replicates Google Drive's functionalities using Telegram as its storage backend. Manage folders and files, perform actions like uploading, renaming, and deleting, utilize trash/bin support, enable permanent deletion, and share public links. The application offers admin login and automatically backs up the database to Telegram.

Total Repo Views

Features

  • File Management: Upload, rename, and delete files with integrated trash/bin functionality and permanent deletion support.
  • Folder Management: Easily create, rename, and delete folders.
  • Sharing: Seamlessly share public links for files and folders.
  • Admin Support: Secure admin login for efficient management.
  • Automatic Backups: Automated database backups sent directly to Telegram.
  • Multiple Bots/Clients: Support for multiple bots/clients for file operations and streaming from Telegram.
  • Large File Support: Upload files up to 4GB using Telegram Premium accounts.
  • Auto Pinger: Built-in feature to keep the website active by preventing idle timeouts.
  • URL Upload Support: Upload files directly to TG Drive from any direct download link of a file.

Tech Stack

  • Backend: Python, FastAPI
  • Frontend: HTML, CSS, JavaScript
  • Database: Local storage as a class object, saved to a file using the pickle module.
  • Storage: Telegram

Demo

Explore the live demo of TGDrive:

Feel free to test the features with the provided login credentials.

Todo List

  • Implement 4GB file uploads using Telegram Premium accounts.
  • Enable sorting of folders/files by date/time uploaded (Newest First).
  • Add a search feature for files and folders.
  • Integrate video player support on the website.
  • Support remote URL uploads.

Deploying Your Own

1. Clone the Repository

git clone https://github.com/TechShreyash/TGDrive
cd TGDrive

2. Set Up Your Environment Variables

Create a .env file in the root directory and add the following environment variables:

Note: You can also set environment variables directly in some hosting services instead of creating a .env file.

Required Variables

Variable Name Type Example Description
API_ID integer 123456 Your Telegram API ID
API_HASH string dagsjdhgjfsahgjfh Your Telegram API Hash
BOT_TOKENS string 21413535:gkdshajfhjfakhjf List of Telegram bot tokens for file operations, separated by commas
STORAGE_CHANNEL integer -100123456789 Chat ID of the Telegram storage channel
DATABASE_BACKUP_MSG_ID integer 123 Message ID of a file in the storage channel for database backups

Note: All bots mentioned in the BOT_TOKENS variable must be added as admins in your STORAGE_CHANNEL.

Note: DATABASE_BACKUP_MSG_ID should be the message ID of a file (document) in the STORAGE_CHANNEL.

Optional Variables

Variable Name Type Default Description
ADMIN_PASSWORD string admin Password for accessing the admin panel
STRING_SESSIONS string None List of Premium Telegram Account Pyrogram String Sessions for file operations
SLEEP_THRESHOLD integer (in seconds) 60 Delay in seconds before retrying after a Telegram API floodwait error
DATABASE_BACKUP_TIME integer (in seconds) 60 Interval in seconds for database backups to the storage channel
MAX_FILE_SIZE float (in GBs) 1.98 (3.98 if STRING_SESSIONS are added) Maximum file size (in GBs) allowed for uploading to Telegram
WEBSITE_URL string None Website url (with https/http) to auto-ping to keep the website active

Note: Premium Client (STRING_SESSIONS) will be used only to upload when file size is greater than 2GB.

Note: File streaming/downloads will be done by bots (BOT_TOKENS).

3. Install/Update Dependencies

pip install -U -r requirements.txt

4. Run the FastAPI Application

uvicorn main:app --host 0.0.0.0 --port 8000

Access the application at https://127.0.0.1:8000.

Note: For public deployment, refer to online guides on deploying FastAPI apps.

Deploy Tutorials

Deploy To Render.com For Free : https://youtu.be/S5OIi5Ur3c0

Deploy to Render

Note: After updating the TG Drive code, clear your browser's cache to ensure the latest JavaScript files are loaded and run correctly.

Contributing

Contributions are welcome! Fork the repository, make your changes, and create a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Support

For inquiries or support, join our Telegram Support Group or email [email protected].

About

A Google Drive website clone, Uses telegram for storage

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 49.8%
  • JavaScript 30.0%
  • HTML 10.4%
  • CSS 9.7%
  • Shell 0.1%