From 872762b6a972f2391ceabd03fd3bc2d993116adc Mon Sep 17 00:00:00 2001 From: Miroslav Pejic Date: Thu, 17 Feb 2022 08:43:45 +0100 Subject: [PATCH] [mirotalksfu] - improve joinRoom --- app/src/Server.js | 10 +++------- public/view/landing.html | 8 ++++++-- public/view/newroom.html | 8 ++++++-- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/app/src/Server.js b/app/src/Server.js index 4a6f6c99..09407206 100644 --- a/app/src/Server.js +++ b/app/src/Server.js @@ -71,7 +71,9 @@ const view = { app.use(cors()); app.use(compression()); +app.use(express.json()); app.use(express.static(dir.public)); +app.use(apiBasePath + '/docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument)); // api docs // Remove trailing slashes in url handle bad requests app.use((err, req, res, next) => { @@ -153,7 +155,7 @@ app.get('/join/', (req, res) => { app.get('/join/*', (req, res) => { if (hostCfg.authenticated) { if (Object.keys(req.query).length > 0) { - log.debug('redirect:' + req.url + ' to ' + url.parse(req.url).pathname); + log.debug('Redirect:' + req.url + ' to ' + url.parse(req.url).pathname); res.redirect(url.parse(req.url).pathname); } else { res.sendFile(view.room); @@ -177,12 +179,6 @@ app.get(['/privacy'], (req, res) => { // API // #################################################### -// Api parse body data as json -app.use(express.json()); - -// api docs -app.use(apiBasePath + '/docs', swaggerUi.serve, swaggerUi.setup(swaggerDocument)); - // request meeting room endpoint app.post(['/api/v1/meeting'], (req, res) => { // check if user was authorized for the api call diff --git a/public/view/landing.html b/public/view/landing.html index f27c672c..8f5148d1 100644 --- a/public/view/landing.html +++ b/public/view/landing.html @@ -119,7 +119,7 @@ @@ -127,9 +127,13 @@ document.getElementById('roomName').onkeyup = (e) => { if (e.keyCode === 13) { e.preventDefault(); - document.getElementById('joinRoomButton').click(); + joinRoom(); } }; + function joinRoom() { + let roomName = document.getElementById('roomName').value; + window.location.href = '/join/' + roomName; + } diff --git a/public/view/newroom.html b/public/view/newroom.html index aa463893..d4deef01 100755 --- a/public/view/newroom.html +++ b/public/view/newroom.html @@ -122,7 +122,7 @@ @@ -130,9 +130,13 @@ document.getElementById('roomName').onkeyup = (e) => { if (e.keyCode === 13) { e.preventDefault(); - document.getElementById('joinRoomButton').click(); + joinRoom(); } }; + function joinRoom() { + let roomName = document.getElementById('roomName').value; + window.location.href = '/join/' + roomName; + }