Handle Peertube Embeds (#1223)
* Handle peertube embeds * Permit full screen for Rumble and PeerTube * Use sandbox='allow-scripts' for iframes * Restore frame-src domains * Use endsWith --------- Co-authored-by: ekzyis <ek@stacker.news>
This commit is contained in:
parent
78520b787b
commit
4fe920d12b
|
@ -106,8 +106,24 @@ function ItemEmbed ({ item }) {
|
|||
<div className={styles.videoContainer}>
|
||||
<iframe
|
||||
title='Rumble Video'
|
||||
allowFullScreen=''
|
||||
allowFullScreen
|
||||
src={meta?.href}
|
||||
sandbox='allow-scripts'
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
if (provider === 'peertube') {
|
||||
return (
|
||||
<div className={styles.videoWrapper}>
|
||||
<div className={styles.videoContainer}>
|
||||
<iframe
|
||||
title='PeerTube Video'
|
||||
allowFullScreen
|
||||
src={meta?.href}
|
||||
sandbox='allow-scripts'
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -281,8 +281,24 @@ export default memo(function Text ({ rel, imgproxyUrls, children, tab, itemId, o
|
|||
<div className={styles.videoContainer}>
|
||||
<iframe
|
||||
title='Rumble Video'
|
||||
allowFullScreen=''
|
||||
allowFullScreen
|
||||
src={meta?.href}
|
||||
sandbox='allow-scripts'
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
if (provider === 'peertube') {
|
||||
return (
|
||||
<div style={videoWrapperStyles}>
|
||||
<div className={styles.videoContainer}>
|
||||
<iframe
|
||||
title='PeerTube Video'
|
||||
allowFullScreen
|
||||
src={meta?.href}
|
||||
sandbox='allow-scripts'
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
|
10
lib/url.js
10
lib/url.js
|
@ -120,6 +120,16 @@ export function parseEmbedUrl (href) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hostname.endsWith('peertube.tv') || hostname.endsWith('bitcointv.com')) {
|
||||
return {
|
||||
provider: 'peertube',
|
||||
id: null,
|
||||
meta: {
|
||||
href: href.replace('/w/', '/videos/embed/')
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ export function middleware (request) {
|
|||
// unsafe-inline for styles is not ideal but okay if script-src is using nonces
|
||||
"style-src 'self' a.stacker.news 'unsafe-inline'",
|
||||
"manifest-src 'self'",
|
||||
'frame-src www.youtube.com platform.twitter.com rumble.com',
|
||||
'frame-src www.youtube.com platform.twitter.com rumble.com bitcointv.com peertube.tv',
|
||||
"connect-src 'self' https: wss:" + devSrc,
|
||||
// disable dangerous plugins like Flash
|
||||
"object-src 'none'",
|
||||
|
|
Loading…
Reference in New Issue