✨ Support access with custom endpoint
This commit is contained in:
@@ -145,9 +145,7 @@ public class FileController(
|
|||||||
private ActionResult? TryProxyRedirect(SnCloudFile file, RemoteStorageConfig dest, string fileName)
|
private ActionResult? TryProxyRedirect(SnCloudFile file, RemoteStorageConfig dest, string fileName)
|
||||||
{
|
{
|
||||||
if (dest.ImageProxy is not null && (file.MimeType?.StartsWith("image/") ?? false))
|
if (dest.ImageProxy is not null && (file.MimeType?.StartsWith("image/") ?? false))
|
||||||
{
|
|
||||||
return Redirect(BuildProxyUrl(dest.ImageProxy, fileName));
|
return Redirect(BuildProxyUrl(dest.ImageProxy, fileName));
|
||||||
}
|
|
||||||
|
|
||||||
return dest.AccessProxy is not null ? Redirect(BuildProxyUrl(dest.AccessProxy, fileName)) : null;
|
return dest.AccessProxy is not null ? Redirect(BuildProxyUrl(dest.AccessProxy, fileName)) : null;
|
||||||
}
|
}
|
||||||
@@ -182,6 +180,9 @@ public class FileController(
|
|||||||
.WithHeaders(headers)
|
.WithHeaders(headers)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (dest.AccessEndpoint is not null)
|
||||||
|
openUrl = openUrl.Replace($"{dest.Endpoint}/{dest.Bucket}", dest.AccessEndpoint);
|
||||||
|
|
||||||
return Redirect(openUrl);
|
return Redirect(openUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ public class RemoteStorageConfig
|
|||||||
public string Region { get; set; } = string.Empty;
|
public string Region { get; set; } = string.Empty;
|
||||||
public string Bucket { get; set; } = string.Empty;
|
public string Bucket { get; set; } = string.Empty;
|
||||||
public string Endpoint { get; set; } = string.Empty;
|
public string Endpoint { get; set; } = string.Empty;
|
||||||
|
public string? AccessEndpoint { get; set; }
|
||||||
public string SecretId { get; set; } = string.Empty;
|
public string SecretId { get; set; } = string.Empty;
|
||||||
public string SecretKey { get; set; } = string.Empty;
|
public string SecretKey { get; set; } = string.Empty;
|
||||||
public bool EnableSigned { get; set; }
|
public bool EnableSigned { get; set; }
|
||||||
|
|||||||
Reference in New Issue
Block a user