[MM-55261] Allow embedded video links to go fullscreen after a permission check (#2905)

This commit is contained in:
Devin Binnie 2023-11-10 09:02:34 -05:00 committed by GitHub
parent 7aed1eb852
commit a1071277d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -105,13 +105,17 @@ export class PermissionsManager extends JsonFileManager<Permissions> {
return false;
}
// Exception for embedded videos such as YouTube
// We still want to ask permission to do this though
const isExternalFullscreen = permission === 'fullscreen' && parsedURL.origin !== serverURL.origin;
// is the requesting url trusted?
if (!(isTrustedURL(parsedURL, serverURL) || (permission === 'media' && parsedURL.origin === serverURL.origin))) {
if (!(isTrustedURL(parsedURL, serverURL) || (permission === 'media' && parsedURL.origin === serverURL.origin) || isExternalFullscreen)) {
return false;
}
// For certain permission types, we need to confirm with the user
if (authorizablePermissionTypes.includes(permission)) {
if (authorizablePermissionTypes.includes(permission) || isExternalFullscreen) {
const currentPermission = this.json[parsedURL.origin]?.[permission];
// If previously allowed, just allow