Add flag to enable/disable screenshots (#1301)

* Bump TransformerKit to fix compile

Fixes build issue with Xcode 15 by raising minimum deployment target
to 10.13

* Add flag to disable screenshots

Make it possible to disable/enable screenshots, this is disabled
by default, to enable use:
$ defaults write com.hicknhacksoftware.MacPass AllowScreenshots YES
and to disable it use:
$ defaults write com.hicknhacksoftware.MacPass AllowScreenshots NO

---------

Co-authored-by: Michael Starke <michael.starke@hicknhack-software.com>
This commit is contained in:
Deniz Türkoglu
2025-04-11 03:50:37 +10:00
committed by GitHub
parent a97353ef7b
commit 37f0ab1f8c
4 changed files with 12 additions and 1 deletions

View File

@@ -2,4 +2,4 @@ binary "https://sparkle-project.org/Carthage/Sparkle.json" "2.6.4"
github "MacPass/KeePassKit" "3.3.2"
github "MacPass/KissXML" "503fc012b73a4507965019720cbf1c157e849657"
github "MacPass/TransformerKit" "3232b04c568df7f98b33ceb21a2090a9ccbc2065"
github "mstarke/HNHUi" "6.0.1"
github "mstarke/HNHUi" "6.0.1"

View File

@@ -100,6 +100,14 @@ typedef void (^MPPasswordChangedBlock)(BOOL didChangePassword);
[super windowDidLoad];
self.window.delegate = self.documentWindowDelegate;
BOOL allowScreenshots = [NSUserDefaults.standardUserDefaults boolForKey:kMPSettingsKeyAllowScreenshots];
if(!allowScreenshots) {
self.window.sharingType = NSWindowSharingNone;
}
else {
self.window.sharingType = NSWindowSharingReadOnly;
}
if (@available(macOS 11.0, *)) {
/* let the user decide how to dipsplay the toolbar */
BOOL useUnifiedToolbar = [NSUserDefaults.standardUserDefaults boolForKey:kMPSettingsKeyUseUnifiedToolbar];

View File

@@ -105,6 +105,7 @@ APPKIT_EXTERN NSString *const kMPSettingsKeyFaviconDownloadMethod;
/* UI */
APPKIT_EXTERN NSString *const kMPSettingsKeyUseUnifiedToolbar;
APPKIT_EXTERN NSString *const kMPSettingsKeyAllowScreenshots;
typedef NS_ENUM(NSUInteger, MPFileChangeStrategy) {
MPFileChangeStrategyAsk,

View File

@@ -101,6 +101,7 @@ NSString *const kMPSettingsKeyAllowRemoteFetchOfPluginRepository
NSString *const kMPSettingsKeyFaviconDownloadMethod = @"FaviconDownloadMethod";
NSString *const kMPSettingsKeyUseUnifiedToolbar = @"UseUnifiedToolbar";
NSString *const kMPSettingsKeyAllowScreenshots = @"AllowScreenshots";
/* Deprecated */
NSString *const kMPDeprecatedSettingsKeyRememberKeyFilesForDatabases = @"kMPSettingsKeyRememberKeyFilesForDatabases";
@@ -186,6 +187,7 @@ NSString *const kMPDepricatedSettingsKeyEntryTouchIdDatabaseEncryptedKeyFormat
kMPSettingsKeyFaviconDownloadMethod: @(MPFaviconDownloadMethodDirect), // Download directly from host
kMPSettingsKeyGloablAutotypeAlwaysShowCandidateSelection: @NO,
kMPSettingsKeyUseUnifiedToolbar: @YES, // Do not use unified toolbar under Big Sur and above
kMPSettingsKeyAllowScreenshots: @NO, // Do not allow screenshots or screen recordings of MacPass
kMPSettingsKeyFocusSearchAfterUnlock: @NO, // Do not enter search directly after unlocking the database
kMPSettingsKeyUsePrivateBrowsingWhenOpeningURLs: @NO // No private mode when option URLs by default
};