#!/bin/sh #---------------------------------------------------- # Author: Florian "Bluewind" Pritz # Contributor: Moritz Wilhelmy # # Licensed under WTFPL v2 # (see COPYING for full license text) # #---------------------------------------------------- # Dependencies: curl # Optional: xclip #---------------------------------------------------- VERSION="0.6.7.1" DELETE= EXTENSION="" GET= PASTEBIN="http://paste.xinu.at" WARNSIZE=10485760 USERAGENT="fb-client/$VERSION" CLIPBOARD="" EXITCODE=0 do_upload() { local EXTRA="" if [ "$EXTENSION" ]; then EXTRA="-F extension=$EXTENSION" fi TMPFILE=`mktemp "$TMPDIR/data.XXXXXX"` if [ `stat -c %s "$1"` -gt "$WARNSIZE" ]; then WARNSIZE=`curl -s "$PASTEBIN/file/get_max_size"` if [ `stat -c %s "$1"` -gt "$WARNSIZE" ]; then echo "Warning: Your upload is too big and would be rejected. Maximum size is: $WARNSIZE bytes. Skipping..." >&2 EXITCODE=1 return 1 fi fi if ! curl -# -n -L -A $USERAGENT $EXTRA -F "file=@$1" "$PASTEBIN/file/do_upload" > $TMPFILE; then EXITCODE=1 return 1 fi sed '$d' $TMPFILE >&2 URL=`tail -1 $TMPFILE` echo $URL CLIPBOARD="$CLIPBOARD $URL" } read_stdin() { if tty -s; then echo "^C to exit, ^D to send" fi cat > "$1" } help() { cat </dev/null`" ] && echo -n $CLIPBOARD | nohup xclip >/dev/null 2>&1 exit $EXITCODE