Update upload_file.sh, add shrink_url.sh, rename twist-dl.node to twist-dl.sh

This commit is contained in:
Alice Gaudon 2020-09-01 11:41:59 +02:00
parent a12ae9248a
commit d37658ab40
4 changed files with 35 additions and 18 deletions

View File

@ -1,18 +0,0 @@
#!/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

17
shrink_url.sh Executable file
View File

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

18
upload_file.sh Executable file
View File

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