aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-06-19 21:52:49 -0700
committerfriendica <info@friendica.com>2014-06-19 21:52:49 -0700
commit14a6a27213515b5d6790508281fb0ece6daa3145 (patch)
tree7e025d581d2696d1c1d3e10025a2b8410a1fa65e /util
parent525daa7475f219f51258dcdb5ed634e7112020de (diff)
downloadvolse-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')
-rwxr-xr-xutil/shredder/ShredOAuth.sh27
-rwxr-xr-xutil/shredder/shredder41
2 files changed, 42 insertions, 26 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
diff --git a/util/shredder/shredder b/util/shredder/shredder
index 5073d5b2f..1586746e0 100755
--- a/util/shredder/shredder
+++ b/util/shredder/shredder
@@ -155,10 +155,10 @@ main () {
fcli_in_reply_to_status_id=
fcli_file=
fcli_help_flag=
- JS_Fields=()
fcli_opts=
+ fcli_post=
- while getopts "C:c:s:r:f:q:h" name
+ while getopts "C:c:s:r:f:q:hp" name
do
case $name in
c) fcli_command="$OPTARG";;
@@ -167,6 +167,7 @@ main () {
r) fcli_in_reply_to_status_id="$OPTARG";;
f) fcli_file="$OPTARG";;
h) fcli_help_flag="1";;
+ p) fcli_post="1";;
q) fcli_opts=("${fcli_opts[@]}" "$OPTARG");;
?) usage
exit 2;;
@@ -175,9 +176,9 @@ main () {
load_config
if [[ "$fcli_help_flag" == "1" ]]; then case $fcli_command in
- statuses_update)
- show_statuses_update 0
- ;;
+# statuses_update)
+# show_statuses_update 0
+# ;;
home_timeline)
show_home_timeline 0
;;
@@ -202,20 +203,24 @@ main () {
return $FO_rval
;;
- statuses_update)
- [[ "$fcli_status" == "" ]] && show_statuses_update 1
- FO_statuses_update 'json' "$fcli_status" "$fcli_in_reply_to_status_id"
- JS_Parsed=$(echo "$FO_ret" | tokenize | parse)
- echo "$JS_Parsed" | js "user" "name" ,
- echo -n " - "
- echo "$JS_Parsed" | js "created_at"
- echo "$JS_Parsed" | js "text"
- echo ""
- echo "------------------------------------------------------------------------------"
- return $FO_rval
- ;;
+# statuses_update)
+# [[ "$fcli_status" == "" ]] && show_statuses_update 1
+# FO_statuses_update 'json' "$fcli_status" "$fcli_in_reply_to_status_id"
+# JS_Parsed=$(echo "$FO_ret" | tokenize | parse)
+# echo "$JS_Parsed" | js "user" "name" ,
+# echo -n " - "
+# echo "$JS_Parsed" | js "created_at"
+# echo "$JS_Parsed" | js "text"
+# echo ""
+# echo "------------------------------------------------------------------------------"
+# return $FO_rval
+# ;;
+
*)
- FO_command $fcli_command ${fcli_opts[@]}
+
+# echo "${fcli_opts[@]}"
+
+ FO_command "$fcli_command" "$fcli_post" fcli_opts[@]
echo $FO_ret