增加请求域名动态返回云存储配置token
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-03-10 14:05:18 +08:00
parent 1a39d03c7e
commit 59be897fd8
4 changed files with 52 additions and 11 deletions
+29 -7
View File
@@ -16,6 +16,7 @@ using Minio;
using Minio.DataModel;
using Minio.DataModel.Args;
using Minio.Exceptions;
using Serilog.Parsing;
using System.IO;
using System.Reactive.Linq;
using System.Runtime.InteropServices;
@@ -82,7 +83,7 @@ public class ObjectStoreServiceOptions
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 bool IsOpenStoreSync { get; set; }
public List<SyncStoreConfig> SyncConfigList { get; set; }
}
[LowerCamelCaseJson]
@@ -178,7 +183,7 @@ public interface IOSSService
List<string> GetRootFolderNames();
public ObjectStoreDTO GetObjectStoreTempToken();
public ObjectStoreDTO GetObjectStoreTempToken(string? domain = null);
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")
{
var ossOptions = ObjectStoreServiceOptions.AliyunOSS;
var client = new Client(new AlibabaCloud.OpenApiClient.Models.Config()
{
AccessKeyId = ossOptions.AccessKeyId,
@@ -1817,11 +1835,12 @@ public class OSSService : IOSSService
AliyunOSSTempToken = tempToken;
return new ObjectStoreDTO() { ObjectStoreUse = ObjectStoreServiceOptions.ObjectStoreUse, AliyunOSS = tempToken };
objectStoreDTO.AliyunOSS = tempToken;
}
else if (ObjectStoreServiceOptions.ObjectStoreUse == "MinIO")
{
return new ObjectStoreDTO() { ObjectStoreUse = ObjectStoreServiceOptions.ObjectStoreUse, MinIO = ObjectStoreServiceOptions.MinIO };
objectStoreDTO.MinIO = ObjectStoreServiceOptions.MinIO;
}
else if (ObjectStoreServiceOptions.ObjectStoreUse == "AWS")
{
@@ -1865,12 +1884,15 @@ public class OSSService : IOSSService
};
AWSTempToken = tempToken;
return new ObjectStoreDTO() { ObjectStoreUse = ObjectStoreServiceOptions.ObjectStoreUse, AWS = tempToken };
objectStoreDTO.AWS = tempToken;
}
else
{
throw new BusinessValidationFailedException("未定义的存储介质类型");
}
return objectStoreDTO;
}
}
@@ -16862,17 +16862,17 @@
</member>
<member name="F:IRaCIS.Core.Application.ViewModel.AccessToDialogueEnum.Question">
<summary>
质疑
</summary>
</member>
<member name="F:IRaCIS.Core.Application.ViewModel.AccessToDialogueEnum.Consistency">
<summary>
һԺ˲
一致性核查
</summary>
</member>
<member name="T:IRaCIS.Core.Application.ViewModel.CopyFrontAuditConfigItemDto">
<summary>
复制
</summary>
</member>
<member name="T:IRaCIS.Core.Application.ViewModel.SystemNoticeView">