summaryrefslogtreecommitdiffstats
path: root/fb.in
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2013-05-11 12:21:59 +0200
committerFlorian Pritz <bluewind@xinu.at>2013-08-11 11:32:51 +0200
commit3ec7aef28c5523d15f7c677ab29dfc30b3b5fc2f (patch)
tree29f0ac19106195e3c88097f34700024487527552 /fb.in
parent0acf745e9aa6ab351fdc4d4c59d3421ea244f17a (diff)
Add API key support
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'fb.in')
-rw-r--r--fb.in14
1 files changed, 13 insertions, 1 deletions
diff --git a/fb.in b/fb.in
index 3ab25db..cc79e21 100644
--- a/fb.in
+++ b/fb.in
@@ -32,6 +32,8 @@ if [ -z "$XDG_CONFIG_HOME" ]; then
XDG_CONFIG_HOME="$HOME/.config"
fi
+apikey_file="$XDG_CONFIG_HOME/fb-client/apikey"
+
config_file="$XDG_CONFIG_HOME/fb-client/config"
if [ -e "$config_file" ]; then
. "$config_file"
@@ -74,6 +76,10 @@ request_helper() {
helperopts="$helperopts -D"
fi
+ if [ -e "$apikey_file" ]; then
+ helperopts="$helperopts -a $apikey_file"
+ fi
+
if [ "$mode" = "d" ]; then
$libdir/fb-helper $helperopts -u "$url"
fi
@@ -83,7 +89,13 @@ request_helper() {
fi
else
useragent="fb-client/shell-$version"
- curlopts="-# -n -L -A $useragent --speed-time 30 --speed-limit 1 --connect-timeout 10"
+ curlopts="-# -L -A $useragent --speed-time 30 --speed-limit 1 --connect-timeout 10"
+
+ if [ -e "$apikey_file" ]; then
+ curlopts="$curlopts --data-urlencode 'apikey@$apikey_file'"
+ else
+ curlopts="$curlopts -n"
+ fi
if [ "$debug" ]; then
curlopts="$curlopts -v"