-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.mjs
35 lines (30 loc) · 682 Bytes
/
index.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env node
import { request } from 'https';
import { webcrypto } from 'crypto';
const meetingId = Buffer.from(
String.fromCharCode(...webcrypto.getRandomValues(new Uint8Array(32))),
'binary'
)
.toString('base64')
.replace(/\+/g, '-')
.replace(/\//g, '_')
.replace(/=/g, '');
const meetingUrl = `https://talk.brave.com/${meetingId}`;
const { hostname, pathname } = new URL(meetingUrl);
const req = request(
{
hostname,
port: 443,
path: `${pathname}?create_only=y`,
method: 'GET'
},
(res) => {
res.on('data', (d) => {
console.log(meetingUrl);
});
}
);
req.on('error', (error) => {
console.error(error);
});
req.end();