From e43a11645759e3a5678c1071e79b2c124d91b736 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Wed, 13 Sep 2017 11:56:41 +0200 Subject: Facebook support: use the new Graph Api This is basically a one liner. Signed-off-by: Tomaz Canabrava --- desktop-widgets/plugins/facebook/facebookconnectwidget.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'desktop-widgets/plugins/facebook/facebookconnectwidget.cpp') diff --git a/desktop-widgets/plugins/facebook/facebookconnectwidget.cpp b/desktop-widgets/plugins/facebook/facebookconnectwidget.cpp index e01f2b3fb..83514f032 100644 --- a/desktop-widgets/plugins/facebook/facebookconnectwidget.cpp +++ b/desktop-widgets/plugins/facebook/facebookconnectwidget.cpp @@ -51,6 +51,8 @@ FacebookManager::FacebookManager(QObject *parent) : QObject(parent) { } +static QString graphApi = QStringLiteral("https://graph.facebook.com/v2.10/"); + QUrl FacebookManager::connectUrl() { return QUrl("https://www.facebook.com/dialog/oauth?" "client_id=427722490709000" @@ -178,7 +180,7 @@ void FacebookManager::sendDive() QBuffer buffer(&bytes); buffer.open(QIODevice::WriteOnly); pix.save(&buffer, "PNG"); - QUrl url("https://graph.facebook.com/v2.2/" + QString(prefs.facebook.album_id) + "/photos?" + + QUrl url(graphApi + QString(prefs.facebook.album_id) + "/photos?" + "&access_token=" + QString(prefs.facebook.access_token) + "&source=image" + "&message=" + dialog.text().replace(""", "%22")); @@ -191,7 +193,7 @@ void FacebookManager::sendDive() //according to rfc 1867 we need to put this string here: QByteArray data(QString("--" + bound + "\r\n").toLocal8Bit()); data.append("Content-Disposition: form-data; name=\"action\"\r\n\r\n"); - data.append("https://graph.facebook.com/v2.2/\r\n"); + data.append(graphApi + "\r\n"); data.append("--" + bound + "\r\n"); //according to rfc 1867 data.append("Content-Disposition: form-data; name=\"uploaded\"; filename=\"" + QString::number(qrand()) + ".png\"\r\n"); //name of the input is "uploaded" in my form, next one is a file name. data.append("Content-Type: image/jpeg\r\n\r\n"); //data type -- cgit v1.2.3-70-g09d2