Skip to content

Instantly share code, notes, and snippets.

@NicoWeio
Created February 7, 2020 10:32
Show Gist options
  • Save NicoWeio/1e456418e8d2436a4b4f671653b3f52f to your computer and use it in GitHub Desktop.
Save NicoWeio/1e456418e8d2436a4b4f671653b3f52f to your computer and use it in GitHub Desktop.
Push files to your device via Join by joaomgcd and transfer.sh; requires transfer, curl, grep
#!/bin/bash
echo Uploading $1 to transfer.sh…
FILEURL=$(transfer $1 | tail -1)
echo URL: $FILEURL
APIKEY='your-api-key'
DEVICEID='your-device-id'
RESULT=$(curl 'https://joinjoaomgcd.appspot.com/_ah/api/messaging/v1/sendPush?file='"$FILEURL"'&deviceId='"$DEVICEID"'&apikey='"$APIKEY" 2>/dev/null)
if echo "$RESULT" | grep -q "\"success\": true"; then
echo "File sent successfully!"
exit 0
else
echo "Error sending file: "
echo $RESULT
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment