fixed (OS X) so you can log in and out without restarting, added Add photo
This commit is contained in:
parent
be1d72cd6a
commit
e5704ddda7
11 changed files with 133 additions and 50 deletions
|
@ -9,7 +9,7 @@ function(HostApp, Paths, Hmac) {
|
|||
function Oauth() {
|
||||
this.app_info = {
|
||||
"id": null,
|
||||
"name": "Tentia",
|
||||
"name": "Tentia on " + HostApp.osType(),
|
||||
"description": "A small TentStatus client.",
|
||||
"url": "http://jabs.nu/Tentia/",
|
||||
"icon": "http://jabs.nu/Tentia/icon.png",
|
||||
|
@ -32,6 +32,10 @@ function(HostApp, Paths, Hmac) {
|
|||
this.state = null;
|
||||
}
|
||||
|
||||
Oauth.prototype.isAuthenticated = function() {
|
||||
return HostApp.stringForKey("user_access_token") != null;
|
||||
}
|
||||
|
||||
Oauth.prototype.authenticate = function() {
|
||||
|
||||
var entity = HostApp.stringForKey("entity");
|
||||
|
@ -153,7 +157,28 @@ function(HostApp, Paths, Hmac) {
|
|||
}
|
||||
|
||||
Oauth.prototype.logout = function() {
|
||||
return false;
|
||||
|
||||
var url = Paths.mkApiRootPath("/apps/" + HostApp.stringForKey("app_id"));
|
||||
var http_method = "DELETE";
|
||||
var auth_header = Hmac.makeAuthHeader(
|
||||
url,
|
||||
http_method,
|
||||
HostApp.stringForKey("app_mac_key"),
|
||||
HostApp.stringForKey("app_mac_key_id")
|
||||
);
|
||||
|
||||
Paths.getURL(url, http_method, function(resp) {
|
||||
HostApp.setStringForKey(null, "app_mac_key");
|
||||
HostApp.setStringForKey(null, "app_mac_key_id");
|
||||
HostApp.setStringForKey(null, "app_id");
|
||||
HostApp.setStringForKey(null, "app_mac_algorithm");
|
||||
HostApp.setStringForKey(null, "user_access_token");
|
||||
HostApp.setStringForKey(null, "user_mac_key");
|
||||
HostApp.setStringForKey(null, "user_mac_algorithm");
|
||||
HostApp.setStringForKey(null, "user_token_type");
|
||||
HostApp.setStringForKey(null, "api_root");
|
||||
HostApp.setStringForKey(null, "entity");
|
||||
}, null, auth_header);
|
||||
}
|
||||
|
||||
|
||||
|
|
Reference in a new issue