下載teldrive

teldrive github repo

根據系統下載teldrive

範例

wget https://github.com/divyam234/teldrive/releases/download/1.4.16/teldrive-1.4.16-linux-amd64.tar.gz
tar -xf  teldrive-1.4.16-linux-amd64.tar.gz

獲取JWT secret

https://generate-secret.vercel.app/32

telegram API

https://my.telegram.org/apps

記得保存

PostgreSQL

待更新:
PostgreSQL放docker裏面比較好

https://www.postgresql.org/download/

su - postgres
createuser telegram
createdb telegram_drive
psql
alter user telegram with encrypted password 'password';
grant all privileges on database telegram_drive to telegram;
GRANT ALL ON SCHEMA public TO telegram;
GRANT ALL ON ALL TABLES IN SCHEMA public TO telegram;
ALTER DATABASE telegram_drive OWNER TO telegram;
GRANT USAGE ON SCHEMA public TO telegram;
CREATE EXTENSION IF NOT EXISTS pgroonga;
GRANT ALL ON ALL SEQUENCES IN SCHEMA public TO telegram;
GRANT ALL ON ALL FUNCTIONS IN SCHEMA public TO telegram;
sudo service postgresql start

記得修改password

配置

待更新:
設置白名單用戶,儲存用戶文件,加密

nano config.toml
[db]
data-source = "postgres://telegram:[email protected]:8998/telegram_drive"

[jwt]
secret = "JWT secret"

[tg]
app-id = tg app id
app-hash = "tg app hash"

[server]
port = 8081

data-sourcepostgres://<db用戶名>:<db密碼>@<db主機>:8998/<db名稱>

secret為你在JWT secret裏獲取到的secret

app-id為你的telegram app id

app-hash為你的telegram app hash

port 為你想要使用的端口(可選)

配置好後按ctrl+x保存,enter確定

防火墻

ufw allow 8081

啓動

./teldrive run

登錄

訪問http://ip:端口

設定

點擊右上角設定

這裏可以配置分隔文件大小

點開account,在tg創建一個私人頻道

然後選擇頻道

返回主頁,即可使用

速度測試

實測上傳速度在150-200mbps左右,8分鐘左右即可上傳完成10gb的文件

無分段文件上傳在50mbps左右

下載速度就比較慢了,只有30mbps左右,不知道是不是我問題