#!/bin/bash ################################################################################ # Author: Fred (support@qo-op.com) # Version: 0.1 # License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/) ################################################################################ mkdir -p "./IPFS/" mkdir -p "./SCAN/" tail -fn 1 /tmp/qrcode.scan | while read -r line do QRCODE=$(echo $line | cut -d ' ' -f 1) MEMBER=$(echo $line | cut -d ' ' -f 2) if [[ "${QRCODE: 0:2}" == "Qm" ]]; then echo "IPFS! ${QRCODE}" mkdir -p "./IPFS/${QRCODE}" # GET PIN FROM NUMBOARD P1=$(python matrixKeypad_RPi_GPIO.py) P2=$(python matrixKeypad_RPi_GPIO.py) P3=$(python matrixKeypad_RPi_GPIO.py) P4=$(python matrixKeypad_RPi_GPIO.py) PIN=$P1$P2$P3$P4 # GET CARD ON IPFS ipfs cat ${QRCODE}/key.gpg > "./IPFS/${QRCODE}/key.pgp" echo $PIN | gpg --passphrase-fd 0 "./IPFS/${QRCODE}/key.pgp" ipfs cat ${QRCODE}/authfile.gpg > "./IPFS/${QRCODE}/authfile.pgp" cat "./IPFS/${QRCODE}/key" | gpg --passphrase-fd 0 "./IPFS/${QRCODE}/authfile.pgp" else mkdir -p "./SCAN/${QRCODE}" curl https://g1pod.madeinzion.org/user/profile/${QRCODE} | jq '._source.avatar._content' | sed 's/\"//g' | base64 -d > "./SCAN/${QRCODE}/avatar.png" convert "./SCAN/${QRCODE}/avatar.png" -rotate 90 "./tmp/rotate.png" composite -compose Over -gravity East "./tmp/rotate.png" "./G1.png" "./tmp/avatar.png" convert -font 'Times-Bold' \ -pointsize 20 -fill black -draw 'text 10,20 "'"$MEMBER"'"' \ "./tmp/avatar.png" "./tmp/uid.png" convert "./tmp/uid.png" -strip +dither -colors 3 -treedepth 3 +remap "./result.png" python inky_display.py fi done