comparison index.js_to_pump.io-client-app_lib_routes @ 30:3e3fa35e3ce2

twitter sync likes, recommend mongodb configure pump2twitter, twitter2pump in webui
author Mathias Gebbe <mgebbe@intevation.de>
date Thu, 28 Aug 2014 18:40:39 +0200
parents faeb3b96bdeb
children
comparison
equal deleted inserted replaced
29:34cfa565f565 30:3e3fa35e3ce2
21 _ = require("underscore"), 21 _ = require("underscore"),
22 uuid = require("node-uuid"), 22 uuid = require("node-uuid"),
23 User = require("../models/user"), 23 User = require("../models/user"),
24 Host = require("../models/host"), 24 Host = require("../models/host"),
25 Usermap = require("../../../../lib/usermap"), 25 Usermap = require("../../../../lib/usermap"),
26 //Usermap = require("../../../../src/usermap"),
26 RequestToken = require("../models/requesttoken"), 27 RequestToken = require("../models/requesttoken"),
27 RememberMe = require("../models/rememberme"), 28 RememberMe = require("../models/rememberme"),
28 site = require("../models/site"); 29 site = require("../models/site");
29 30
30 exports.hostmeta = function(req, res) { 31 exports.hostmeta = function(req, res) {
40 41
41 exports.index = function(req, res, next) { 42 exports.index = function(req, res, next) {
42 var hosts, users, bank = Host.bank(); 43 var hosts, users, bank = Host.bank();
43 44
44 if (req.user) { 45 if (req.user) {
45 var fb=false, gp=false, tw=false; 46 var fb=false, gp=false, tw=false, twfromesn=true, twtoesn=true;
46 Usermap.search({ 47 Usermap.search({
47 user_pumpio: req.user.id 48 user_pumpio: req.user.id
48 }, function(err, result) { 49 }, function(err, result) {
49 if(err) res.render('login', { pageTitle: "pumpbridge" }); 50 if(err) res.render('login', { pageTitle: "pumpbridge" });
50 _.each(result, function(um) { 51 _.each(result, function(um) {
51 if ( um.id.indexOf('@facebook') != -1 ) fb=true; 52 if ( um.id.indexOf('@facebook') != -1 ) fb=true;
52 if ( um.id.indexOf('@twitter') != -1 ) tw=true; 53 if ( um.id.indexOf('@twitter') != -1 ) {
54 tw=true;
55 if(typeof um.fromesn != "undefined") twfromesn = um.fromesn;
56 if(typeof um.toesn != "undefined") twtoesn = um.toesn;
57 }
53 if ( um.id.indexOf('@google') != -1 ) gp=true; 58 if ( um.id.indexOf('@google') != -1 ) gp=true;
54 }); 59 });
55 res.render('index', { pageTitle: "pumpbridge" , user: req.user, usermapfb: fb, usermapgp: gp, usermaptw: tw}); 60 res.render('index', { pageTitle: "pumpbridge" , user: req.user, usermapfb: fb, usermapgp: gp, usermaptw: tw, twfromesn: twfromesn, twtoesn: twtoesn});
56 }); 61 });
57 } else { 62 } else {
58 res.render('login', { pageTitle: "pumpbridge" }); 63 res.render('login', { pageTitle: "pumpbridge" });
59 } 64 }
60 }; 65 };
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)