mirror of
https://github.com/TheodoreKrypton/tgfs
synced 2024-11-22 23:32:45 +00:00
.github/workflows | ||
src | ||
test | ||
.gitignore | ||
.prettierignore | ||
.prettierrc | ||
Dockerfile | ||
example-config.yaml | ||
jest.config.js | ||
LICENSE | ||
package.json | ||
README.md | ||
tsconfig.json | ||
yarn.lock |
tgfs
Use telegram as file storage, with a command line tool and WebDAV server.
Tested on Windows, Ubuntu, MacOS
Installation
Through Git
$ yarn install && yarn build
$ alias tgfs="yarn start:prod"
Step by Step Guide to Set up config
First step
- Duplicate the
example-config.yaml
file and name itconfig.yaml
- Go to Here, login with your phone number and create a Telegram app.
- Copy the
api_id
andapi_hash
from the Telegram app page (step 2) to the config file (telegram -> 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
, where1234567
is the channel id. Copy the channel id to the config file (telegram -> private_file_channel
)
Create a Telegram bot (Optional, if you don't want to use your own account)
- Go to BotFather, create a new bot and copy the token to the config file (
telegram -> bot_token
) - Add the bot to the channel as an administrator
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
Use it as a WebDAV server
$ tgfs -w
or
$ tgfs --webdav
Tested WebDAV Clients:
Config fields explanation
-
telegram
- 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.
-
webdav
- host: The host of the WebDAV server listening on.
- port: The port of the WebDAV server listening on.
- users: The users of the WebDAV server.
- password: The password of the user.