OAuth in browser now
This commit is contained in:
parent
2f8cc0d613
commit
91913ddaad
4 changed files with 18 additions and 6 deletions
|
@ -1,7 +1,7 @@
|
|||
[Desktop Entry]
|
||||
Version={VERSION}
|
||||
Comment=Tent is a distributed social network protocol and Bungloo is one of the clients using it.
|
||||
Exec=/usr/bin/bungloo
|
||||
Comment=Tent is a distributed social network protocol and Bungloo is one of the microbloging clients using it.
|
||||
Exec=bungloo %U
|
||||
GenericName=Tent Client
|
||||
Icon=bungloo
|
||||
Name=Bungloo
|
||||
|
@ -10,3 +10,4 @@ StartupNotify=true
|
|||
Terminal=false
|
||||
Type=Application
|
||||
Categories=Network;Qt
|
||||
MimeType=x-scheme-handler/bungloo;
|
||||
|
|
|
@ -97,7 +97,10 @@ class Bungloo():
|
|||
argv = json.loads(str(args))
|
||||
if len(argv) > 0:
|
||||
if argv[0] == "--new-message":
|
||||
self.controller.openNewMessageWidow(" ".join(argv[1:]))
|
||||
text = " ".join(argv[1:])
|
||||
self.controller.openNewMessageWidow(text)
|
||||
elif argv[0].startswith("bungloo://oauthtoken"):
|
||||
self.oauth_implementation.bungloo_callback(QtCore.QUrl(argv[0].encode("utf-8"), QtCore.QUrl.TolerantMode))
|
||||
|
||||
|
||||
|
||||
|
@ -171,8 +174,8 @@ class Controller(QtCore.QObject):
|
|||
pass
|
||||
|
||||
@QtCore.pyqtSlot()
|
||||
def openNewMessageWidow(self):
|
||||
self.openNewMessageWindowInReplyToStatus("")
|
||||
def openNewMessageWidow(self, text=""):
|
||||
self.openNewMessageWindowInReplyToStatus("") # FIXME: create a status_string with this content
|
||||
|
||||
@QtCore.pyqtSlot(str)
|
||||
def openNewMessageWindowInReplyToStatus(self, status_string):
|
||||
|
@ -323,6 +326,7 @@ Usage: bungloo [option [text]]
|
|||
|
||||
app = SingleApplication.SingleApplicationWithMessaging(sys.argv, key)
|
||||
if app.isRunning():
|
||||
print json.dumps(sys.argv[1:])
|
||||
app.sendMessage(json.dumps(sys.argv[1:]))
|
||||
sys.exit(1)
|
||||
|
||||
|
|
|
@ -233,6 +233,9 @@ class Oauth:
|
|||
self.core.page().mainFrame().evaluateJavaScript(script)
|
||||
|
||||
def handle_authentication(self, url):
|
||||
self.app.controller.openURL(url)
|
||||
return False
|
||||
|
||||
self.auth_view = Helper.WebViewCreator(self.app)
|
||||
self.auth_view.setWindowTitle("Authentication")
|
||||
|
||||
|
@ -242,7 +245,7 @@ class Oauth:
|
|||
new_manager.sslErrors.connect(lambda reply, errors: self.handleSslErrors(reply, errors))
|
||||
self.auth_view.page().setNetworkAccessManager(new_manager)
|
||||
self.auth_view.show()
|
||||
print url
|
||||
|
||||
self.auth_view.load_url(url)
|
||||
return False
|
||||
|
||||
|
|
|
@ -157,6 +157,10 @@ function(HostApp, APICalls, Hmac) {
|
|||
content_type: "application/json",
|
||||
auth_header: auth_header,
|
||||
callback: function(resp) {
|
||||
debug(url)
|
||||
debug(requestBody)
|
||||
debug(auth_header)
|
||||
debug(resp.responseText)
|
||||
those.requestAccessTokenTicketFinished(resp.responseText);
|
||||
}});
|
||||
|
||||
|
|
Reference in a new issue