diff --git a/package-lock.json b/package-lock.json index 180de292..45fc3957 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32,7 +32,6 @@ "react-tooltip": "^4.2.8", "request": "^2.88.2", "ts-node": "^10", - "twilio-video": "^2.8.0", "uuid": "^8.3.2" }, "devDependencies": { @@ -40,7 +39,6 @@ "@types/react": "^16.9.43", "@types/react-dom": "^16.9.8", "@types/redis": "^2.8.25", - "@types/twilio-video": "^2.7.3", "@types/uuid": "^8.3.4", "@typescript-eslint/eslint-plugin": "^3.8.0", "@typescript-eslint/parser": "^3.8.0", @@ -2684,11 +2682,6 @@ "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz", "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==" }, - "node_modules/@twilio/webrtc": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/@twilio/webrtc/-/webrtc-4.3.2.tgz", - "integrity": "sha512-3gIq7XDI3vBoikRBchCnocFmlRQt45KC7v0DKkat+TV6WBXYJx+Hub22PR18PAROkwl5dAmIziByjYWWVhCHgA==" - }, "node_modules/@types/color-name": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", @@ -2769,12 +2762,6 @@ "@types/node": "*" } }, - "node_modules/@types/twilio-video": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/@types/twilio-video/-/twilio-video-2.7.3.tgz", - "integrity": "sha512-IDqG3hB1GSbtAoMqIV/sOT02hstBhGUrejpNd+1PbKm3tyhO62T2wwd4rFC2A+nKXTY3aC+2FoQwvR68d5j08g==", - "dev": true - }, "node_modules/@types/uuid": { "version": "8.3.4", "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.4.tgz", @@ -3301,7 +3288,10 @@ "node_modules/async-limiter": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", - "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==" + "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==", + "dev": true, + "optional": true, + "peer": true }, "node_modules/asynckit": { "version": "0.4.0", @@ -3356,17 +3346,6 @@ "integrity": "sha512-Td525n+iPOOyUQIeBfcASuG6uJsDOITl7Mds5gFyerkWiX7qhUTdYUBlSgNMyVqtSJqwpt1kXGLdUt6SykLMRA==", "dev": true }, - "node_modules/backoff": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/backoff/-/backoff-2.5.0.tgz", - "integrity": "sha1-9hbtqdPktmuMp/ynn2lXIsX44m8=", - "dependencies": { - "precond": "0.2" - }, - "engines": { - "node": ">= 0.6" - } - }, "node_modules/balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", @@ -3625,9 +3604,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001507", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001507.tgz", - "integrity": "sha512-SFpUDoSLCaE5XYL2jfqe9ova/pbQHEmbheDf5r4diNwbAgR3qxM9NQtfsiSscjqoya5K7kFcHPUQ+VsUkIJR4A==", + "version": "1.0.30001574", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001574.tgz", + "integrity": "sha512-BtYEK4r/iHt/txm81KBudCUcTy7t+s9emrIaHqjYurQ10x71zJ5VQ9x1dYPcz/b+pKSp4y/v1xSI67A+LzpNyg==", "dev": true, "funding": [ { @@ -8186,14 +8165,6 @@ "node": ">=12" } }, - "node_modules/precond": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/precond/-/precond-0.2.3.tgz", - "integrity": "sha1-qpWRvKokkj8eD0hJ0kD0fvwQdaw=", - "engines": { - "node": ">= 0.6" - } - }, "node_modules/prelude-ls": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", @@ -9479,35 +9450,6 @@ "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" }, - "node_modules/twilio-video": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/twilio-video/-/twilio-video-2.8.0.tgz", - "integrity": "sha512-TDL4GxlSqYE32zmN0nOVtsdIVAgValRl3LRBuUAuREsQXXk7oEWyXHqNIF1/N9Kvh5J5BVK6FvXnxSA5TsdLkA==", - "dependencies": { - "@twilio/webrtc": "4.3.2", - "backoff": "^2.5.0", - "ws": "^3.3.1", - "xmlhttprequest": "^1.8.0" - }, - "engines": { - "node": ">=0.12" - } - }, - "node_modules/twilio-video/node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, - "node_modules/twilio-video/node_modules/ws": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", - "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", - "dependencies": { - "async-limiter": "~1.0.0", - "safe-buffer": "~5.1.0", - "ultron": "~1.1.0" - } - }, "node_modules/type-check": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", @@ -9548,11 +9490,6 @@ "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz", "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==" }, - "node_modules/ultron": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", - "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" - }, "node_modules/unbox-primitive": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", @@ -11961,11 +11898,6 @@ "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz", "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==" }, - "@twilio/webrtc": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/@twilio/webrtc/-/webrtc-4.3.2.tgz", - "integrity": "sha512-3gIq7XDI3vBoikRBchCnocFmlRQt45KC7v0DKkat+TV6WBXYJx+Hub22PR18PAROkwl5dAmIziByjYWWVhCHgA==" - }, "@types/color-name": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz", @@ -12046,12 +11978,6 @@ "@types/node": "*" } }, - "@types/twilio-video": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/@types/twilio-video/-/twilio-video-2.7.3.tgz", - "integrity": "sha512-IDqG3hB1GSbtAoMqIV/sOT02hstBhGUrejpNd+1PbKm3tyhO62T2wwd4rFC2A+nKXTY3aC+2FoQwvR68d5j08g==", - "dev": true - }, "@types/uuid": { "version": "8.3.4", "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-8.3.4.tgz", @@ -12428,7 +12354,10 @@ "async-limiter": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", - "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==" + "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==", + "dev": true, + "optional": true, + "peer": true }, "asynckit": { "version": "0.4.0", @@ -12471,14 +12400,6 @@ "integrity": "sha512-Td525n+iPOOyUQIeBfcASuG6uJsDOITl7Mds5gFyerkWiX7qhUTdYUBlSgNMyVqtSJqwpt1kXGLdUt6SykLMRA==", "dev": true }, - "backoff": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/backoff/-/backoff-2.5.0.tgz", - "integrity": "sha1-9hbtqdPktmuMp/ynn2lXIsX44m8=", - "requires": { - "precond": "0.2" - } - }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", @@ -12681,9 +12602,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001507", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001507.tgz", - "integrity": "sha512-SFpUDoSLCaE5XYL2jfqe9ova/pbQHEmbheDf5r4diNwbAgR3qxM9NQtfsiSscjqoya5K7kFcHPUQ+VsUkIJR4A==", + "version": "1.0.30001574", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001574.tgz", + "integrity": "sha512-BtYEK4r/iHt/txm81KBudCUcTy7t+s9emrIaHqjYurQ10x71zJ5VQ9x1dYPcz/b+pKSp4y/v1xSI67A+LzpNyg==", "dev": true }, "caseless": { @@ -16168,11 +16089,6 @@ "is-json": "^2.0.1" } }, - "precond": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/precond/-/precond-0.2.3.tgz", - "integrity": "sha1-qpWRvKokkj8eD0hJ0kD0fvwQdaw=" - }, "prelude-ls": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", @@ -17152,34 +17068,6 @@ "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" }, - "twilio-video": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/twilio-video/-/twilio-video-2.8.0.tgz", - "integrity": "sha512-TDL4GxlSqYE32zmN0nOVtsdIVAgValRl3LRBuUAuREsQXXk7oEWyXHqNIF1/N9Kvh5J5BVK6FvXnxSA5TsdLkA==", - "requires": { - "@twilio/webrtc": "4.3.2", - "backoff": "^2.5.0", - "ws": "^3.3.1", - "xmlhttprequest": "^1.8.0" - }, - "dependencies": { - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" - }, - "ws": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz", - "integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==", - "requires": { - "async-limiter": "~1.0.0", - "safe-buffer": "~5.1.0", - "ultron": "~1.1.0" - } - } - } - }, "type-check": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", @@ -17207,11 +17095,6 @@ "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz", "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==" }, - "ultron": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", - "integrity": "sha512-UIEXBNeYmKptWH6z8ZnqTeS8fV74zG0/eRU9VGkpzz+LIJNs8W/zM/L+7ctCkRrgbNnnR0xxw4bKOr0cW0N0Og==" - }, "unbox-primitive": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.2.tgz", diff --git a/package.json b/package.json index ffe5787d..83ed96ef 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,6 @@ "react-tooltip": "^4.2.8", "request": "^2.88.2", "ts-node": "^10", - "twilio-video": "^2.8.0", "uuid": "^8.3.2" }, "devDependencies": { @@ -53,7 +52,6 @@ "@types/react": "^16.9.43", "@types/react-dom": "^16.9.8", "@types/redis": "^2.8.25", - "@types/twilio-video": "^2.7.3", "@types/uuid": "^8.3.4", "@typescript-eslint/eslint-plugin": "^3.8.0", "@typescript-eslint/parser": "^3.8.0", diff --git a/server/cognitiveServicesKey/function.json b/server/cognitiveServicesKey/function.json deleted file mode 100644 index 69630370..00000000 --- a/server/cognitiveServicesKey/function.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "bindings": [ - { - "authLevel": "anonymous", - "type": "httpTrigger", - "direction": "in", - "name": "req", - "methods": [ - "get", - "post" - ] - }, - { - "type": "http", - "direction": "out", - "name": "res" - } - ], - "scriptFile": "../dist/cognitiveServicesKey/index.js" -} diff --git a/server/cognitiveServicesKey/index.ts b/server/cognitiveServicesKey/index.ts deleted file mode 100644 index 9a8b793a..00000000 --- a/server/cognitiveServicesKey/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { AzureFunction, Context, HttpRequest } from '@azure/functions' -import { getUserIdFromHeaders } from '../src/authenticate' - -const httpTrigger: AzureFunction = async function (context: Context, req: HttpRequest): Promise { - const userId = await getUserIdFromHeaders(context, req) - - if (!userId) { - context.res = { - status: 401, - body: 'The user name is required to ensure their access token' - } - return - } - - context.res = { - body: { - cognitiveServicesKey: process.env.COGNITIVE_SERVICES_KEY, - cognitiveServicesRegion: process.env.COGNITIVE_SERVICES_REGION - } - } -} - -export default httpTrigger diff --git a/server/cognitiveServicesKey/sample.dat b/server/cognitiveServicesKey/sample.dat deleted file mode 100644 index 2e609439..00000000 --- a/server/cognitiveServicesKey/sample.dat +++ /dev/null @@ -1,3 +0,0 @@ -{ - "name": "Azure" -} \ No newline at end of file diff --git a/server/leaveVideoChat/function.json b/server/leaveVideoChat/function.json deleted file mode 100644 index bf59585e..00000000 --- a/server/leaveVideoChat/function.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "bindings": [ - { - "authLevel": "anonymous", - "type": "httpTrigger", - "direction": "in", - "name": "req", - "methods": ["get", "post"] - }, - { - "type": "webPubSub", - "name": "actions", - "hub": "chat", - "direction": "out" - }, - { - "type": "http", - "direction": "out", - "name": "res" - } - ], - "scriptFile": "../dist/leaveVideoChat/index.js" -} diff --git a/server/leaveVideoChat/index.ts b/server/leaveVideoChat/index.ts deleted file mode 100644 index f0c6a150..00000000 --- a/server/leaveVideoChat/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { AzureFunction, Context, HttpRequest } from '@azure/functions' - -import { authenticatedAzureWrap } from '../src/azureWrap' -import leaveVideoChat from '../src/endpoints/leaveVideoChat' - -const httpTrigger: AzureFunction = async function (context: Context, req: HttpRequest): Promise { - await authenticatedAzureWrap(context, req, leaveVideoChat) -} - -export default httpTrigger diff --git a/server/leaveVideoChat/sample.dat b/server/leaveVideoChat/sample.dat deleted file mode 100644 index 2e609439..00000000 --- a/server/leaveVideoChat/sample.dat +++ /dev/null @@ -1,3 +0,0 @@ -{ - "name": "Azure" -} \ No newline at end of file diff --git a/server/package-lock.json b/server/package-lock.json index 4d630d1c..63776413 100644 --- a/server/package-lock.json +++ b/server/package-lock.json @@ -15,7 +15,6 @@ "redis": "^3.0.2", "storyboard-engine": "0.0.5", "tracery-grammar": "^2.7.4", - "twilio": "^3.55.0", "uuid": "^8.3.0" }, "devDependencies": { @@ -721,11 +720,6 @@ "node": ">=8" } }, - "node_modules/asap": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", - "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=" - }, "node_modules/async-retry": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/async-retry/-/async-retry-1.3.3.tgz", @@ -740,14 +734,6 @@ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" }, - "node_modules/axios": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", - "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", - "dependencies": { - "follow-redirects": "^1.14.0" - } - }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -888,11 +874,6 @@ "integrity": "sha512-HJSzj25iPm8E01nt+rSmCIlwjsmjvKfUivG/kXBglpymcHF1FolWAqWwTEV4FvN1Lx5UjPf0J1W4H8yQsVBfFg==", "optional": true }, - "node_modules/dayjs": { - "version": "1.10.4", - "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.10.4.tgz", - "integrity": "sha512-RI/Hh4kqRc1UKLOAf/T5zdMMX5DQIlDxwUe3wSyMMnEbGunnpENCdbUgM+dW7kXidZqCttBrmw7BhN4TMddkCw==" - }, "node_modules/debug": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", @@ -1075,25 +1056,6 @@ "@google-cloud/storage": "^5.3.0" } }, - "node_modules/follow-redirects": { - "version": "1.14.9", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.9.tgz", - "integrity": "sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w==", - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/RubenVerborgh" - } - ], - "engines": { - "node": ">=4.0" - }, - "peerDependenciesMeta": { - "debug": { - "optional": true - } - } - }, "node_modules/form-data": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.0.tgz", @@ -1517,11 +1479,6 @@ "resolved": "https://registry.npmjs.org/limiter/-/limiter-1.1.5.tgz", "integrity": "sha512-FWWMIEOxz3GwUI4Ts/IvgVy6LPvoMPgjMdQ185nN6psJyBJ4yOpzqm695/h5umdLJg2vW3GR5iG11MAkR2AzJA==" }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - }, "node_modules/lodash.camelcase": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", @@ -1746,11 +1703,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/pop-iterate": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/pop-iterate/-/pop-iterate-1.0.1.tgz", - "integrity": "sha1-zqz9q0q/NT16DyqqLB/Hs/lBO6M=" - }, "node_modules/priorityqueuejs": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/priorityqueuejs/-/priorityqueuejs-1.0.0.tgz", @@ -1835,32 +1787,6 @@ "node": ">=6" } }, - "node_modules/q": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/q/-/q-2.0.3.tgz", - "integrity": "sha1-dbjbAlWhpa+C9Yw/Oqoe/sfQ0TQ=", - "dependencies": { - "asap": "^2.0.0", - "pop-iterate": "^1.0.1", - "weak-map": "^1.0.5" - } - }, - "node_modules/qs": { - "version": "6.9.6", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.9.6.tgz", - "integrity": "sha512-TIRk4aqYLNoJUbd+g2lEdz5kLWIuTMRagAXxl78Q0RiVjAOugHmeKNGdd3cwo/ktpf9aL9epCfFqWDEKysUlLQ==", - "engines": { - "node": ">=0.6" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/querystringify": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", - "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" - }, "node_modules/readable-stream": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", @@ -1938,11 +1864,6 @@ "node": ">=0.10.0" } }, - "node_modules/requires-port": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", - "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=" - }, "node_modules/retry": { "version": "0.13.1", "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz", @@ -1965,11 +1886,6 @@ "node": ">=8.10.0" } }, - "node_modules/rootpath": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/rootpath/-/rootpath-0.1.2.tgz", - "integrity": "sha1-Wzeah9ypBum5HWkKWZQ5vvJn6ms=" - }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -1994,11 +1910,6 @@ "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" }, - "node_modules/scmp": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/scmp/-/scmp-2.1.0.tgz", - "integrity": "sha512-o/mRQGk9Rcer/jEEw/yw4mwo3EU/NvYvp577/Btqrym9Qy5/MdWGBqipbALgd2lrdWTJ5/gqDusxfnQBxOxT2Q==" - }, "node_modules/seedrandom": { "version": "2.4.4", "resolved": "https://registry.npmjs.org/seedrandom/-/seedrandom-2.4.4.tgz", @@ -2158,38 +2069,6 @@ "node": ">=0.6.11 <=0.7.0 || >=0.7.3" } }, - "node_modules/twilio": { - "version": "3.55.0", - "resolved": "https://registry.npmjs.org/twilio/-/twilio-3.55.0.tgz", - "integrity": "sha512-CQpe4Hv1Bd7miaLXMlWmN28eVO3NOzPDokBXIVTfPFOUhx+RPsmvxrn3MVEYgNLUFbKwps7LKib0DWm3i0sbVA==", - "dependencies": { - "axios": "^0.21.1", - "dayjs": "^1.8.29", - "jsonwebtoken": "^8.5.1", - "lodash": "^4.17.19", - "q": "2.0.x", - "qs": "^6.9.4", - "rootpath": "^0.1.2", - "scmp": "^2.1.0", - "url-parse": "^1.4.7", - "xmlbuilder": "^13.0.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependencies": { - "@types/express": "^4.17.7", - "@types/qs": "6.9.4" - } - }, - "node_modules/twilio/node_modules/xmlbuilder": { - "version": "13.0.2", - "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-13.0.2.tgz", - "integrity": "sha512-Eux0i2QdDYKbdbA6AM6xE4m6ZTZr4G4xF9kahI2ukSEMCzwce2eX9WlTI5J3s+NU7hpasFsr8hWIONae7LluAQ==", - "engines": { - "node": ">=6.0" - } - }, "node_modules/typedarray-to-buffer": { "version": "3.1.5", "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", @@ -2250,15 +2129,6 @@ "node": ">= 4.0.0" } }, - "node_modules/url-parse": { - "version": "1.5.10", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", - "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", - "dependencies": { - "querystringify": "^2.1.1", - "requires-port": "^1.0.0" - } - }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -2273,11 +2143,6 @@ "uuid": "dist/bin/uuid" } }, - "node_modules/weak-map": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/weak-map/-/weak-map-1.0.5.tgz", - "integrity": "sha1-eWkVhNmGB/UHC9O3CkDmuyLkAes=" - }, "node_modules/webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", @@ -3056,11 +2921,6 @@ "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==", "optional": true }, - "asap": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", - "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=" - }, "async-retry": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/async-retry/-/async-retry-1.3.3.tgz", @@ -3075,14 +2935,6 @@ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=" }, - "axios": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", - "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", - "requires": { - "follow-redirects": "^1.14.0" - } - }, "balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -3191,11 +3043,6 @@ "integrity": "sha512-HJSzj25iPm8E01nt+rSmCIlwjsmjvKfUivG/kXBglpymcHF1FolWAqWwTEV4FvN1Lx5UjPf0J1W4H8yQsVBfFg==", "optional": true }, - "dayjs": { - "version": "1.10.4", - "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.10.4.tgz", - "integrity": "sha512-RI/Hh4kqRc1UKLOAf/T5zdMMX5DQIlDxwUe3wSyMMnEbGunnpENCdbUgM+dW7kXidZqCttBrmw7BhN4TMddkCw==" - }, "debug": { "version": "4.3.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", @@ -3343,11 +3190,6 @@ "node-forge": "^0.10.0" } }, - "follow-redirects": { - "version": "1.14.9", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.9.tgz", - "integrity": "sha512-MQDfihBQYMcyy5dhRDJUHcw7lb2Pv/TuE6xP1vyraLukNDHKbDxDNaOE3NbCAdKQApno+GPRyo1YAp89yCjK4w==" - }, "form-data": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.0.tgz", @@ -3693,11 +3535,6 @@ "resolved": "https://registry.npmjs.org/limiter/-/limiter-1.1.5.tgz", "integrity": "sha512-FWWMIEOxz3GwUI4Ts/IvgVy6LPvoMPgjMdQ185nN6psJyBJ4yOpzqm695/h5umdLJg2vW3GR5iG11MAkR2AzJA==" }, - "lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - }, "lodash.camelcase": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", @@ -3876,11 +3713,6 @@ "yocto-queue": "^0.1.0" } }, - "pop-iterate": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/pop-iterate/-/pop-iterate-1.0.1.tgz", - "integrity": "sha1-zqz9q0q/NT16DyqqLB/Hs/lBO6M=" - }, "priorityqueuejs": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/priorityqueuejs/-/priorityqueuejs-1.0.0.tgz", @@ -3954,26 +3786,6 @@ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" }, - "q": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/q/-/q-2.0.3.tgz", - "integrity": "sha1-dbjbAlWhpa+C9Yw/Oqoe/sfQ0TQ=", - "requires": { - "asap": "^2.0.0", - "pop-iterate": "^1.0.1", - "weak-map": "^1.0.5" - } - }, - "qs": { - "version": "6.9.6", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.9.6.tgz", - "integrity": "sha512-TIRk4aqYLNoJUbd+g2lEdz5kLWIuTMRagAXxl78Q0RiVjAOugHmeKNGdd3cwo/ktpf9aL9epCfFqWDEKysUlLQ==" - }, - "querystringify": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz", - "integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==" - }, "readable-stream": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", @@ -4029,11 +3841,6 @@ "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", "optional": true }, - "requires-port": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", - "integrity": "sha1-kl0mAdOaxIXgkc8NpcbmlNw9yv8=" - }, "retry": { "version": "0.13.1", "resolved": "https://registry.npmjs.org/retry/-/retry-0.13.1.tgz", @@ -4050,11 +3857,6 @@ "extend": "^3.0.2" } }, - "rootpath": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/rootpath/-/rootpath-0.1.2.tgz", - "integrity": "sha1-Wzeah9ypBum5HWkKWZQ5vvJn6ms=" - }, "safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -4065,11 +3867,6 @@ "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==" }, - "scmp": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/scmp/-/scmp-2.1.0.tgz", - "integrity": "sha512-o/mRQGk9Rcer/jEEw/yw4mwo3EU/NvYvp577/Btqrym9Qy5/MdWGBqipbALgd2lrdWTJ5/gqDusxfnQBxOxT2Q==" - }, "seedrandom": { "version": "2.4.4", "resolved": "https://registry.npmjs.org/seedrandom/-/seedrandom-2.4.4.tgz", @@ -4205,30 +4002,6 @@ "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==" }, - "twilio": { - "version": "3.55.0", - "resolved": "https://registry.npmjs.org/twilio/-/twilio-3.55.0.tgz", - "integrity": "sha512-CQpe4Hv1Bd7miaLXMlWmN28eVO3NOzPDokBXIVTfPFOUhx+RPsmvxrn3MVEYgNLUFbKwps7LKib0DWm3i0sbVA==", - "requires": { - "axios": "^0.21.1", - "dayjs": "^1.8.29", - "jsonwebtoken": "^8.5.1", - "lodash": "^4.17.19", - "q": "2.0.x", - "qs": "^6.9.4", - "rootpath": "^0.1.2", - "scmp": "^2.1.0", - "url-parse": "^1.4.7", - "xmlbuilder": "^13.0.2" - }, - "dependencies": { - "xmlbuilder": { - "version": "13.0.2", - "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-13.0.2.tgz", - "integrity": "sha512-Eux0i2QdDYKbdbA6AM6xE4m6ZTZr4G4xF9kahI2ukSEMCzwce2eX9WlTI5J3s+NU7hpasFsr8hWIONae7LluAQ==" - } - } - }, "typedarray-to-buffer": { "version": "3.1.5", "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", @@ -4276,15 +4049,6 @@ "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" }, - "url-parse": { - "version": "1.5.10", - "resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz", - "integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==", - "requires": { - "querystringify": "^2.1.1", - "requires-port": "^1.0.0" - } - }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", @@ -4296,11 +4060,6 @@ "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.0.tgz", "integrity": "sha512-fX6Z5o4m6XsXBdli9g7DtWgAx+osMsRRZFKma1mIUsLCz6vRvv+pz5VNbyu9UEDzpMWulZfvpgb/cmDXVulYFQ==" }, - "weak-map": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/weak-map/-/weak-map-1.0.5.tgz", - "integrity": "sha1-eWkVhNmGB/UHC9O3CkDmuyLkAes=" - }, "webidl-conversions": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", diff --git a/server/package.json b/server/package.json index d4f1d768..5dae71f9 100644 --- a/server/package.json +++ b/server/package.json @@ -18,7 +18,6 @@ "redis": "^3.0.2", "storyboard-engine": "0.0.5", "tracery-grammar": "^2.7.4", - "twilio": "^3.55.0", "uuid": "^8.3.0" }, "devDependencies": { diff --git a/server/sendCaption/function.json b/server/sendCaption/function.json deleted file mode 100644 index 845c7601..00000000 --- a/server/sendCaption/function.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "bindings": [ - { - "authLevel": "anonymous", - "type": "httpTrigger", - "direction": "in", - "name": "req", - "methods": ["get", "post"] - }, - { - "type": "webPubSub", - "name": "actions", - "hub": "chat", - "direction": "out" - }, - { - "type": "http", - "direction": "out", - "name": "res" - }, - { - "tableName": "auditLog", - "name": "tableBinding", - "type": "table", - "direction": "out" - } - ], - "scriptFile": "../dist/sendCaption/index.js" -} diff --git a/server/sendCaption/index.ts b/server/sendCaption/index.ts deleted file mode 100644 index a9958cc7..00000000 --- a/server/sendCaption/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { AzureFunction, Context, HttpRequest } from '@azure/functions' -import { authenticatedAzureWrap } from '../src/azureWrap' -import sendCaption from '../src/endpoints/sendCaption' - -const httpTrigger: AzureFunction = async function ( - context: Context, - req: HttpRequest -): Promise { - await authenticatedAzureWrap(context, req, sendCaption, { audit: true }) -} - -export default httpTrigger diff --git a/server/sendCaption/sample.dat b/server/sendCaption/sample.dat deleted file mode 100644 index 2e609439..00000000 --- a/server/sendCaption/sample.dat +++ /dev/null @@ -1,3 +0,0 @@ -{ - "name": "Azure" -} \ No newline at end of file diff --git a/server/src/cosmosdb.ts b/server/src/cosmosdb.ts index 452287e0..113bba26 100644 --- a/server/src/cosmosdb.ts +++ b/server/src/cosmosdb.ts @@ -137,34 +137,6 @@ const CosmosDB = { } }, - // WARNING: This is currently broken. - // Needs to be updated to return a string list of all userIds in the user's current room - async updateVideoPresenceForUser (user: User, isActive: boolean) { - const data = { ...user, isInVideoChat: isActive } - - try { - const container = getContainer('users') - await container.item(user.id, partitionKey).replace(data) - return [] - } catch (e) { - console.log('ERROR: Could not update user video presence', user.id, isActive, e) - } - }, - - // TODO: Should this be shoved into roomOccupants? - async getVideoPresenceForRoom (roomId: string) { - const container = await getContainer('users') - const query = { - query: 'select c.id from c where c.videoRoomId = @roomId and c.isActive = true', - parameters: [{ - name: '@videoRoomId', - value: roomId - }] - } - const { resources: users } = await container.items.query(query, { partitionKey }).fetchAll() - return users - }, - async getPublicUser (userId: string) { const container = await getContainer('users') const result = await container.item(userId, partitionKey).read() diff --git a/server/src/database.ts b/server/src/database.ts index 76d3c7ec..aa6e3b01 100644 --- a/server/src/database.ts +++ b/server/src/database.ts @@ -50,12 +50,6 @@ interface Database { /** Removes a user from their current room, and adds them to a new room */ setCurrentRoomForUser(user: User, roomId: string); - /** Updates the status and returns an array of userIds with active video in the given user's room */ - updateVideoPresenceForUser (user: User, isActive: boolean): Promise; - - /* Returns a list of users currently in videochat */ - getVideoPresenceForRoom(roomId: string): Promise - // ----------------------------------------------------------------- // USER DATA // ----------------------------------------------------------------- diff --git a/server/src/endpoints/leaveVideoChat.ts b/server/src/endpoints/leaveVideoChat.ts deleted file mode 100644 index 328fe90f..00000000 --- a/server/src/endpoints/leaveVideoChat.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { AuthenticatedEndpointFunction, LogFn } from '../endpoint' -import { User } from '../user' -import { DB } from '../database' - -// TODO: Fully remove this, as video chat is no longer supported and this should never be invoked on account of there -// being no way to enter video chat! -const leaveVideoChat: AuthenticatedEndpointFunction = async (user: User, inputs: any, log: LogFn) => { - const videoChatters = await DB.updateVideoPresenceForUser(user, false) - - return { - messages: [] - } -} - -export default leaveVideoChat diff --git a/server/src/endpoints/sendCaption.ts b/server/src/endpoints/sendCaption.ts deleted file mode 100644 index ebed2748..00000000 --- a/server/src/endpoints/sendCaption.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { AuthenticatedEndpointFunction, LogFn } from '../endpoint' - -import { MESSAGE_MAX_LENGTH } from '../config' -import { User } from '../user' - -const sendCaption: AuthenticatedEndpointFunction = async (user: User, inputs: any, log: LogFn) => { - const message = inputs.text - if (!message) { - return { - httpResponse: { - status: 500, - body: 'Include a user ID and a message!' - } - } - } else if (message.length > MESSAGE_MAX_LENGTH) { - // TODO: Not sure if this makes sense for captions. - return { - httpResponse: { - status: 400, - body: 'Message length too long!' - } - } - } - - log(`Sending caption to ${user.roomId}: ${message} from ${user.id}`) - - return { - messages: [ - { - groupId: user.roomId, - target: 'caption', - arguments: [inputs.id, user.id, message] - } - ], - httpResponse: { status: 200 } - } -} - -export default sendCaption diff --git a/server/src/redis.ts b/server/src/redis.ts index a0c303d5..3b6f14ac 100644 --- a/server/src/redis.ts +++ b/server/src/redis.ts @@ -145,20 +145,6 @@ const Redis: RedisInternal = { await Redis.addOccupantToRoom(roomId, user.id) }, - async updateVideoPresenceForUser (user: User, isActive: boolean) { - if (isActive) { - await addToSet(videoPresenceKey(user.roomId), user.id) - } else { - await removeFromSet(videoPresenceKey(user.roomId), user.id) - } - - return await Redis.getVideoPresenceForRoom(user.roomId) - }, - - async getVideoPresenceForRoom (roomId: string) { - return await getSet(videoPresenceKey(roomId)) || [] - }, - // User async getUser (userId: string) { const userData = await getCache(profileKeyForUser(userId)) @@ -447,9 +433,6 @@ function roomNotesKey (roomId: string): string { return `${roomId}Notes` } -export function videoPresenceKey (roomId: string) { - return `${roomId}PresenceVideo` -} const userMapKey = 'userMap' const spaceAvailabilityKey = 'spaceIsClosed' diff --git a/server/src/rooms/index.ts b/server/src/rooms/index.ts index e868080d..465e44ac 100644 --- a/server/src/rooms/index.ts +++ b/server/src/rooms/index.ts @@ -15,7 +15,8 @@ export interface Room { description: string - // If true, webRTC audio/video chat is enabled + // If true, video chat is enabled + // This currently does nothing, but leaving in place for hypothetical Zoom integration mediaChat?: boolean // Indicates whether the room should let users place post-it notes @@ -32,11 +33,6 @@ export interface Room { specialFeatures?: string[] // 'RAINBOW_DOOR'|'DULL_DOOR'|'FULL_ROOM_INDEX'|'VENDING_MACHINE' - // The GUID for a corresponding ACS videochat room - // This should hopefully eventually be auto-generated and mandatory - // but hand-coding for testing purposes now - chatGuid?: string - riddles?: string[] // Array of users currently in this room diff --git a/server/twilioToken/function.json b/server/twilioToken/function.json deleted file mode 100644 index 21433d07..00000000 --- a/server/twilioToken/function.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "bindings": [ - { - "authLevel": "anonymous", - "type": "httpTrigger", - "direction": "in", - "name": "req", - "methods": [ - "get", - "post" - ] - }, - { - "type": "http", - "direction": "out", - "name": "res" - } - ], - "scriptFile": "../dist/twilioToken/index.js" -} diff --git a/server/twilioToken/index.ts b/server/twilioToken/index.ts deleted file mode 100644 index 2d6e3b2b..00000000 --- a/server/twilioToken/index.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { AzureFunction, Context, HttpRequest } from '@azure/functions' -import { getUserIdFromHeaders } from '../src/authenticate' -import Twilio from 'twilio' - -const VideoGrant = Twilio.jwt.AccessToken.VideoGrant -const MAX_ALLOWED_SESSION_DURATION = 14400 - -const httpTrigger: AzureFunction = async function (context: Context, req: HttpRequest): Promise { - const userId = await getUserIdFromHeaders(context, req) - - if (!userId) { - context.res = { - status: 401, - body: 'The user name is required to ensure their access token' - } - } - - const token = new Twilio.jwt.AccessToken( - process.env.TWILIO_ACCOUNT_SID, - process.env.TWILIO_API_KEY, - process.env.TWILIO_API_SECRET, - { ttl: MAX_ALLOWED_SESSION_DURATION } - ); - - // Assign the generated identity to the token. - // This code used to work, then we switched from require to import - // This production code seems to work (famous last words) - // so tentatively Just A TypeScript Thing? - // (Em, 8/14/22) - (token as any).identity = userId - - // Grant the access token Twilio Video capabilities. - const grant = new VideoGrant() - token.addGrant(grant) - - // Serialize the token to a JWT string. - context.res = { - body: token.toJwt() - } -} - -export default httpTrigger diff --git a/server/twilioToken/sample.dat b/server/twilioToken/sample.dat deleted file mode 100644 index 2e609439..00000000 --- a/server/twilioToken/sample.dat +++ /dev/null @@ -1,3 +0,0 @@ -{ - "name": "Azure" -} \ No newline at end of file diff --git a/src/Actions.ts b/src/Actions.ts index acd9237d..fdcf6005 100644 --- a/src/Actions.ts +++ b/src/Actions.ts @@ -20,7 +20,6 @@ export type Action = | PlayerConnectedAction | PlayerDisconnectedAction | ChatMessageAction - | CaptionMessageAction | ModMessageAction | DeleteMessageAction | ChatReadyAction @@ -37,13 +36,8 @@ export type Action = | PlayerBannedAction | PlayerUnbannedAction | UpdateProfileColorAction - | MediaReceivedSpeakingDataAction - | StopVideoChatAction - | StartVideoChatAction | ErrorAction - | RefreshReactAction | SendMessageAction - | SendCaptionAction | SetNameAction | StartWhisperAction | ShowProfileAction @@ -68,11 +62,6 @@ export type Action = | DeactivateAutoscrollAction | ActivateAutoscrollAction | SetUseSimpleNamesAction - | SetKeepCameraWhenMovingAction - | SetTextOnlyModeAction - | SetAudioOnlyModeAction - | SetNumberOfFacesAction - | SetCaptionsEnabledAction | SpaceIsClosedAction | SpaceOpenedOrClosedAction | CommandMessageAction @@ -108,12 +97,7 @@ export enum ActionType { PlayerUnbanned = 'PLAYER_UNBANNED', UpdateProfileColor = 'UPDATE_PROFILE_COLOR', UpdateFontReward = 'UPDATE_FONT_REWARD', - // WebRTC - StopVideoChat = 'STOP_VIDEO_CHAT', - StartVideoChat = 'START_VIDEO_CHAT', - MediaReceivedSpeakingData = 'MEDIA_RECEIVED_SPEAKING_DATA', // UI actions - RefreshReact = 'REFRESH_REACT', SendMessage = 'SEND_MESSAGE', SendCaption = 'SEND_CAPTION', SetName = 'SET_NAME', @@ -127,11 +111,6 @@ export enum ActionType { DeactivateAutoscroll = 'DEACTIVATE_AUTOSCROLL', ActivateAutoscroll = 'ACTIVATE_AUTOSCROLL', SetUseSimpleNames = 'SET_USE_SIMPLE_NAMES', - SetKeepCameraWhenMoving = 'SET_KEEP_CAMERA_WHEN_MOVING', - SetTextOnlyMode = 'SET_TEXT_ONLY_MODE', - SetAudioOnlyMode = 'SET_AUDIO_ONLY_MODE', - SetNumberOfFaces = 'SET_NUMBER_OF_FACES', - SetCaptionsEnabled = 'SET_CAPTIONS_ENABLED', // Authenticate = 'AUTHENTICATE', IsRegistered = 'IS_REGISTERED', @@ -321,26 +300,6 @@ export const ChatMessageAction = ( } } -interface CaptionMessageAction { - type: ActionType.CaptionMessage; - value: { - messageId: string; - name: string; - message: string; - }; -} - -export const CaptionMessageAction = ( - messageId: string, - name: string, - message: string -): CaptionMessageAction => { - return { - type: ActionType.CaptionMessage, - value: { messageId, name, message } - } -} - interface WhisperAction { type: ActionType.Whisper; value: { @@ -560,36 +519,6 @@ export const UpdateFontRewardAction = ( } } -interface MediaReceivedSpeakingDataAction { - type: ActionType.MediaReceivedSpeakingData; - value: string; -} - -export const MediaReceivedSpeakingDataAction = ( - participantId: string -): MediaReceivedSpeakingDataAction => { - return { - type: ActionType.MediaReceivedSpeakingData, - value: participantId - } -} - -interface StopVideoChatAction { - type: ActionType.StopVideoChat; -} - -export const StopVideoChatAction = (): StopVideoChatAction => { - return { type: ActionType.StopVideoChat } -} - -interface StartVideoChatAction { - type: ActionType.StartVideoChat; -} - -export const StartVideoChatAction = (): StartVideoChatAction => { - return { type: ActionType.StartVideoChat } -} - interface ErrorAction { type: ActionType.Error; value: string; @@ -604,34 +533,11 @@ export const ErrorAction = (error: string): ErrorAction => { // UI Actions -// HACK ALERT: Used to force a re-render, but ideally the data relevant to the re-render should be tied to the action. -// Used right now because of timing issues in room presence between the client state and Twilio. -interface RefreshReactAction { - type: ActionType.RefreshReact; -} - -export const RefreshReactAction = (): RefreshReactAction => { - return { - type: ActionType.RefreshReact - } -} - interface SendMessageAction { type: ActionType.SendMessage; value: string; } -export const SendCaptionAction = (message: string): SendCaptionAction => { - return { - type: ActionType.SendCaption, - value: message - } -} -interface SendCaptionAction { - type: ActionType.SendCaption; - value: string; -} - export const SendMessageAction = (message: string): SendMessageAction => { return { type: ActionType.SendMessage, @@ -771,76 +677,6 @@ export const SetUseSimpleNamesAction = ( return { type: ActionType.SetUseSimpleNames, value: useSimpleNames } } -interface SetKeepCameraWhenMovingAction { - type: ActionType.SetKeepCameraWhenMoving; - value: boolean; -} - -export const SetKeepCameraWhenMovingAction = ( - keepCameraWhenMoving: boolean -): SetKeepCameraWhenMovingAction => { - return { - type: ActionType.SetKeepCameraWhenMoving, - value: keepCameraWhenMoving - } -} - -interface SetTextOnlyModeAction { - type: ActionType.SetTextOnlyMode; - textOnlyMode: boolean; - refresh: boolean; -} - -export const SetTextOnlyModeAction = ( - textOnlyMode: boolean, - refresh: boolean -): SetTextOnlyModeAction => { - return { - type: ActionType.SetTextOnlyMode, - textOnlyMode: textOnlyMode, - refresh: refresh - } -} - -interface SetAudioOnlyModeAction { - type: ActionType.SetAudioOnlyMode; - value: boolean; -} - -export const SetAudioOnlyModeAction = ( - enable: boolean -): SetAudioOnlyModeAction => { - return { - type: ActionType.SetAudioOnlyMode, - value: enable - } -} -interface SetCaptionsEnabledAction { - type: ActionType.SetCaptionsEnabled; - value: boolean; -} - -export const SetCaptionsEnabledAction = ( - enable: boolean -): SetCaptionsEnabledAction => { - return { - type: ActionType.SetCaptionsEnabled, - value: enable - } -} - -interface SetNumberOfFacesAction { - type: ActionType.SetNumberOfFaces; - value: number; -} - -export const SetNumberOfFacesAction = (num: number): SetNumberOfFacesAction => { - return { - type: ActionType.SetNumberOfFaces, - value: num - } -} - export const AuthenticateAction = ( userId: string | undefined, name: string | undefined, diff --git a/src/App.tsx b/src/App.tsx index fe952793..a62174b8 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -9,10 +9,6 @@ import { LoadMessageArchiveAction, PlayerBannedAction, SendMessageAction, - SetCaptionsEnabledAction, - SetKeepCameraWhenMovingAction, - SetNumberOfFacesAction, - SetTextOnlyModeAction, SetUseSimpleNamesAction, ShowSideMenuAction, SpaceIsClosedAction @@ -33,8 +29,6 @@ import HelpView from './components/HelpView' import InputView from './components/InputView' import LoggedOutView from './components/LoggedOutView' import MapModalView from './components/MapModalView' -import MediaChatView from './components/MediaChatView' -import MediaSelectorView from './components/MediaSelectorView' import { MessageList } from './components/MessageList' import { ModalView } from './components/ModalView' import { NoteWallView } from './components/NoteWallView' @@ -56,7 +50,6 @@ import { checkIsRegistered, connect } from './networking' import reducer, { defaultState, State } from './reducer' import * as Storage from './storage' import { ThunkDispatch, useReducerWithThunk } from './useReducerWithThunk' -import { TwilioChatContextProvider } from './videochat/twilioChatContext' import SpecialTextModalView from './components/SpecialTextModalView' import ReactTooltip from 'react-tooltip' import { ObeliskView } from './components/ObeliskView' @@ -144,47 +137,15 @@ const App = () => { const useSimpleNames = await Storage.getUseSimpleNames() dispatch(SetUseSimpleNamesAction(useSimpleNames)) - const keepCameraWhenMoving = await Storage.getKeepCameraWhenMoving() - dispatch(SetKeepCameraWhenMovingAction(keepCameraWhenMoving)) - const textOnlyMode = await Storage.getTextOnlyMode() - dispatch(SetTextOnlyModeAction(textOnlyMode, false)) - const captionsEnabled = await Storage.getCaptionsEnabled() - dispatch(SetCaptionsEnabledAction(captionsEnabled)) dispatch(IsRegisteredAction()) connect(userId, dispatch) - // WARNING: Prior to the "calculate number of faces for videochat" code, - // there was a no-op resize handler here. - // window.addEventListener('resize', () => {}) - // I frankly have no idea what this was doing, - // and worry my changes will cause unexpected errors - // -Em, 10/12/2021 + // WARNING: I don't know what this does. + // When videochat existed, we had a warning that this no-op existed prior to videochat + // So when I removed videochat, I left it here + // (-Emilia) window.addEventListener('resize', () => {}) - const onResize = () => { - // It seems like a smell to do this in here and have to grab into #main, - // but I think it's fine? - const VideoWidth = 180 - const $main = document.getElementById('main') - // Addendum: in Firefox on Windows sometimes we get into this function with 'main' as null! - if ($main) { - const numberOfFaces = - Math.floor($main.clientWidth / VideoWidth) - 1 - dispatch(SetNumberOfFacesAction(numberOfFaces)) - } else { - console.warn( - "Attempted to call onResize when 'main' element was null; will default to show no faces" - ) - } - } - - // Our initial paint time is stupid slow - // but waiting a long time seems to ensure that #main exists - setTimeout(onResize, 2000) - window.addEventListener( - 'resize', - _.throttle(onResize, 100, { trailing: true }) - ) } }) }, []) @@ -239,28 +200,6 @@ const App = () => { return } - // It's slightly weird we now construct this here and pass it as a prop to - // RoomView instead of constructing it there. Shrug, the conf is in 2 days. - let videoChatView - if ( - state.roomData && - state.roomId && - state.roomData[state.roomId] && - state.roomData[state.roomId].mediaChat - ) { - videoChatView = ( - - ) - } - let innerModalView, modalView // TODO: If we get more modal options than just a size boolean, make this an options object. @@ -295,29 +234,11 @@ const App = () => { case Modal.Settings: { innerModalView = ( ) break } - case Modal.MediaSelector: { - console.log('Opening media selector') - // TODO: Fix this userIsSpeaking (it was...broken in the first place but if we're bordering we should do it here) - innerModalView = ( - - ) - break - } case Modal.Badges: { innerModalView = ( { - - - + + - - -
- - {shouldShowMenu ? ( - - - {/* Once we moved the sidebar to be position:fixed, we still + +
+ + {shouldShowMenu ? ( + + + {/* Once we moved the sidebar to be position:fixed, we still needed something to take up its space in the CSS grid. This should be fixable via CSS, but sigh, it's 3 days before the event */} -
- - ) : ( - - )} - {modalView} -
- {state.roomData[state.roomId] ? ( - - ) : null} - - - - - dispatch(SendMessageAction(message)) - } - usersInRoom={state.roomData[state.roomId]?.users} + + + )} + {modalView} +
+ {state.roomData[state.roomId] ? ( + + ) : null} + + -
- {profile} + + + dispatch(SendMessageAction(message)) + } + usersInRoom={state.roomData[state.roomId]?.users} + />
- - - - - + {profile} +
+ + + + diff --git a/src/audioAnalysis.ts b/src/audioAnalysis.ts deleted file mode 100644 index 6a4eb567..00000000 --- a/src/audioAnalysis.ts +++ /dev/null @@ -1,84 +0,0 @@ -import { Dispatch } from 'react' -import { - Action, - MediaReceivedSpeakingDataAction -} from './Actions' - -/* "Who's speaking" implementation notes - * In another iteration of videochat, all audio streams got run through this audio analyzer code - * Such that, when someone made a bunch of noise, their WebRTC PeerID got dispatched and set on an array of - * IDs of "people who are speaking", which gets passed into MediaChatView. - * - * What currently exists: - * - this analysis code is currently not referenced, but probably needs tweaking to handle Twilio IDs - * - MediaChatView still gets a list of 'speaking' peers, but doesn't do anything with that data. - * - * I suspect we want to throw this out, and each individual speaker view should be responsible for detecting - * whether it's speaking and updating the UI appropriately. - * I also believe Twilio might give us some of this data automatically if we ask for it. - * - * I'm temporarily leaving all this code in place in case we want it. - * But if you implement a different system and don't touch any of this, feel free to completely remove - * this file, MediaReceivedSpeakingDataAction, state.speakingPeerIds, and everything that falls out from that. -*/ - -/* -const peerAnalysers: [string, AnalyserNode][] = [] - -function setUpAnalyser (stream: MediaStream): AnalyserNode { - const audioCtx = new (window.AudioContext || - (window as any).webkitAudioContext)() - const source = audioCtx.createMediaStreamSource(stream) - var analyser = audioCtx.createAnalyser() - analyser.minDecibels = -90 - analyser.maxDecibels = -10 - analyser.smoothingTimeConstant = 0.85 - - source.connect(analyser) - - return analyser -} - -let shouldStopAnalysing = false -function startAnalyserLoop (dispatch: Dispatch) { - console.log('Starting analyser loop') - - const average = (ns: Uint8Array) => { - let sum = 0 - for (let i = 0; i < ns.length; i++) { - sum += ns[i] - } - return (sum /= ns.length) - } - - const analyse = () => { - const list: string[] = [] - - if (shouldStopAnalysing) { - shouldStopAnalysing = false - return - } - - peerAnalysers.forEach(([id, a]) => { - a.fftSize = 2048 - const bufferLength = a.fftSize - const byteFrequencyDataArray = new Uint8Array(bufferLength) - - a.getByteFrequencyData(byteFrequencyDataArray) - - if (average(byteFrequencyDataArray) > 1) { - list.push(id) - } - }) - - dispatch(MediaReceivedSpeakingDataAction(list)) - - window.requestAnimationFrame(analyse) - } - window.requestAnimationFrame(analyse) -} - -export function stopAudioAnalyserLoop () { - shouldStopAnalysing = true -} -*/ diff --git a/src/components/LocalMediaView.tsx b/src/components/LocalMediaView.tsx deleted file mode 100644 index fbc915c1..00000000 --- a/src/components/LocalMediaView.tsx +++ /dev/null @@ -1,82 +0,0 @@ -import React, { useState, useContext } from 'react' -import { FaCog, FaVolumeUp, FaVolumeMute, FaVideo, FaVideoSlash, FaUser } from 'react-icons/fa' - -import { DispatchContext } from '../App' -import { ShowModalAction } from '../Actions' -import { Modal } from '../modals' -import { useMediaChatContext } from '../videochat/mediaChatContext' - -interface Props { - speaking: boolean - hideUI?: boolean -} - -export default function LocalMediaView (props: Props) { - const dispatch = useContext(DispatchContext) - const { localStreamView, setMicEnabled, setCameraEnabled, cameraEnabled, micEnabled } = useMediaChatContext() - - const onChangeVideo = (e) => { - setCameraEnabled(!cameraEnabled) - } - - const onChangeAudio = (e) => { - setMicEnabled(!micEnabled) - } - - const showMediaSelector = () => { - dispatch(ShowModalAction(Modal.MediaSelector)) - } - - if (!localStreamView) { - return null - } - - return ( -
- You - {cameraEnabled ? ( - localStreamView - ) : ( - - )} - {props.hideUI ? ( - '' - ) : ( -
- - - -
- )} -
- ) -} diff --git a/src/components/MediaChatButtonView.tsx b/src/components/MediaChatButtonView.tsx deleted file mode 100644 index 913b87b7..00000000 --- a/src/components/MediaChatButtonView.tsx +++ /dev/null @@ -1,185 +0,0 @@ -import React from 'react' -import { FaCog } from 'react-icons/fa' -import { SetAudioOnlyModeAction, SetTextOnlyModeAction, ShowModalAction, ShowModalWithOptionsAction, StopVideoChatAction } from '../Actions' -import { DispatchContext } from '../App' -import { Modal } from '../modals' -import { useMediaChatContext } from '../videochat/mediaChatContext' - -interface Props { - inMediaChat: boolean - textOnlyMode: boolean - offscreenCount: number - totalCount: number - audioOnlyMode: boolean - canJoinVideoChat: boolean -} -const MediaChatButtonView = (props: Props) => { - const { - currentMic, - currentCamera, - publishingCamera, - publishingMic, - inCall, - publishMedia, - publishAudio, - unpublishMedia - } = useMediaChatContext() - - const dispatch = React.useContext(DispatchContext) - - const leaveVideoChat = () => { - dispatch(StopVideoChatAction()) - unpublishMedia() - } - - const joinVideoChat = async () => { - if (!props.canJoinVideoChat) return - if (currentMic || currentCamera) { - publishMedia() - } else { - dispatch(ShowModalAction(Modal.MediaSelector)) - } - } - - const showMediaSelector = () => { - dispatch(ShowModalAction(Modal.MediaSelector)) - } - - const joinAudioChat = async () => { - if (!props.canJoinVideoChat) return - if (currentMic) { - publishAudio() - } else { - dispatch( - ShowModalWithOptionsAction(Modal.MediaSelector, { hideVideo: true }) - ) - } - } - - const enableTextOnlyMode = () => { - const prompt = confirm('This will disable all audio/video aspects of this space other than the ' + - 'stream in the theater. You will no longer be able to see or hear other participants, but you can still ' + - 'interact via text chat.\n\nSwitching modes will refresh your page - please be patient while it reloads.' - ) - if (prompt) { - dispatch(SetTextOnlyModeAction(true, true)) - } - } - - const disableTextOnlyMode = () => { - const prompt = confirm('Re-enabling video and audio mode means that you will be able to see and hear video and audio from ' + - 'other participants. Your camera and microphone will default to off when you switch modes.\b\n\nSwitching modes will ' + - 'refresh your page - please be patient while it reloads.' - ) - if (prompt) { - dispatch(SetTextOnlyModeAction(false, true)) - } - } - - const toggleAudioOnlyMode = () => { - let text - if (props.audioOnlyMode) { - text = - 'This will show you others' webcam feeds. ' + - 'This will not affect whether or not you are sending your own webcam feed to others.' - } else { - text = 'This will hide all video feeds from other attendees. ' + - "You will still be able to hear them, but you won't see them. This may improve performance if things are slow.\n\n" + - 'Note that you will still broadcast your webcam feed to others if you enable it, and you will ' + - 'still be able to see the talks broadcast in the Theater.' - } - const prompt = confirm(text) - if (prompt) { - dispatch(SetAudioOnlyModeAction(!props.audioOnlyMode)) - } - } - - let chatButtons - if (props.inMediaChat) { - let leaveButtonLabel = '' - if (publishingCamera && publishingMic) { - leaveButtonLabel = 'Turn off Webcam and Mic' - } else if (publishingCamera) { - // This case shouldn't ever exist with the current UI - leaveButtonLabel = 'Turn off Webcam' - } else if (publishingMic) { - leaveButtonLabel = 'Turn off Mic' - } - chatButtons = ( - <> - - - - ) - } else if (props.textOnlyMode) { - chatButtons = [ - - ] - } else if (props.canJoinVideoChat) { - chatButtons = [ - , - , - - ] - } - - var offscreenLabel - if (props.totalCount > 0) { - offscreenLabel = ( -
- {props.totalCount} {props.totalCount === 1 ? 'person is' : 'people are'} in the call{publishingCamera || publishingMic ? ', not including you' : ''}. -
- ) - } - - return ( -
- {offscreenLabel} - {chatButtons} -
- - -
-
- ) -} - -export default MediaChatButtonView diff --git a/src/components/MediaChatView.tsx b/src/components/MediaChatView.tsx deleted file mode 100644 index 5ddaa18d..00000000 --- a/src/components/MediaChatView.tsx +++ /dev/null @@ -1,161 +0,0 @@ -import React, { useEffect, VideoHTMLAttributes, useRef, useState } from 'react' -import LocalMediaView from './LocalMediaView' - -import '../../style/videoChat.css' -import { useMediaChatContext } from '../videochat/mediaChatContext' -import ParticipantChatView from './ParticipantChatView' -import MediaChatButtonView from './MediaChatButtonView' -import { SetTextOnlyModeAction } from '../Actions' -import { DispatchContext } from '../App' -import { MinimalUser } from '../../server/src/user' - -interface MediaProps { - visibleSpeakers: [string, Date][] - currentSpeaker: string - numberOfFaces: number - inMediaChat: boolean - textOnlyMode: boolean - audioOnlyMode: boolean - currentUser: MinimalUser -} - -export default function MediaChatView (props: MediaProps) { - const { publishingCamera, callParticipants, inCall, joinCallFailed } = useMediaChatContext() - const dispatch = React.useContext(DispatchContext) - - // TODO: props.visibleSpeakers should never be undefined, but it is?! - const visibleSpeakers = (props.visibleSpeakers || []).map(x => x[0]) - - console.log('Re-rendering media chat view?') - - if (!inCall) { - if (joinCallFailed) { - return ( -
- - Could not connect to audio/video! Rooms are max 50 chatters - if you - want to use audio/video, try moving to another room. Otherwise, it - may be a network issue. - -
- ) - } else if (props.textOnlyMode) { - const disableTextMode = () => { - const prompt = confirm('Entering video/audio mode means that you will be able to see and hear video and audio from ' + - 'other participants. Your camera and microphone will default to off when you switch modes. Switching modes will ' + - 'refresh your page - please be patient while it reloads.' - ) - if (prompt) { - dispatch(SetTextOnlyModeAction(false, true)) - } - } - - return ( -
- There may be a voice/video call happening here that you can't see. - . -
- ) - } else { - return ( -
- Attempting to connect to room. -
- ) - } - } - - // TODO: Is this a meaningful fail state? What causes this? s - if (!callParticipants) { - return
- } - - let playerVideo - if (publishingCamera) { - playerVideo = - } - - const participants = Array.from(callParticipants.values()) - .filter(p => p.audioTracks.size + p.videoTracks.size > 0) - - const videoParticipantIds = participants - .filter((p) => visibleSpeakers.includes(p.identity)) - - const audioParticipantIds = participants - .filter((p) => !visibleSpeakers.includes(p.identity)) - - console.log('[NUM_FACES]: ', props.numberOfFaces) - // We might have folks on video, but no "dominantSpeaker" notifications generated yet. - // We should still flesh out the wall o' faces in that situation. - // NOTE: This will result in video folks being added in whatever they appear in an Arrayified callParticipants - // I don't know what that ordering is, or if it's deterministic. - while (videoParticipantIds.length < props.numberOfFaces && audioParticipantIds.length > 0) { - videoParticipantIds.push(audioParticipantIds.shift()) - } - - const videoParticipants = videoParticipantIds.map((p) => { - return ( - - ) - }) - - const audioParticipants = audioParticipantIds - .map((p) => { - - }) - - // TODO: This will eventually need to check for speakers as well - // It's unclear to me if this logic should live here - // (vs inside MediaChatButtonView, or in the data model proper) - const canJoinVideoChat = props.currentUser.isMod - - // If we're showing the bar, we don't override the height; if we're hiding we force it to 0. - // We still want it to render the audioParticipants, so that's why we still paint it. - // TODO: this is jank - const customStyle = { height: playerVideo || (!props.audioOnlyMode && videoParticipants.length > 0) ? undefined : '0px' } - return ( -
-
- {playerVideo} {videoParticipants} {audioParticipants} -
- -
- ) -} - -// via https://github.com/facebook/react/issues/11163 -type PropsType = VideoHTMLAttributes & { - srcObject: MediaStream; -}; - -export function HtmlVideo ({ srcObject, ...props }: PropsType) { - const refVideo = useRef(null) - - useEffect(() => { - if (!refVideo.current) return - console.log(srcObject) - refVideo.current.srcObject = srcObject - }, [srcObject]) - - return