[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-anastasis] branch master updated (780e28a -> 0c1dd62)
From: |
gnunet |
Subject: |
[taler-anastasis] branch master updated (780e28a -> 0c1dd62) |
Date: |
Wed, 28 Dec 2022 11:28:26 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a change to branch master
in repository anastasis.
from 780e28a -almost working posting
new f581f54 -script now works with pingenv2
new 0c1dd62 -script now works with pingenv2
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
src/authorization/anastasis-authorization-post.sh | 46 +++++++++++++----------
1 file changed, 27 insertions(+), 19 deletions(-)
diff --git a/src/authorization/anastasis-authorization-post.sh
b/src/authorization/anastasis-authorization-post.sh
index f74f382..fb3221f 100755
--- a/src/authorization/anastasis-authorization-post.sh
+++ b/src/authorization/anastasis-authorization-post.sh
@@ -1,6 +1,6 @@
#!/bin/bash
# This file is in the public domain.
-set -eux
+set -eu
# Theses are Anastasis SARL specific, do not share!
# CLIENT_ID=
@@ -49,7 +49,7 @@ cat - | sed -e "s/%NAME%/$NAME/g" \
-e "s/%COUNTRY%/$COUNTRY/g" \
-e "s/%MESSAGE%/$MESSAGE/g" > input.tex <<EOF
\NeedsTeXFormat{LaTeX2e}
-\documentclass[fontsize=11pt,a4paper,DE]{scrlttr2}
+\documentclass[fontsize=11pt,a4paper]{scrlttr2}
\makeatletter
\KOMAoptions{foldmarks=off}
%\@setplength{toaddrvpos}{30mm}
@@ -70,9 +70,9 @@ cat - | sed -e "s/%NAME%/$NAME/g" \
\end{letter}
\end{document}
EOF
-pdflatex input.tex
+pdflatex input.tex > /dev/null 2> /dev/null
-REPLY=`curl -X POST -H "Content-Type: application/x-www-form-urlencoded" \
+REPLY=`curl -s -X POST -H "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "grant_type=client_credentials" \
--data-urlencode "client_id=$CLIENT_ID" \
--data-urlencode "client_secret=$CLIENT_SECRET" \
@@ -81,14 +81,14 @@ REPLY=`curl -X POST -H "Content-Type:
application/x-www-form-urlencoded" \
ACCESS_TOKEN=`echo $REPLY | jq -r .access_token`
-REPLY=`curl \
+REPLY=`curl -s \
-X GET "$ENDPOINT/file-upload" \
-H "Authorization: Bearer $ACCESS_TOKEN"`
ATTRS=`echo $REPLY | jq .data.attributes`
UPLOAD_URL=`echo $ATTRS | jq -r .url`
URL_SIG=`echo $ATTRS | jq -r .url_signature`
-curl -X PUT -T input.pdf $UPLOAD_URL
+curl -s -X PUT -T input.pdf $UPLOAD_URL
RECIPIENT="$(jq -n '
@@ -129,7 +129,7 @@ REQUEST="$(jq -n '
address_position: "left",
delivery_product: "cheap",
print_mode: "duplex",
- auto_send: false,
+ auto_send: true,
print_spectrum: "grayscale"
} }
}' \
@@ -139,7 +139,7 @@ REQUEST="$(jq -n '
--arg URL_SIG "$URL_SIG" \
)"
-STATUS=$(curl --request POST \
+STATUS=$(curl -s --request POST \
--url $ENDPOINT/organisations/${ORG_ID}/letters \
--header 'Content-Type: application/vnd.api+json' \
--header "Authorization: Bearer $ACCESS_TOKEN" \
@@ -156,22 +156,30 @@ case $STATUS in
exit 1;
;;
esac
-LETTER_ID=`echo $REPLY | jq -r .data.id`
-
-REPLY=`mktemp /tmp/authorization-delete-replyXXXXXX`
-STATUS=$(curl --request DELETE \
- --url $ENDPOINT/organisations/$ORG_ID/letters/$LETTER_ID \
- --header "Authorization: Bearer $ACCESS_TOKEN" \
- -o $REPLY \
- -w "%{http_code}" -s)
-cat $REPLY >> $LOGS
-case $STATUS in
+LETTER_ID=`cat $MYDIR/final-reply.txt | jq -r .data.id`
+REPLY=$MYDIR/delete-reply.txt
+STATUS=409
+sleep 1;
+while test $STATUS = 409;
+do
+ STATUS=$(curl -s --request DELETE \
+ --url $ENDPOINT/organisations/$ORG_ID/letters/$LETTER_ID \
+ --header "Authorization: Bearer $ACCESS_TOKEN" \
+ -o $REPLY \
+ -w "%{http_code}" -s)
+ case $STATUS in
204)
+ cat $REPLY >> $LOGS
;;
+ 409)
+ # Happens, likely still in processing...
+ ;;
*)
echo "Failed to delete letter: $STATUS" >> $LOGS
;;
-esac
+ esac
+done
+
rm -r $MYDIR
exit 0
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-anastasis] branch master updated (780e28a -> 0c1dd62),
gnunet <=