@@ -401,63 +401,12 @@ function ServerMethods(aLogLevel, aModules) {
401
401
aRes . send ( { } ) ;
402
402
}
403
403
404
- // Returns the personalized root page
405
404
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
-
412
405
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 } ` ) ;
414
408
}
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 ) ;
461
410
}
462
411
463
412
function isInBlacklist ( name ) {
@@ -466,11 +415,11 @@ function ServerMethods(aLogLevel, aModules) {
466
415
467
416
// Finish the call to getRoom and postRoom
468
417
// eslint-disable-next-line consistent-return
469
- async function finshGetPostRoom ( aReq , aRes , routedFromStartMeeting ) {
418
+ async function getRoom ( aReq , aRes ) {
470
419
const meetingAllowed = await isMeetingAllowed ( aReq ) ;
471
420
const { query } = aReq ;
472
421
473
- if ( isInBlacklist ( aReq . params . roomName ) ) {
422
+ if ( aReq . params . roomName && isInBlacklist ( aReq . params . roomName ) ) {
474
423
logger . log ( 'getRoom. error:' , `Blacklist found '${ aReq . params . roomName } '` ) ;
475
424
return aRes . status ( 404 ) . send ( null ) ;
476
425
}
@@ -491,12 +440,13 @@ function ServerMethods(aLogLevel, aModules) {
491
440
aRes . set ( 'Cache-Control' , 'no-cache, no-store, must-revalidate' ) ;
492
441
aRes . set ( 'Pragma' , 'no-cache' ) ;
493
442
aRes . set ( 'Expires' , 0 ) ;
443
+
494
444
aRes
495
445
. render ( `${ template || tbConfig . defaultTemplate } .ejs` ,
496
446
{
497
447
autoGenerateRoomName : tbConfig . autoGenerateRoomName ,
498
448
userName : htmlEscape ( userName || C . DEFAULT_USER_NAME ) ,
499
- roomName : htmlEscape ( aReq . params . roomName ) ,
449
+ roomName : htmlEscape ( aReq . params . roomName || '' ) ,
500
450
publishVideo,
501
451
publishAudio,
502
452
chromeExtensionId : tbConfig . chromeExtId ,
@@ -541,7 +491,6 @@ function ServerMethods(aLogLevel, aModules) {
541
491
hotjarVersion : tbConfig . hotjarVersion ,
542
492
enableFeedback : tbConfig . enableFeedback ,
543
493
enterButtonLabel : 'Join Meeting' ,
544
- routedFromStartMeeting : Boolean ( routedFromStartMeeting ) ,
545
494
introText : tbConfig . introText ,
546
495
appName : tbConfig . appName ,
547
496
helpLinkText1 : tbConfig . helpLinkText1 ,
@@ -561,25 +510,6 @@ function ServerMethods(aLogLevel, aModules) {
561
510
} ) ;
562
511
}
563
512
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
-
583
513
// Given a sessionInfo (which might be empty or non usable) returns a promise than will fullfill
584
514
// to an usable sessionInfo. This function cannot be invoked directly, it has
585
515
// to be bound so 'this' is a valid Opentok instance!
@@ -1074,7 +1004,6 @@ function ServerMethods(aLogLevel, aModules) {
1074
1004
lockRoom,
1075
1005
getRoot,
1076
1006
getRoom,
1077
- postRoom,
1078
1007
getRoomInfo,
1079
1008
postRoomArchive,
1080
1009
postUpdateArchiveInfo,
0 commit comments