2020-06-27 17:50:28 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
local_file=$1
|
2020-07-06 10:49:18 +02:00
|
|
|
slug=$2
|
|
|
|
token=$(cat "$HOME/.ily_token")
|
2020-06-27 17:50:28 +02:00
|
|
|
|
2020-07-06 10:49:18 +02:00
|
|
|
if test -z "$slug"; then
|
|
|
|
method=POST
|
2020-06-27 17:50:28 +02:00
|
|
|
else
|
2020-07-06 10:49:18 +02:00
|
|
|
method=PUT
|
2020-06-27 17:50:28 +02:00
|
|
|
fi
|
2020-07-06 10:49:18 +02:00
|
|
|
|
|
|
|
curl -X $method -H 'Accept: text/plain' \
|
|
|
|
-H "Authorization: $token" \
|
|
|
|
-F 'type=file' \
|
|
|
|
-F "upload=@$local_file" \
|
|
|
|
-F 'ttl=2592000' \
|
|
|
|
"https://ily.li/$slug"
|