signon-ui new package

This commit is contained in:
Rmys
2022-11-07 17:38:15 +03:00
parent 9e758633f5
commit 039014d897
11 changed files with 317 additions and 2 deletions
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Licensed under the GNU General Public License, version 3.
# See the file http://www.gnu.org/licenses/gpl.txt
from pisi.actionsapi import pisitools
from pisi.actionsapi import qt5
def setup():
qt5.configure()
def build():
qt5.make()
def install():
qt5.install()
pisitools.dodoc("COPYING", "TODO", "README*")
@@ -0,0 +1,26 @@
From e155e6e70ce7a6c52837688b570e8020faac5496 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
Date: Sat, 8 Sep 2018 18:58:42 +0200
Subject: [PATCH] Fix WebEngine cache directory path
Otherwise the URL is treated as a path, which results in a folder "file:" in ~.
---
src/browser-request.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/browser-request.cpp b/src/browser-request.cpp
index 146bec8..1895d59 100644
--- a/src/browser-request.cpp
+++ b/src/browser-request.cpp
@@ -132,7 +132,7 @@ void BrowserRequestPrivate::start()
m_dialog->rootContext()->setContextProperty("request", this);
m_dialog->rootContext()->setContextProperty("rootDir",
- QUrl::fromLocalFile(rootDir.absolutePath()));
+ rootDir.absolutePath());
m_dialog->setSource(webview);
}
--
2.18.0
@@ -0,0 +1,128 @@
From 90890e7d27c544e3557bed2f6624614141db0fc4 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
Date: Sat, 29 Sep 2018 15:34:43 +0200
Subject: [PATCH] Reintroduce the username field reading with webkit-options.d
Use WebChannel to spy on the input fields.
Use the old UserAgent to make sure the selectors match.
---
src/browser-request.cpp | 11 +++++++++++
src/qml/WebView.qml | 36 ++++++++++++++++++++++++++++++++++++
2 files changed, 47 insertions(+)
diff --git a/src/browser-request.cpp b/src/browser-request.cpp
index 1895d59..e58f302 100644
--- a/src/browser-request.cpp
+++ b/src/browser-request.cpp
@@ -31,6 +31,7 @@
#include <QStandardPaths>
#include <QTimer>
#include <SignOn/uisessiondata_priv.h>
+#include <QSettings>
using namespace SignOnUi;
using namespace SignOnUi::QQuick;
@@ -43,8 +44,10 @@ class BrowserRequestPrivate: public QObject
Q_DECLARE_PUBLIC(BrowserRequest)
Q_PROPERTY(QUrl pageComponentUrl READ pageComponentUrl CONSTANT)
Q_PROPERTY(QUrl currentUrl READ currentUrl WRITE setCurrentUrl)
+ Q_PROPERTY(QString username MEMBER m_username)
Q_PROPERTY(QUrl startUrl READ startUrl CONSTANT)
Q_PROPERTY(QUrl finalUrl READ finalUrl CONSTANT)
+ Q_PROPERTY(QString usernameSelector READ usernameSelector CONSTANT)
public:
BrowserRequestPrivate(BrowserRequest *request);
@@ -58,6 +61,7 @@ public:
QUrl startUrl() const { return m_startUrl; }
QUrl finalUrl() const { return m_finalUrl; }
QUrl responseUrl() const { return m_responseUrl; }
+ QString usernameSelector() const { return m_settings->value("UsernameField").toString(); }
public Q_SLOTS:
void cancel();
@@ -77,6 +81,8 @@ private:
QUrl m_startUrl;
QUrl m_finalUrl;
QUrl m_responseUrl;
+ QString m_username;
+ QSettings *m_settings;
QTimer m_failTimer;
mutable BrowserRequest *q_ptr;
};
@@ -116,6 +122,9 @@ void BrowserRequestPrivate::start()
m_finalUrl = params.value(SSOUI_KEY_FINALURL).toString();
m_startUrl = params.value(SSOUI_KEY_OPENURL).toString();
+
+ m_settings = new QSettings("signon-ui/webkit-options.d/" + m_startUrl.host(), QString(), this);
+
buildDialog(params);
QObject::connect(m_dialog, SIGNAL(finished(int)),
@@ -231,6 +240,8 @@ void BrowserRequestPrivate::onFinished()
QVariantMap reply;
QUrl url = m_responseUrl.isEmpty() ? m_currentUrl : m_responseUrl;
reply[SSOUI_KEY_URLRESPONSE] = url.toString();
+ if (!m_username.isEmpty())
+ reply[SSOUI_KEY_USERNAME] = m_username;
m_dialog->close();
diff --git a/src/qml/WebView.qml b/src/qml/WebView.qml
index 33462b8..3af0239 100644
--- a/src/qml/WebView.qml
+++ b/src/qml/WebView.qml
@@ -1,4 +1,5 @@
import QtQuick 2.0
+import QtWebChannel 1.0
import QtWebEngine 1.1
WebEngineView {
@@ -25,8 +26,43 @@ WebEngineView {
profile: WebEngineProfile {
cachePath: rootDir
persistentStoragePath: rootDir
+ // For compatibility with the webkit-options.d values
+ httpUserAgent: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.21 (KHTML, like Gecko) Safari/537.21"
}
+ QtObject {
+ id: commProxy
+ WebChannel.id: "comm"
+ property string username: ""
+ property string selector: signonRequest.usernameSelector
+ onUsernameChanged: signonRequest.username = username
+ }
+
+ WebChannel {
+ id: chan
+ registeredObjects: [commProxy]
+ }
+ webChannel: chan
+
+ WebEngineScript {
+ id: qwebchannel
+ injectionPoint: WebEngineScript.DocumentCreation
+ sourceUrl: "qrc:/qtwebchannel/qwebchannel.js"
+ worldId: WebEngineScript.MainWorld
+ }
+
+ WebEngineScript {
+ id: commScript
+ injectionPoint: WebEngineScript.DocumentReady
+ sourceCode: "new QWebChannel(window.qt.webChannelTransport, function(channel) {" +
+ " var elem = document.querySelector(channel.objects.comm.selector);" +
+ " elem.addEventListener('keyup', function() { channel.objects.comm.username = elem.value; });" +
+ "});"
+ worldId: WebEngineScript.MainWorld
+ }
+
+ userScripts: [qwebchannel, commScript]
+
ProgressBar {
anchors.top: parent.top
anchors.left: parent.left
--
2.18.0
@@ -0,0 +1,12 @@
diff --git a/src/qml/WebView.qml b/src/qml/WebView.qml
index 33462b8..b720111 100644
--- a/src/qml/WebView.qml
+++ b/src/qml/WebView.qml
@@ -25,6 +25,7 @@ WebEngineView {
profile: WebEngineProfile {
cachePath: rootDir
persistentStoragePath: rootDir
+ httpUserAgent: "Mozilla/5.0 (X11; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/77.0"
}
ProgressBar {
+59
View File
@@ -0,0 +1,59 @@
<?xml version="1.0" ?>
<!DOCTYPE PISI SYSTEM "http://www.pisilinux.org/projeler/pisi/pisi-spec.dtd">
<PISI>
<Source>
<Name>signon-ui</Name>
<Homepage>https://gitlab.com/accounts-sso/signon-ui</Homepage>
<Packager>
<Name>Pisi Linux Admins</Name>
<Email>admin@pisilinux.org</Email>
</Packager>
<License>GPLv3</License>
<IsA>library</IsA>
<Summary>UI component responsible for handling the user interactions which can happen during the login process of an online account</Summary>
<Description>Bir çevrimiçi hesabın oturum açma işlemi sırasında meydana gelebilecek kullanıcı etkileşimlerini yönetmekten sorumlu UI bileşeni</Description>
<Archive sha1sum="a0be04c7d0c13a2011370d7511ffce800ba0cd66" type="targz">https://gitlab.com/accounts-sso/signon-ui/-/archive/4368bb77d9d1abc2978af514225ba4a42c29a646/signon-ui-0.17+20171022.tar.gz</Archive>
<BuildDependencies>
<Dependency>glib2-devel</Dependency>
<Dependency>signon-devel</Dependency>
<Dependency>libproxy-devel</Dependency>
<Dependency>qt5-base-devel</Dependency>
<Dependency>libnotify-devel</Dependency>
<Dependency>qt5-webkit-devel</Dependency>
<Dependency>libaccounts-qt5-devel</Dependency>
</BuildDependencies>
<Patches>
<Patch level="1">0001-Reintroduce-the-username-field-reading-with-webkit-o.patch</Patch> -->
<Patch level="1">0001-Fix-WebEngine-cache-directory-path.patch</Patch> -->
</Patches>
</Source>
<Package>
<Name>signon-ui</Name>
<RuntimeDependencies>
<Dependency>glib2</Dependency>
<Dependency>signon</Dependency>
<Dependency>libproxy</Dependency>
<Dependency>qt5-base</Dependency>
<Dependency>libnotify</Dependency>
<Dependency>qt5-webkit</Dependency>
<Dependency>libaccounts-qt5</Dependency>
</RuntimeDependencies>
<Files>
<Path fileType="executable">/usr/bin</Path>
<Path fileType="data">/usr/share/dbus-1</Path>
<Path fileType="doc">/usr/share/doc</Path>
<Path fileType="data">/usr/share/applications</Path>
</Files>
</Package>
<History>
<Update release="1">
<Date>2022-11-07</Date>
<Version>0.17</Version>
<Comment>First release</Comment>
<Name>Pisi Linux Admins</Name>
<Email>admin@pisilinux.org</Email>
</Update>
</History>
</PISI>
@@ -0,0 +1,8 @@
<?xml version="1.0" ?>
<PISI>
<Source>
<Name>signon-ui</Name>
<Summary xml:lang="tr">UI component responsible for handling the user interactions which can happen during the login process of an online account</Summary>
<Description xml:lang="tr">Bir çevrimiçi hesabın oturum açma işlemi sırasında meydana gelebilecek kullanıcı etkileşimlerini yönetmekten sorumlu UI bileşeni</Description>
</Source>
</PISI>