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}>
|
<div className={styles.videoContainer}>
|
||||||
<iframe
|
<iframe
|
||||||
title='Rumble Video'
|
title='Rumble Video'
|
||||||
allowFullScreen=''
|
allowFullScreen
|
||||||
src={meta?.href}
|
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>
|
||||||
</div>
|
</div>
|
||||||
|
@ -281,8 +281,24 @@ export default memo(function Text ({ rel, imgproxyUrls, children, tab, itemId, o
|
|||||||
<div className={styles.videoContainer}>
|
<div className={styles.videoContainer}>
|
||||||
<iframe
|
<iframe
|
||||||
title='Rumble Video'
|
title='Rumble Video'
|
||||||
allowFullScreen=''
|
allowFullScreen
|
||||||
src={meta?.href}
|
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>
|
||||||
</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 {
|
} catch {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ export function middleware (request) {
|
|||||||
// unsafe-inline for styles is not ideal but okay if script-src is using nonces
|
// unsafe-inline for styles is not ideal but okay if script-src is using nonces
|
||||||
"style-src 'self' a.stacker.news 'unsafe-inline'",
|
"style-src 'self' a.stacker.news 'unsafe-inline'",
|
||||||
"manifest-src 'self'",
|
"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,
|
"connect-src 'self' https: wss:" + devSrc,
|
||||||
// disable dangerous plugins like Flash
|
// disable dangerous plugins like Flash
|
||||||
"object-src 'none'",
|
"object-src 'none'",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user