Remove support for deprecated PushBullet API

This also moves the call to Base64Encode, which fixes #70 by
preventing a double-encoding of the auth string when building with
support for libcurl instead of csocket.  The base64 encoding is now done
in the csocket request, where it is still required to operate correctly.
This commit is contained in:
John Reese 2014-04-13 11:44:10 -07:00
parent 84cf52fdf1
commit 9d7e6ea8f2
1 changed files with 4 additions and 10 deletions

View File

@ -277,16 +277,8 @@ class CPushMod : public CModule
// BASIC auth, base64-encoded APIKey: // BASIC auth, base64-encoded APIKey:
service_auth = options["secret"] + CString(":"); service_auth = options["secret"] + CString(":");
service_auth.Base64Encode();
// Pushbullet uses numeric device_id but they params["device_iden"] = options["target"];
// are transitioning to an alphanumeric device_iden
if (is_number(options["target"]))
{
params["device_id"] = options["target"];
} else {
params["device_iden"] = options["target"];
}
params["type"] = "note"; params["type"] = "note";
params["title"] = message_title; params["title"] = message_title;
params["body"] = message_content; params["body"] = message_content;
@ -1649,7 +1641,9 @@ void CPushSocket::Request(bool post, const CString& host, const CString& url, MC
if (auth != "") if (auth != "")
{ {
request += "Authorization: Basic " + auth + crlf; CString auth_b64 = auth.Base64Encode_n();
request += "Authorization: Basic " + auth_b64 + crlf;
parent->PutDebug("Authorization: Basic " + auth_b64);
} }
request += crlf; request += crlf;