Permalink
Browse files

added oexchange support

  • Loading branch information...
1 parent c6d9583 commit ea10d58965343cab50820e8b536b7a016f790798 @bashofmann committed Feb 22, 2012
Showing with 40 additions and 2 deletions.
  1. +1 −0 .gitignore
  2. +14 −2 backend/node_server.js
  3. +10 −0 js/client.js
  4. +15 −0 js/templates/feed.ms
View
@@ -0,0 +1 @@
+.idea
View
@@ -4,6 +4,7 @@ var sys = require('sys'),
qs = require('querystring'),
io = require('socket.io'),
http = require('http'),
+ oexchange = require('oexchange'),
server,
ioServer,
ioSendFunction;
@@ -36,8 +37,19 @@ server = http.createServer(function (req, res) {
sys.puts(params['hub.mode']);
sys.puts('got challenge' + params['hub.challenge']);
res.write(params['hub.challenge']);
- }
- res.end();
+ res.end();
+ } else if (typeof(params['share.hostname']) != "undefined" && typeof(params['url']) != "undefined") {
+ oexchange.getSharingUrl(params['share.hostname'], params, function(result) {
+ console.log(result);
+ if (result) {
+ res.write(result);
+ }
+ res.end();
+ });
+ } else {
+ res.end();
+ }
+
}
});
View
@@ -19,6 +19,16 @@ var app = Sammy('#main', function() {
}
});
});
+ this.post('/statusnet_js_mashup_2nd/Share', function() {
+ var that = this;
+ $.ajax({
+ url: 'http://localhost:8000?share.hostname=' + encodeURIComponent(this.params['hostname']) + '&url=' + encodeURIComponent(window.location),
+ success: function(response) {
+ window.open(response);
+ that.redirect('/statusnet_js_mashup_2nd');
+ }
+ });
+ });
this.get('/statusnet_js_mashup_2nd/Login', function() {
if (oauth2.authParameters && oauth2.authParameters['access_token']) {
this.redirect('/statusnet_js_mashup_2nd');
View
@@ -13,6 +13,21 @@
</fieldset>
</form>
+<form class="form-horizontal" method="post" action="/statusnet_js_mashup_2nd/Share">
+ <legend>Share this mashup</legend>
+ <fieldset>
+ <div class="control-group">
+ <label class="control-label" for="input_status">Target hostname</label>
+ <div class="controls">
+ <input type="text" class="input-xlarge" name="hostname"/>
+ </div>
+ </div>
+ <div class="form-actions">
+ <button type="submit" class="btn btn-primary">share</button>
+ </div>
+ </fieldset>
+</form>
+
<legend>Feed</legend>
{{#feed}}

0 comments on commit ea10d58

Please sign in to comment.