Advertisement
Guest User

Untitled

a guest
Jun 5th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. if [ -f $HOME/.wallabash ]; then
  4. . $HOME/.wallabash
  5. fi
  6.  
  7. API="$WALLABAG_URL/api/entries.html"
  8.  
  9. AUTH=$(curl -s "$WALLABAG_URL/oauth/v2/token" -d "grant_type=password" \
  10. -d "client_secret=$WALLABAG_CLIENT_SECRET" \
  11. -d "client_id=$WALLABAG_CLIENT_ID" \
  12. -d "username=$WALLABAG_USERNAME" \
  13. -d "password=$WALLABAG_PASSWORD")
  14.  
  15. TOKEN=$(echo $AUTH | jq -r '.access_token')
  16.  
  17. if [ -z "$1" ]; then
  18. curl -s -G "$API" -d "access_token=$TOKEN" | jq -r '._embedded.items[].url'
  19. else
  20. curl -s "$API" -d "access_token=$TOKEN" -d "url=$1" > /dev/null
  21. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement