Giter Site home page Giter Site logo

telegramfuse's Introduction

Keep In Mind

Though Telegram allows file uploads, it is not intended to be used as cloud storage. Your files could be lost at any time. Don't rely on this project (or any similar ones) for storing important files on Telegram. Storing large amounts of files on this could result in Telegram deleting your files or banning you, proceed at your own risk.

TelegramFS

A FUSE program that stores files on Telegram.

Though I demonstrated Discord in the video too, I haven't included the code here. While I believe that storing your OWN files on Discord does NOT violate TOS, I think that spreading the code to do so might. Idk I'm trying to not actually get banned :)

Usage and How to Run

Requirements

  • Linux. Sorry Windows gamers, probably WSL would work
  • Python - I used 3.10.12
  • libfuse3
  • A non-negligible amount of memory, if you plan to upload large files. I ran this on a system with 16GB RAM and that was usually enough, but I had occasional crashes uploading lots of large files in a row.

To Run

Before running this, I recommend creating a virtual environment in Python.

  • (optional) Create a venv with python -m venv <your-env-name>
  • Rename .env.sample to .env and fill in the variables with appropriate values. Here's a description of these values and where you can get them from:
    • APP_ID and APP_HASH: You can get these from https://my.telegram.org/myapp. AGAIN, storing large amounts of files could get you banned. So be careful and take precautions if you care about losing your account.
    • CHANNEL_LINK: the link to your Telegram channel.
    • SESSION_NAME: this can be whatever you want, just the name that will be used for the file storing details of your Telegram session.
  • Run pip install -r requirements.txt.
    • This might fail to get pyfuse3. If it does, you may be missing some requirements. On my system (Ubuntu 20.04), running this command to install some exta packages worked for me: sudo apt install meson cmake fuse3 libfuse3-dev libglib2.0-dev pkg-config. You can also install from these directions: http://www.rath.org/pyfuse3-docs/install.html
  • Enable the user_allow_other option in /etc/fuse.conf.
  • Run python main.py <path/to/your/mount> for instance, python3 main.py ./telegramfs will mount at the directory `telegramfs`` in the current working dir. The directory you are mounting must exist.

Known Issues

Uploading large files to Telegram (more than ~3GB) may result in degraded performance or the system killing the process for using too much memory. This is probably my fault. I found the behavior of memory management in Python is a bit strange, even calling gc.collect() after clearing the buffer doesn't always seem to work. It could also be an issue with the LRU cache I implemented... I don't have the patience to wait 20 minutes for it to crash and then debug, especially because the vast majority of my files are pretty small.

Error handling is somewhat lacking. If Telegram uploads fail, you'll probably see message in console, but it won't retry. Worst case, you can delete whatever file you were trying to upload and try again.

TO UNMOUNT, IF SOMETHING BREAKS

fusermount -u <path/of/your/mount>

telegramfuse's People

Contributors

devdetour avatar oliomin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.