Add input field to specify call name
This commit is contained in:
parent
5b431afbc2
commit
8ebd92c53d
18
package-lock.json
generated
18
package-lock.json
generated
@ -3282,9 +3282,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@types/body-parser": {
|
"@types/body-parser": {
|
||||||
"version": "1.17.1",
|
"version": "1.19.0",
|
||||||
"resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.17.1.tgz",
|
"resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.0.tgz",
|
||||||
"integrity": "sha512-RoX2EZjMiFMjZh9lmYrwgoP9RTpAjSHiJxdp4oidAQVO02T7HER3xj9UKue5534ULWeqVEkujhWcyvUce+d68w==",
|
"integrity": "sha512-W98JrE0j2K78swW4ukqMleo8R7h/pFETjM2DQ90MF6XK2i4LO4W3gQ71Lt4w3bfm2EvVSyWHplECvB5sK22yFQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/connect": "*",
|
"@types/connect": "*",
|
||||||
@ -3304,9 +3304,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/connect": {
|
"@types/connect": {
|
||||||
"version": "3.4.32",
|
"version": "3.4.33",
|
||||||
"resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.32.tgz",
|
"resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.33.tgz",
|
||||||
"integrity": "sha512-4r8qa0quOvh7lGD0pre62CAb1oni1OO6ecJLGCezTmhQ8Fz50Arx9RUszryR8KlgK6avuSXvviL6yWyViQABOg==",
|
"integrity": "sha512-2+FrkXY4zllzTNfJth7jOqEHC+enpLeGslEhpnTAkg21GkRrWV4SsAtqchtT4YS9/nODBU2/ZfsBY2X4J/dX7A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/node": "*"
|
"@types/node": "*"
|
||||||
@ -4877,7 +4877,8 @@
|
|||||||
},
|
},
|
||||||
"kind-of": {
|
"kind-of": {
|
||||||
"version": "6.0.2",
|
"version": "6.0.2",
|
||||||
"resolved": "",
|
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz",
|
||||||
|
"integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -14804,7 +14805,8 @@
|
|||||||
},
|
},
|
||||||
"kind-of": {
|
"kind-of": {
|
||||||
"version": "6.0.2",
|
"version": "6.0.2",
|
||||||
"resolved": "",
|
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz",
|
||||||
|
"integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -61,6 +61,7 @@
|
|||||||
"@babel/core": "^7.7.2",
|
"@babel/core": "^7.7.2",
|
||||||
"@babel/polyfill": "^7.7.0",
|
"@babel/polyfill": "^7.7.0",
|
||||||
"@babel/preset-env": "^7.7.1",
|
"@babel/preset-env": "^7.7.1",
|
||||||
|
"@types/body-parser": "^1.19.0",
|
||||||
"@types/classnames": "^2.2.9",
|
"@types/classnames": "^2.2.9",
|
||||||
"@types/debug": "^4.1.5",
|
"@types/debug": "^4.1.5",
|
||||||
"@types/ejs": "^2.6.3",
|
"@types/ejs": "^2.6.3",
|
||||||
@ -84,6 +85,7 @@
|
|||||||
"babel-core": "^7.0.0-bridge.0",
|
"babel-core": "^7.0.0-bridge.0",
|
||||||
"babel-minify": "^0.5.1",
|
"babel-minify": "^0.5.1",
|
||||||
"babelify": "^10.0.0",
|
"babelify": "^10.0.0",
|
||||||
|
"body-parser": "^1.19.0",
|
||||||
"chastifol": "^4.1.0",
|
"chastifol": "^4.1.0",
|
||||||
"classnames": "^2.2.6",
|
"classnames": "^2.2.6",
|
||||||
"core-js": "^3.4.1",
|
"core-js": "^3.4.1",
|
||||||
|
|||||||
@ -69,6 +69,11 @@ body.call {
|
|||||||
@include button-style($color-fg, darken($color-bg, 5%));
|
@include button-style($color-fg, darken($color-bg, 5%));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&:focus {
|
||||||
|
outline: none;
|
||||||
|
box-shadow: 0 0 1rem rgba(black, 0.4);
|
||||||
|
}
|
||||||
|
|
||||||
&:active {
|
&:active {
|
||||||
outline: none;
|
outline: none;
|
||||||
transform: translate(0px, 1px);
|
transform: translate(0px, 1px);
|
||||||
@ -95,10 +100,29 @@ body.call {
|
|||||||
color: $color-primary;
|
color: $color-primary;
|
||||||
}
|
}
|
||||||
|
|
||||||
input {
|
input[type="text"] {
|
||||||
font-family: $font-monospace;
|
font-size: 1rem;
|
||||||
|
padding: 1rem 1rem 0.75rem;
|
||||||
|
width: 100%;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
border-bottom: 2px solid rgba($color-warning, 0);
|
||||||
|
transition: border-bottom 200ms ease-in;
|
||||||
|
text-align: center;
|
||||||
|
color: white;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
&:focus {
|
||||||
|
border-bottom: 2px solid $color-warning;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
input[type="submit"] {
|
||||||
|
// font-family: $font-monospace;
|
||||||
@include button($color-primary, $color-warning);
|
@include button($color-primary, $color-warning);
|
||||||
font-size: 1.1rem;
|
font-size: 1rem;
|
||||||
padding: 1rem 1rem;
|
padding: 1rem 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,15 +27,23 @@ describe('server/app', () => {
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('GET /call', () => {
|
describe('POST /call', () => {
|
||||||
|
|
||||||
it('redirects to a new call', () => {
|
it('redirects to a new call', () => {
|
||||||
return request(app)
|
return request(app)
|
||||||
.get('/call')
|
.post('/call')
|
||||||
.expect(302)
|
.expect(302)
|
||||||
.expect('location', new RegExp(`^${BASE_URL}/call/[0-9a-f-]{36}$`))
|
.expect('location', new RegExp(`^${BASE_URL}/call/[0-9a-f-]{36}$`))
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('redirects to specific call', () => {
|
||||||
|
return request(app)
|
||||||
|
.post('/call')
|
||||||
|
.send('call=test%20id')
|
||||||
|
.expect(302)
|
||||||
|
.expect('location', `${BASE_URL}/call/test%20id`)
|
||||||
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('GET /call/<uuid>', () => {
|
describe('GET /call/<uuid>', () => {
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import { config } from './config'
|
import { config } from './config'
|
||||||
import _debug from 'debug'
|
import _debug from 'debug'
|
||||||
|
import bodyParser from 'body-parser'
|
||||||
import express from 'express'
|
import express from 'express'
|
||||||
import handleSocket from './socket'
|
import handleSocket from './socket'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
@ -38,6 +39,7 @@ app.use((req, res, next) => {
|
|||||||
})
|
})
|
||||||
next()
|
next()
|
||||||
})
|
})
|
||||||
|
app.use(bodyParser.urlencoded({ extended: false }))
|
||||||
|
|
||||||
const router = express.Router()
|
const router = express.Router()
|
||||||
router.use('/res', express.static(path.join(__dirname, '../../res')))
|
router.use('/res', express.static(path.join(__dirname, '../../res')))
|
||||||
|
|||||||
@ -8,8 +8,9 @@ const router = Router()
|
|||||||
const BASE_URL: string = config.baseUrl
|
const BASE_URL: string = config.baseUrl
|
||||||
const cfgIceServers = config.iceServers
|
const cfgIceServers = config.iceServers
|
||||||
|
|
||||||
router.get('/', (req, res) => {
|
router.post('/', (req, res) => {
|
||||||
res.redirect(`${BASE_URL}/call/${v4()}`)
|
const callId = req.body.call ? encodeURIComponent(req.body.call) : v4()
|
||||||
|
res.redirect(`${BASE_URL}/call/${callId}`)
|
||||||
})
|
})
|
||||||
|
|
||||||
router.get('/:callId', (req, res) => {
|
router.get('/:callId', (req, res) => {
|
||||||
|
|||||||
@ -10,12 +10,13 @@
|
|||||||
</a>
|
</a>
|
||||||
|
|
||||||
<div id="container">
|
<div id="container">
|
||||||
<form id="form" method="get" action="<%= baseUrl + '/call' %>">
|
<form id="form" method="post" action="<%= baseUrl + '/call' %>" autocomplete="off">
|
||||||
<h1>
|
<h1>
|
||||||
<img src="<%= baseUrl + '/res/peer-calls.svg' %>" width="100%" alt="Peer Calls">
|
<img src="<%= baseUrl + '/res/peer-calls.svg' %>" width="100%" alt="Peer Calls">
|
||||||
</h1>
|
</h1>
|
||||||
<p>Group peer-to-peer calls for everyone. Create a private room. Share the link.</p>
|
<p>Group peer-to-peer calls for everyone. Create a private room. Share the link.</p>
|
||||||
<input type="submit" value="New Session">
|
<input type="text" value="" name="call" placeholder="Room ID (Leave empty for random)" autofocus>
|
||||||
|
<input type="submit" value="Start Session">
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user