Merge branch 'Test_IRC_Net8' of https://gitea.frp.extimaging.com/XCKJ/irc-netcore-api into Test_IRC_Net8
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
commit
3c2701fe9d
|
|
@ -25,6 +25,7 @@ using Microsoft.Extensions.Options;
|
||||||
using Org.BouncyCastle.Tls;
|
using Org.BouncyCastle.Tls;
|
||||||
using RestSharp;
|
using RestSharp;
|
||||||
using RestSharp.Authenticators;
|
using RestSharp.Authenticators;
|
||||||
|
using Serilog;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
|
@ -137,10 +138,15 @@ namespace IRaCIS.Api.Controllers
|
||||||
public async Task<IResponseOutput> GetObjectStoreTokenAsync([FromServices] IOptionsMonitor<ObjectStoreServiceOptions> options, [FromServices] IOSSService _oSSService)
|
public async Task<IResponseOutput> GetObjectStoreTokenAsync([FromServices] IOptionsMonitor<ObjectStoreServiceOptions> options, [FromServices] IOSSService _oSSService)
|
||||||
{
|
{
|
||||||
|
|
||||||
var result = _oSSService.GetObjectStoreTempToken();
|
var domain = HttpContext.Request.Host.Host;
|
||||||
|
|
||||||
|
|
||||||
|
var result = _oSSService.GetObjectStoreTempToken(domain);
|
||||||
|
|
||||||
//result.AWS = await GetAWSTemToken(options.CurrentValue);
|
//result.AWS = await GetAWSTemToken(options.CurrentValue);
|
||||||
|
|
||||||
|
Log.Logger.Information($"使用域名:{domain}请求token.返回{result.ToJsonStr()}");
|
||||||
|
|
||||||
return ResponseOutput.Ok(result);
|
return ResponseOutput.Ok(result);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,19 @@
|
||||||
"ObjectStoreService": {
|
"ObjectStoreService": {
|
||||||
// 使用的对象存储服务类型
|
// 使用的对象存储服务类型
|
||||||
"ObjectStoreUse": "AliyunOSS",
|
"ObjectStoreUse": "AliyunOSS",
|
||||||
|
"IsOpenStoreSync": false,
|
||||||
|
"SyncConfigList": [
|
||||||
|
{
|
||||||
|
"Domain": "ir.test.extimaging.com",
|
||||||
|
"Primary": "AliyunOSS",
|
||||||
|
"Target": "AWS"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Domain": "lili.test.extimaging.com",
|
||||||
|
"Primary": "AWS",
|
||||||
|
"Target": "AliyunOSS"
|
||||||
|
}
|
||||||
|
],
|
||||||
// 阿里云对象存储服务的配置
|
// 阿里云对象存储服务的配置
|
||||||
"AliyunOSS": {
|
"AliyunOSS": {
|
||||||
// 阿里云 OSS 的 Region ID
|
// 阿里云 OSS 的 Region ID
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ using Minio;
|
||||||
using Minio.DataModel;
|
using Minio.DataModel;
|
||||||
using Minio.DataModel.Args;
|
using Minio.DataModel.Args;
|
||||||
using Minio.Exceptions;
|
using Minio.Exceptions;
|
||||||
|
using Serilog.Parsing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reactive.Linq;
|
using System.Reactive.Linq;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
@ -82,7 +83,7 @@ public class ObjectStoreServiceOptions
|
||||||
|
|
||||||
public bool IsOpenStoreSync { get; set; }
|
public bool IsOpenStoreSync { get; set; }
|
||||||
|
|
||||||
public List<SyncStoreConfig> SyncConfigList { get; set; }
|
public List<SyncStoreConfig> SyncConfigList { get; set; } = new List<SyncStoreConfig>();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -107,6 +108,10 @@ public class ObjectStoreDTO
|
||||||
|
|
||||||
public AWSTempToken AWS { get; set; }
|
public AWSTempToken AWS { get; set; }
|
||||||
|
|
||||||
|
public bool IsOpenStoreSync { get; set; }
|
||||||
|
|
||||||
|
public List<SyncStoreConfig> SyncConfigList { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[LowerCamelCaseJson]
|
[LowerCamelCaseJson]
|
||||||
|
|
@ -178,7 +183,7 @@ public interface IOSSService
|
||||||
|
|
||||||
List<string> GetRootFolderNames();
|
List<string> GetRootFolderNames();
|
||||||
|
|
||||||
public ObjectStoreDTO GetObjectStoreTempToken();
|
public ObjectStoreDTO GetObjectStoreTempToken(string? domain = null);
|
||||||
|
|
||||||
public Task MoveObject(string sourcePath, string destPath, bool overwrite = true);
|
public Task MoveObject(string sourcePath, string destPath, bool overwrite = true);
|
||||||
|
|
||||||
|
|
@ -1769,13 +1774,26 @@ public class OSSService : IOSSService
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public ObjectStoreDTO GetObjectStoreTempToken()
|
public ObjectStoreDTO GetObjectStoreTempToken(string? domain = null)
|
||||||
{
|
{
|
||||||
|
//如果传递了域名,并且打开了存储同步,根据域名使用的具体存储覆盖之前的配置,否则就用固定的配置
|
||||||
|
if (ObjectStoreServiceOptions.IsOpenStoreSync && domain.IsNotNullOrEmpty())
|
||||||
|
{
|
||||||
|
var userDomain = domain?.Trim();
|
||||||
|
|
||||||
var ossOptions = ObjectStoreServiceOptions.AliyunOSS;
|
var find = ObjectStoreServiceOptions.SyncConfigList.FirstOrDefault(t => t.Domain == userDomain);
|
||||||
|
if (find != null)
|
||||||
|
{
|
||||||
|
ObjectStoreServiceOptions.ObjectStoreUse = find.Primary;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var objectStoreDTO = new ObjectStoreDTO() { ObjectStoreUse= ObjectStoreServiceOptions.ObjectStoreUse, IsOpenStoreSync = ObjectStoreServiceOptions.IsOpenStoreSync ,SyncConfigList= ObjectStoreServiceOptions .SyncConfigList};
|
||||||
|
|
||||||
if (ObjectStoreServiceOptions.ObjectStoreUse == "AliyunOSS")
|
if (ObjectStoreServiceOptions.ObjectStoreUse == "AliyunOSS")
|
||||||
{
|
{
|
||||||
|
var ossOptions = ObjectStoreServiceOptions.AliyunOSS;
|
||||||
|
|
||||||
var client = new Client(new AlibabaCloud.OpenApiClient.Models.Config()
|
var client = new Client(new AlibabaCloud.OpenApiClient.Models.Config()
|
||||||
{
|
{
|
||||||
AccessKeyId = ossOptions.AccessKeyId,
|
AccessKeyId = ossOptions.AccessKeyId,
|
||||||
|
|
@ -1817,11 +1835,12 @@ public class OSSService : IOSSService
|
||||||
|
|
||||||
AliyunOSSTempToken = tempToken;
|
AliyunOSSTempToken = tempToken;
|
||||||
|
|
||||||
return new ObjectStoreDTO() { ObjectStoreUse = ObjectStoreServiceOptions.ObjectStoreUse, AliyunOSS = tempToken };
|
objectStoreDTO.AliyunOSS = tempToken;
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (ObjectStoreServiceOptions.ObjectStoreUse == "MinIO")
|
else if (ObjectStoreServiceOptions.ObjectStoreUse == "MinIO")
|
||||||
{
|
{
|
||||||
return new ObjectStoreDTO() { ObjectStoreUse = ObjectStoreServiceOptions.ObjectStoreUse, MinIO = ObjectStoreServiceOptions.MinIO };
|
objectStoreDTO.MinIO = ObjectStoreServiceOptions.MinIO;
|
||||||
}
|
}
|
||||||
else if (ObjectStoreServiceOptions.ObjectStoreUse == "AWS")
|
else if (ObjectStoreServiceOptions.ObjectStoreUse == "AWS")
|
||||||
{
|
{
|
||||||
|
|
@ -1865,12 +1884,15 @@ public class OSSService : IOSSService
|
||||||
};
|
};
|
||||||
|
|
||||||
AWSTempToken = tempToken;
|
AWSTempToken = tempToken;
|
||||||
return new ObjectStoreDTO() { ObjectStoreUse = ObjectStoreServiceOptions.ObjectStoreUse, AWS = tempToken };
|
|
||||||
|
objectStoreDTO.AWS = tempToken;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw new BusinessValidationFailedException("未定义的存储介质类型");
|
throw new BusinessValidationFailedException("未定义的存储介质类型");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return objectStoreDTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16922,17 +16922,17 @@
|
||||||
</member>
|
</member>
|
||||||
<member name="F:IRaCIS.Core.Application.ViewModel.AccessToDialogueEnum.Question">
|
<member name="F:IRaCIS.Core.Application.ViewModel.AccessToDialogueEnum.Question">
|
||||||
<summary>
|
<summary>
|
||||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
质疑
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="F:IRaCIS.Core.Application.ViewModel.AccessToDialogueEnum.Consistency">
|
<member name="F:IRaCIS.Core.Application.ViewModel.AccessToDialogueEnum.Consistency">
|
||||||
<summary>
|
<summary>
|
||||||
һ<EFBFBD><EFBFBD><EFBFBD>Ժ˲<EFBFBD>
|
一致性核查
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="T:IRaCIS.Core.Application.ViewModel.CopyFrontAuditConfigItemDto">
|
<member name="T:IRaCIS.Core.Application.ViewModel.CopyFrontAuditConfigItemDto">
|
||||||
<summary>
|
<summary>
|
||||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
复制
|
||||||
</summary>
|
</summary>
|
||||||
</member>
|
</member>
|
||||||
<member name="T:IRaCIS.Core.Application.ViewModel.SystemNoticeView">
|
<member name="T:IRaCIS.Core.Application.ViewModel.SystemNoticeView">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue