From 9d7e6ea8f2665c16020d2e9c02e5a724a265479d Mon Sep 17 00:00:00 2001 From: John Reese Date: Sun, 13 Apr 2014 11:44:10 -0700 Subject: [PATCH] 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. --- push.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/push.cpp b/push.cpp index 65d771d..ee3915f 100755 --- a/push.cpp +++ b/push.cpp @@ -277,16 +277,8 @@ class CPushMod : public CModule // BASIC auth, base64-encoded APIKey: service_auth = options["secret"] + CString(":"); - service_auth.Base64Encode(); - // Pushbullet uses numeric device_id but they - // are transitioning to an alphanumeric device_iden - if (is_number(options["target"])) - { - params["device_id"] = options["target"]; - } else { - params["device_iden"] = options["target"]; - } + params["device_iden"] = options["target"]; params["type"] = "note"; params["title"] = message_title; params["body"] = message_content; @@ -1649,7 +1641,9 @@ void CPushSocket::Request(bool post, const CString& host, const CString& url, MC 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;