1
0
mirror of https://github.com/bitwarden/browser synced 2026-01-04 09:33:27 +00:00

[PM-14006] Prevent screenshot setting V2 (#12570)

* Add screenshot protection to windows and mac

* Update messaging of screencapture prevention feature

* Rename settings key

* Default allow screenshots

* Update screenshot setting description

* Fix typo

* Add confirm visible prompt
This commit is contained in:
Bernd Schoolmann
2025-02-10 20:02:13 +01:00
committed by GitHub
parent 2b5c7861e2
commit 543cf0fb3f
5 changed files with 106 additions and 1 deletions

View File

@@ -75,6 +75,14 @@ const MINIMIZE_ON_COPY = new UserKeyDefinition<boolean>(DESKTOP_SETTINGS_DISK, "
clearOn: [], // User setting, no need to clear
});
const PREVENT_SCREENSHOTS = new KeyDefinition<boolean>(
DESKTOP_SETTINGS_DISK,
"preventScreenshots",
{
deserializer: (b) => b,
},
);
/**
* Various settings for controlling application behavior specific to the desktop client.
*/
@@ -147,6 +155,13 @@ export class DesktopSettingsService {
sshAgentEnabled$ = this.sshAgentEnabledState.state$.pipe(map(Boolean));
private readonly preventScreenshotState = this.stateProvider.getGlobal(PREVENT_SCREENSHOTS);
/**
* The application setting for whether or not to allow screenshots of the app.
*/
preventScreenshots$ = this.preventScreenshotState.state$.pipe(map(Boolean));
private readonly minimizeOnCopyState = this.stateProvider.getActive(MINIMIZE_ON_COPY);
/**
@@ -270,4 +285,12 @@ export class DesktopSettingsService {
async setMinimizeOnCopy(value: boolean, userId: UserId) {
await this.stateProvider.getUser(userId, MINIMIZE_ON_COPY).update(() => value);
}
/**
* Sets the setting for whether or not the screenshot protection is enabled.
* @param value `true` if the screenshot protection is enabled, `false` if it is not.
*/
async setPreventScreenshots(value: boolean) {
await this.preventScreenshotState.update(() => value);
}
}