초기커밋
This commit is contained in:
42
UGQApiServer/UGQData/UGQBannerImageList.cs
Normal file
42
UGQApiServer/UGQData/UGQBannerImageList.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
||||
using Microsoft.Extensions.Caching.Distributed;
|
||||
using Microsoft.Extensions.Options;
|
||||
using Amazon.S3;
|
||||
|
||||
|
||||
using MetaAssets;
|
||||
|
||||
|
||||
using UGQApiServer.Models;
|
||||
using UGQApiServer.Settings;
|
||||
using UGQApiServer.Storage;
|
||||
using UGQDatabase.Models;
|
||||
using UGQDataAccess.Settings;
|
||||
|
||||
|
||||
namespace UGQApiServer.UGQData;
|
||||
|
||||
|
||||
public class UGQBannerImageList
|
||||
{
|
||||
readonly AmazonS3Client _s3Client;
|
||||
readonly S3Settings _settings;
|
||||
|
||||
public UGQBannerImageList(IOptions<S3Settings> settings)
|
||||
{
|
||||
_settings = settings.Value;
|
||||
_s3Client = new AmazonS3Client(_settings.AccessKey, _settings.SecretAccessKey, Amazon.RegionEndpoint.USEast1);
|
||||
}
|
||||
|
||||
public async Task<List<string>> getFiles()
|
||||
{
|
||||
var res = await _s3Client.ListObjectsAsync(_settings.BucketName, "preset");
|
||||
return res.S3Objects.Where(x => x.Key.EndsWith(".png"))
|
||||
.Select(x => x.Key).ToList();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user