2014-07-28 23:00:07 +08:00
|
|
|
@Router.configure layoutTemplate: 'layout'
|
2014-06-19 04:11:29 +08:00
|
|
|
|
2014-07-28 23:00:07 +08:00
|
|
|
@Router.map ->
|
2014-06-19 04:11:29 +08:00
|
|
|
@route "login",
|
2014-11-13 21:46:39 +08:00
|
|
|
path: "/login"
|
|
|
|
action: ->
|
2014-11-13 22:29:27 +08:00
|
|
|
meetingId = @params.query.meeting_id
|
|
|
|
userId = @params.query.user_id
|
|
|
|
authToken = @params.query.auth_token
|
|
|
|
|
|
|
|
if meetingId? and userId? and authToken?
|
|
|
|
Meteor.call("validateAuthToken", meetingId, userId, authToken)
|
2014-12-11 03:30:14 +08:00
|
|
|
|
|
|
|
applyNewSessionVars = ->
|
|
|
|
setInSession("authToken", authToken)
|
|
|
|
setInSession("meetingId", meetingId)
|
|
|
|
setInSession("userId", userId)
|
2014-12-12 01:23:19 +08:00
|
|
|
Router.go('/')
|
2014-12-11 03:30:14 +08:00
|
|
|
|
2014-12-11 03:31:03 +08:00
|
|
|
clearSessionVar(applyNewSessionVars)
|
2014-11-13 22:29:27 +08:00
|
|
|
|
2014-06-19 04:11:29 +08:00
|
|
|
@route "main",
|
|
|
|
path: "/"
|
2014-11-11 20:18:07 +08:00
|
|
|
onBeforeAction: ->
|
2014-11-22 01:07:16 +08:00
|
|
|
console.log "in main. onBeforeAction"
|
|
|
|
authToken = getInSession 'authToken'
|
|
|
|
meetingId = getInSession 'meetingId'
|
|
|
|
userId = getInSession 'userId'
|
2014-11-22 01:52:14 +08:00
|
|
|
console.log "currently #{authToken} #{meetingId} #{userId}"
|
2014-11-22 01:07:16 +08:00
|
|
|
Meteor.subscribe 'chat', meetingId, userId, authToken, ->
|
2014-11-12 21:15:13 +08:00
|
|
|
Meteor.subscribe 'shapes', meetingId, ->
|
|
|
|
Meteor.subscribe 'slides', meetingId, ->
|
|
|
|
Meteor.subscribe 'meetings', meetingId, ->
|
|
|
|
Meteor.subscribe 'presentations', meetingId, ->
|
2014-11-22 01:07:16 +08:00
|
|
|
Meteor.subscribe 'users', meetingId, userId, authToken, ->
|
|
|
|
console.log "done subscribing"
|
2014-12-11 04:09:17 +08:00
|
|
|
onLoadComplete()
|
2014-11-22 01:07:16 +08:00
|
|
|
@render('main')
|