oauth work around for 10.3.3 security features which resolves issue #11
This commit is contained in:
parent
e1a5c31adb
commit
0c8bc294c1
6 changed files with 53 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
1
|
||||
45
|
||||
46
|
||||
AboutPage.qml
|
||||
AppCover.qml
|
||||
LoginSheet.qml
|
||||
|
@ -45,3 +45,4 @@ icons/sign-out.png
|
|||
icons/star-o.png
|
||||
icons/star.png
|
||||
StreamTab.qml
|
||||
WebViewSheet.qml
|
||||
|
|
|
@ -212,6 +212,9 @@ NavigationPane {
|
|||
pnut.sendPost(text)
|
||||
}
|
||||
},
|
||||
WebViewSheet {
|
||||
id: webViewSheet
|
||||
},
|
||||
QTimer {
|
||||
id: timer
|
||||
interval: 30000
|
||||
|
@ -272,12 +275,19 @@ NavigationPane {
|
|||
|
||||
onAuthorizationReceived: {
|
||||
console.log("-- THIS --")
|
||||
webViewSheet.close()
|
||||
closeLogin()
|
||||
pnut.getStream(endpoint, Pnut.STREAM_OLDER);
|
||||
timer.start();
|
||||
console.log("__Should be closed now")
|
||||
}
|
||||
|
||||
onOpenBrowser: {
|
||||
//console.log("-- open browser --")
|
||||
webViewSheet.url = url
|
||||
webViewSheet.open()
|
||||
}
|
||||
|
||||
onFollowSuccess: update_user_page(user)
|
||||
|
||||
onUnfollowSuccess: update_user_page(user)
|
||||
|
|
26
assets/WebViewSheet.qml
Normal file
26
assets/WebViewSheet.qml
Normal file
|
@ -0,0 +1,26 @@
|
|||
import bb.cascades 1.4
|
||||
|
||||
Sheet {
|
||||
peekEnabled: false
|
||||
property alias url: webview.url
|
||||
Page {
|
||||
ScrollView {
|
||||
scrollViewProperties.pinchToZoomEnabled: true
|
||||
scrollViewProperties.scrollMode: ScrollMode.Both
|
||||
WebView {
|
||||
id: webview
|
||||
settings.zoomToFitEnabled: true
|
||||
|
||||
onUrlChanged: {
|
||||
//console.log("::" + url)
|
||||
// Workaround for 10.3.3
|
||||
if (url.toString().match(/http\:\/\/.*#access_token\=/i)) {
|
||||
//console.log("Matched url: " + url.toString());
|
||||
webview.stop();
|
||||
webview.url = url.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -78,6 +78,7 @@ config_pri_assets {
|
|||
$$quote($$BASEDIR/assets/ThreadPage.qml) \
|
||||
$$quote($$BASEDIR/assets/UserItem.qml) \
|
||||
$$quote($$BASEDIR/assets/UserPage.qml) \
|
||||
$$quote($$BASEDIR/assets/WebViewSheet.qml) \
|
||||
$$quote($$BASEDIR/assets/icons/at.png) \
|
||||
$$quote($$BASEDIR/assets/icons/bell-slash.png) \
|
||||
$$quote($$BASEDIR/assets/icons/bell.png) \
|
||||
|
|
12
src/Pnut.cpp
12
src/Pnut.cpp
|
@ -51,6 +51,11 @@ Pnut::Pnut()
|
|||
|
||||
Q_ASSERT(conn_req);
|
||||
|
||||
bool brw_req = connect(oauthManager, SIGNAL(openBrowser(QUrl)),
|
||||
this, SLOT(onOpenBrowser(QUrl)));
|
||||
|
||||
Q_ASSERT(brw_req);
|
||||
|
||||
qDebug() << "Pnut created, I am life.";
|
||||
}
|
||||
|
||||
|
@ -519,3 +524,10 @@ void Pnut::getFollowing(QString uid)
|
|||
req_map[++req_id] = ":following";
|
||||
getRequest(url, parameters, req_id);
|
||||
}
|
||||
|
||||
void Pnut::onOpenBrowser(QUrl url)
|
||||
{
|
||||
qDebug() << "_onOpenBrowser_";
|
||||
qDebug() << url;
|
||||
emit openBrowser(url);
|
||||
}
|
||||
|
|
|
@ -93,6 +93,7 @@ public slots:
|
|||
void onRequestReady(QByteArray data);
|
||||
void onAuthorizedRequestReady(QByteArray data, int id);
|
||||
void onAuthorizationReceived(QString token, QString verifier);
|
||||
void onOpenBrowser(QUrl url);
|
||||
|
||||
Q_SIGNALS:
|
||||
void authorizationRequired();
|
||||
|
@ -108,6 +109,7 @@ Q_SIGNALS:
|
|||
void postReceived(QVariantMap post);
|
||||
void userStreamReceived(QVariantList stream);
|
||||
void userListReceived(QVariantList users);
|
||||
void openBrowser(QUrl url);
|
||||
|
||||
private:
|
||||
static const QString PNUT_API_ROOT;
|
||||
|
|
Reference in a new issue