diff options
author | friendica <info@friendica.com> | 2014-06-19 21:52:49 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-06-19 21:52:49 -0700 |
commit | 14a6a27213515b5d6790508281fb0ece6daa3145 (patch) | |
tree | 7e025d581d2696d1c1d3e10025a2b8410a1fa65e /util/shredder/ShredOAuth.sh | |
parent | 525daa7475f219f51258dcdb5ed634e7112020de (diff) | |
download | volse-hubzilla-14a6a27213515b5d6790508281fb0ece6daa3145.tar.gz volse-hubzilla-14a6a27213515b5d6790508281fb0ece6daa3145.tar.bz2 volse-hubzilla-14a6a27213515b5d6790508281fb0ece6daa3145.zip |
limited progress in providing a POST option to shredder, back to auth signature mismatches again, likely a quoting issue
Diffstat (limited to 'util/shredder/ShredOAuth.sh')
-rwxr-xr-x | util/shredder/ShredOAuth.sh | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/util/shredder/ShredOAuth.sh b/util/shredder/ShredOAuth.sh index 9e808a2d6..9828124c7 100755 --- a/util/shredder/ShredOAuth.sh +++ b/util/shredder/ShredOAuth.sh @@ -174,13 +174,16 @@ FO_statuses_home_timeline () { FO_command () { local command="$1" - local opts="$2" + local post="$2" + declare -a opts=("${!3}") local params=( $(OAuth_param 'screen_name' $screen_name) $(OAuth_param 'count' $count) ) -#echo ${opts[@]} +#echo "$3" +#echo '---' +#echo "${opts[@]}" convscreen=$(OAuth_PE "$screen_name"); data="screen_name=${convscreen}&count=${count}" @@ -189,19 +192,27 @@ FO_command () { for b in ${opts[@]}; do lhs=`echo $b | awk -F= '{print $1};'` rhs=`echo $b | awk -F= '{print $2};'` - params=("${params[@]}" $(OAuth_param $lhs $rhs)) - data=$data"&"$lhs=$rhs + params=("${params[@]}" $(OAuth_param "$lhs" "$rhs")) + data=$data"&""$lhs"="$rhs" done fi -#echo ${params[@]} +#echo 'params: ' ${params[@]} -#echo $data +#echo 'data: ' $data + local auth_header=''; - local auth_header=$(OAuth_authorization_header 'Authorization' "$redmatrix_url" '' '' 'GET' "${redmatrix_url}/api/${command}.json" ${params[@]}) + if [ "$post" == '1' ]; then + auth_header=$(OAuth_authorization_header 'Authorization' "$redmatrix_url" '' '' 'POST' "${redmatrix_url}/api/${command}.json" ${params[@]}) + FO_ret=$(curl -s "${redmatrix_url}/api/${command}.json" --data-urlencode "${data}" --header "${auth_header}") + + else + auth_header=$(OAuth_authorization_header 'Authorization' "$redmatrix_url" '' '' 'GET' "${redmatrix_url}/api/${command}.json" ${params[@]}) + FO_ret=$(curl -s --get "${redmatrix_url}/api/${command}.json" --data "${data}" --header "${auth_header}") + + fi - FO_ret=$(curl -s --get "${redmatrix_url}/api/${command}.json" --data "${data}" --header "${auth_header}") FO_rval=$? return $FO_rval |