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
|
#!/bin/bash
|
||||||
|
|
||||||
set -eu
|
PASTE_URL="YNH_HASTE_URL"
|
||||||
|
|
||||||
PASTE_URL="https://YNH_HASTE_URL"
|
|
||||||
|
|
||||||
haste () {
|
haste () {
|
||||||
local output returnfile contents
|
local output returnfile contents
|
||||||
|
@ -33,10 +31,10 @@ haste () {
|
||||||
then
|
then
|
||||||
contents=$(cat $1)
|
contents=$(cat $1)
|
||||||
fi
|
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\" ]]
|
if (( $? == 0 )) && [[ $output =~ \"key\" ]]
|
||||||
then
|
then
|
||||||
returnfile=$(sed 's/^.*"key":"/http:\/\/'${PASTE_URL}'\//;s/".*$//' <<< "$output")
|
returnfile=$(sed 's/^.*"key":"/https:\/\/'${PASTE_URL}'\//;s/".*$//' <<< "$output")
|
||||||
if [[ -n $returnfile ]]
|
if [[ -n $returnfile ]]
|
||||||
then
|
then
|
||||||
echo "$returnfile"
|
echo "$returnfile"
|
||||||
|
|
Loading…
Reference in a new issue