Disable wrapper sandbox and add explicit user confirmation after FCP checks
这个提交包含在:
1 父节点
0743c75a45
当前提交
c664991aa1
5 个文件已更改
+29
-26
没有与搜索条件相匹配的文件
@@ -108,7 +108,7 @@ typedef NS_ENUM(NSInteger,DYRegistrationState) { DYChecking, DYRegistering, DYRe
|
||||
@interface AppDelegate ()
|
||||
@property(weak) IBOutlet NSWindow *window;
|
||||
@property(assign) NSTextField *statusTitle, *statusDetail, *exitDetail;
|
||||
@property(assign) DYActionButton *retryButton, *keepButton;
|
||||
@property(assign) DYActionButton *retryButton, *keepButton, *confirmationButton;
|
||||
@property(assign) NSProgressIndicator *progress;
|
||||
@property(assign) DYSurface *registrationCard;
|
||||
@property DYRegistrationState registrationState;
|
||||
@@ -177,10 +177,14 @@ typedef NS_ENUM(NSInteger,DYRegistrationState) { DYChecking, DYRegistering, DYRe
|
||||
NSStackView *registration = DYStack(@[DYHeading(@"puzzlepiece.extension",@"插件连接",DYBlue()),self.statusTitle,self.statusDetail,self.progress,
|
||||
DYStack(@[self.retryButton,self.keepButton],NSUserInterfaceLayoutOrientationHorizontal,8)],NSUserInterfaceLayoutOrientationVertical,13);
|
||||
self.registrationCard = DYCard(DYBlue(),registration);
|
||||
NSStackView *host = DYStack(@[DYHeading(@"play.rectangle",@"在剪辑中开始创作",DYGreen()),
|
||||
self.confirmationButton = DYButton(@"已确认正常,退出",DYGreen(),NO,self,@selector(confirmHost:));
|
||||
self.confirmationButton.enabled = NO;
|
||||
self.confirmationButton.toolTip = @"请先在 Final Cut Pro 中应用大鱼调色并确认效果正常,再点击此按钮。";
|
||||
NSStackView *host = DYStack(@[DYHeading(@"play.rectangle",@"在 Final Cut Pro 中检查",DYGreen()),
|
||||
DYLabel(@"调色,留在时间线里。",22,NSFontWeightSemibold,NSColor.whiteColor),
|
||||
DYLabel(@"Final Cut Pro:效果 → 大鱼调色\nMotion:滤镜 → 大鱼调色\n将效果应用到片段,在检查器中调整。",13,NSFontWeightRegular,DYSecondary()),
|
||||
DYStack(@[DYButton(@"打开 Final Cut Pro",DYColor(.20,.46,.94),YES,self,@selector(openFinalCut:)),DYButton(@"打开 Motion",DYGreen(),NO,self,@selector(openMotion:))],NSUserInterfaceLayoutOrientationHorizontal,8)],NSUserInterfaceLayoutOrientationVertical,13);
|
||||
DYLabel(@"Final Cut Pro:效果 → 大鱼调色\n将效果应用到片段,确认画面与调节正常。\n打开宿主检查会保留本窗口,等待你确认。",13,NSFontWeightRegular,DYSecondary()),
|
||||
DYStack(@[DYButton(@"打开 FCP 检查",DYColor(.20,.46,.94),YES,self,@selector(openFinalCut:)),DYButton(@"打开 Motion",DYGreen(),NO,self,@selector(openMotion:))],NSUserInterfaceLayoutOrientationHorizontal,8),
|
||||
self.confirmationButton],NSUserInterfaceLayoutOrientationVertical,13);
|
||||
DYSurface *hostCard = DYCard(DYGreen(),host);
|
||||
NSStackView *top = DYStack(@[self.registrationCard,hostCard],NSUserInterfaceLayoutOrientationHorizontal,14);
|
||||
[self.registrationCard.heightAnchor constraintEqualToAnchor:hostCard.heightAnchor].active = YES;
|
||||
@@ -252,8 +256,8 @@ typedef NS_ENUM(NSInteger,DYRegistrationState) { DYChecking, DYRegistering, DYRe
|
||||
if (!validComponent) {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{ [self finishRegistration:NO details:@"未找到完整的插件组件。请从发布地址重新安装大鱼调色。" results:@{}]; }); return;
|
||||
}
|
||||
// The system CLI may request PKDiscoverAll even without -A. A sandbox
|
||||
// denies discovery while still allowing pkd to accept explicit registration.
|
||||
// The stand-alone wrapper can inspect the registry directly. Registration
|
||||
// and actual host rendering remain separate states; the user confirms FCP.
|
||||
NSDictionary *before = [self runPluginKit:@[@"-m",@"-v",@"-i",DYPluginID]];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
self.registrationState = DYRegistering; self.statusTitle.stringValue = @"正在注册插件…";
|
||||
@@ -266,20 +270,13 @@ typedef NS_ENUM(NSInteger,DYRegistrationState) { DYChecking, DYRegistering, DYRe
|
||||
after = [self runPluginKit:@[@"-m",@"-v",@"-i",DYPluginID]];
|
||||
registered = [self registry:after containsPlugin:path]; if (registered) break;
|
||||
}
|
||||
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 中使用;若宿主已打开,请保存后重新打开。") :
|
||||
NSString *message = registered ?
|
||||
@"已确认当前插件登记。请在 Final Cut Pro 中实际应用并确认效果正常;若宿主已打开,请保存后重新打开。" :
|
||||
@"插件注册尚未完成。请点击“重新检查”,或重新安装后再试。窗口将保持打开。";
|
||||
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")};
|
||||
@"discoveryVerified":@(registered),@"submissionAccepted":@(submissionAccepted),@"hostVerification":@"awaiting-user-confirmation",
|
||||
@"confirmationMethod":registered ? @"exact-path-discovery" : @"unconfirmed"};
|
||||
dispatch_async(dispatch_get_main_queue(), ^{ [self finishRegistration:registered details:message results:results]; });
|
||||
}
|
||||
});
|
||||
@@ -289,9 +286,10 @@ typedef NS_ENUM(NSInteger,DYRegistrationState) { DYChecking, DYRegistering, DYRe
|
||||
self.registrationState = success ? DYReady : DYFailed;
|
||||
[self.progress stopAnimation:nil]; self.progress.indeterminate = NO; self.progress.doubleValue = success ? 100 : 0;
|
||||
self.registrationCard.tint = success ? DYGreen() : DYColor(1,.67,.30); [self.registrationCard setNeedsDisplay:YES];
|
||||
self.statusTitle.stringValue = success ? @"✓ 插件已就绪" : @"需要重新检查";
|
||||
self.statusTitle.stringValue = success ? @"✓ 插件注册成功" : @"需要重新检查";
|
||||
self.statusTitle.textColor = success ? DYGreen() : DYColor(1,.75,.4); self.statusDetail.stringValue = details;
|
||||
self.retryButton.title = @"重新检查"; self.retryButton.enabled = YES;
|
||||
self.confirmationButton.enabled = success;
|
||||
[self.diagnostics addEntriesFromDictionary:results]; self.diagnostics[@"status"] = success ? @"registered" : @"failed"; [self writeDiagnostics];
|
||||
NSAccessibilityPostNotificationWithUserInfo(self.window,NSAccessibilityAnnouncementRequestedNotification,
|
||||
@{NSAccessibilityAnnouncementKey:self.statusTitle.stringValue,NSAccessibilityPriorityKey:@(NSAccessibilityPriorityHigh)});
|
||||
@@ -311,6 +309,12 @@ typedef NS_ENUM(NSInteger,DYRegistrationState) { DYChecking, DYRegistering, DYRe
|
||||
self.keepButton.title = @"正在浏览介绍"; self.keepButton.enabled = NO;
|
||||
self.exitDetail.stringValue = @"已保留功能介绍窗口。插件可独立在宿主中使用。";
|
||||
}
|
||||
- (void)confirmHost:(id)sender {
|
||||
if (self.registrationState != DYReady) return;
|
||||
self.diagnostics[@"hostVerification"] = @"user-confirmed";
|
||||
self.diagnostics[@"terminationReason"] = @"user-confirmed-host";
|
||||
[self writeDiagnostics]; [NSApp terminate:nil];
|
||||
}
|
||||
- (void)writeDiagnostics {
|
||||
NSURL *base = [NSFileManager.defaultManager URLsForDirectory:NSApplicationSupportDirectory inDomains:NSUserDomainMask].firstObject;
|
||||
NSURL *folder = [base URLByAppendingPathComponent:@"com.dayu.color" isDirectory:YES];
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.6.1</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>42</string>
|
||||
<string>43</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>com.apple.security.app-sandbox</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<dict/>
|
||||
</plist>
|
||||
在新工单中引用
屏蔽一个用户