Separate successful PluginKit registration from sandbox discovery restrictions

这个提交包含在:
mac 于 2026-11-02 16:08:06 +08:00 提交
1 父节点 7bb14ea8da
当前提交 0743c75a45
4 个文件已更改
+28 -11

没有与搜索条件相匹配的文件

+1 -1
查看文件
@@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>1.6.1</string>
<key>CFBundleVersion</key>
<string>41</string>
<string>42</string>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>PlugInKit</key>
+21 -6
查看文件
@@ -245,11 +245,15 @@ typedef NS_ENUM(NSInteger,DYRegistrationState) { DYChecking, DYRegistering, DYRe
dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INITIATED,0), ^{
@autoreleasepool {
NSBundle *plugin = [NSBundle bundleWithPath:path];
if (![plugin.bundleIdentifier isEqualToString:DYPluginID]) {
NSDictionary *attributes = [plugin objectForInfoDictionaryKey:@"PlugInKit"][@"Attributes"];
BOOL validComponent = [plugin.bundleIdentifier isEqualToString:DYPluginID] &&
[[plugin objectForInfoDictionaryKey:@"CFBundleVersion"] isEqual:[NSBundle.mainBundle objectForInfoDictionaryKey:@"CFBundleVersion"]] &&
[attributes[@"com.apple.protocol"] isEqual:@"FxPlug"] && [attributes[@"com.apple.version"] isEqual:@"1.1"];
if (!validComponent) {
dispatch_async(dispatch_get_main_queue(), ^{ [self finishRegistration:NO details:@"未找到完整的插件组件。请从发布地址重新安装大鱼调色。" results:@{}]; }); return;
}
// -A requests PKDiscoverAll and is rejected inside the APP sandbox.
// Default discovery is sufficient for this APP's own embedded component.
// The system CLI may request PKDiscoverAll even without -A. A sandbox
// denies discovery while still allowing pkd to accept explicit registration.
NSDictionary *before = [self runPluginKit:@[@"-m",@"-v",@"-i",DYPluginID]];
dispatch_async(dispatch_get_main_queue(), ^{
self.registrationState = DYRegistering; self.statusTitle.stringValue = @"正在注册插件…";
@@ -262,9 +266,20 @@ typedef NS_ENUM(NSInteger,DYRegistrationState) { DYChecking, DYRegistering, DYRe
after = [self runPluginKit:@[@"-m",@"-v",@"-i",DYPluginID]];
registered = [self registry:after containsPlugin:path]; if (registered) break;
}
NSString *message = registered ? @"已确认当前插件登记。请在 Final Cut Pro 或 Motion 中使用;若宿主已打开,请保存后重新打开。" :
@"系统尚未确认插件注册。请点击“重新检查”,或重新安装后再试。窗口将保持打开。";
NSDictionary *results = @{@"before":before,@"submission":add,@"after":after ?: @{},@"registered":@(registered)};
BOOL discovered = registered;
BOOL discoveryRestricted = [after[@"output"] containsString:@"unauthorized discovery flag"] && [after[@"code"] intValue] != 0;
BOOL submissionAccepted = [add[@"code"] intValue] == 0;
// An unavailable discovery operation is not a failed registration.
// Use the successful pkd acknowledgement only for this known restriction,
// after checking the exact embedded component's identity/build/protocol.
registered = discovered || (discoveryRestricted && submissionAccepted);
NSString *message = registered ? (discovered ?
@"已确认当前插件登记。请在 Final Cut Pro 或 Motion 中使用;若宿主已打开,请保存后重新打开。" :
@"系统已接受插件注册。可在 Final Cut Pro 或 Motion 中使用;若宿主已打开,请保存后重新打开。") :
@"插件注册尚未完成。请点击“重新检查”,或重新安装后再试。窗口将保持打开。";
NSDictionary *results = @{@"before":before,@"submission":add,@"after":after ?: @{},@"registered":@(registered),
@"discoveryVerified":@(discovered),@"discoveryRestricted":@(discoveryRestricted),@"submissionAccepted":@(submissionAccepted),
@"confirmationMethod":discovered ? @"exact-path-discovery" : (registered ? @"pkd-registration-acknowledgement" : @"unconfirmed")};
dispatch_async(dispatch_get_main_queue(), ^{ [self finishRegistration:registered details:message results:results]; });
}
});
+1 -1
查看文件
@@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>1.6.1</string>
<key>CFBundleVersion</key>
<string>41</string>
<string>42</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>