tgfs
Use telegram as file storage, with a command line tool and WebDAV server. Refer to the wiki page for more detail.
Tested on Windows, Ubuntu, MacOS
Installation
Through PYPI
$ pip install tgfs
Through Git
$ yarn install && yarn build
$ alias tgfs="yarn start:prod"
Use it as a WebDAV server
$ tgfs -w
or
$ tgfs --webdav
Tested WebDAV Clients:
cmd usage
-
ls
$ tgfs cmd ls /
-
mkdir
$ tgfs cmd mkdir /documents
$ tgfs cmd mkdir -p /documents/pictures
-
cp
$ tgfs cmd cp ~/some-file /
-
rm
$ tgfs cmd rm /some-file
$ tgfs cmd rm -r /some-folder
Step by Step Guide to Set up config
For feature development purpose, any configuration is unstable at the current stage. You may need to reconfigure following any update.
Automatically:
A config file will be auto-generated when you run the program for the first time. Just follow the instructions to create a Telegram app and a private channel to store the files.
Manually:
Preparation
- Duplicate the
example-config.yamlfile and name itconfig.yaml
Set up account details (why do I need this?)
- Go to Here, login with your phone number and create a Telegram app.
- Copy the
api_idandapi_hashfrom the Telegram app page (step 2) to the config file (telegram -> account -> api_id / api_hash)
Set up the channel to store files
- Create a new Telegram private channel (New Channel in the menu on the left)
- There should be a message like "Channel created". Right click the message and copy the post link.
- The format of the link should be like
https://t.me/c/1234567/1, where1234567is the channel id. Copy the channel id to the config file (telegram -> private_file_channel)
Set up a Telegram bot (why do I need this?)
- Go to BotFather, send
/newbot, and follow the steps to create a bot. - Paste the bot token given by BotFater to the config file (
telegram -> bot -> token) - Go to your file channel (created in the previous step), add your bot to subscriber, and promote it to admin, with permission to send/edit/delete messages.
Config fields explanation
-
telegram
- account/bot:
- session_file: The file path to store the session data. If you want to use multiple accounts, you can set different session files for each account.
- login_timeout: Time to wait before login attempt aborts (in milliseconds).
- account/bot:
-
tgfs
- users: the users authenticated by tgfs, used by both webdav authentication and monitor
- download
- chunk_size_kb: The chunk size in KB when downloading files. Bigger chunk size means less requests.
-
webdav
- host: The host of the WebDAV server listening on.
- port: The port of the WebDAV server listening on.
- path: The root path for the WebDAV server. For example, setting this value to /webdav makes the WebDAV link
http://[host]:[port]/webdav.
FAQ
Q: Why do I need a bot when my account is also able to send messages?
Frequently sending messages may get your account banned, so using a bot is the best way to manage the risk. You can create another bot when it is banned.
Q: Why do I need an account API then?
The functionality of bot API is limited. For example, a bot can neither read history messages, nor send files exceeding 50MB. The account API is used when a bot cannot do the job.
Metadata
Release files for tgfs 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tgfs-0.1.0.tar.gz | 27.2 kB | Without provenance | Details for tgfs-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tgfs-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for tgfs-0.1.0-py3-none-any.whl |
Total release size: 66.1 kB
Release files / tgfs-0.1.0.tar.gz
| Download URL | tgfs-0.1.0.tar.gz |
|---|---|
| Size | 27.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
75a2b66de9d6522e609f13c249c18f1d74ce329d7609c5b46420333fab1a60c2
|
|
BLAKE2b-256 checksum How to use checksums |
4490f66f880451e105bb17080890f6758980eb093bf2d5f8f121563cd2e63a4a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.11.4 Windows/10
|
Release files / tgfs-0.1.0-py3-none-any.whl
| Download URL | tgfs-0.1.0-py3-none-any.whl |
|---|---|
| Size | 38.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f239c477aedcb3a72e6c7958a76ea2e3d4c28be63b9c13fec5ee9358ce02f852
|
|
BLAKE2b-256 checksum How to use checksums |
77ae5f1dd0863e96264c5a65e8283c4bda4c9f13895c3f4a70de9549b99ebb47
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.11.4 Windows/10
|
Security for tgfs 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.