Skip to content

Commit

Permalink
feat(sdk): set allowed features
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyckahn committed Oct 16, 2023
1 parent 66adc2c commit be1a6e5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
4 changes: 4 additions & 0 deletions sdk/sdk.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { iframeFeatureAllowList } from '../src/config/iframeFeatureAllowList'

export const defaultRootDomain = 'https://chitchatter.im/'

// NOTE: This is a subset of standard iframe attributes:
Expand Down Expand Up @@ -38,6 +40,8 @@ class ChatEmbed extends HTMLElement {
}
}

iframe.setAttribute('allow', iframeFeatureAllowList.join(';'))

shadow.appendChild(iframe)
}
}
Expand Down
6 changes: 6 additions & 0 deletions src/config/iframeFeatureAllowList.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export const iframeFeatureAllowList = [
'camera',
'microphone',
'display-capture',
'fullscreen',
]
9 changes: 2 additions & 7 deletions src/pages/Home/EmbedCodeDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,14 @@ import DialogContentText from '@mui/material/DialogContentText'
import DialogTitle from '@mui/material/DialogTitle'
import { CopyableBlock } from 'components/CopyableBlock/CopyableBlock'

import { iframeFeatureAllowList } from 'config/iframeFeatureAllowList'

interface EmbedCodeDialogProps {
showEmbedCode: boolean
handleEmbedCodeWindowClose: () => void
embedUrl: URL
}

const iframeFeatureAllowList = [
'camera',
'microphone',
'display-capture',
'fullscreen',
]

export const EmbedCodeDialog = ({
showEmbedCode,
handleEmbedCodeWindowClose,
Expand Down

0 comments on commit be1a6e5

Please sign in to comment.