dotfiles/arch/bin/w3m-wallabagger.sh

11 lines
798 B
Bash
Raw Normal View History

2022-08-24 08:07:33 +00:00
#!/bin/bash
set -euo pipefail
# curl commands are currently '--insecure' until the certificate situation is sorted out
token=$(curl --silent --insecure -X POST --data grant_type=password --data client_id=3_3kfqif569iqsk8s88koccsk8kkg8oc0o4k8kckoo8ss84cgw0k --data client_secret=4s5ioftf8juocc0woskscogogwgw0wwwsg4cccoscwoc0c88cc --data username=adam --data password="$(secret-tool lookup Title wallabag)" 'https://wallabag.theadamcooper.com/oauth/v2/token' | jshon -e access_token | sed 's/"//g')
if [[ -n $token ]]; then
curl --silent --insecure -X POST --header "Authorization: Bearer ${token}" --data url="$1" 'https://wallabag.theadamcooper.com/api/entries.json' &> /dev/null
else
echo "$(date +"%Y-%m-%d %H:%M") Invalid token" >> /home/adam/.config/local/share/w3m/w3m-wallabagger.log
fi