mirror of
https://github.com/TheodoreKrypton/tgfs
synced 2024-11-22 07:04:35 +00:00
.github/workflows | ||
src | ||
test | ||
.gitignore | ||
.prettierignore | ||
.prettierrc | ||
Dockerfile | ||
entrypoint.sh | ||
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 NPM
$ npm 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
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:
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
)
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.
- login_timeout: Time to wait before login attempt aborts (in milliseconds).
-
tgfs
- download
- porgress: Whether to show a progress bar when downloading files
- chunk_size_kb: The chunk size in KB when downloading files. Bigger chunk size means less requests.
- download
-
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.