Skip to content

Commit

Permalink
Merge pull request Roguelike-Celebration#846 from MoyTW/revert-twilio…
Browse files Browse the repository at this point in the history
…-removal

Revert "Merge pull request Roguelike-Celebration#840 from Roguelike-Celebration/remove-video"
  • Loading branch information
MoyTW authored Sep 5, 2024
2 parents ff466fc + c2ec988 commit c69ee50
Show file tree
Hide file tree
Showing 59 changed files with 3,268 additions and 89 deletions.
145 changes: 131 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,15 @@
"react-tooltip": "^4.2.8",
"request": "^2.88.2",
"ts-node": "^10",
"twilio-video": "^2.8.0",
"uuid": "^8.3.2"
},
"devDependencies": {
"@types/lodash": "^4.14.158",
"@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",
Expand Down
20 changes: 20 additions & 0 deletions server/cognitiveServicesKey/function.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"bindings": [
{
"authLevel": "anonymous",
"type": "httpTrigger",
"direction": "in",
"name": "req",
"methods": [
"get",
"post"
]
},
{
"type": "http",
"direction": "out",
"name": "res"
}
],
"scriptFile": "../dist/cognitiveServicesKey/index.js"
}
23 changes: 23 additions & 0 deletions server/cognitiveServicesKey/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { AzureFunction, Context, HttpRequest } from '@azure/functions'
import { getUserIdFromHeaders } from '../src/authenticate'

const httpTrigger: AzureFunction = async function (context: Context, req: HttpRequest): Promise<void> {
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
3 changes: 3 additions & 0 deletions server/cognitiveServicesKey/sample.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name": "Azure"
}
23 changes: 23 additions & 0 deletions server/leaveVideoChat/function.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"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"
}
10 changes: 10 additions & 0 deletions server/leaveVideoChat/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
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<void> {
await authenticatedAzureWrap(context, req, leaveVideoChat)
}

export default httpTrigger
3 changes: 3 additions & 0 deletions server/leaveVideoChat/sample.dat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"name": "Azure"
}
Loading

0 comments on commit c69ee50

Please sign in to comment.