Created
May 10, 2024 07:20
-
-
Save j796160836/56b5ea8a46cc8acfe5d9a44568c1b41b to your computer and use it in GitHub Desktop.
Upload file to Alist
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export HTTP_PROXY=http://192.168.1.3:3128 | |
export HTTPS_PROXY=$HTTP_PROXY | |
export NO_PROXY="localhost, 127.0.0.1" | |
domain='https://YOUR_SERVER_IP' | |
token='xxxxxxxxxx' | |
file=$1 | |
remotePath="/uploads/$(date +"%Y-%m-%d")/$file" | |
if [ "$#" -ne 1 ]; then | |
echo "Usage: ./upload.sh file.txt" | |
exit 1 | |
fi | |
if [ ! -f "$1" ]; then | |
echo "$1 file not found!" | |
exit 1 | |
fi | |
curl -X PUT "$domain/api/fs/put" -H "Authorization:$token" -H "File-Path:$remotePath" -T "$file" | |
unset HTTP_PROXY | |
unset HTTPS_PROXY |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment