2014-06-27 02:09:39 +08:00
|
|
|
###
|
|
|
|
Meteor.startup(function () {
|
|
|
|
// Add seed data if first time server starting
|
|
|
|
CreateSeedData();
|
|
|
|
|
|
|
|
// Publish data collections
|
|
|
|
PublishCollections();
|
|
|
|
|
|
|
|
// Set collection permissions
|
|
|
|
SetCollectionPermissions();
|
|
|
|
|
|
|
|
});
|
|
|
|
###
|
2014-10-04 01:32:44 +08:00
|
|
|
Meteor.methods
|
2014-10-08 00:30:04 +08:00
|
|
|
# If we can change this to a format where we know what to send the user that'd
|
|
|
|
# be much, much better than the user passing in the first part of their
|
|
|
|
# credentials and us looking up and suplying them with the second part.
|
|
|
|
# It'd be much more secure.
|
2014-11-12 20:53:36 +08:00
|
|
|
getMyInfo: (uId) -> #TODO add meetingId
|
2014-10-04 01:32:44 +08:00
|
|
|
u = Meteor.Users.findOne("userId": uId)
|
|
|
|
if u?
|
2014-10-31 07:16:47 +08:00
|
|
|
console.log "__server::getMyInfo " + u.userId + " DBID:" + u._id + " name:" + u.user.name
|
2014-11-14 01:54:50 +08:00
|
|
|
return {userId: u.userId, DBID: u._id, name: u.user.name, userSecret: u.userSecret}
|
2014-11-11 21:38:39 +08:00
|
|
|
else
|
|
|
|
console.log "__server::getMyInfo - could not find user with uId=#{uId}"
|
2014-11-12 03:54:28 +08:00
|
|
|
return {error: "did not find that user"}
|
2014-10-31 07:16:47 +08:00
|
|
|
|
2014-06-27 02:09:39 +08:00
|
|
|
Meteor.startup ->
|
2014-10-25 02:02:01 +08:00
|
|
|
Meteor.log.info "server start"
|
|
|
|
|
2014-06-27 02:09:39 +08:00
|
|
|
#remove all data
|
2014-07-28 23:00:07 +08:00
|
|
|
clearCollections()
|
2014-07-26 00:36:31 +08:00
|
|
|
|
2014-06-27 02:09:39 +08:00
|
|
|
# create create a PubSub connection, start listening
|
|
|
|
Meteor.redisPubSub = new Meteor.RedisPubSub(->
|
2014-10-25 02:02:01 +08:00
|
|
|
Meteor.log.info "created pubsub")
|