[-]
[+]
|
Changed |
_service:tar_git:harbour-sailtrix.spec
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -2,6 +2,6 @@
<service name="tar_git">
<param name="url">https://gitlab.com/HengYeDev/harbour-sailtrix</param>
<param name="branch">master</param>
- <param name="revision">1.3.8.1</param>
+ <param name="revision">1.3.9</param>
</service>
</services>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-sailtrix-1.3.9.tar.bz2/harbour-sailtrix.desktop
^
|
@@ -10,6 +10,6 @@
[X-Sailjail]
-Permissions=Internet;Audio;Documents;Downloads;PublicDir;Pictures;Videos;Music;RemovableMedia;Secrets;UserDirs;MediaIndexing
+Permissions=Internet;Audio;Documents;Downloads;PublicDir;Pictures;Videos;Music;RemovableMedia;Secrets;UserDirs;MediaIndexing;WebView
OrganizationName=org.yeheng
ApplicationName=sailtrix
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-sailtrix-1.3.9.tar.bz2/harbour-sailtrix.pro
^
|
@@ -79,6 +79,7 @@
COPYING \
README \
harbour-sailtrix.desktop \
+ html/ssoDone.html \
icons/108x108/harbour-sailtrix.png \
icons/128x128/harbour-sailtrix.png \
icons/172x172/harbour-sailtrix.png \
@@ -223,4 +224,9 @@
# QMAKE_CXXFLAGS += -fsanitize=address
# QMAKE_LFLAGS += -fsanitize=address
-PKGCONFIG += sailfishsecrets sailfishcrypto keepalive nemonotifications-qt5
+PKGCONFIG += sailfishsecrets sailfishcrypto keepalive nemonotifications-qt5 qt5embedwidget
+
+html.files = html/*
+html.path = $$INSTALL_ROOT/usr/share/harbour-sailtrix/html
+
+INSTALLS += html
|
[-]
[+]
|
Added |
_service:tar_git:harbour-sailtrix-1.3.9.tar.bz2/html/ssoDone.html
^
|
@@ -0,0 +1 @@
+<h1>Sailtrix SSO Done</h1>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-sailtrix-1.3.9.tar.bz2/qml/pages/Credits.qml
^
|
@@ -18,7 +18,7 @@
spacing: Theme.paddingLarge
Label {
- text: "Sailtrix 1.3.7"
+ text: "Sailtrix 1.3.9"
color: Theme.highlightColor
font.family: Theme.fontFamilyHeading
font.pixelSize: Theme.fontSizeLarge
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-sailtrix-1.3.9.tar.bz2/qml/pages/SSOLogin.qml
^
|
@@ -1,14 +1,29 @@
import QtQuick 2.0
import Sailfish.Silica 1.0
+import Sailfish.WebView 1.0
import LoginBridge 1.0
-Dialog {
- id: loginDialog
+Page {
+ id: loginPage
allowedOrientations: Orientation.All
+
LoginBridge {
id: bridge
+
+ onDiscovered: {
+ webviewer.url = bridge.homeserverUrl + "/_matrix/client/r0/login/sso/redirect?redirectUrl=https://0.0.0.0/sailtrixSSO"
+ webviewer.visible = true
+ indicator.running = false
+ }
+
+ onErrorChanged: {
+ if (error == "Done") {
+ pageStack.clear();
+ pageStack.replace("Rooms.qml")
+ }
+ }
}
Column {
@@ -17,7 +32,7 @@
width: parent.width
spacing: Theme.paddingLarge
- DialogHeader {
+ PageHeader {
title: qsTr("Login with SSO")
}
@@ -26,6 +41,51 @@
placeholderText: qsTr("Homeserver URL (matrix.org)")
width: parent.width
id: homeserverUrl
+
+ EnterKey.iconSource: "image://theme/icon-m-enter-next"
+ EnterKey.enabled: text.length > 0
+ EnterKey.onClicked: {
+ bridge.homeserverUrl = homeserverUrl.text;
+ bridge.login(true);
+ indicator.running = true
+ column.visible = false
+ }
+ }
+
+ Button {
+ text: "Continue"
+
+ id: continueButton
+
+
+ preferredWidth: Theme.buttonWidthLarge
+ anchors.horizontalCenter: parent.horizontalCenter
+
+ onClicked: {
+ bridge.homeserverUrl = homeserverUrl.text;
+ bridge.login(true);
+ indicator.running = true
+ column.visible = false
+ }
}
}
+
+
+ WebView {
+ visible: false
+ id: webviewer
+ anchors.fill: parent
+
+ onUrlChanged: {
+ if (url.toString().lastIndexOf("https://0.0.0.0/sailtrixSSO") === 0) {
+ bridge.ssoLogin(url.toString().substring(39));
+ webviewer.visible = false
+ indicator.running = true
+ }
+ }
+ }
+
+ PageBusyIndicator {
+ id: indicator
+ }
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-sailtrix-1.3.9.tar.bz2/qml/pages/Start.qml
^
|
@@ -48,13 +48,13 @@
onClicked: pageStack.push("LoginDialog.qml")
}
- /* For later Button {
+ Button {
text: qsTr("Log in with SSO")
preferredWidth: Theme.buttonWidthLarge
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: page.verticalCenter
- onClicked: pageStack.push("LoginDialog.qml")
- } */
+ onClicked: pageStack.push("SSOLogin.qml")
+ }
}
}
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-sailtrix-1.3.9.tar.bz2/src/dbus/notifications.cpp
^
|
@@ -206,7 +206,8 @@
n->setAppIcon("harbour-sailtrix");
n->setAppName("Sailtrix");
n->setCategory("x-nemo.messaging.im");
-
+ n->setHintValue(QStringLiteral("x-nemo-priority"), 120);
+ n->setHintValue(QStringLiteral("x-nemo-feedback"), QStringLiteral("chat_exists"));
QString summary = "New Message";
QString icon = "image://theme/icon-lock-chat";
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-sailtrix-1.3.9.tar.bz2/src/loginbridge.cpp
^
|
@@ -25,7 +25,8 @@
QUrl homeserver_url;
-void LoginBridge::login() {
+void LoginBridge::login(bool serverDiscoveryOnly) {
+ m_serverDiscoveryOnly = serverDiscoveryOnly;
setError(nullptr);
qDebug() << "Clicked";
manager = new QNetworkAccessManager(this);
@@ -110,9 +111,14 @@
if (reply->error() == QNetworkReply::NoError) {
qDebug() << "Homeserver is valid.";
- disconnect(manager, &QNetworkAccessManager::finished, this, &LoginBridge::validateHomeserver);
- connect(manager, &QNetworkAccessManager::finished, this, &LoginBridge::validateFlow);
- manager->get(QNetworkRequest(QUrl(QString(homeserver_url.toString() + "/_matrix/client/r0/login"))));
+ if (m_serverDiscoveryOnly) {
+ setHomeserverUrl(homeserver_url.toString());
+ emit discovered();
+ } else {
+ disconnect(manager, &QNetworkAccessManager::finished, this, &LoginBridge::validateHomeserver);
+ connect(manager, &QNetworkAccessManager::finished, this, &LoginBridge::validateFlow);
+ manager->get(QNetworkRequest(QUrl(QString(homeserver_url.toString() + "/_matrix/client/r0/login"))));
+ }
} else {
qDebug() << "Homeserver validation error: " << reply->errorString();
setError("Homeserver is not valid");
@@ -161,6 +167,23 @@
}
}
+void LoginBridge::ssoLogin(QString token) {
+ disconnect(manager, &QNetworkAccessManager::finished, this, &LoginBridge::validateHomeserver);
+ connect(manager, &QNetworkAccessManager::finished, this, &LoginBridge::doLogin);
+
+ QJsonObject obj;
+ obj.insert("type", "m.login.token");
+
+ obj.insert("token", token);
+
+ obj.insert("initial_device_display_name", "Sailtrix on SailfishOS");
+
+ QNetworkRequest loginRequest(QString(homeserver_url.toString() + "/_matrix/client/r0/login"));
+ loginRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
+
+ manager->post(loginRequest, QJsonDocument(obj).toJson());
+}
+
void LoginBridge::doLogin(QNetworkReply* reply) {
qDebug() << "Login responded: " << reply->error();
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-sailtrix-1.3.9.tar.bz2/src/loginbridge.h
^
|
@@ -19,7 +19,8 @@
Q_PROPERTY(QString password READ password WRITE setPassword)
Q_PROPERTY(QString error READ error WRITE setError NOTIFY errorChanged)
public:
- Q_INVOKABLE void login();
+ Q_INVOKABLE void login(bool serverDiscoveryOnly = false);
+ Q_INVOKABLE void ssoLogin(QString token);
QString homeserverUrl();
QString username();
QString password();
@@ -30,6 +31,7 @@
void setError(const QString &error);
signals:
void errorChanged();
+ void discovered();
private slots:
void doServerDiscovery(QNetworkReply* reply);
void validateHomeserver(QNetworkReply* reply);
@@ -42,6 +44,7 @@
QString m_username;
QString m_password;
QString m_error;
+ bool m_serverDiscoveryOnly = false;
QNetworkAccessManager* manager;
QNetworkAccessManager* keys_upload;
Secrets::SecretManager m_secretManager;
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-sailtrix-1.3.9.tar.bz2/translations/harbour-sailtrix.ts
^
|
@@ -406,17 +406,17 @@
<context>
<name>SSOLogin</name>
<message>
- <location filename="../qml/pages/SSOLogin.qml" line="21"/>
+ <location filename="../qml/pages/SSOLogin.qml" line="36"/>
<source>Login with SSO</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../qml/pages/SSOLogin.qml" line="25"/>
+ <location filename="../qml/pages/SSOLogin.qml" line="40"/>
<source>Homeserver</source>
<translation type="unfinished"></translation>
</message>
<message>
- <location filename="../qml/pages/SSOLogin.qml" line="26"/>
+ <location filename="../qml/pages/SSOLogin.qml" line="41"/>
<source>Homeserver URL (matrix.org)</source>
<translation type="unfinished"></translation>
</message>
@@ -584,6 +584,11 @@
<source>Log in with Username/Password</source>
<translation type="unfinished"></translation>
</message>
+ <message>
+ <location filename="../qml/pages/Start.qml" line="52"/>
+ <source>Log in with SSO</source>
+ <translation type="unfinished"></translation>
+ </message>
</context>
<context>
<name>User</name>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-sailtrix.yaml
^
|
@@ -1,6 +1,6 @@
Name: harbour-sailtrix
Summary: Matrix client for SailfishOS
-Version: 1.3.8.1
+Version: 1.3.9
Release: 1
# The contents of the Group field should be one of the groups listed here:
# https://github.com/mer-tools/spectacle/blob/master/data/GROUPS
@@ -43,12 +43,15 @@
- sailfishcrypto
- nemonotifications-qt5
- keepalive
+ - qt5embedwidget
# Runtime dependencies which are not automatically detected
Requires:
- sailfishsilica-qt5 >= 0.10.9
- sailfishsecretsdaemon-secretsplugins-default
- nemo-qml-plugin-notifications-qt5
+ - sailfish-components-webview-qt5
+
# All installed files
Files:
- '%{_bindir}'
|