Skip to content

Commit 3d58602

Browse files
authored
[ECO-5813] Switch microphone is broken in room view (#692)
* Initial * Update serverMethods.js * Remove unused endpoint * Remove landingcontroller and view * Update room.ejs * Linting * Update CUSTOMIZING-UI.md * Update Gruntfile.js
1 parent d6bb200 commit 3d58602

12 files changed

+45
-477
lines changed

CUSTOMIZING-UI.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,5 @@ These can be configured with these settings:
3838

3939
## Changing landing page HTML
4040

41-
Edit the view file [`views/index.ejs`](views/index.ejs) and change the images and text in the `<body>` section. You can also change the text in the `<title>` tag.
41+
Edit the view file [`views/room.ejs`](views/room.ejs) and change the images and text in the `<body>` section. You can also change the text in the `<title>` tag.
4242

Gruntfile.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ module.exports = function (grunt) {
163163
},
164164
minify: true,
165165
},
166-
src: 'views/index.ejs',
166+
src: 'views/room.ejs',
167167
dest: 'web/css/landing-critical.opentok.css',
168168
},
169169
},

api.yml

-28
Original file line numberDiff line numberDiff line change
@@ -85,34 +85,6 @@ paths:
8585
description: Unknown template
8686
schema:
8787
$ref: '#/definitions/ErrorInfo'
88-
post:
89-
summary: Connects to a new room when routed from the root page.
90-
x-implemented-in: postRoom
91-
consumes:
92-
- application/json
93-
produces:
94-
- 'text/html,'
95-
description: >-
96-
Returns an HTML document that shows the defined UI for a chat 'room'
97-
where the user may or may not have specified an identity. The document
98-
returned will NOT have any of the information needed to connect to the
99-
Tokbox servers already factored in.
100-
parameters:
101-
- name: roomName
102-
description: Name of the room.
103-
in: path
104-
type: string
105-
required: true
106-
- name: userName
107-
description: Name/Id of the user that is connecting.
108-
in: formData
109-
type: string
110-
required: true
111-
responses:
112-
'200':
113-
description: The HTML for the room
114-
schema:
115-
$ref: '#/definitions/RoomHTML'
11688
/updateArchiveInfo:
11789
post:
11890
summary: Callback for the OpenTok Archive API.

karma.conf.js

