summaryrefslogtreecommitdiffstats
path: root/fb.in
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@server-speed.net>2011-03-07 19:00:06 +0100
committerFlorian Pritz <bluewind@server-speed.net>2011-03-20 21:08:32 +0100
commit913ed7c9d756407212c56205d23cc2a06d25511a (patch)
tree72fa248b2cec43cc54487027fe55695b1927cb8d /fb.in
parent483ddd7630faaa5942907659e658db3fe91c898b (diff)
use helper script instead of curl for uploading
Signed-off-by: Florian Pritz <bluewind@server-speed.net>
Diffstat (limited to 'fb.in')
-rw-r--r--fb.in21
1 files changed, 5 insertions, 16 deletions
diff --git a/fb.in b/fb.in
index f6877ae..ce85695 100644
--- a/fb.in
+++ b/fb.in
@@ -25,6 +25,7 @@ WARNSIZE=10485760
USERAGENT="fb-client/$VERSION"
CLIPBOARD=""
EXITCODE=0
+LIBDIR="@LIBDIR@"
do_upload() {
local EXTRA=""
@@ -53,9 +54,6 @@ do_upload() {
file="$TMPDIR/$basefilename.xz"
fi
- if [ "$EXTENSION" ]; then
- EXTRA="-F extension=$EXTENSION"
- fi
TMPFILE=`mktemp "$TMPDIR/data.XXXXXX"`
if [ `stat -c %s -- "$file"` -gt "$WARNSIZE" ]; then
WARNSIZE=`curl -s "$PASTEBIN/file/get_max_size"`
@@ -65,21 +63,12 @@ do_upload() {
return 1
fi
fi
- CURLOPTS="-# -n -L -A $USERAGENT $EXTRA"
- if [ `stat -c %s -- "$file"` -eq "0" ] || echo "$file" | grep -F -q ","; then
- basefilename=`echo "$basefilename" | tr -d ,`
- if ! curl $CURLOPTS -F "file=@-;filename=$basefilename" "$PASTEBIN/file/do_upload" < "$file" > $TMPFILE; then
- EXITCODE=1
- return 1
- fi
- else
- if ! curl $CURLOPTS -F "file=@$file" "$PASTEBIN/file/do_upload" > $TMPFILE; then
- EXITCODE=1
- return 1
- fi
+ if ! $LIBDIR/fb-upload "$PASTEBIN/file/do_upload" "$file" > $TMPFILE; then
+ EXITCODE=1
+ return 1
fi
sed '$d' $TMPFILE >&2
- URL=`tail -1 $TMPFILE`
+ URL=`tail -1 $TMPFILE`"$EXTENSION"
echo $URL
CLIPBOARD="$CLIPBOARD $URL"
}