Validate signed FxPlug package layout and deploy isolated beta endpoints with live ACK checks

这个提交包含在:
mac 于 2026-11-02 17:34:14 +08:00 提交
1 父节点 55acdaa4b1
当前提交 30c8904003
5 个文件已更改
+75 -9

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

+24
查看文件
@@ -0,0 +1,24 @@
#!/usr/bin/env python3
"""Anonymous public-beta endpoint smoke test; no credentials or production settings."""
import datetime,json,time,urllib.request,urllib.error,uuid
from pathlib import Path
ROOT=Path(__file__).resolve().parent.parent
BASE='https://dayu.media/wp-json/dayu-color/v1/'
def call(route,body=None):
request=urllib.request.Request(BASE+route,data=json.dumps(body).encode() if body else None,headers={'Content-Type':'application/json'})
try:
with urllib.request.urlopen(request,timeout=15) as r:return r.status,json.load(r)
except urllib.error.HTTPError as e:return e.code,json.load(e)
def main():
status,feed=call('update?bundle_id=com.dayu.color&channel=beta&current_build=44');assert status==200 and feed['bundle_id']=='com.dayu.color'
assert call('update?bundle_id=other&channel=beta')[0]==400
assert call('diagnostics')[0] in (401,403)
event_id=str(uuid.uuid4());installation=str(uuid.uuid4());session=str(uuid.uuid4())
event=dict(event_id=event_id,session_id=session,source='app',version='1.7.0',build=45,event='diagnostic_summary',occurred_at=time.time(),fields={'status':'deployment_smoke_test','count':1})
payload=dict(bundle_id='com.dayu.color',installation_id=installation,events=[event])
for attempt in range(2):
status,reply=call('diagnostics',payload);assert status==200 and reply['accepted'] and reply['event_ids']==[event_id],(status,reply)
bad=dict(payload,bundle_id='other');assert call('diagnostics',bad)[0]==400
record=dict(passed=True,checked_at=datetime.datetime.now(datetime.timezone.utc).isoformat(),checks=['update GET','product isolation','admin read denied anonymously','diagnostic stored ACK','retry same UUID ACK','foreign upload denied'],test_event_id=event_id,test_installation_id=installation,update=feed)
(ROOT/'verification/BetaBackendLive.json').write_text(json.dumps(record,ensure_ascii=False,indent=2)+'\n');print(json.dumps(record,ensure_ascii=False))
if __name__=='__main__':main()
+1 -1
查看文件
@@ -76,7 +76,7 @@ def main():
appearance=dict(title="大鱼调色", subtitle="适用于 Final Cut Pro 与 Motion 的原生调色效果",
badgeImage=str(ROOT / "design/dayu-color-app-icon-v1.png"), authorContact="https://dayu.media"),
pages=dict(welcome="安装大鱼调色 " + version + ",包含原生 FxPlug 调色插件和 Final Cut Pro 效果入口。",
readme="系统要求:macOS 14.6 或更高版本。本发行构建适用于 Apple Silicon Mac。\n\n安装内容:\n/Library/Plug-Ins/FxPlug/大鱼调色.app\n登录用户“影片/Motion Templates/Effects/大鱼调色”中的效果模板与预览图。\n\n重新打开 Final Cut Pro 后,在“效果 → 大鱼调色”中应用;Motion 中可选择原生滤镜。\n本安装包不包含用户自选 LUT、预设或媒体文件。",
readme="系统要求:macOS 14.6 或更高版本。本发行构建适用于 Apple Silicon Mac。\n\n安装内容:\n/Library/Plug-Ins/FxPlug/大鱼调色.app\n登录用户“影片/Motion Templates/Effects/大鱼调色”中的效果模板与预览图。\n\n重新打开 Final Cut Pro 后,在“效果 → 大鱼调色”中应用;Motion 中可选择原生滤镜。\n本安装包不包含用户自选 LUT、预设或媒体文件。\n\n公测诊断默认开启,可在主 APP 关闭。仅发送版本、系统环境、加载耗时与本插件错误摘要到 dayu.media;不发送素材、预设或账号,保留30天。主 APP 启动时检查更新,新版由用户确认安装。",
license="", conclusion="大鱼调色已安装。主 APP 自动注册插件,成功后显示3秒倒计时退出。可点击“打开 FCP 检查”保留窗口,并在宿主中实际检查效果。"))
manifest_path = CACHE / "dayu-color-package-manifest.json"
manifest_path.write_text(json.dumps(manifest, ensure_ascii=False, indent=2) + "\n")
+10
查看文件
@@ -0,0 +1,10 @@
{
"path": "/Volumes/dayumedia (存储空间1)/wwwroot/dayu_media/wp-content/mu-plugins/dayu-color-beta.php",
"sha256": "6a2d5eca90975cef2541631798a748b5b109054fa69e1a988b0239c5558d09fd",
"backup": null,
"size": 14176,
"timestamp": "202611021731",
"mount": "//dayu@192.168.31.21/dayumedia%20%28%E5%AD%98%E5%82%A8%E7%A9%BA%E9%97%B41%29 on /Volumes/dayumedia (存储空间1) (smbfs, nodev, nosuid, mounted by mac)",
"localProject": "/Users/mac/Downloads/dayumedia/dayu-color-beta",
"sourceCommit": "55acdaa4b13c399efbed20dc125014fb8e6c522b"
}
+20
查看文件
@@ -0,0 +1,20 @@
{
"passed": true,
"checked_at": "2026-11-02T09:32:08.443963+00:00",
"checks": [
"update GET",
"product isolation",
"admin read denied anonymously",
"diagnostic stored ACK",
"retry same UUID ACK",
"foreign upload denied"
],
"test_event_id": "da567307-e342-4acc-8418-3dc73a877b43",
"test_installation_id": "453b6c16-5d4d-4ecb-a38f-172082e8abd7",
"update": {
"bundle_id": "com.dayu.color",
"channel": "beta",
"update_available": false,
"message": "当前没有公测更新。"
}
}
@@ -3,7 +3,8 @@
#import <AppKit/AppKit.h>
#import <CommonCrypto/CommonDigest.h>
#include <atomic>
#include <sys/xattr.h>
#include <signal.h>
#include <errno.h>
static NSError *DYUpdateError(NSString *message) { return [NSError errorWithDomain:@"com.dayu.color.update" code:1 userInfo:@{NSLocalizedDescriptionKey:message}]; }
static NSURL *updateFolder(void) {
@@ -38,8 +39,15 @@ static NSString *command(NSString *path,NSArray *arguments,NSError **error) {
if((self=[super init])){_generation.store(0);NSURLSessionConfiguration *config=NSURLSessionConfiguration.ephemeralSessionConfiguration;
config.timeoutIntervalForRequest=6;config.timeoutIntervalForResource=300;config.HTTPShouldSetCookies=NO;config.URLCache=nil;
_session=[[NSURLSession sessionWithConfiguration:config delegate:self delegateQueue:nil]retain];_state=[@{@"phase":@"idle",@"message":@"启动时自动检查公测更新。"}copy];
// Only this updater's abandoned inspection folders are disposable.
dispatch_async(dispatch_get_global_queue(QOS_CLASS_UTILITY,0),^{for(NSURL *url in [NSFileManager.defaultManager contentsOfDirectoryAtURL:updateFolder() includingPropertiesForKeys:nil options:0 error:nil])if([url.lastPathComponent hasPrefix:@"inspection-"])[NSFileManager.defaultManager removeItemAtURL:url error:nil];});
// Reclaim only abandoned validation folders, never another running updater's work.
dispatch_async(dispatch_get_global_queue(QOS_CLASS_UTILITY,0),^{
for(NSURL *url in [NSFileManager.defaultManager contentsOfDirectoryAtURL:updateFolder() includingPropertiesForKeys:@[NSURLContentModificationDateKey] options:0 error:nil]){
NSArray *parts=[url.lastPathComponent componentsSeparatedByString:@"-"];
if(parts.count<3||![parts[0]isEqual:@"inspection"]||[parts[1]rangeOfString:@"^[0-9]+$" options:NSRegularExpressionSearch].location==NSNotFound)continue;
int pid=[parts[1]intValue];NSDate *date=nil;[url getResourceValue:&date forKey:NSURLContentModificationDateKey error:nil];
if(pid>0&&kill(pid,0)!=0&&errno==ESRCH&&date&&date.timeIntervalSinceNow< -600)[NSFileManager.defaultManager removeItemAtURL:url error:nil];
}
});
}return self;
}
- (void)dealloc {[_session invalidateAndCancel];[_session release];[_task release];[_package release];[_state release];[_manifest release];[_changed release];[super dealloc];}
@@ -72,7 +80,7 @@ static NSString *command(NSString *path,NSArray *arguments,NSError **error) {
NSString *signature=command(@"/usr/sbin/pkgutil",@[@"--check-signature",package.path],error);
if(!signature||![signature containsString:@"Developer ID Installer:"]||![signature containsString:@"(B3W25FX5H5)"]){if(error)*error=DYUpdateError(@"更新包签名团队不匹配。");return NO;}
if(!command(@"/usr/sbin/spctl",@[@"--assess",@"--type",@"install",@"--verbose=2",package.path],error))return NO;
NSURL *inspection=[updateFolder() URLByAppendingPathComponent:[@"inspection-" stringByAppendingString:NSUUID.UUID.UUIDString]];
NSURL *inspection=[updateFolder() URLByAppendingPathComponent:[NSString stringWithFormat:@"inspection-%d-%@",getpid(),NSUUID.UUID.UUIDString]];
@try {
if(!command(@"/usr/sbin/pkgutil",@[@"--expand-full",package.path,inspection.path],error))return NO;
NSMutableArray *apps=[NSMutableArray array];NSUInteger entries=0;
@@ -93,8 +101,12 @@ static NSString *command(NSString *path,NSArray *arguments,NSError **error) {
BOOL appTarget=NO,templates=NO;
for(NSURL *url in [NSFileManager.defaultManager enumeratorAtURL:inspection includingPropertiesForKeys:nil options:0 errorHandler:nil]){
if([url.lastPathComponent isEqual:@"PackageInfo"]){NSString *xml=[NSString stringWithContentsOfURL:url encoding:NSUTF8StringEncoding error:nil];
if([xml containsString:@"install-location=\"/Library/Plug-Ins/FxPlug\""])appTarget=YES;
if(![xml containsString:@"com.dayu.color.installer"]){if(error)*error=DYUpdateError(@"更新包含不属于本产品的安装组件。");return NO;}
NSXMLDocument *document=[[[NSXMLDocument alloc]initWithXMLString:xml options:0 error:nil]autorelease];
NSXMLElement *root=document.rootElement;NSString *identifier=[[root attributeForName:@"identifier"]stringValue];
NSString *location=[[root attributeForName:@"install-location"]stringValue]?:@"/";
NSString *relative=[location isEqual:@"/"]?@"Payload/Library/Plug-Ins/FxPlug/大鱼调色.app":([location isEqual:@"/Library/Plug-Ins/FxPlug"]?@"Payload/大鱼调色.app":nil);
if(relative&&[[[[url.URLByDeletingLastPathComponent URLByAppendingPathComponent:relative]path]stringByStandardizingPath]isEqual:app.path.stringByStandardizingPath])appTarget=YES;
if(![identifier hasPrefix:@"com.dayu.color.installer."]){if(error)*error=DYUpdateError(@"更新包含不属于本产品的安装组件。");return NO;}
}
if([url.lastPathComponent isEqual:@"大鱼调色.moef"])templates=YES;
}
@@ -105,7 +117,7 @@ static NSString *command(NSString *path,NSArray *arguments,NSError **error) {
- (void)check {
NSString *phase=_state[@"phase"];if([@[@"checking",@"downloading",@"validating"]containsObject:phase])return;
unsigned generation=++_generation;[self emit:@"checking" message:@"正在检查公测更新…"];
NSString *url=[NSString stringWithFormat:@"https://dayu.media/wp-json/dayu-color/v1/update?bundle_id=com.dayu.color&channel=beta&current_build=%@",[NSBundle.mainBundle objectForInfoDictionaryKey:@"CFBundleVersion"]];
NSString *url=[NSString stringWithFormat:@"https://dayu.media/wp-json/dayu-color/v1/update?bundle_id=com.dayu.color&channel=beta&current_build=%@",([NSBundle.mainBundle objectForInfoDictionaryKey:@"CFBundleVersion"]?:@"0")];
NSMutableURLRequest *request=[NSMutableURLRequest requestWithURL:[NSURL URLWithString:url] cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:6];
[_task release];_task=[[_session dataTaskWithRequest:request completionHandler:^(NSData *data,NSURLResponse *response,NSError *error){@autoreleasepool{
NSDictionary *value=data.length<=32768?[NSJSONSerialization JSONObjectWithData:data?:[NSData data] options:0 error:nil]:nil;
@@ -150,7 +162,7 @@ static NSString *command(NSString *path,NSArray *arguments,NSError **error) {
}}]retain];[_task resume];
}
- (void)install {
if(![_state[@"phase"]isEqual:@"ready"]&&![_state[@"phase"]isEqual:@"host_wait"])return;
if(![@[@"ready",@"host_wait",@"installer"]containsObject:_state[@"phase"]])return;
for(NSString *ID in @[@"com.apple.FinalCut",@"com.apple.FinalCutApp",@"com.apple.motionapp",@"com.apple.motionappApp"])
if([NSRunningApplication runningApplicationsWithBundleIdentifier:ID].count){[self emit:@"host_wait" message:@"请先保存并正常退出 FCP / Motion,再点击安装更新。不会强制退出宿主。"];
DYBetaEvent(@"update_installer",@{@"status":@"waiting_for_host"});return;}