2013-08-20 09:43:18 +08:00
|
|
|
config = require("../config")
|
|
|
|
|
2014-04-24 04:18:25 +08:00
|
|
|
moduleDeps = ["App"]
|
2013-09-16 07:10:19 +08:00
|
|
|
|
2013-08-20 10:51:26 +08:00
|
|
|
# The main router that registers the routes that can be accessed by the client.
|
2013-08-20 09:43:18 +08:00
|
|
|
module.exports = class MainRouter
|
2013-09-16 07:10:19 +08:00
|
|
|
|
|
|
|
constructor: () ->
|
|
|
|
config.modules.wait moduleDeps, =>
|
|
|
|
@app = config.modules.get("App")
|
|
|
|
@_registerRoutes()
|
2013-08-20 09:43:18 +08:00
|
|
|
|
|
|
|
_registerRoutes: () ->
|
|
|
|
@app.get "/", @_index
|
|
|
|
|
2014-05-15 04:54:43 +08:00
|
|
|
@app.get "/html5.client", @_landingPageHandler
|
|
|
|
|
2014-05-15 03:28:45 +08:00
|
|
|
|
2014-04-25 05:33:59 +08:00
|
|
|
# Base route to render the HTML5 client.
|
2013-10-29 01:23:15 +08:00
|
|
|
#
|
|
|
|
# This method is registered as a route on express.
|
|
|
|
#
|
|
|
|
# @internal
|
2013-09-16 07:10:19 +08:00
|
|
|
_index: (req, res) =>
|
2014-04-24 04:18:25 +08:00
|
|
|
res.render "index",
|
|
|
|
title: config.appName
|
2014-05-15 04:54:43 +08:00
|
|
|
|
|
|
|
# A route to enter the HTML5 client from a landing page
|
|
|
|
#
|
|
|
|
# @internal
|
|
|
|
_landingPageHandler: (req, res) ->
|
|
|
|
meetingId = req.query.meeting_id
|
|
|
|
userId = req.query.user_id
|
|
|
|
authToken = req.query.auth_token
|
|
|
|
|
|
|
|
console.log "\n\nLANDING PAGE PROVIDED:\n" +
|
2014-05-21 02:54:20 +08:00
|
|
|
"meeting_id= #{meetingId}\n" +
|
|
|
|
"user_id= #{userId}\n" +
|
|
|
|
"auth_token= #{authToken}\n\n"
|
2014-05-15 04:54:43 +08:00
|
|
|
|
2014-05-15 23:54:39 +08:00
|
|
|
#go straight into the session view
|
|
|
|
res.render "index",
|
2014-05-16 02:43:17 +08:00
|
|
|
title: config.appName
|