more register stuff
This commit is contained in:
parent
365e6e034c
commit
8faf687bc5
18 changed files with 843 additions and 158 deletions
Binary file not shown.
|
@ -6,7 +6,21 @@
|
|||
// Licence: BSD (see attached LICENCE.txt file).
|
||||
//
|
||||
|
||||
MY_ENTITY = "https://jeena.tent.is";
|
||||
MY_ENTITY = "http://lala.home.jeena.net:3002";
|
||||
|
||||
var app_info = {
|
||||
"name": "Tentia",
|
||||
"description": "A small TentStatus client.",
|
||||
"url": "http://jabs.nu/Tentia/",
|
||||
"icon": "http://jabs.nu/Tentia/icon.png",
|
||||
"redirect_uris": [
|
||||
"tentia://oauthtoken"
|
||||
],
|
||||
"scopes": {
|
||||
"read_posts": "Uses posts to show them in a list",
|
||||
"write_posts": "Posts on users behalf"
|
||||
}
|
||||
};
|
||||
|
||||
function getURL(url, type, callback, data) {
|
||||
$.ajax({
|
||||
|
@ -22,7 +36,17 @@ function getURL(url, type, callback, data) {
|
|||
alert(ajaxOptions);
|
||||
alert(thrownError);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function makeid(len) {
|
||||
var text = "";
|
||||
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
|
||||
for( var i=0; i < len; i++ )
|
||||
text += possible.charAt(Math.floor(Math.random() * possible.length));
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
function OauthImplementation() {
|
||||
|
@ -35,40 +59,46 @@ OauthImplementation.prototype.requestProfileURL = function (entity) {
|
|||
getURL(entity, "HEAD", function(resp) {
|
||||
var headers = resp.getAllResponseHeaders();
|
||||
var regex = /Link: <([^>]*)>; rel="https:\/\/tent.io\/rels\/profile"/;
|
||||
var matches = headers.match(regex)
|
||||
alert(matches[1]);
|
||||
those.register(matches[1]);
|
||||
var profile_url = headers.match(regex)[1]
|
||||
if (profile_url == "/profile") {
|
||||
profile_url = entity + "/profile";
|
||||
}
|
||||
alert(profile_url);
|
||||
those.register(profile_url);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
OauthImplementation.prototype.register = function (url) {
|
||||
|
||||
var app_info = {
|
||||
"name": "Tentia",
|
||||
"description": "A small TentStatus client.",
|
||||
"url": "http://jabs.nu/Tentia/",
|
||||
"icon": "http://jabs.nu/Tentia/icon.png",
|
||||
"redirect_uris": [
|
||||
"tentia://oauth_token"
|
||||
],
|
||||
"scopes": {
|
||||
"read_posts": "Uses posts to show them in a list",
|
||||
"write_posts": "Posts on users behalf"
|
||||
}
|
||||
};
|
||||
|
||||
var those = this;
|
||||
getURL(url, "GET", function(resp) {
|
||||
var profile = JSON.parse(resp.responseText);
|
||||
var server = profile["https://tent.io/types/info/core/v0.1.0"]["servers"][0];
|
||||
var callback = function(resp) {
|
||||
alert(JSON.parse(resp.responseText));
|
||||
var data = JSON.parse(resp.responseText);
|
||||
those.authRequest(server, data);
|
||||
}
|
||||
alert(server + "/apps")
|
||||
getURL(server + "/apps", "POST", callback, JSON.stringify(app_info));
|
||||
});
|
||||
}
|
||||
|
||||
OauthImplementation.prototype.authRequest = function(server, register_data) {
|
||||
// id
|
||||
// mac_key_id
|
||||
// mac_key
|
||||
// mac_algorithm
|
||||
var state = makeid(19);
|
||||
var auth = "/oauth/authorize?client_id=" + register_data["id"]
|
||||
+ "&redirect_uri=" + escape(app_info["redirect_uris"][0])
|
||||
+ "&scope=" + Object.keys(app_info["scopes"]).join(",")
|
||||
+ "&state=" + state
|
||||
+ "&tent_post_types=" + escape("https://tent.io/types/posts/status/v0.1.0");
|
||||
|
||||
alert(server + auth)
|
||||
controller.openURL_(server + auth);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -113,7 +143,11 @@ OauthImplementation.prototype.requestTokenTicketFinished = function(data) {
|
|||
|
||||
OauthImplementation.prototype.requestAccessToken = function(responseBody) {
|
||||
// "twittia://oauth_token?oauth_token=jCcf7ClzJMbE4coZdONi467OAQxRGOBZJsuopG8C8&oauth_verifier=BK2ZkAIz51lqI4qta8MnKc280GyDLy0OQBpdsEmjT40"
|
||||
|
||||
alert("XXX");
|
||||
alert(responseBody);
|
||||
|
||||
|
||||
/*
|
||||
var urlVars = getUrlVars(responseBody);
|
||||
|
||||
var url = OAUTH_ACCESS_TOKEN_URL;
|
||||
|
@ -144,7 +178,7 @@ OauthImplementation.prototype.requestAccessToken = function(responseBody) {
|
|||
alert(ajaxOptions);
|
||||
alert(thrownError);
|
||||
}
|
||||
});
|
||||
});*/
|
||||
}
|
||||
|
||||
OauthImplementation.prototype.requestAccessTokenTicketFinished = function(responseBody) {
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,27 +1,28 @@
|
|||
ffffffffffffffffffffffffffffffff 3ddc90c7adbe232b25db27bf9ae28615 ffffffffffffffffffffffffffffffff 102 /Users/jeena/Projects/Tentia/build/Debug/Tentia.app
|
||||
00000000000000000000000000000000 d3b0bab7e35e3d2ecbe610f54e5c88a5 ffffffffffffffffffffffffffffffff 264643 /Users/jeena/Projects/Tentia/build/Debug/Tentia.app/Contents/Resources/Icon.icns
|
||||
0000000050783ba000000000000000cc 6b23c46f80bbe095d628a0dd8c50b78c ffffffffffffffffffffffffffffffff 204 /Users/jeena/Projects/Tentia/build/Debug/Tentia.app/Contents/Frameworks/Sparkle.framework
|
||||
ffffffffffffffffffffffffffffffff 07d4ddde1c7b4b4fee20864dfe87606b ffffffffffffffffffffffffffffffff 125132 /Users/jeena/Projects/Tentia/build/Debug/Tentia.app/Contents/MacOS/Tentia
|
||||
ffffffffffffffffffffffffffffffff 7365c3e40e3a8c345e594a3358870afe ffffffffffffffffffffffffffffffff 47308 /Users/jeena/Projects/Tentia/build/Tentia.build/Debug/Twittia.build/Objects-normal/i386/Tentia
|
||||
ffffffffffffffffffffffffffffffff ed3b6292efc4dffe0e1fdcc298491563 ffffffffffffffffffffffffffffffff 71736 /Users/jeena/Projects/Tentia/build/Tentia.build/Debug/Twittia.build/Objects-normal/x86_64/Tentia
|
||||
42acb1866502724ee28245c2f99e565a 2577f0e7533580056a012b1d8c07e8e3 ffffffffffffffffffffffffffffffff 74372 /Users/jeena/Projects/Tentia/build/Tentia.build/Debug/Twittia.build/Objects-normal/x86_64/Controller.o
|
||||
d56a7f2949f5e77d95daeff9827e3c0c f52127d6e87cbff0cead9facce224e97 ffffffffffffffffffffffffffffffff 60296 /Users/jeena/Projects/Tentia/build/Tentia.build/Debug/Twittia.build/Objects-normal/i386/Controller.o
|
||||
00000000000000000000000000000000 c7a2ed34f1b3c3c36f2238612a286b0e ffffffffffffffffffffffffffffffff 7294 /Users/jeena/Projects/Tentia/build/Debug/Tentia.app/Contents/Resources/OauthImplementation.js
|
||||
0000000050783ba000000000000000cc 6b23c46f80bbe095d628a0dd8c50b78c ffffffffffffffffffffffffffffffff 204 /Users/jeena/Projects/Tentia/build/Debug/Tentia.app/Contents/Frameworks/Sparkle.framework
|
||||
ffffffffffffffffffffffffffffffff 6711c5d466273f5a792af8d9e1a5319f ffffffffffffffffffffffffffffffff 6456 /Users/jeena/Projects/Tentia/build/Tentia.build/Debug/Twittia.build/Objects-normal/i386/TweetModel.o
|
||||
ffffffffffffffffffffffffffffffff d72ca303542648087e1ad07182f9d39f ffffffffffffffffffffffffffffffff 9580 /Users/jeena/Projects/Tentia/build/Tentia.build/Debug/Twittia.build/Objects-normal/i386/Constants.o
|
||||
ffffffffffffffffffffffffffffffff 1ef511a44e75dd4e304fe7498e57eaad ffffffffffffffffffffffffffffffff 24136 /Users/jeena/Projects/Tentia/build/Tentia.build/Debug/Twittia.build/Objects-normal/i386/ViewDelegate.o
|
||||
ffffffffffffffffffffffffffffffff f52127d6e87cbff0cead9facce224e97 ffffffffffffffffffffffffffffffff 60296 /Users/jeena/Projects/Tentia/build/Tentia.build/Debug/Twittia.build/Objects-normal/i386/Controller.o
|
||||
ffffffffffffffffffffffffffffffff a6d1a98896876b2874da800beec1af5f ffffffffffffffffffffffffffffffff 2520 /Users/jeena/Projects/Tentia/build/Tentia.build/Debug/Twittia.build/Objects-normal/i386/main.o
|
||||
ffffffffffffffffffffffffffffffff 6bcdf375b7d539d37a5749532ffc84b5 ffffffffffffffffffffffffffffffff 29928 /Users/jeena/Projects/Tentia/build/Tentia.build/Debug/Twittia.build/Objects-normal/i386/NewMessageWindow.o
|
||||
ffffffffffffffffffffffffffffffff a97a8adeefed1ba8a895f7136e93dbf0 ffffffffffffffffffffffffffffffff 10692 /Users/jeena/Projects/Tentia/build/Tentia.build/Debug/Twittia.build/Objects-normal/i386/AccessToken.o
|
||||
00000000006c1f9f000000000000016a d56a7f2949f5fca495daeff9827e3b33 ffffffffffffffffffffffffffffffff 13965516 /var/folders/zl/vphyb36166vg0vnzmz23_y740000gn/C/com.apple.Xcode.501/SharedPrecompiledHeaders/Tentia_Prefix-blwgpqgklakogehapwplzglymvsa/Tentia_Prefix.pch.pth
|
||||
ffffffffffffffffffffffffffffffff ed3b6292efc4dffe0e1fdcc298491563 ffffffffffffffffffffffffffffffff 71736 /Users/jeena/Projects/Tentia/build/Tentia.build/Debug/Twittia.build/Objects-normal/x86_64/Tentia
|
||||
ffffffffffffffffffffffffffffffff 244b8c9ee82cc5939662218150f75171 ffffffffffffffffffffffffffffffff 8624 /Users/jeena/Projects/Tentia/build/Tentia.build/Debug/Twittia.build/Objects-normal/x86_64/TweetModel.o
|
||||
ffffffffffffffffffffffffffffffff e1dd691322b6c644d65505d9fd9e9344 ffffffffffffffffffffffffffffffff 11084 /Users/jeena/Projects/Tentia/build/Tentia.build/Debug/Twittia.build/Objects-normal/x86_64/Constants.o
|
||||
ffffffffffffffffffffffffffffffff 2a0eeea2e8601206c56722921666610f ffffffffffffffffffffffffffffffff 28012 /Users/jeena/Projects/Tentia/build/Tentia.build/Debug/Twittia.build/Objects-normal/x86_64/ViewDelegate.o
|
||||
ffffffffffffffffffffffffffffffff 2577f0e7533580056a012b1d8c07e8e3 ffffffffffffffffffffffffffffffff 74372 /Users/jeena/Projects/Tentia/build/Tentia.build/Debug/Twittia.build/Objects-normal/x86_64/Controller.o
|
||||
ffffffffffffffffffffffffffffffff 34c5f6253fd3652602ac9f689caff418 ffffffffffffffffffffffffffffffff 2672 /Users/jeena/Projects/Tentia/build/Tentia.build/Debug/Twittia.build/Objects-normal/x86_64/main.o
|
||||
ffffffffffffffffffffffffffffffff 1c94908045430b21b3bd64e63fe2ae06 ffffffffffffffffffffffffffffffff 35572 /Users/jeena/Projects/Tentia/build/Tentia.build/Debug/Twittia.build/Objects-normal/x86_64/NewMessageWindow.o
|
||||
ffffffffffffffffffffffffffffffff 0b19471e78e79db38cf65ac8ea0898ec ffffffffffffffffffffffffffffffff 13872 /Users/jeena/Projects/Tentia/build/Tentia.build/Debug/Twittia.build/Objects-normal/x86_64/AccessToken.o
|
||||
00000000006c1f9f000000000000016a 42acb18665026997e28245c2f99e5165 ffffffffffffffffffffffffffffffff 13379576 /var/folders/zl/vphyb36166vg0vnzmz23_y740000gn/C/com.apple.Xcode.501/SharedPrecompiledHeaders/Tentia_Prefix-ebfofqgutfagnlccnfecejfszpvw/Tentia_Prefix.pch.pth
|
||||
00000000000000000000000000000000 8aee465c6d1319e6da0148fd63b765fd ffffffffffffffffffffffffffffffff 726 /Users/jeena/Projects/Tentia/build/Debug/Tentia.app/Contents/Resources/index_oauth.html
|
||||
00000000000000000000000000000000 cc90fbe023b6ad3b1d31bdcece689545 ffffffffffffffffffffffffffffffff 630 /Users/jeena/Projects/Tentia/build/Debug/Tentia.app/Contents/Resources/pin.png
|
||||
00000000000000000000000000000000 d3b0bab7e35e3d2ecbe610f54e5c88a5 ffffffffffffffffffffffffffffffff 121861 /Users/jeena/Projects/Tentia/build/Debug/Tentia.app/Contents/Resources/Icon.icns
|
||||
00000000000000000000000000000000 461f981fcc74c67c6a4c4118e66a23ce ffffffffffffffffffffffffffffffff 11868 /Users/jeena/Projects/Tentia/build/Debug/Tentia.app/Contents/Resources/sprite-icons.png
|
||||
00000000000000000000000000000000 a0807f75cabb63b870a3a7b7ea3b4eea ffffffffffffffffffffffffffffffff 3002 /Users/jeena/Projects/Tentia/build/Debug/Tentia.app/Contents/Resources/default.css
|
||||
00000000000000000000000000000000 54f84f996cfd6998112e0864b3a219a5 ffffffffffffffffffffffffffffffff 72174 /Users/jeena/Projects/Tentia/build/Debug/Tentia.app/Contents/Resources/jQuery.js
|
||||
|
@ -37,7 +38,6 @@ ffffffffffffffffffffffffffffffff 0b19471e78e79db38cf65ac8ea0898ec ffffffffffffff
|
|||
00000000000000000000000000000000 ea6df34316ae4b4a2b0a04e0ea2b7541 ffffffffffffffffffffffffffffffff 5550 /Users/jeena/Projects/Tentia/build/Debug/Tentia.app/Contents/Resources/sha1.js
|
||||
00000000000000000000000000000000 c5fc2a371798c0a6995845e5185b1605 ffffffffffffffffffffffffffffffff 20756 /Users/jeena/Projects/Tentia/build/Debug/Tentia.app/Contents/Resources/oauth.js
|
||||
00000000000000000000000000000000 f046752ea2d26acc574f55553b495770 ffffffffffffffffffffffffffffffff 1178 /Users/jeena/Projects/Tentia/build/Debug/Tentia.app/Contents/Resources/dsa_pub.pem
|
||||
00000000000000000000000000000000 c7a2ed34f1b3c3c36f2238612a286b0e ffffffffffffffffffffffffffffffff 6253 /Users/jeena/Projects/Tentia/build/Debug/Tentia.app/Contents/Resources/OauthImplementation.js
|
||||
00000000000000000000000000000000 5574e00c2add45a7d40448dc5ebe5186 ffffffffffffffffffffffffffffffff 607 /Users/jeena/Projects/Tentia/build/Debug/Tentia.app/Contents/Resources/Constants.js
|
||||
00000000000000000000000000000000 c674cff473d4e9e23616ac3a869f2f2d ffffffffffffffffffffffffffffffff 8 /Users/jeena/Projects/Tentia/build/Debug/Tentia.app/Contents/PkgInfo
|
||||
00000000000000000000000000000000 c674cff473d4e9e23616ac3a869f2f2d ffffffffffffffffffffffffffffffff 2494 /Users/jeena/Projects/Tentia/build/Debug/Tentia.app/Contents/Info.plist
|
||||
|
|
File diff suppressed because one or more lines are too long
Reference in a new issue