From 4ba7388fc87534410ca6e55562a22cf8362c03b9 Mon Sep 17 00:00:00 2001 From: Quence Z Date: Wed, 7 Oct 2020 13:29:48 +0800 Subject: [PATCH 1/7] feat: Enable SSL conection Since most of browsers block media(such as webcam) accessing from unsecure connections, we have to deploy this application with https. --- public/script.js | 5 +---- server.js | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/public/script.js b/public/script.js index e9c41c5..2159fe1 100644 --- a/public/script.js +++ b/public/script.js @@ -1,9 +1,6 @@ const socket = io('/') const videoGrid = document.getElementById('video-grid') -const myPeer = new Peer(undefined, { - host: '/', - port: '3001' -}) +const myPeer = new Peer(undefined, {}) const myVideo = document.createElement('video') myVideo.muted = true const peers = {} diff --git a/server.js b/server.js index 0033e80..4ecaeb8 100644 --- a/server.js +++ b/server.js @@ -1,8 +1,14 @@ +const { v4: uuidV4 } = require('uuid') const express = require('express') const app = express() -const server = require('http').Server(app) -const io = require('socket.io')(server) -const { v4: uuidV4 } = require('uuid') +const fs = require('fs') +const https = require('https') +const options = { + key:fs.readFileSync('server-key.pem'), + cert: fs.readFileSync('server-cert.pem') +} +const httpsServer = https.createServer(options, app) +const io = require('socket.io')(httpsServer) app.set('view engine', 'ejs') app.use(express.static('public')) @@ -26,4 +32,6 @@ io.on('connection', socket => { }) }) -server.listen(3000) \ No newline at end of file +httpsServer.listen(443, function () { + console.log("Example app listening at http://%s:%s", httpsServer.address().address, httpsServer.address().port); + }); From c9f265e2ba83ad404ea493c7d0a97dfa3ff07299 Mon Sep 17 00:00:00 2001 From: Quence Z Date: Wed, 7 Oct 2020 13:32:05 +0800 Subject: [PATCH 2/7] docs: Create README.md Descriptions and dummy installations, including how to gernerate a key. --- README.md | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..b57fc35 --- /dev/null +++ b/README.md @@ -0,0 +1,50 @@ +# Dummy installation +This is repo is forked from [Zoom-Clone-With-WebRTC](https://github.com/WebDevSimplified/Zoom-Clone-With-WebRTC) and here is the [tutorial video]( +https://www.youtube.com/watch?v=DvlyzDZDEq4&t=684s). +Since I want to deploy this application and access it by IP address or domain name instead of `loaclhost`, I found [this issue](https://github.com/WebDevSimplified/Zoom-Clone-With-WebRTC/issues/23). After a little bit of modification, it works. + +Tested ubuntu-mate 18.04 x86_64, VM Player. +## Dependencies +Install nodejs and npm. It's recommanded to use nodejs 10.x or higher. nodejs LTS(12.x) is selected here. +```bash +sudo apt-get update + +# in case you don't have them +sudo apt-get install curl +sudo apt-get openssl + +curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - # this is for 64 bit machine +sudo apt-get install -y nodejs +``` +This is necessary: +```bash +npm install socket.io uuid express ejs +npm install --save-dev nodemon +``` +And of course clone this repo: +```bash +git clone https://github.com/WebDevSimplified/Zoom-Clone-With-WebRTC +``` + +## Certificate +If you want to use this application via IP address or domain name instead of `localhost`, this step is necessary. Since most of browsers block media(such as webcam) accessing from unsecure connections, we have to deploy this application with https. Here are commands using `openssl` to generate a key and certificate. +> For windows user, `openssl` is a built-in command in MINGW64 git-bash. +```bash +# generate a key +openssl genrsa -out server-key.pem + +# this step will probably ask you to input the information of the signature, +# such as country, company name, etc +openssl req -new -key server-key.pem -out csr.pem + +# generate a certificate +openssl x509 -req -days 9999 -in csr.pem -signkey server-key.pem -out server-cert.pem + +# optional: we dont need this, but I think it's okay +rm csr.pem +``` + +## Run it +```bash +npm run devStart +``` \ No newline at end of file From f62401ba7f159d95b6f570f6da9321ea625e9885 Mon Sep 17 00:00:00 2001 From: Quence Z Date: Wed, 7 Oct 2020 13:43:07 +0800 Subject: [PATCH 3/7] docs: Update REAME.md More discriptions of (## Run it). --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b57fc35..ce0031c 100644 --- a/README.md +++ b/README.md @@ -47,4 +47,5 @@ rm csr.pem ## Run it ```bash npm run devStart -``` \ No newline at end of file +``` +And you can enter `https://your.IP.addr/` in your borwser, it will automatically generate a uuid and redirect you to your chatting room. For anyone want to join you, you can just share the url of your chatting room. From 91214fc117d5fc9aece3e22f107f82c10b3ddc85 Mon Sep 17 00:00:00 2001 From: ghnmqdtg Date: Mon, 12 Oct 2020 19:11:12 +0800 Subject: [PATCH 4/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ce0031c..9e7546b 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ sudo apt-get update # in case you don't have them sudo apt-get install curl -sudo apt-get openssl +sudo apt-get install openssl curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - # this is for 64 bit machine sudo apt-get install -y nodejs From 64f7afb0dae6e8a323b7ade96f89833699ccefb8 Mon Sep 17 00:00:00 2001 From: ghnmqdtg Date: Mon, 12 Oct 2020 21:16:33 -0700 Subject: [PATCH 5/7] Update README.md --- .gitignore | 4 +- README.md | 5 +- package-lock.json | 157 ++++++++++++++++++++++++---------------------- package.json | 4 +- 4 files changed, 90 insertions(+), 80 deletions(-) diff --git a/.gitignore b/.gitignore index b512c09..30fb9eb 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -node_modules \ No newline at end of file +node_modules +server-cert.pem +server-key.pem \ No newline at end of file diff --git a/README.md b/README.md index 9e7546b..12d06c1 100644 --- a/README.md +++ b/README.md @@ -27,8 +27,9 @@ git clone https://github.com/WebDevSimplified/Zoom-Clone-With-WebRTC ``` ## Certificate -If you want to use this application via IP address or domain name instead of `localhost`, this step is necessary. Since most of browsers block media(such as webcam) accessing from unsecure connections, we have to deploy this application with https. Here are commands using `openssl` to generate a key and certificate. +If you want to use this application via IP address or domain name instead of `localhost`, this step is necessary. Since most of browsers block media(such as webcam) accessing from unsecure connections, we have to deploy this application with `HTTPS`. Here are commands using `openssl` to generate a key and certificate. > For windows user, `openssl` is a built-in command in MINGW64 git-bash. +> For Linux user, just run these commands in termial. ```bash # generate a key openssl genrsa -out server-key.pem @@ -46,6 +47,6 @@ rm csr.pem ## Run it ```bash -npm run devStart +sudo npm run devStart ``` And you can enter `https://your.IP.addr/` in your borwser, it will automatically generate a uuid and redirect you to your chatting room. For anyone want to join you, you can just share the url of your chatting room. diff --git a/package-lock.json b/package-lock.json index f5f2dc4..38cb383 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,12 +19,6 @@ "defer-to-connect": "^1.0.1" } }, - "@types/color-name": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", - "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", - "dev": true - }, "abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", @@ -122,9 +116,9 @@ "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=" }, "base64-arraybuffer": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz", - "integrity": "sha1-c5JncZI7Whl0etZmqlzUv5xunOg=" + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.4.tgz", + "integrity": "sha1-mBjHngWbE1X5fgQooBfIOOkLqBI=" }, "base64id": { "version": "2.0.0", @@ -140,9 +134,9 @@ } }, "binary-extensions": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.0.0.tgz", - "integrity": "sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.1.0.tgz", + "integrity": "sha512-1Yj8h9Q+QDF5FzhMs/c9+6UntbD5MkRfRwac8DoEm9ZfUBZ7tZ55YcGVAzEe4bXsdQHEk+s9S5wsOKVdZrw0tQ==", "dev": true }, "blob": { @@ -184,12 +178,11 @@ }, "dependencies": { "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, "requires": { - "@types/color-name": "^1.1.1", "color-convert": "^2.0.1" } }, @@ -225,9 +218,9 @@ "dev": true }, "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, "requires": { "has-flag": "^4.0.0" @@ -274,9 +267,9 @@ }, "dependencies": { "get-stream": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz", - "integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", "dev": true, "requires": { "pump": "^3.0.0" @@ -312,9 +305,9 @@ } }, "chokidar": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.0.tgz", - "integrity": "sha512-aXAaho2VJtisB/1fg1+3nlLJqGOuewTzQpd/Tz0yTg2R0e4IGtshYvtjowyEumcBv2z+y4+kc75Mz7j5xJskcQ==", + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.2.tgz", + "integrity": "sha512-IZHaDeBeI+sZJRX7lGcXsdzgvZqKv6sECqsbErJA4mHWfpRrD8B97kSFN4cQz6nGBGiuFia1MKR4d6c1o8Cv7A==", "dev": true, "requires": { "anymatch": "~3.1.1", @@ -334,9 +327,9 @@ "dev": true }, "cli-boxes": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.0.tgz", - "integrity": "sha512-gpaBrMAizVEANOpfZp/EEUixTXDyGt7DFzdK5hU+UbWt/J0lB0w20ncZj59Z9a93xHb9u12zF5BS6i9RKbtg4w==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz", + "integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==", "dev": true }, "clone-response": { @@ -464,9 +457,9 @@ "integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA=" }, "dot-prop": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.2.0.tgz", - "integrity": "sha512-uEUyaDKoSQ1M4Oq8l45hSE26SnTxL6snNnqvK/VWx5wJhmff5z0FUVJDKDanor/6w3kzE3i7XZOk+7wC0EXr1A==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", + "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", "dev": true, "requires": { "is-obj": "^2.0.0" @@ -484,9 +477,9 @@ "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=" }, "ejs": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.3.tgz", - "integrity": "sha512-wmtrUGyfSC23GC/B1SMv2ogAUgbQEtDmTIhfqielrG5ExIM9TP4UoYdi90jLF1aTcsWCJNEO0UrgKzP0y3nTSg==", + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.5.tgz", + "integrity": "sha512-dldq3ZfFtgVTJMLjOe+/3sROTzALlL9E34V4/sDtUd/KlBSS0s6U1/+WPE1B4sj9CXHJpL1M6rhNJnc9Wbal9w==", "requires": { "jake": "^10.6.1" } @@ -545,18 +538,18 @@ } }, "engine.io-client": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.4.3.tgz", - "integrity": "sha512-0NGY+9hioejTEJCaSJZfWZLk4FPI9dN+1H1C4+wj2iuFba47UgZbJzfWs4aNFajnX/qAaYKbe2lLTfEEWzCmcw==", + "version": "3.4.4", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.4.4.tgz", + "integrity": "sha512-iU4CRr38Fecj8HoZEnFtm2EiKGbYZcPn3cHxqNGl/tmdWRf60KhK+9vE0JeSjgnlS/0oynEfLgKbT9ALpim0sQ==", "requires": { "component-emitter": "~1.3.0", "component-inherit": "0.0.3", - "debug": "~4.1.0", + "debug": "~3.1.0", "engine.io-parser": "~2.2.0", "has-cors": "1.1.0", "indexof": "0.0.1", - "parseqs": "0.0.5", - "parseuri": "0.0.5", + "parseqs": "0.0.6", + "parseuri": "0.0.6", "ws": "~6.1.0", "xmlhttprequest-ssl": "~1.5.4", "yeast": "0.1.2" @@ -568,17 +561,22 @@ "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==" }, "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", "requires": { - "ms": "^2.1.1" + "ms": "2.0.0" } }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" + "parseqs": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/parseqs/-/parseqs-0.0.6.tgz", + "integrity": "sha512-jeAGzMDbfSHHA091hr0r31eYfTig+29g3GKKE/PPbEQ65X0lmMwlEoqmhzu0iztID5uJpZsFlUPDP8ThPL7M8w==" + }, + "parseuri": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/parseuri/-/parseuri-0.0.6.tgz", + "integrity": "sha512-AUjen8sAkGgao7UyCX6Ahv0gIK2fABKmYjvP4xmy5JaKvcbTRueIqIPHLAfq30xJddqSE033IOMUSOMCcK3Sow==" }, "ws": { "version": "6.1.4", @@ -591,13 +589,13 @@ } }, "engine.io-parser": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-2.2.0.tgz", - "integrity": "sha512-6I3qD9iUxotsC5HEMuuGsKA0cXerGz+4uGcXQEkfBidgKf0amsjrrtwcbwK/nzpZBxclXlV7gGl9dgWvu4LF6w==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-2.2.1.tgz", + "integrity": "sha512-x+dN/fBH8Ro8TFwJ+rkB2AmuVw9Yu2mockR/p3W8f8YtExwFgDvBDi0GWyb4ZLkpahtDGZgtr3zLovanJghPqg==", "requires": { "after": "0.8.2", "arraybuffer.slice": "~0.0.7", - "base64-arraybuffer": "0.1.5", + "base64-arraybuffer": "0.1.4", "blob": "0.0.5", "has-binary2": "~1.0.2" } @@ -1279,9 +1277,9 @@ } }, "registry-auth-token": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.1.1.tgz", - "integrity": "sha512-9bKS7nTl9+/A1s7tnPeGrUpRcVY+LUh7bfFgzpndALdPfXQBfQV77rQVtqgUV3ti4vc/Ik81Ex8UJDWDQ12zQA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.0.tgz", + "integrity": "sha512-P+lWzPrsgfN+UEpDS3U8AQKg/UjZX6mQSJueZj3EK+vNESoqBSpBUD3gmu4sF9lOsjXWjF11dQKUqemf3veq1w==", "dev": true, "requires": { "rc": "^1.2.8" @@ -1441,6 +1439,11 @@ "to-array": "0.1.4" }, "dependencies": { + "base64-arraybuffer": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/base64-arraybuffer/-/base64-arraybuffer-0.1.5.tgz", + "integrity": "sha1-c5JncZI7Whl0etZmqlzUv5xunOg=" + }, "debug": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", @@ -1455,15 +1458,20 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, "socket.io-parser": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.3.0.tgz", - "integrity": "sha512-hczmV6bDgdaEbVqhAeVMM/jfUfzuEZHsQg6eOmLgJht6G3mPKMxYm75w2+qhAQZ+4X+1+ATZ+QFKeOZD5riHng==", + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/socket.io-parser/-/socket.io-parser-3.3.1.tgz", + "integrity": "sha512-1QLvVAe8dTz+mKmZ07Swxt+LAo4Y1ff50rlyoEx00TQmDFVQYPfcqGvIDJLGaBdhdNCecXtyKpD+EgKGcmmbuQ==", "requires": { - "component-emitter": "1.2.1", + "component-emitter": "~1.3.0", "debug": "~3.1.0", "isarray": "2.0.1" }, "dependencies": { + "component-emitter": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", + "integrity": "sha512-Rd3se6QB+sO1TwqZjscQrurpEPIfO0/yYnSin6Q/rD3mOutHvUrCAhJub3r90uNb+SESBuE0QYoB90YdfatsRg==" + }, "debug": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", @@ -1662,9 +1670,9 @@ "integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=" }, "update-notifier": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-4.1.0.tgz", - "integrity": "sha512-w3doE1qtI0/ZmgeoDoARmI5fjDoT93IfKgEGqm26dGUOh8oNpaSTsGNdYRN/SjOuo10jcJGwkEL3mroKzktkew==", + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-4.1.3.tgz", + "integrity": "sha512-Yld6Z0RyCYGB6ckIjffGOSOmHXj1gMeE7aROz4MG+XMkmixBX4jUngrGXNYz7wPKBmtoD4MnBa2Anu7RSKht/A==", "dev": true, "requires": { "boxen": "^4.2.0", @@ -1683,12 +1691,11 @@ }, "dependencies": { "ansi-styles": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", - "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "dev": true, "requires": { - "@types/color-name": "^1.1.1", "color-convert": "^2.0.1" } }, @@ -1724,9 +1731,9 @@ "dev": true }, "supports-color": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", - "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, "requires": { "has-flag": "^4.0.0" @@ -1749,9 +1756,9 @@ "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" }, "uuid": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.1.0.tgz", - "integrity": "sha512-CI18flHDznR0lq54xBycOVmphdCYnQLKn8abKn7PXUiKUGdEd+/l9LWNJmugXel4hXq7S+RMNl34ecyC9TntWg==" + "version": "8.3.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.1.tgz", + "integrity": "sha512-FOmRr+FmWEIG8uhZv6C2bTgEVXsHk08kE7mPlrBbEe+c3r9pjceVPgupIfNIhc4yx55H69OXANrUaSuu9eInKg==" }, "vary": { "version": "1.1.2", @@ -1786,9 +1793,9 @@ } }, "ws": { - "version": "7.3.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.3.0.tgz", - "integrity": "sha512-iFtXzngZVXPGgpTlP1rBqsUK82p9tKqsWRPg5L56egiljujJT3vGAYnHANvFxBieXrTFavhzhxW52jnaWV+w2w==" + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.3.1.tgz", + "integrity": "sha512-D3RuNkynyHmEJIpD2qrgVkc9DQ23OrN/moAwZX4L8DfvszsJxpjQuUq3LMx6HoYji9fbIOBY18XWBsAux1ZZUA==" }, "xdg-basedir": { "version": "4.0.0", diff --git a/package.json b/package.json index 7215838..4781499 100644 --- a/package.json +++ b/package.json @@ -10,10 +10,10 @@ "author": "", "license": "ISC", "dependencies": { - "ejs": "^3.1.3", + "ejs": "^3.1.5", "express": "^4.17.1", "socket.io": "^2.3.0", - "uuid": "^8.1.0" + "uuid": "^8.3.1" }, "devDependencies": { "nodemon": "^2.0.4" From 72d5a99a8bae305dfaf308629981dafa4c42aaae Mon Sep 17 00:00:00 2001 From: Quence Z Date: Sat, 21 Nov 2020 03:08:11 +0800 Subject: [PATCH 6/7] Typo: http-->https --- server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server.js b/server.js index 4ecaeb8..7a2f757 100644 --- a/server.js +++ b/server.js @@ -33,5 +33,5 @@ io.on('connection', socket => { }) httpsServer.listen(443, function () { - console.log("Example app listening at http://%s:%s", httpsServer.address().address, httpsServer.address().port); + console.log("Example app listening at https://%s:%s", httpsServer.address().address, httpsServer.address().port); }); From a3f97e997b789fc48b4e2abcddd20f90b1ad2114 Mon Sep 17 00:00:00 2001 From: Quence Z Date: Sat, 21 Nov 2020 03:12:01 +0800 Subject: [PATCH 7/7] Update README.md and non-code files --- README.md | 57 +++++++++++++++++++++++++++++------------------ package-lock.json | 42 +++++++++++++++++----------------- package.json | 2 +- server-cert.pem | 22 ++++++++++++++++++ server-key.pem | 27 ++++++++++++++++++++++ 5 files changed, 106 insertions(+), 44 deletions(-) create mode 100644 server-cert.pem create mode 100644 server-key.pem diff --git a/README.md b/README.md index 12d06c1..52e7cb1 100644 --- a/README.md +++ b/README.md @@ -3,33 +3,41 @@ This is repo is forked from [Zoom-Clone-With-WebRTC](https://github.com/WebDevSi https://www.youtube.com/watch?v=DvlyzDZDEq4&t=684s). Since I want to deploy this application and access it by IP address or domain name instead of `loaclhost`, I found [this issue](https://github.com/WebDevSimplified/Zoom-Clone-With-WebRTC/issues/23). After a little bit of modification, it works. -Tested ubuntu-mate 18.04 x86_64, VM Player. +Tested on ubuntu-mate 18.04 x86_64, VM Player and windows 10, baremetal. ## Dependencies -Install nodejs and npm. It's recommanded to use nodejs 10.x or higher. nodejs LTS(12.x) is selected here. -```bash -sudo apt-get update +- Of course clone this repo: + ```bash + git clone https://github.com/WebDevSimplified/Zoom-Clone-With-WebRTC + ``` +- Install `nodejs` and `npm` + It's recommanded to use nodejs 10.x or higher. nodejs LTS(12.x) is selected here. + For windows user, please refer: [official download page](https://nodejs.org/en/download/). + ```bash + sudo apt-get update -# in case you don't have them -sudo apt-get install curl -sudo apt-get install openssl + # in case you don't have them + sudo apt-get install curl -curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - # this is for 64 bit machine -sudo apt-get install -y nodejs -``` -This is necessary: -```bash -npm install socket.io uuid express ejs -npm install --save-dev nodemon -``` -And of course clone this repo: -```bash -git clone https://github.com/WebDevSimplified/Zoom-Clone-With-WebRTC -``` + curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - # this is for 64 bit machine + sudo apt-get install -y nodejs + ``` +- Packages of `nodejs` + It's recommanded that windows user run these commands as administrator to prevent some magic bugs. + ```bash + npm install + npm install --save-dev nodemon + ``` ## Certificate -If you want to use this application via IP address or domain name instead of `localhost`, this step is necessary. Since most of browsers block media(such as webcam) accessing from unsecure connections, we have to deploy this application with `HTTPS`. Here are commands using `openssl` to generate a key and certificate. +If you want to use this application via IP address or domain name instead of `localhost`, this step is necessary. Since most of browsers block media(such as webcam) accessing from unsecure connections, we have to deploy this application with `HTTPS`. This repo comes with the key I generated. You can use it if you don't have `openssl` installed. Yet it's recommanded to generate your own key. +Here are commands using `openssl` to generate a key and certificate: > For windows user, `openssl` is a built-in command in MINGW64 git-bash. > For Linux user, just run these commands in termial. +```bash +# install openssl if you don't have it +sudo apt-get install openssl +``` + ```bash # generate a key openssl genrsa -out server-key.pem @@ -41,7 +49,7 @@ openssl req -new -key server-key.pem -out csr.pem # generate a certificate openssl x509 -req -days 9999 -in csr.pem -signkey server-key.pem -out server-cert.pem -# optional: we dont need this, but I think it's okay +# optional: we dont need this, but I think it's okay to keep it rm csr.pem ``` @@ -49,4 +57,9 @@ rm csr.pem ```bash sudo npm run devStart ``` -And you can enter `https://your.IP.addr/` in your borwser, it will automatically generate a uuid and redirect you to your chatting room. For anyone want to join you, you can just share the url of your chatting room. +And you can enter +``` +https://your.IP.addr/ +``` +in your borwser. It's likely to have a warning `NET::ERR_CERT_AUTHORITY_INVALID` or somthing like that. For Chrome, just click *Advance*, *Continue...* +It will automatically generate a uuid and redirect you to your chatting room. For anyone want to join you, you can just share the url of your chatting room. diff --git a/package-lock.json b/package-lock.json index 38cb383..c737a39 100644 --- a/package-lock.json +++ b/package-lock.json @@ -305,9 +305,9 @@ } }, "chokidar": { - "version": "3.4.2", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.2.tgz", - "integrity": "sha512-IZHaDeBeI+sZJRX7lGcXsdzgvZqKv6sECqsbErJA4mHWfpRrD8B97kSFN4cQz6nGBGiuFia1MKR4d6c1o8Cv7A==", + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.4.3.tgz", + "integrity": "sha512-DtM3g7juCXQxFVSNPNByEC2+NImtBuxQQvWlHunpJIS5Ocr0lG306cC7FCi7cEA0fzmybPUIl4txBIobk1gGOQ==", "dev": true, "requires": { "anymatch": "~3.1.1", @@ -317,7 +317,7 @@ "is-binary-path": "~2.1.0", "is-glob": "~4.0.1", "normalize-path": "~3.0.0", - "readdirp": "~3.4.0" + "readdirp": "~3.5.0" } }, "ci-info": { @@ -1059,9 +1059,9 @@ "integrity": "sha512-hZXc7K2e+PgeI1eDBe/10Ard4ekbfrrqG8Ep+8Jmf4JID2bNg7NvCPOZN+kfF574pFQI7mum2AUqDidoKqcTOw==" }, "nodemon": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.4.tgz", - "integrity": "sha512-Ltced+hIfTmaS28Zjv1BM552oQ3dbwPqI4+zI0SLgq+wpJhSyqgYude/aZa/3i31VCQWMfXJVxvu86abcam3uQ==", + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/nodemon/-/nodemon-2.0.6.tgz", + "integrity": "sha512-4I3YDSKXg6ltYpcnZeHompqac4E6JeAMpGm8tJnB9Y3T0ehasLa4139dJOcCrB93HHrUMsCrKtoAlXTqT5n4AQ==", "dev": true, "requires": { "chokidar": "^3.2.2", @@ -1072,8 +1072,8 @@ "semver": "^5.7.1", "supports-color": "^5.5.0", "touch": "^3.1.0", - "undefsafe": "^2.0.2", - "update-notifier": "^4.0.0" + "undefsafe": "^2.0.3", + "update-notifier": "^4.1.0" }, "dependencies": { "debug": { @@ -1226,9 +1226,9 @@ } }, "pupa": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pupa/-/pupa-2.0.1.tgz", - "integrity": "sha512-hEJH0s8PXLY/cdXh66tNEQGndDrIKNqNC5xmrysZy3i5C3oEoLna7YAOad+7u125+zH1HNXUmGEkrhb3c2VriA==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/pupa/-/pupa-2.1.1.tgz", + "integrity": "sha512-l1jNAspIBSFqbT+y+5FosojNpVpF94nlI+wDUpqP9enwOTfHx9f0gh5nB96vl+6yTpsJsypeNrwfzPrKuHB41A==", "dev": true, "requires": { "escape-goat": "^2.0.0" @@ -1268,9 +1268,9 @@ } }, "readdirp": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.4.0.tgz", - "integrity": "sha512-0xe001vZBnJEK+uKcj8qOhyAKPzIT+gStxWr3LCB0DwcXR5NZJ3IaC+yGnHCYzB/S7ov3m3EEbZI2zeNvX+hGQ==", + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.5.0.tgz", + "integrity": "sha512-cMhu7c/8rdhkHXWsY+osBhfSy0JikwpHK/5+imo+LpeasTF8ouErHrlYkwT0++njiyuDvc7OFY5T3ukvZ8qmFQ==", "dev": true, "requires": { "picomatch": "^2.2.1" @@ -1583,9 +1583,9 @@ } }, "term-size": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/term-size/-/term-size-2.2.0.tgz", - "integrity": "sha512-a6sumDlzyHVJWb8+YofY4TW112G6p2FCPEAFk+59gIYHv3XHRhm9ltVQ9kli4hNWeQBwSpe8cRN25x0ROunMOw==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/term-size/-/term-size-2.2.1.tgz", + "integrity": "sha512-wK0Ri4fOGjv/XPy8SBHZChl8CM7uMc5VML7SqiQ0zG7+J5Vr+RMQDoHa2CNT6KHUnTGIXH34UDMkPzAUyapBZg==", "dev": true }, "to-array": { @@ -1793,9 +1793,9 @@ } }, "ws": { - "version": "7.3.1", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.3.1.tgz", - "integrity": "sha512-D3RuNkynyHmEJIpD2qrgVkc9DQ23OrN/moAwZX4L8DfvszsJxpjQuUq3LMx6HoYji9fbIOBY18XWBsAux1ZZUA==" + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.0.tgz", + "integrity": "sha512-kyFwXuV/5ymf+IXhS6f0+eAFvydbaBW3zjpT6hUdAh/hbVjTIB5EHBGi0bPoCLSK2wcuz3BrEkB9LrYv1Nm4NQ==" }, "xdg-basedir": { "version": "4.0.0", diff --git a/package.json b/package.json index 4781499..d367f3b 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,6 @@ "uuid": "^8.3.1" }, "devDependencies": { - "nodemon": "^2.0.4" + "nodemon": "^2.0.6" } } diff --git a/server-cert.pem b/server-cert.pem new file mode 100644 index 0000000..89e6f25 --- /dev/null +++ b/server-cert.pem @@ -0,0 +1,22 @@ +-----BEGIN CERTIFICATE----- +MIIDmTCCAoECFEe5IanVsmdJOZlAnhMA7EQmFp49MA0GCSqGSIb3DQEBCwUAMIGI +MQswCQYDVQQGEwJUVzEMMAoGA1UECAwDVFBFMQwwCgYDVQQHDANUUEUxEjAQBgNV +BAoMCU15Q29tcGFueTESMBAGA1UECwwJZnVsbFN0YWNrMQ8wDQYDVQQDDAZRVUVO +Q0UxJDAiBgkqhkiG9w0BCQEWFXF1ZW5jeTg5NTEzQGdtYWlsLmNvbTAeFw0yMDEx +MjAxOTExMDlaFw00ODA0MDYxOTExMDlaMIGIMQswCQYDVQQGEwJUVzEMMAoGA1UE +CAwDVFBFMQwwCgYDVQQHDANUUEUxEjAQBgNVBAoMCU15Q29tcGFueTESMBAGA1UE +CwwJZnVsbFN0YWNrMQ8wDQYDVQQDDAZRVUVOQ0UxJDAiBgkqhkiG9w0BCQEWFXF1 +ZW5jeTg5NTEzQGdtYWlsLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC +ggEBAJ+DaJSkPiZA0401Vp2H619VkeEJiDO9Ons8CFR+UwjW0gdRhnD+sWT6a6lu +fItvoxYwwwU/iQ2fqsWgLCmfKnAPNXAFe1UGeT+1rb+6Tk6XmefIzaWlsaC3Z2rR +d40FreiSs8uyGC9Aena7qDDfENS4NJpFfwYGw70Y0r4RogT7/JOXB/e2hQBZm+2F +rQ6gwNl3pWEHaw/FN9YrqLUf3kkjTCRaWNLFMQG723V5SBJ57OMsI3RT3XdXv3uB +fgsYZxZtf3Rn1j2iJ6RlNxVvBKN1qjN+MUaYTQXyiu5OguRCMnS1mdq569eiS5v6 +VBHl62O3qt9KQikwmyOKvi4x9w0CAwEAATANBgkqhkiG9w0BAQsFAAOCAQEAJtmq +U8xPI2Gke0So6ekuoyFmmu8FpODB5sqoliPYBWEkV5uA8Khhmw6pyyNyTnS+9N3i +IIUC39+q0d/vldAr7ruliYl7cqzS3+U6qwR2/oqBiirrAsCMxoPGIjj+skcJ3jKJ +iPbO3c/vgZJyVyc45H43vP9FamcCxCVrwEWeFQPHIo7eJZ5qebgt1XsUlCG5BJe0 +YpM7wEroGpyr7mgLwZ5c+fp6YmssAlNrbpPIJ8xHgUYZ6SIRfSw7HpSKw+yTSsIp +7ku70MQptFh208PgGh3wSIUKkZ71I/dVEV2joWz93+iYWB3anrjcdTa6LZ0zBbAW +82tyV4/cR8VgEt4u5A== +-----END CERTIFICATE----- diff --git a/server-key.pem b/server-key.pem new file mode 100644 index 0000000..654b3c2 --- /dev/null +++ b/server-key.pem @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEpQIBAAKCAQEAn4NolKQ+JkDTjTVWnYfrX1WR4QmIM706ezwIVH5TCNbSB1GG +cP6xZPprqW58i2+jFjDDBT+JDZ+qxaAsKZ8qcA81cAV7VQZ5P7Wtv7pOTpeZ58jN +paWxoLdnatF3jQWt6JKzy7IYL0B6druoMN8Q1Lg0mkV/BgbDvRjSvhGiBPv8k5cH +97aFAFmb7YWtDqDA2XelYQdrD8U31iuotR/eSSNMJFpY0sUxAbvbdXlIEnns4ywj +dFPdd1e/e4F+CxhnFm1/dGfWPaInpGU3FW8Eo3WqM34xRphNBfKK7k6C5EIydLWZ +2rnr16JLm/pUEeXrY7eq30pCKTCbI4q+LjH3DQIDAQABAoIBAQCfFl4tMQlS+YCD +6thx0Gcs85jESc9vWqCC28KrEjoaLLXX2rUs6LdfsGnD14+bOUH8FbHLACzeS4n0 +A+VHtZiLnn97M9xnVkeDBN0+xL7on0Y95wVC2dgoJAKehD6phSqHNBjhZMO+DJ6W +4F3EMBUHMpgz7G/dQM3jQGiea9OdB2jBWtdrAE5rv26by/CaVEmn6zKpor5TAFK+ +KDGkmGTHCUZYry6ukqBF7uwFOLimQKCsrDFqSOf9621Po1mHOSux2q1YDhdMrZhx +xwspXDRIdoh5PyR2uj5rTcT2xk102y0cMnIrOYrjrFOe7x7PUXRPB7vZO3QouLoB +Co1tDY95AoGBANO3lzfsoLIRUIr7LkHPiwIyOUhDQvQP3MCZdqWDkAkA+CCdcVWV +tD7VLDzM+vgOUN8x9Uc1SYZjE7YNxqwN36FPePTG73VIHMysshXZ7Vt998St2Vro +4as1kzCUIQh3l7dhx1s9NXfGLpv0Nx2zML9+ulQh4LEhiiYh/349D5evAoGBAMDg +j1DOwxlIzDk8f0XvdLs6tb2skB11TZw9YIf5BV3LhmYmzChCeVBD9FMnB5NxA8Nr +bpAEwGaL8/fGqpvN0droStQgqTzQLxU06T8TYwauZiJvRALYExeC0nRRSCpVEc9W +1Nb7aI7+iZ1EAKplIUW+Eth6oN86oDgKVqu8y9ADAoGBAI02+p0prvG2zNM2wN7S +kPSxDTYe7wyde+/XLKUvgKYQyG/wtASS6vux8mTHkGpeGiEVUHXjnBwP/7jBrY9b +XZtZx+L0wgmnRNZcJhifGEubVOUR1FVn2gX5oSiY1QOxyTde97rqs7wlKzeIiC6+ +M7i2zY+KXTWoml3e9Wx9S+YvAoGALIitDp9u9LuWS/DoAiHT9hcMN4tMi0C2dsjF +LSAWWR3RHmz+3pzanenS1BBC84w4rjp0ANTYB9Vws1kvs2HGfqD8Bha0fNIkzOS2 +plW3m6dQ9cpzDaUOY3NVXH4YB4402obWBf1umvWymJlG/hDzqcLFXy6RTnme3NGm +SWkCNjkCgYEAqENorey7Jh2Qp5NPikPOHKZr9I0slp3PLxlJumGdRTpWJa8baRnR +LeY8MHYYSOdWQ2P9GNwLsGoYyJayHwqWl2NpSteGfS6MO/jOgIm1CQGZDsshB8fk +IoW+7YiCYAShZL2BO9tiGB31fWhFskT7fTJHOdPhbpwtWK4B3bz98PY= +-----END RSA PRIVATE KEY-----