-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ module.exports = function (config) {
2222
'web/js/libs/**/*.js',
2323
'node_modules/swagger-boilerplate/lib/shared/**/*.js',
2424
'web/js/components/modal.js',
25-
'web/js/landingView.js', // Don't load the views yet
26-
'web/js/landingController.js',
2725
'web/js/roomView.js',
2826
'web/js/roomController.js', // TO-DO...
2927
'web/js/helpers/textProcessor.js',

server/serverMethods.js

+7-78
Original file line numberDiff line numberDiff line change
@@ -401,63 +401,12 @@ function ServerMethods(aLogLevel, aModules) {
401401
aRes.send({});
402402
}
403403

404-
// Returns the personalized root page
405404
async function getRoot(aReq, aRes) {
406-
const meetingAllowed = await isMeetingAllowed(aReq);
407-
const language = getUserLanguage(accepts(aReq).languages());
408-
const country = getUserCountry(aReq);
409-
410-
let roomName = '';
411-
412405
if (aReq.tbConfig.autoGenerateRoomName) {
413-
roomName = `${haikunator.haikunate({ tokenLength: 0 })}-${haikunator.haikunate()}`;
406+
const roomName = `${haikunator.haikunate({ tokenLength: 0 })}-${haikunator.haikunate()}`;
407+
return aRes.redirect(`/room/${roomName}`);
414408
}
415-
416-
// Create a session ID and token for the network test
417-
aReq.tbConfig.precallOtInstance.createSession({ mediaMode: 'routed' }, (error, testSession) => {
418-
aRes
419-
.render('index.ejs', {
420-
roomName,
421-
autoGenerateRoomName: aReq.tbConfig.autoGenerateRoomName,
422-
isWebRTCVersion: aReq.tbConfig.isWebRTCVersion,
423-
minMeetingNameLength: aReq.tbConfig.minMeetingNameLength,
424-
publisherResolution: aReq.tbConfig.publisherResolution,
425-
precallSessionId: testSession.sessionId,
426-
precallApiKey: aReq.tbConfig.precallApiKey,
427-
precallToken: aReq.tbConfig.precallOtInstance.generateToken(testSession.sessionId, {
428-
role: 'publisher',
429-
}),
430-
showTos: aReq.tbConfig.showTos,
431-
showUnavailable: !meetingAllowed,
432-
useGoogleFonts: aReq.tbConfig.useGoogleFonts,
433-
adobeTrackingUrl: aReq.tbConfig.adobeTrackingUrl,
434-
ATPrimaryCategory: aReq.tbConfig.ATPrimaryCategory,
435-
ATSiteIdentifier: aReq.tbConfig.ATSiteIdentifier,
436-
ATFunctionDept: aReq.tbConfig.ATFunctionDept,
437-
maxUsersPerRoom: aReq.tbConfig.maxUsersPerRoom,
438-
userLanguage: language,
439-
userCountry: country,
440-
hotjarId: aReq.tbConfig.hotjarId,
441-
hotjarVersion: aReq.tbConfig.hotjarVersion,
442-
enableFeedback: aReq.tbConfig.enableFeedback,
443-
opentokJsUrl: aReq.tbConfig.opentokJsUrl,
444-
enablePrecallTest: aReq.tbConfig.enablePrecallTest,
445-
enterButtonLabel: 'Start Meeting',
446-
introText: aReq.tbConfig.introText,
447-
appName: aReq.tbConfig.appName,
448-
helpLinkText1: aReq.tbConfig.helpLinkText1,
449-
helpLinkUrl1: aReq.tbConfig.helpLinkUrl1,
450-
helpLinkText2: aReq.tbConfig.helpLinkText2,
451-
helpLinkUrl2: aReq.tbConfig.helpLinkUrl2,
452-
}, (err, html) => {
453-
if (err) {
454-
logger.error('getRoot. error: ', err);
455-
aRes.status(500).send(new ErrorInfo(500, 'Invalid Template'));
456-
} else {
457-
aRes.send(html);
458-
}
459-
});
460-
});
409+
getRoom(aReq, aRes);
461410
}
462411

463412
function isInBlacklist(name) {
@@ -466,11 +415,11 @@ function ServerMethods(aLogLevel, aModules) {
466415

467416
// Finish the call to getRoom and postRoom
468417
// eslint-disable-next-line consistent-return
469-
async function finshGetPostRoom(aReq, aRes, routedFromStartMeeting) {
418+
async function getRoom(aReq, aRes) {
470419
const meetingAllowed = await isMeetingAllowed(aReq);
471420
const { query } = aReq;
472421

473-
if (isInBlacklist(aReq.params.roomName)) {
422+
if (aReq.params.roomName && isInBlacklist(aReq.params.roomName)) {
474423
logger.log('getRoom. error:', `Blacklist found '${aReq.params.roomName}'`);
475424
return aRes.status(404).send(null);
476425
}
@@ -491,12 +440,13 @@ function ServerMethods(aLogLevel, aModules) {
491440
aRes.set('Cache-Control', 'no-cache, no-store, must-revalidate');
492441
aRes.set('Pragma', 'no-cache');
493442
aRes.set('Expires', 0);
443+
494444
aRes
495445
.render(`${template || tbConfig.defaultTemplate}.ejs`,
496446
{
497447
autoGenerateRoomName: tbConfig.autoGenerateRoomName,
498448
userName: htmlEscape(userName || C.DEFAULT_USER_NAME),
499-
roomName: htmlEscape(aReq.params.roomName),
449+
roomName: htmlEscape(aReq.params.roomName || ''),
500450
publishVideo,
501451
publishAudio,
502452
chromeExtensionId: tbConfig.chromeExtId,
@@ -541,7 +491,6 @@ function ServerMethods(aLogLevel, aModules) {
541491
hotjarVersion: tbConfig.hotjarVersion,
542492
enableFeedback: tbConfig.enableFeedback,
543493
enterButtonLabel: 'Join Meeting',
544-
routedFromStartMeeting: Boolean(routedFromStartMeeting),
545494
introText: tbConfig.introText,
546495
appName: tbConfig.appName,
547496
helpLinkText1: tbConfig.helpLinkText1,
@@ -561,25 +510,6 @@ function ServerMethods(aLogLevel, aModules) {
561510
});
562511
}
563512

564-
// Finish the call to getRoom and postRoom
565-
// eslint-disable-next-line no-unused-vars
566-
function getRoom(aReq, aRes, routedFromStartMeeting) {
567-
const { query } = aReq;
568-
569-
logger.log(`getRoom serving ${aReq.path}`, 'roomName:', aReq.params.roomName,
570-
'userName:', query && query.userName,
571-
'template:', query && query.template);
572-
573-
finshGetPostRoom(aReq, aRes, false);
574-
}
575-
576-
// Return the personalized HTML for a room when directed from the root.
577-
function postRoom(aReq, aRes) {
578-
logger.log(`postRoom serving ${aReq.path}`, 'roomName:', aReq.params.roomName,
579-
'body:', aReq.body);
580-
finshGetPostRoom(aReq, aRes, true);
581-
}
582-
583513
// Given a sessionInfo (which might be empty or non usable) returns a promise than will fullfill
584514
// to an usable sessionInfo. This function cannot be invoked directly, it has
585515
// to be bound so 'this' is a valid Opentok instance!
@@ -1074,7 +1004,6 @@ function ServerMethods(aLogLevel, aModules) {
10741004
lockRoom,
10751005
getRoot,
10761006
getRoom,
1077-
postRoom,
10781007
getRoomInfo,
10791008
postRoomArchive,
10801009
postUpdateArchiveInfo,

views/index.ejs

-187
This file was deleted.

0 commit comments

Comments
 (0)