Created
February 7, 2020 10:32
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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