🐛 Bug fixes
This commit is contained in:
1
DysonNetwork.Drive/.gitignore
vendored
Normal file
1
DysonNetwork.Drive/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/Uploads/
|
@@ -52,10 +52,8 @@
|
||||
<PackageReference Include="EFCore.BulkExtensions" Version="9.0.1" />
|
||||
<PackageReference Include="EFCore.BulkExtensions.PostgreSql" Version="9.0.1" />
|
||||
<PackageReference Include="EFCore.NamingConventions" Version="9.0.0" />
|
||||
<PackageReference Include="SkiaSharp" Version="3.119.0" />
|
||||
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="3.119.0" />
|
||||
<PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="3.119.0" />
|
||||
<PackageReference Include="SkiaSharp.NativeAssets.macOS" Version="3.119.0" />
|
||||
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="2.88.9" />
|
||||
<PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="2.88.9" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="9.0.3" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="9.0.3" />
|
||||
<PackageReference Include="tusdotnet" Version="2.10.0" />
|
||||
|
@@ -18,7 +18,7 @@ public static class ApplicationBuilderExtensions
|
||||
app.UseAuthorization();
|
||||
app.MapControllers();
|
||||
|
||||
app.MapTus("/tus", _ => Task.FromResult(TusService.BuildConfiguration(tusStore)));
|
||||
app.MapTus("/api/tus", _ => Task.FromResult(TusService.BuildConfiguration(tusStore, app.Configuration)));
|
||||
|
||||
return app;
|
||||
}
|
||||
|
@@ -50,7 +50,7 @@ public class FileService(
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
|
||||
public async Task<List<CloudFile>> GetFilesAsync(List<string> fileIds)
|
||||
{
|
||||
var cachedFiles = new Dictionary<string, CloudFile>();
|
||||
@@ -146,7 +146,11 @@ public class FileService(
|
||||
{
|
||||
case "image":
|
||||
var blurhash =
|
||||
BlurHashSharp.SkiaSharp.BlurHashEncoder.Encode(xComponent: 3, yComponent: 3, filename: ogFilePath);
|
||||
BlurHashSharp.SkiaSharp.BlurHashEncoder.Encode(
|
||||
xComponent: 3,
|
||||
yComponent: 3,
|
||||
filename: ogFilePath
|
||||
);
|
||||
|
||||
// Rewind stream
|
||||
stream.Position = 0;
|
||||
@@ -160,7 +164,7 @@ public class FileService(
|
||||
|
||||
// Try to get orientation from exif data
|
||||
var orientation = 1;
|
||||
var meta = new Dictionary<string, object>
|
||||
var meta = new Dictionary<string, object?>
|
||||
{
|
||||
["blur"] = blurhash,
|
||||
["format"] = format,
|
||||
|
@@ -12,7 +12,7 @@ namespace DysonNetwork.Drive.Storage;
|
||||
|
||||
public abstract class TusService
|
||||
{
|
||||
public static DefaultTusConfiguration BuildConfiguration(ITusStore store) => new()
|
||||
public static DefaultTusConfiguration BuildConfiguration(ITusStore store, IConfiguration configuration) => new()
|
||||
{
|
||||
Store = store,
|
||||
Events = new Events
|
||||
@@ -73,6 +73,13 @@ public abstract class TusService
|
||||
|
||||
// Dispose the stream after all processing is complete
|
||||
await fileStream.DisposeAsync();
|
||||
},
|
||||
OnCreateCompleteAsync = eventContext =>
|
||||
{
|
||||
var gatewayUrl = configuration["GatewayUrl"];
|
||||
if (gatewayUrl is not null)
|
||||
eventContext.SetUploadUrl(new Uri(gatewayUrl + "/drive/tus/" + eventContext.FileId));
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"Debug": true,
|
||||
"BaseUrl": "http://localhost:5071",
|
||||
"GatewayUrl": "http://localhost:5094",
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
|
Reference in New Issue
Block a user