验证在线 LUT 分类、帧上传与下载应用,准备 1.22.0
这个提交包含在:
1 父节点
a2a8624dc0
当前提交
a04c4a69ed
11 个文件已更改
+295
-27
没有与搜索条件相匹配的文件
+2
-2
@@ -17,9 +17,9 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XPC!</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.21.8</string>
|
||||
<string>1.22.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>126</string>
|
||||
<string>127</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string></string>
|
||||
<key>PlugInKit</key>
|
||||
|
||||
@@ -72,11 +72,11 @@ static NSDictionary *DYOnlineKeyQuery(void) {
|
||||
CFTypeRef result=NULL;OSStatus status=SecItemCopyMatching((CFDictionaryRef)query,&result);
|
||||
if(status!=errSecSuccess)return nil;
|
||||
NSData *data=[(NSData *)result autorelease];NSDictionary *value=[NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
|
||||
if(![value isKindOfClass:NSDictionary.class]||![value[@"token"]isKindOfClass:NSString.class]||[value[@"token"]length]!=64||[value[@"token"]rangeOfString:@"^[a-f0-9]{64}$" options:NSRegularExpressionSearch].location==NSNotFound||[value[@"expires_at"]doubleValue]<=NSDate.date.timeIntervalSince1970)return nil;
|
||||
if(![value isKindOfClass:NSDictionary.class]||![value[@"token"]isKindOfClass:NSString.class]||[value[@"token"]length]!=64||[value[@"token"]rangeOfString:@"^[a-f0-9]{64}$" options:NSRegularExpressionSearch].location==NSNotFound||![value[@"expires_at"]isKindOfClass:NSNumber.class]||[value[@"expires_at"]doubleValue]<=NSDate.date.timeIntervalSince1970)return nil;
|
||||
return value;
|
||||
}
|
||||
+ (BOOL)saveCredential:(NSDictionary *)value error:(NSError **)error {
|
||||
if(![value[@"token"]isKindOfClass:NSString.class]||[value[@"token"]length]!=64){if(error)*error=DYOnlineError(401,@"登录凭据无效。");return NO;}
|
||||
if(![value[@"token"]isKindOfClass:NSString.class]||[value[@"token"]length]!=64||[value[@"token"]rangeOfString:@"^[a-f0-9]{64}$" options:NSRegularExpressionSearch].location==NSNotFound||![value[@"expires_at"]isKindOfClass:NSNumber.class]||[value[@"expires_at"]doubleValue]<=NSDate.date.timeIntervalSince1970){if(error)*error=DYOnlineError(401,@"登录凭据无效。");return NO;}
|
||||
NSData *data=[NSJSONSerialization dataWithJSONObject:value options:0 error:error];if(!data)return NO;
|
||||
OSStatus status=SecItemUpdate((CFDictionaryRef)DYOnlineKeyQuery(),(CFDictionaryRef)@{(id)kSecValueData:data});
|
||||
if(status==errSecItemNotFound) {
|
||||
|
||||
@@ -284,7 +284,7 @@ typedef NS_ENUM(NSInteger,DYRegistrationState) { DYChecking, DYRegistering, DYRe
|
||||
- (void)stopAccountLogin {
|
||||
self.accountGeneration++;[self.accountTask cancel];self.accountTask=nil;
|
||||
[self.loginTimer invalidate];self.loginTimer=nil;self.loginSessionKey=nil;self.pollingLogin=NO;
|
||||
self.loginButton.enabled=YES;self.accessButton.enabled=YES;
|
||||
self.loginButton.title=@"微信登录";self.loginButton.enabled=YES;self.accessButton.enabled=YES;
|
||||
}
|
||||
- (void)refreshOnlineAccount:(id)sender {
|
||||
if(self.loginSessionKey.length)return;
|
||||
@@ -303,6 +303,7 @@ typedef NS_ENUM(NSInteger,DYRegistrationState) { DYChecking, DYRegistering, DYRe
|
||||
}];
|
||||
}
|
||||
- (void)loginOnlineAccount:(id)sender {
|
||||
if(self.loginSessionKey.length){[self stopAccountLogin];self.accountTitle.stringValue=@"登录已取消";self.accountDetail.stringValue=@"可以重新点击微信登录。";return;}
|
||||
[self stopAccountLogin];NSUInteger generation=self.accountGeneration;
|
||||
NSString *device=[DYOnlineLUTClient deviceUUID];
|
||||
if(!device){self.accountDetail.stringValue=@"无法读取本机身份,请稍后重试。";return;}
|
||||
@@ -317,6 +318,7 @@ typedef NS_ENUM(NSInteger,DYRegistrationState) { DYChecking, DYRegistering, DYRe
|
||||
[self stopAccountLogin];self.accountTitle.stringValue=@"登录未完成";self.accountDetail.stringValue=error.localizedDescription?:@"登录服务返回的地址无效。";return;
|
||||
}
|
||||
self.loginSessionKey=key;self.accountTitle.stringValue=@"请在浏览器中完成微信登录";self.accountDetail.stringValue=@"完成扫码和账号确认后,这里会自动验证在线 LUT 权限。";
|
||||
self.loginButton.title=@"取消登录";self.loginButton.enabled=YES;
|
||||
if(![NSWorkspace.sharedWorkspace openURL:url]){[self stopAccountLogin];self.accountDetail.stringValue=@"无法打开浏览器,请重试。";return;}
|
||||
self.loginTimer=[NSTimer scheduledTimerWithTimeInterval:2 target:self selector:@selector(pollOnlineLogin:) userInfo:@{ @"started":NSDate.date } repeats:YES];
|
||||
}];
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1.21.8</string>
|
||||
<string>1.22.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>126</string>
|
||||
<string>127</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
|
||||
在新工单中引用
屏蔽一个用户