Update upload scripts for ily.li

This commit is contained in:
Alice Gaudon 2020-08-13 11:36:52 +02:00
parent bc726fe81f
commit 90e6fbdca1
3 changed files with 20 additions and 14 deletions

View File

@ -8,13 +8,7 @@ file_name+=$base_name
flameshot gui -r > $file_name
sftp -oPort=4242 gaudonpr@ftp.gaudon.pro << EOT
cd public_html/push.arisu.fr/
put $file_name
EOT
url="https://push.arisu.fr/"
url+=$base_name
url=$(sh $(dirname $0)/push_file.sh $file_name)
echo $url | xclip -selection clipboard

View File

@ -7,13 +7,7 @@ base_name=$latest_screenshot
file_name+=$base_name
sftp -oPort=4242 gaudonpr@ftp.gaudon.pro << EOT
cd public_html/push.arisu.fr/
put $file_name
EOT
url="https://push.arisu.fr/"
url+=$base_name
url=$(sh $(dirname $0)/push_file.sh $file_name)
echo $url | xclip -selection clipboard

18
push_file.sh Executable file
View File

@ -0,0 +1,18 @@
#!/bin/sh
local_file=$1
token=$(cat $HOME/.ily_token)
if test -z "$2"; then
curl -X POST -H 'Accept: text/plain' \
-H "Authorization: $token" \
-F 'upload=@'$local_file \
-F 'ttl=2592000' \
https://ily.li/
else
curl -X PUT -H 'Accept: text/plain' \
-H "Authorization: $token" \
-F 'upload=@'$local_file \
-F 'ttl=2592000' \
"https://ily.li/$2"
fi