✨ Setup drive dashboard
This commit is contained in:
@@ -41,6 +41,7 @@ public class FilePool : ModelBase, IIdentifiedResource
|
||||
{
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
[MaxLength(1024)] public string Name { get; set; } = string.Empty;
|
||||
[MaxLength(8192)] public string Description { get; set; } = string.Empty;
|
||||
[Column(TypeName = "jsonb")] public RemoteStorageConfig StorageConfig { get; set; } = new();
|
||||
[Column(TypeName = "jsonb")] public BillingConfig BillingConfig { get; set; } = new();
|
||||
[Column(TypeName = "jsonb")] public PolicyConfig PolicyConfig { get; set; } = new();
|
||||
|
@@ -156,9 +156,9 @@ public abstract class TusService
|
||||
|
||||
var metadata = eventContext.Metadata;
|
||||
var contentType = metadata.TryGetValue("content-type", out var ct) ? ct.GetString(Encoding.UTF8) : null;
|
||||
|
||||
|
||||
var scope = eventContext.HttpContext.RequestServices.CreateScope();
|
||||
|
||||
|
||||
var rejected = false;
|
||||
|
||||
var fs = scope.ServiceProvider.GetRequiredService<FileService>();
|
||||
@@ -173,9 +173,22 @@ public abstract class TusService
|
||||
|
||||
// Do the policy check
|
||||
var policy = pool!.PolicyConfig;
|
||||
if (!rejected && !pool.PolicyConfig.AllowEncryption)
|
||||
{
|
||||
var encryptPassword = eventContext.HttpContext.Request.Headers["X-FilePass"].FirstOrDefault();
|
||||
if (!string.IsNullOrEmpty(encryptPassword))
|
||||
{
|
||||
eventContext.FailRequest(
|
||||
HttpStatusCode.Forbidden,
|
||||
"File encryption is not allowed in this pool"
|
||||
);
|
||||
rejected = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!rejected && policy.AcceptTypes is not null)
|
||||
{
|
||||
if (contentType is null)
|
||||
if (string.IsNullOrEmpty(contentType))
|
||||
{
|
||||
eventContext.FailRequest(
|
||||
HttpStatusCode.BadRequest,
|
||||
|
Reference in New Issue
Block a user