From 0743c75a4530c67e95602d700e279be7a6ab0717 Mon Sep 17 00:00:00 2001 From: mac Date: Mon, 2 Nov 2026 16:08:06 +0800 Subject: [PATCH] Separate successful PluginKit registration from sandbox discovery restrictions --- research/MainApp1.6.1.md | 8 ++++--- 大鱼调色/Plugin/Info.plist | 2 +- 大鱼调色/Wrapper Application/AppDelegate.m | 27 +++++++++++++++++----- 大鱼调色/Wrapper Application/Info.plist | 2 +- 4 files changed, 28 insertions(+), 11 deletions(-) diff --git a/research/MainApp1.6.1.md b/research/MainApp1.6.1.md index 5d460d6..2be1549 100644 --- a/research/MainApp1.6.1.md +++ b/research/MainApp1.6.1.md @@ -1,4 +1,4 @@ -# 主 APP 1.6.1(41)改造 +# 主 APP 1.6.1(42)改造 本轮范围:仅主 APP 产品介绍、插件自动检查/提交注册、成功退出。不加入登录、授权、加密、自动更新或后端接口;以本轮用户说明为准,不执行旧交接中的下一阶段账号计划。 @@ -8,7 +8,7 @@ 比较了单列介绍、左右双栏状态+功能、状态+使用指引+双列特色卡三种结构,选择第三种:优先显示注册与宿主入口,接着完整调色、LUT、胶片、蒙版叠层,顶部首先显示可点击的发布地址 https://dayu.media。窗口默认920×850,最小760×620,纵向滚动;介绍可通过按钮/⌘I保留,菜单⌘R重试、⌘W关闭、⌘Q退出。保留可访问的原生按钮、文本、焦点环和状态播报;表面不透明,增强对比度加粗边框。 -状态唯一归属 AppDelegate:checking → registering → ready/failed。所有 PluginKit 操作在后台队列;主线程负责状态和窗口。重复检查期间禁用重入。每次打开都提交内嵌组件注册;以回读 Bundle ID、FxPlug登记协议1.1和当前插件完整路径为成功条件,不能仅凭命令退出码判定。成功默认5秒后退出;查看介绍取消本次倒计时;失败保留窗口和重试。关闭窗口退出,无后台常驻。 +状态唯一归属 AppDelegate:checking → registering → ready/failed。所有 PluginKit 操作在后台队列;主线程负责状态和窗口。重复检查期间禁用重入。每次打开都提交内嵌组件注册;先验证内嵌组件Bundle ID、当前构建号和FxPlug登记协议1.1,提交精确路径的注册;查询可用时核对实际路径。若系统明确拒绝沙盒查询,则使用成功的pkd注册应答,不将查询受限误报为注册失败。其他查询/提交失败仍不放行。成功默认5秒后退出;查看介绍取消本次倒计时;失败保留窗口和重试。关闭窗口退出,无后台常驻。 运行诊断仅记录本机插件登记和版本,写入应用 Application Support/com.dayu.color/Registration.json;不联网、不含凭据。--show-introduction 是保留介绍的启动方式,仍运行真实注册流程。 @@ -18,6 +18,8 @@ ## 保留范围 -主 Bundle ID com.dayu.color,服务com.dayu.color.XPC,唯一正式路径/Library/Plug-Ins/FxPlug/大鱼调色.app。主 APP/内嵌服务版本同步1.6.1(41)。调色/渲染、Uniform、参数、预设、Metal、模板无改动。现有自检及正式安装、宿主、打包/Release证据在verification记录;本文件不预先宣称未执行的验证通过。 +主 Bundle ID com.dayu.color,服务com.dayu.color.XPC,唯一正式路径/Library/Plug-Ins/FxPlug/大鱼调色.app。主 APP/内嵌服务版本同步1.6.1(42)。调色/渲染、Uniform、参数、预设、Metal、模板无改动。现有自检及正式安装、宿主、打包/Release证据在verification记录;本文件不预先宣称未执行的验证通过。 首轮正式40版发现沙盒查询-A会返回PKDiscoverAll未授权,虽然-a注册已经成功。41版移除-A/-D,仅查询自身组件,不取消沙盒、不新增权限。注册标记+后的可变空白单独归一化;发布地址按用户补充移到页面最顶部。40版保留为问题定位记录,不作为最终发行包。 + +41版实测证明系统CLI即使不带-A,查询也请求PKDiscoverAll;沙盒拒绝查询但允许显式注册。最终42版分别记录discoveryVerified、discoveryRestricted、submissionAccepted与confirmationMethod。只有明确的查询权限错误且精确组件验证/注册应答成功时,使用pkd应答判定注册成功;没有给沙盒增加权限,也没有把未知错误一律当成功。交付时由外部PluginKit回读和删除登记后重建的实际结果独立验证。 diff --git a/大鱼调色/Plugin/Info.plist b/大鱼调色/Plugin/Info.plist index 239080f..b523185 100644 --- a/大鱼调色/Plugin/Info.plist +++ b/大鱼调色/Plugin/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 1.6.1 CFBundleVersion - 41 + 42 NSHumanReadableCopyright PlugInKit diff --git a/大鱼调色/Wrapper Application/AppDelegate.m b/大鱼调色/Wrapper Application/AppDelegate.m index c4db8b4..e3203c9 100644 --- a/大鱼调色/Wrapper Application/AppDelegate.m +++ b/大鱼调色/Wrapper Application/AppDelegate.m @@ -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]; }); } }); diff --git a/大鱼调色/Wrapper Application/Info.plist b/大鱼调色/Wrapper Application/Info.plist index 46cbf8e..c4792eb 100644 --- a/大鱼调色/Wrapper Application/Info.plist +++ b/大鱼调色/Wrapper Application/Info.plist @@ -19,7 +19,7 @@ CFBundleShortVersionString 1.6.1 CFBundleVersion - 41 + 42 LSMinimumSystemVersion $(MACOSX_DEPLOYMENT_TARGET) NSHumanReadableCopyright