19 lines
367 B
Bash
19 lines
367 B
Bash
|
#!/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
|