mirror of
https://github.com/YunoHost-Apps/haste_ynh.git
synced 2024-09-03 20:36:28 +02:00
Fix haste command
This commit is contained in:
parent
2c0f85715b
commit
5713c40336
1 changed files with 3 additions and 5 deletions
|
@ -1,8 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -eu
|
||||
|
||||
PASTE_URL="https://YNH_HASTE_URL"
|
||||
PASTE_URL="YNH_HASTE_URL"
|
||||
|
||||
haste () {
|
||||
local output returnfile contents
|
||||
|
@ -33,10 +31,10 @@ haste () {
|
|||
then
|
||||
contents=$(cat $1)
|
||||
fi
|
||||
output=$(curl -# -f -XPOST "http://"${PASTE_URL}"/documents" -d"$contents")
|
||||
output=$(curl -# -f -k -XPOST "https://"${PASTE_URL}"/documents" -d"$contents")
|
||||
if (( $? == 0 )) && [[ $output =~ \"key\" ]]
|
||||
then
|
||||
returnfile=$(sed 's/^.*"key":"/http:\/\/'${PASTE_URL}'\//;s/".*$//' <<< "$output")
|
||||
returnfile=$(sed 's/^.*"key":"/https:\/\/'${PASTE_URL}'\//;s/".*$//' <<< "$output")
|
||||
if [[ -n $returnfile ]]
|
||||
then
|
||||
echo "$returnfile"
|
||||
|
|
Loading…
Reference in a new issue