* [gentoo-commits] repo/gentoo:master commit in: kde-apps/libkgapi/, kde-apps/libkgapi/files/
@ 2018-01-18 23:01 Andreas Sturmlechner
0 siblings, 0 replies; 3+ messages in thread
From: Andreas Sturmlechner @ 2018-01-18 23:01 UTC (permalink / raw
To: gentoo-commits
commit: f949b61b15f50aa8d58fc82001b03cc216dd3160
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 18 22:08:30 2018 +0000
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Thu Jan 18 23:01:28 2018 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f949b61b
kde-apps/libkgapi: Fix Google token page URL
Upstream commit fa572d93cfa463f61432dd92239e747f9642fbae
Package-Manager: Portage-2.3.19, Repoman-2.3.6
.../files/libkgapi-17.12.1-gmail-tokenpage.patch | 40 ++++++++++++++++++++++
kde-apps/libkgapi/libkgapi-17.12.1-r1.ebuild | 36 +++++++++++++++++++
2 files changed, 76 insertions(+)
diff --git a/kde-apps/libkgapi/files/libkgapi-17.12.1-gmail-tokenpage.patch b/kde-apps/libkgapi/files/libkgapi-17.12.1-gmail-tokenpage.patch
new file mode 100644
index 00000000000..61162ddf7c0
--- /dev/null
+++ b/kde-apps/libkgapi/files/libkgapi-17.12.1-gmail-tokenpage.patch
@@ -0,0 +1,40 @@
+From fa572d93cfa463f61432dd92239e747f9642fbae Mon Sep 17 00:00:00 2001
+From: David Kahles <david.kahles96@gmail.com>
+Date: Fri, 12 Jan 2018 15:23:53 +0100
+Subject: Fix token page URL
+
+Summary:
+It seems like Google changed the URL of the token page.
+Maybe we should use QString::startsWith, to be futureproof?
+
+BUG: 388483
+
+Test Plan:
+- Login in KOrganizer and KMail works again
+- All tests pass (though i think there is no oauth2 test)
+
+Reviewers: dvratil, mlaurent
+
+Reviewed By: mlaurent
+
+Differential Revision: https://phabricator.kde.org/D9843
+---
+ src/core/ui/authwidget_p.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/core/ui/authwidget_p.h b/src/core/ui/authwidget_p.h
+index 78b0e7f..29ece44 100644
+--- a/src/core/ui/authwidget_p.h
++++ b/src/core/ui/authwidget_p.h
+@@ -79,7 +79,7 @@ class Q_DECL_HIDDEN AuthWidgetPrivate: public QObject {
+ bool isSigninPage(const QUrl &url) const { return url.path() == QLatin1String("/signin/oauth"); }
+ bool isUsernameFrame(const QUrl &url) { return url.path() == QLatin1String("/signin/oauth/identifier"); }
+ bool isPasswordFrame(const QUrl &url) { return url.path() == QLatin1String("/signin/v2/challenge/pwd"); }
+- bool isTokenPage(const QUrl &url) { return url.path() == QLatin1String("/o/oauth2/approval/v2"); }
++ bool isTokenPage(const QUrl &url) { return url.path() == QLatin1String("/o/oauth2/approval/v2/approvalnativeapp"); }
+
+ void setSslIcon(const QString &icon);
+
+--
+cgit v0.11.2
+
diff --git a/kde-apps/libkgapi/libkgapi-17.12.1-r1.ebuild b/kde-apps/libkgapi/libkgapi-17.12.1-r1.ebuild
new file mode 100644
index 00000000000..d3c67b28e4f
--- /dev/null
+++ b/kde-apps/libkgapi/libkgapi-17.12.1-r1.ebuild
@@ -0,0 +1,36 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+KDE_BLOCK_SLOT4="false"
+KDE_TEST="true"
+VIRTUALX_REQUIRED="test"
+inherit kde5
+
+DESCRIPTION="Library for accessing Google calendar and contact resources"
+HOMEPAGE="https://cgit.kde.org/libkgapi.git"
+
+LICENSE="LGPL-2.1+"
+KEYWORDS="~amd64 ~x86"
+IUSE="nls"
+
+COMMON_DEPEND="
+ $(add_frameworks_dep kio)
+ $(add_frameworks_dep kwindowsystem)
+ $(add_kdeapps_dep kcalcore)
+ $(add_kdeapps_dep kcontacts)
+ $(add_qt_dep qtgui)
+ $(add_qt_dep qtnetwork)
+ $(add_qt_dep qtwebengine 'widgets')
+ $(add_qt_dep qtwidgets)
+ $(add_qt_dep qtxml)
+"
+DEPEND="${COMMON_DEPEND}
+ nls? ( $(add_qt_dep linguist-tools) )
+"
+RDEPEND="${COMMON_DEPEND}
+ !kde-apps/kdepim-l10n
+"
+
+PATCHES=( "${FILESDIR}/${P}-gmail-tokenpage.patch" )
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: kde-apps/libkgapi/, kde-apps/libkgapi/files/
@ 2017-04-27 18:15 Andreas Sturmlechner
0 siblings, 0 replies; 3+ messages in thread
From: Andreas Sturmlechner @ 2017-04-27 18:15 UTC (permalink / raw
To: gentoo-commits
commit: 9adfadc371f342a5117387b4faf2a4549c1a4d1e
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 27 17:53:37 2017 +0000
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Thu Apr 27 18:14:44 2017 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9adfadc3
kde-apps/libkgapi: Drop old
Package-Manager: Portage-2.3.3, Repoman-2.3.1
kde-apps/libkgapi/Manifest | 1 -
.../libkgapi/files/libkgapi-5.3.1-qt-5.8.patch | 52 ----------------------
kde-apps/libkgapi/libkgapi-17.04.0.ebuild | 31 -------------
kde-apps/libkgapi/libkgapi-5.3.1-r1.ebuild | 33 --------------
4 files changed, 117 deletions(-)
diff --git a/kde-apps/libkgapi/Manifest b/kde-apps/libkgapi/Manifest
index 7c9dd7e0b7f..5e3215e56b7 100644
--- a/kde-apps/libkgapi/Manifest
+++ b/kde-apps/libkgapi/Manifest
@@ -1,3 +1,2 @@
DIST libkgapi-17.04.0.tar.xz 173868 SHA256 8cc057ad5f88dee2a218b3a3aaf09720312a3fbb9a4a06b2aeb6706818557c54 SHA512 af44c3e4d5bd34c7920a3a29e5e157c4fa3900283277176d3288cde339c7a9f99e9dc7a94eae925a15734fe9bda853559a310364e5a2c58cee5e0b31aa5de112 WHIRLPOOL 582985294e874605af7a77df61571564a177354d8b8e788b32147326c414003174ad3877d1ec99cbdaf021a32e47d58de4b545a2169db5946ed1269343bacb4e
DIST libkgapi-2.2.0.tar.bz2 127026 SHA256 c02965b639c2496d489d4f1865e35473db6f1b5e9e84fb079988d33db629c2b4 SHA512 c5f37aacb89243d7985d7064aa8941d3d2a6c26685113e876b38c737ea2e1126b40b0f88b0908e7ea8a7bcb2fade1dc528c2f73f22890b9e892c6d18d9d3bb42 WHIRLPOOL 1aa1d5c661098793a6c6a112ed92198c044cd0ab9e320631e165dc2cbb510df6c7d0a96412b2147728aaba822e40c571c07ca2b88ad5f5a055c0755490774a08
-DIST libkgapi-5.3.1.tar.xz 159584 SHA256 366692ced93442809175351f5590e6a82c4e6316f21d989c239bb72132a601fa SHA512 257d1beea9615e9daa05333ad2de948a4e729c6cad192acbd50803be51ee86d7b3665a05fb94b40afc1bcdfcb5dbf5c2c8d2e6d635cf9c1988fe169ec69462cd WHIRLPOOL 2c9c1c073702af0fdc8dd56410299a6547a6dd0a263e8eb20d162f153ceca8aa56efb7c8666c7594f270b5d3fee2ec2543d1569aeed80700bfdae8541bdc36fb
diff --git a/kde-apps/libkgapi/files/libkgapi-5.3.1-qt-5.8.patch b/kde-apps/libkgapi/files/libkgapi-5.3.1-qt-5.8.patch
deleted file mode 100644
index a7f69a86cae..00000000000
--- a/kde-apps/libkgapi/files/libkgapi-5.3.1-qt-5.8.patch
+++ /dev/null
@@ -1,52 +0,0 @@
-From 03a019820e9da9cf293a3ac66e55da745894c504 Mon Sep 17 00:00:00 2001
-From: Milian Wolff <mail@milianw.de>
-Date: Tue, 31 Jan 2017 17:18:57 +0100
-Subject: Fix compile with Qt 5.8: add missing QImage includes
-
----
- src/contacts/contactcreatejob.cpp | 2 +-
- src/contacts/contactfetchphotojob.cpp | 1 +
- src/contacts/contactmodifyjob.cpp | 2 +-
- 3 files changed, 3 insertions(+), 2 deletions(-)
-
-diff --git a/src/contacts/contactcreatejob.cpp b/src/contacts/contactcreatejob.cpp
-index 5f41c1a..a7eb5f7 100644
---- a/src/contacts/contactcreatejob.cpp
-+++ b/src/contacts/contactcreatejob.cpp
-@@ -31,7 +31,7 @@
- #include <QtNetwork/QNetworkRequest>
- #include <QtNetwork/QNetworkReply>
- #include <QtCore/QBuffer>
--
-+#include <QtGui/QImage>
-
- using namespace KGAPI2;
-
-diff --git a/src/contacts/contactfetchphotojob.cpp b/src/contacts/contactfetchphotojob.cpp
-index 54606cb..a3ebe48 100644
---- a/src/contacts/contactfetchphotojob.cpp
-+++ b/src/contacts/contactfetchphotojob.cpp
-@@ -28,6 +28,7 @@
-
- #include <QtNetwork/QNetworkRequest>
- #include <QtNetwork/QNetworkReply>
-+#include <QtGui/QImage>
-
- Q_DECLARE_METATYPE(KGAPI2::ContactPtr)
-
-diff --git a/src/contacts/contactmodifyjob.cpp b/src/contacts/contactmodifyjob.cpp
-index ead5787..03a0e73 100644
---- a/src/contacts/contactmodifyjob.cpp
-+++ b/src/contacts/contactmodifyjob.cpp
-@@ -31,7 +31,7 @@
- #include <QtNetwork/QNetworkRequest>
- #include <QtNetwork/QNetworkReply>
- #include <QtCore/QBuffer>
--
-+#include <QtGui/QImage>
-
- using namespace KGAPI2;
-
---
-cgit v0.11.2
-
diff --git a/kde-apps/libkgapi/libkgapi-17.04.0.ebuild b/kde-apps/libkgapi/libkgapi-17.04.0.ebuild
deleted file mode 100644
index 8f4bcb63881..00000000000
--- a/kde-apps/libkgapi/libkgapi-17.04.0.ebuild
+++ /dev/null
@@ -1,31 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-KDE_BLOCK_SLOT4="false"
-KDE_TEST="true"
-VIRTUALX_REQUIRED="test"
-inherit kde5
-
-DESCRIPTION="Library for accessing Google calendar and contact resources"
-HOMEPAGE="https://projects.kde.org/projects/extragear/libs/libkgapi"
-
-LICENSE="LGPL-2.1+"
-KEYWORDS="~amd64 ~x86"
-IUSE=""
-
-DEPEND="
- $(add_frameworks_dep kio)
- $(add_frameworks_dep kwindowsystem)
- $(add_kdeapps_dep kcalcore)
- $(add_kdeapps_dep kcontacts)
- $(add_qt_dep qtgui)
- $(add_qt_dep qtnetwork)
- $(add_qt_dep qtwebengine)
- $(add_qt_dep qtwidgets)
- $(add_qt_dep qtxml)
-"
-RDEPEND="${DEPEND}
- !kde-apps/kdepim-l10n
-"
diff --git a/kde-apps/libkgapi/libkgapi-5.3.1-r1.ebuild b/kde-apps/libkgapi/libkgapi-5.3.1-r1.ebuild
deleted file mode 100644
index af63dce00aa..00000000000
--- a/kde-apps/libkgapi/libkgapi-5.3.1-r1.ebuild
+++ /dev/null
@@ -1,33 +0,0 @@
-# Copyright 1999-2017 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=6
-
-KDE_BLOCK_SLOT4="false"
-KDE_TEST="true"
-VIRTUALX_REQUIRED="test"
-inherit kde5
-
-DESCRIPTION="Library for accessing Google calendar and contact resources"
-HOMEPAGE="https://projects.kde.org/projects/extragear/libs/libkgapi"
-[[ ${KDE_BUILD_TYPE} != live ]] && SRC_URI="mirror://kde/stable/${PN}/${PV}/src/${P}.tar.xz"
-
-LICENSE="GPL-2+ LGPL-2.1+"
-KEYWORDS="~amd64 ~x86"
-IUSE=""
-
-DEPEND="
- $(add_frameworks_dep kcoreaddons)
- $(add_frameworks_dep kio)
- $(add_frameworks_dep kwindowsystem)
- $(add_kdeapps_dep kcalcore)
- $(add_kdeapps_dep kcontacts)
- $(add_qt_dep qtgui)
- $(add_qt_dep qtnetwork)
- $(add_qt_dep qtwebkit)
- $(add_qt_dep qtwidgets)
- $(add_qt_dep qtxml)
-"
-RDEPEND="${DEPEND}"
-
-PATCHES=( "${FILESDIR}"/${P}-qt-5.8.patch )
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [gentoo-commits] repo/gentoo:master commit in: kde-apps/libkgapi/, kde-apps/libkgapi/files/
@ 2017-04-27 18:15 Andreas Sturmlechner
0 siblings, 0 replies; 3+ messages in thread
From: Andreas Sturmlechner @ 2017-04-27 18:15 UTC (permalink / raw
To: gentoo-commits
commit: 88f5d2ddef486a6ca915d2d7467e69461d4b1eff
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 27 17:52:40 2017 +0000
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Thu Apr 27 18:14:43 2017 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=88f5d2dd
kde-apps/libkgapi: Fix 2FA, add USE=nls and missing DEPEND
Package-Manager: Portage-2.3.3, Repoman-2.3.1
.../libkgapi/files/libkgapi-17.04.0-auth1.patch | 168 +++++++++++
.../libkgapi/files/libkgapi-17.04.0-auth2.patch | 36 +++
.../libkgapi/files/libkgapi-17.04.0-auth3.patch | 310 +++++++++++++++++++++
kde-apps/libkgapi/libkgapi-17.04.0-r1.ebuild | 36 +++
4 files changed, 550 insertions(+)
diff --git a/kde-apps/libkgapi/files/libkgapi-17.04.0-auth1.patch b/kde-apps/libkgapi/files/libkgapi-17.04.0-auth1.patch
new file mode 100644
index 00000000000..eb426465947
--- /dev/null
+++ b/kde-apps/libkgapi/files/libkgapi-17.04.0-auth1.patch
@@ -0,0 +1,168 @@
+From 68b89bce22d0da234345ccffb869ae6863592624 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Daniel=20Vr=C3=A1til?= <dvratil@kde.org>
+Date: Thu, 27 Apr 2017 17:22:27 +0200
+Subject: [PATCH 1/3] Auth: Adapt to changes in Google OAuth token retrieval
+ process
+
+URLs and HTML code have changed a bit, which breaks authentication. Hopefully
+they won't change it too often in the future.
+---
+ src/core/ui/authwidget_p.cpp | 109 ++++++++++++++++++++++++-------------------
+ src/core/ui/authwidget_p.h | 6 +++
+ 2 files changed, 67 insertions(+), 48 deletions(-)
+
+diff --git a/src/core/ui/authwidget_p.cpp b/src/core/ui/authwidget_p.cpp
+index 6de33f5..75d38cd 100644
+--- a/src/core/ui/authwidget_p.cpp
++++ b/src/core/ui/authwidget_p.cpp
+@@ -112,11 +112,35 @@ void AuthWidgetPrivate::emitError(const enum Error errCode, const QString& msg)
+
+ void AuthWidgetPrivate::webviewUrlChanged(const QUrl &url)
+ {
+- qCDebug(KGAPIDebug) << url;
++ qCDebug(KGAPIDebug) << "URLChange:" << url;
+
+- /* Access token here - hide browser and tell user to wait until we
+- * finish the authentication process ourselves */
+- if (url.host() == QLatin1String("accounts.google.com") && url.path() == QLatin1String("/o/oauth2/approval")) {
++ if (!isGoogleHost(url)) {
++ return;
++ }
++
++ // Username and password inputs are loaded dynamically, so we only get
++ // urlChanged, but not urlFinished.
++ if (isUsernameFrame(url)) {
++#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
++ if (!username.isEmpty()) {
++ webview->page()->runJavaScript(QStringLiteral("document.getElementById(\"identifierId\").value = \"%1\";").arg(username));
++ }
++#endif
++ } else if (isPasswordFrame(url)) {
++#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
++ if (!password.isEmpty()) {
++ webview->page()->runJavaScript(QStringLiteral("var elems = document.getElementsByTagName(\"input\");"
++ "for (var i = 0; i < elems.length; i++) {"
++ " if (elems[i].type == \"password\" && elems[i].name == \"password\") {"
++ " elems[i].value = \"%1\";"
++ " break;"
++ " }"
++ "}").arg(password));
++ }
++#endif
++ } else if (isTokenPage(url)) {
++ /* Access token here - hide browser and tell user to wait until we
++ * finish the authentication process ourselves */
+ webview->setVisible(false);
+ progressbar->setVisible(false);
+ label->setVisible(true);
+@@ -131,57 +155,46 @@ void AuthWidgetPrivate::webviewFinished(bool ok)
+ qCWarning(KGAPIDebug) << "Failed to load" << webview->url();
+ }
+
+- QUrl url = webview->url();
+- qCDebug(KGAPIDebug) << url;
+-
+- if (url.host() == QLatin1String("accounts.google.com") && url.path() == QLatin1String("/ServiceLogin")) {
+- if (username.isEmpty() && password.isEmpty()) {
+- return;
+- }
+-
+-#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
+- const auto js = QStringLiteral("document.getElementById(\"%1\").value = \"%2\";");
+- if (!username.isEmpty()) {
+- webview->page()->runJavaScript(js.arg(QStringLiteral("Email"), username));
+- }
+-
+- if (!password.isEmpty()) {
+- webview->page()->runJavaScript(js.arg(QStringLiteral("Passwd"), password));
+- }
+-#endif
++ const QUrl url = webview->url();
++ qCDebug(KGAPIDebug) << "URLFinished:" << url;
+
++ if (!isGoogleHost(url)) {
+ return;
+ }
+
+- if (url.host() == QLatin1String("accounts.google.com") && url.path() == QLatin1String("/o/oauth2/approval")) {
+- QString title = webview->title();
+- QString token;
+-
+- if (title.startsWith(QLatin1String("success"), Qt::CaseInsensitive)) {
+- int pos = title.indexOf(QLatin1String("code="));
+- /* Skip the 'code=' string as well */
+- token = title.mid (pos + 5);
++ if (isTokenPage(url)) {
++ const auto token = url.queryItemValue(QStringLiteral("approvalCode"));
++ if (!token.isEmpty()) {
++ qCDebug(KGAPIDebug) << "Got token: " << token;
++ auto fetch = new KGAPI2::NewTokensFetchJob(token, apiKey, secretKey);
++ connect(fetch, &Job::finished, this, &AuthWidgetPrivate::tokensReceived);
+ } else {
+- webview->page()->toHtml([title](const QString &html) {
+- qCDebug(KGAPIDebug) << "Parsing token page failed. Title:" << title;
+- qCDebug(KGAPIDebug) << html;
+- });
++#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0)
++ qCWarning(KGAPIDebug) << "Failed to parse token from URL, peaking into HTML...";
++ webview->page()->runJavaScript(
++ QStringLiteral("document.getElementById(\"code\").value;"),
++ [this](const QVariant &result) {
++ const auto token = result.toString();
++ if (token.isEmpty()) {
++ qCWarning(KGAPIDebug) << "Peaked into HTML, but cound not find token :(";
++ webview->page()->toHtml([](const QString &html) {
++ qCDebug(KGAPIDebug) << "Parsing token page failed";
++ qCDebug(KGAPIDebug) << html;
++ });
++ emitError(AuthError, tr("Parsing token page failed."));
++ return;
++ }
++ qCDebug(KGAPIDebug) << "Peaked into HTML and found token: " << token;
++ auto fetch = new KGAPI2::NewTokensFetchJob(token, apiKey, secretKey);
++ connect(fetch, &Job::finished, this, &AuthWidgetPrivate::tokensReceived);
++ });
++#else
++ qCWarning(KGAPIDebug) << "Failed to parse token from URL!";
+ emitError(AuthError, tr("Parsing token page failed."));
+- return;
+- }
+-
+- if (token.isEmpty()) {
+- webview->page()->toHtml([](const QString &html) {
+- qCDebug(KGAPIDebug) << "Failed to obtain token.";
+- qCDebug(KGAPIRaw) << html;
+- });
+- emitError(AuthError, tr("Failed to obtain token."));
+- return;
++#endif
+ }
+-
+- KGAPI2::NewTokensFetchJob *fetchJob = new KGAPI2::NewTokensFetchJob(token, apiKey, secretKey);
+- connect(fetchJob, &Job::finished,
+- this, &AuthWidgetPrivate::tokensReceived);
++ } else {
++ //qCDebug(KGAPIDebug) << "Unhandled page:" << url.host() << ", " << url.path();
+ }
+ }
+
+diff --git a/src/core/ui/authwidget_p.h b/src/core/ui/authwidget_p.h
+index 673b0cb..9c488be 100644
+--- a/src/core/ui/authwidget_p.h
++++ b/src/core/ui/authwidget_p.h
+@@ -82,6 +82,12 @@ class Q_DECL_HIDDEN AuthWidgetPrivate: public QObject {
+ void setupUi();
+ void setProgress(AuthWidget::Progress progress);
+
++ bool isGoogleHost(const QUrl &url) const { return url.host() == QLatin1String("accounts.google.com"); }
++ bool isSigninPage(const QUrl &url) const { return url.path() == QLatin1String("/signin/oauth"); }
++ bool isUsernameFrame(const QUrl &url) { return url.path() == QLatin1String("/signin/oauth/identifier"); }
++ bool isPasswordFrame(const QUrl &url) { return url.path() == QLatin1String("/signin/v2/challenge/pwd"); }
++ bool isTokenPage(const QUrl &url) { return url.path() == QLatin1String("/o/oauth2/approval/v2"); }
++
+ AuthWidget *q;
+
+ friend class AuthWidget;
+--
+2.12.2
+
diff --git a/kde-apps/libkgapi/files/libkgapi-17.04.0-auth2.patch b/kde-apps/libkgapi/files/libkgapi-17.04.0-auth2.patch
new file mode 100644
index 00000000000..cba162a4f18
--- /dev/null
+++ b/kde-apps/libkgapi/files/libkgapi-17.04.0-auth2.patch
@@ -0,0 +1,36 @@
+From 5a20c7494f48da93914f50bbb54423ef540ef998 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Daniel=20Vr=C3=A1til?= <dvratil@kde.org>
+Date: Thu, 27 Apr 2017 17:24:03 +0200
+Subject: [PATCH 2/3] Auth: don't store cookies
+
+Don't store WebEngine cookies, otherwise Google will display the account
+that user signed in with the last time, which may not be desirable.
+---
+ src/core/ui/authwidget_p.cpp | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/core/ui/authwidget_p.cpp b/src/core/ui/authwidget_p.cpp
+index 75d38cd..a51f4a9 100644
+--- a/src/core/ui/authwidget_p.cpp
++++ b/src/core/ui/authwidget_p.cpp
+@@ -26,6 +26,7 @@
+ #include "../../debug.h"
+
+ #include <QWebEngineView>
++#include <QWebEngineProfile>
+ #include <QNetworkReply>
+ #include <QContextMenuEvent>
+
+@@ -36,6 +37,9 @@ using namespace KGAPI2;
+ WebView::WebView(QWidget *parent)
+ : QWebEngineView(parent)
+ {
++ // Don't store cookies, so that subsequent invocations of AuthJob won't remember
++ // the previous accounts.
++ QWebEngineProfile::defaultProfile()->setPersistentCookiesPolicy(QWebEngineProfile::NoPersistentCookies);
+ }
+
+
+--
+2.12.2
+
diff --git a/kde-apps/libkgapi/files/libkgapi-17.04.0-auth3.patch b/kde-apps/libkgapi/files/libkgapi-17.04.0-auth3.patch
new file mode 100644
index 00000000000..61d3b306bed
--- /dev/null
+++ b/kde-apps/libkgapi/files/libkgapi-17.04.0-auth3.patch
@@ -0,0 +1,310 @@
+From 7b0934611ef72fb7e7c405813a1d2bb8b944dadc Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Daniel=20Vr=C3=A1til?= <dvratil@kde.org>
+Date: Thu, 27 Apr 2017 18:41:45 +0200
+Subject: [PATCH 3/3] Auth: add URL bar and SSL indicator to the authentication
+ page
+
+To increase trust-worthiness of the authentication dialog we now display
+the URL and an SSL indicator above the webview.
+---
+ src/core/ui/authwidget.cpp | 2 +
+ src/core/ui/authwidget_p.cpp | 137 +++++++++++++++++++++++++++++++++++++++----
+ src/core/ui/authwidget_p.h | 25 ++++----
+ 3 files changed, 136 insertions(+), 28 deletions(-)
+
+diff --git a/src/core/ui/authwidget.cpp b/src/core/ui/authwidget.cpp
+index 18d2106..ac09b63 100644
+--- a/src/core/ui/authwidget.cpp
++++ b/src/core/ui/authwidget.cpp
+@@ -107,6 +107,8 @@ void AuthWidget::authenticate()
+
+ qCDebug(KGAPIRaw) << "Requesting new token:" << url;
+
++ d->sslIndicator->setVisible(true);
++ d->urlEdit->setVisible(true);
+ d->webview->setVisible(true);
+ if (d->showProgressBar) {
+ d->progressbar->setVisible(true);
+diff --git a/src/core/ui/authwidget_p.cpp b/src/core/ui/authwidget_p.cpp
+index a51f4a9..f732935 100644
+--- a/src/core/ui/authwidget_p.cpp
++++ b/src/core/ui/authwidget_p.cpp
+@@ -25,35 +25,79 @@
+ #include "private/newtokensfetchjob_p.h"
+ #include "../../debug.h"
+
+-#include <QWebEngineView>
+ #include <QWebEngineProfile>
+ #include <QNetworkReply>
+ #include <QContextMenuEvent>
+
++#include <QVBoxLayout>
++#include <QLabel>
++#include <QTimer>
++#include <QMessageBox>
++
+ #include <QDateTime>
+
+ using namespace KGAPI2;
+
+-WebView::WebView(QWidget *parent)
+- : QWebEngineView(parent)
++namespace
+ {
+- // Don't store cookies, so that subsequent invocations of AuthJob won't remember
+- // the previous accounts.
+- QWebEngineProfile::defaultProfile()->setPersistentCookiesPolicy(QWebEngineProfile::NoPersistentCookies);
+-}
+
+-
+-WebView::~WebView()
++class WebView : public QWebEngineView
+ {
++ Q_OBJECT
++public:
++ explicit WebView(QWidget *parent = nullptr)
++ : QWebEngineView(parent)
++ {
++ // Don't store cookies, so that subsequent invocations of AuthJob won't remember
++ // the previous accounts.
++ QWebEngineProfile::defaultProfile()->setPersistentCookiesPolicy(QWebEngineProfile::NoPersistentCookies);
++ }
+
+-}
++ void contextMenuEvent(QContextMenuEvent *e) Q_DECL_OVERRIDE
++ {
++ // No menu
++ e->accept();
++ }
++};
+
+-void WebView::contextMenuEvent(QContextMenuEvent *e)
++class WebPage : public QWebEnginePage
+ {
+- // No menu
+- e->accept();
++ Q_OBJECT
++public:
++ explicit WebPage(QObject *parent = nullptr)
++ : QWebEnginePage(parent)
++ , mLastError(nullptr)
++ {
++ }
++
++ QWebEngineCertificateError *lastCertificateError() const
++ {
++ return mLastError;
++ }
++
++ bool certificateError(const QWebEngineCertificateError &err) Q_DECL_OVERRIDE
++ {
++ if (mLastError) {
++ delete mLastError;
++ }
++ mLastError = new QWebEngineCertificateError(err.error(), err.url(), err.isOverridable(), err.errorDescription());
++ Q_EMIT sslError();
++
++ return false; // don't let it through
++ }
++
++Q_SIGNALS:
++ void sslError();
++
++private:
++ QWebEngineCertificateError *mLastError;
++};
++
+ }
+
++
++
++
+ AuthWidgetPrivate::AuthWidgetPrivate(AuthWidget *parent):
+ QObject(),
+ showProgressBar(true),
+@@ -67,6 +111,15 @@ AuthWidgetPrivate::~AuthWidgetPrivate()
+ {
+ }
+
++void AuthWidgetPrivate::setSslIcon(const QString &iconName)
++{
++ // FIXME: workaround for silly Breeze icons: the small 22x22 icons are
++ // monochromatic, which is absolutely useless since we are trying to security
++ // information here, so instead we force use the bigger 48x48 icons which
++ // have colors and downscale them
++ sslIndicator->setIcon(QIcon::fromTheme(iconName).pixmap(48));
++}
++
+ void AuthWidgetPrivate::setupUi()
+ {
+ vbox = new QVBoxLayout(q);
+@@ -79,6 +132,26 @@ void AuthWidgetPrivate::setupUi()
+ label->setVisible(false);
+ vbox->addWidget(label);
+
++ auto hbox = new QHBoxLayout;
++ hbox->setSpacing(0);
++ sslIndicator = new QToolButton(q);
++ connect(sslIndicator, &QToolButton::clicked,
++ this, [this]() {
++ auto page = qobject_cast<WebPage*>(webview->page());
++ if (auto err = page->lastCertificateError()) {
++ QMessageBox msg;
++ msg.setIconPixmap(QIcon::fromTheme(QStringLiteral("security-low")).pixmap(64));
++ msg.setText(err->errorDescription());
++ msg.addButton(QMessageBox::Ok);
++ msg.exec();
++ }
++ });
++ hbox->addWidget(sslIndicator);
++ urlEdit = new QLineEdit(q);
++ urlEdit->setReadOnly(true);
++ hbox->addWidget(urlEdit);
++ vbox->addLayout(hbox);
++
+ progressbar = new QProgressBar(q);
+ progressbar->setMinimum(0);
+ progressbar->setMaximum(100);
+@@ -87,6 +160,13 @@ void AuthWidgetPrivate::setupUi()
+
+ webview = new WebView(q);
+
++ auto webpage = new WebPage(webview);
++ connect(webpage, &WebPage::sslError,
++ this, [this]() {
++ setSslIcon(QStringLiteral("security-low"));
++ });
++ webview->setPage(webpage);
++
+ vbox->addWidget(webview);
+ connect(webview, &QWebEngineView::loadProgress, progressbar, &QProgressBar::setValue);
+ connect(webview, &QWebEngineView::urlChanged, this, &AuthWidgetPrivate::webviewUrlChanged);
+@@ -104,6 +184,8 @@ void AuthWidgetPrivate::setProgress(AuthWidget::Progress progress)
+ void AuthWidgetPrivate::emitError(const enum Error errCode, const QString& msg)
+ {
+ label->setVisible(true);
++ sslIndicator->setVisible(false);
++ urlEdit->setVisible(false);
+ webview->setVisible(false);
+ progressbar->setVisible(false);
+
+@@ -118,10 +200,33 @@ void AuthWidgetPrivate::webviewUrlChanged(const QUrl &url)
+ {
+ qCDebug(KGAPIDebug) << "URLChange:" << url;
+
++ // Whoa! That should not happen!
++ if (url.scheme() != QLatin1String("https")) {
++ QTimer::singleShot(0, this, [this, url]() {
++ QUrl sslUrl = url;
++ sslUrl.setScheme(QStringLiteral("https"));
++ webview->setUrl(sslUrl);
++ });
++ return;
++ }
++
+ if (!isGoogleHost(url)) {
++ // We handled SSL above, so we are secure. We are however outside of
++ // accounts.google.com, which is a little suspicious in context of this class
++ setSslIcon(QStringLiteral("security-medium"));
+ return;
+ }
+
++ if (qobject_cast<WebPage*>(webview->page())->lastCertificateError()) {
++ setSslIcon(QStringLiteral("security-low"));
++ } else {
++ // We have no way of obtaining current SSL certifiace from QWebEngine, but we
++ // handled SSL and accounts.google.com cases above and QWebEngine did not report
++ // any SSL error to us, so we can assume we are safe.
++ setSslIcon(QStringLiteral("security-high"));
++ }
++
++
+ // Username and password inputs are loaded dynamically, so we only get
+ // urlChanged, but not urlFinished.
+ if (isUsernameFrame(url)) {
+@@ -145,6 +250,8 @@ void AuthWidgetPrivate::webviewUrlChanged(const QUrl &url)
+ } else if (isTokenPage(url)) {
+ /* Access token here - hide browser and tell user to wait until we
+ * finish the authentication process ourselves */
++ sslIndicator->setVisible(false);
++ urlEdit->setVisible(false);
+ webview->setVisible(false);
+ progressbar->setVisible(false);
+ label->setVisible(true);
+@@ -160,6 +267,8 @@ void AuthWidgetPrivate::webviewFinished(bool ok)
+ }
+
+ const QUrl url = webview->url();
++ urlEdit->setText(url.toDisplayString(QUrl::PrettyDecoded));
++ urlEdit->setCursorPosition(0);
+ qCDebug(KGAPIDebug) << "URLFinished:" << url;
+
+ if (!isGoogleHost(url)) {
+@@ -238,3 +347,5 @@ void AuthWidgetPrivate::accountInfoReceived(KGAPI2::Job* job)
+ setProgress(AuthWidget::Finished);
+ }
+
++
++#include "authwidget_p.moc"
+diff --git a/src/core/ui/authwidget_p.h b/src/core/ui/authwidget_p.h
+index 9c488be..78b0e7f 100644
+--- a/src/core/ui/authwidget_p.h
++++ b/src/core/ui/authwidget_p.h
+@@ -26,27 +26,18 @@
+ #include "ui/authwidget.h"
+ #include "types.h"
+
++#include <QLineEdit>
++#include <QToolButton>
+ #include <QProgressBar>
+-#include <QVBoxLayout>
+ #include <QWebEngineView>
+-#include <QLabel>
++
++class QVBoxLayout;
++class QLabel;
+
+ namespace KGAPI2 {
+
+ class Job;
+
+-class WebView : public QWebEngineView
+-{
+- Q_OBJECT
+-public:
+- explicit WebView(QWidget *parent=0);
+- ~WebView();
+-
+-protected:
+- void contextMenuEvent(QContextMenuEvent *) Q_DECL_OVERRIDE;
+-};
+-
+-
+ class Q_DECL_HIDDEN AuthWidgetPrivate: public QObject {
+
+ Q_OBJECT
+@@ -65,9 +56,11 @@ class Q_DECL_HIDDEN AuthWidgetPrivate: public QObject {
+ QString apiKey;
+ QString secretKey;
+
++ QToolButton *sslIndicator;
++ QLineEdit *urlEdit;
+ QProgressBar *progressbar;
+ QVBoxLayout *vbox;
+- WebView *webview;
++ QWebEngineView *webview;
+ QLabel *label;
+
+ private Q_SLOTS:
+@@ -88,6 +81,8 @@ class Q_DECL_HIDDEN AuthWidgetPrivate: public QObject {
+ bool isPasswordFrame(const QUrl &url) { return url.path() == QLatin1String("/signin/v2/challenge/pwd"); }
+ bool isTokenPage(const QUrl &url) { return url.path() == QLatin1String("/o/oauth2/approval/v2"); }
+
++ void setSslIcon(const QString &icon);
++
+ AuthWidget *q;
+
+ friend class AuthWidget;
+--
+2.12.2
+
diff --git a/kde-apps/libkgapi/libkgapi-17.04.0-r1.ebuild b/kde-apps/libkgapi/libkgapi-17.04.0-r1.ebuild
new file mode 100644
index 00000000000..d48cb19e0dc
--- /dev/null
+++ b/kde-apps/libkgapi/libkgapi-17.04.0-r1.ebuild
@@ -0,0 +1,36 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+KDE_BLOCK_SLOT4="false"
+KDE_TEST="true"
+VIRTUALX_REQUIRED="test"
+inherit kde5
+
+DESCRIPTION="Library for accessing Google calendar and contact resources"
+HOMEPAGE="https://projects.kde.org/projects/extragear/libs/libkgapi"
+
+LICENSE="LGPL-2.1+"
+KEYWORDS="~amd64 ~x86"
+IUSE="nls"
+
+COMMON_DEPEND="
+ $(add_frameworks_dep kio)
+ $(add_frameworks_dep kwindowsystem)
+ $(add_kdeapps_dep kcalcore)
+ $(add_kdeapps_dep kcontacts)
+ $(add_qt_dep qtgui)
+ $(add_qt_dep qtnetwork)
+ $(add_qt_dep qtwebengine)
+ $(add_qt_dep qtwidgets)
+ $(add_qt_dep qtxml)
+"
+DEPEND="${COMMON_DEPEND}
+ nls? ( $(add_qt_dep linguist-tools) )
+"
+RDEPEND="${COMMON_DEPEND}
+ !kde-apps/kdepim-l10n
+"
+
+PATCHES=( "${FILESDIR}"/${P}-auth{1,2,3}.patch )
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-01-18 23:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-18 23:01 [gentoo-commits] repo/gentoo:master commit in: kde-apps/libkgapi/, kde-apps/libkgapi/files/ Andreas Sturmlechner
-- strict thread matches above, loose matches on Subject: below --
2017-04-27 18:15 Andreas Sturmlechner
2017-04-27 18:15 Andreas Sturmlechner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox