DocSpace-client/products/ASC.Files/Server/Startup.cs

68 lines
2.0 KiB
C#
Raw Normal View History

2022-03-03 18:01:34 +00:00
namespace ASC.Files;
public class Startup : BaseStartup
{
public override JsonConverter[] Converters { get => new JsonConverter[] { new FileEntryWrapperConverter(), new FileShareConverter() }; }
public Startup(IConfiguration configuration, IHostEnvironment hostEnvironment)
: base(configuration, hostEnvironment)
2022-02-09 14:34:09 +00:00
{
2020-07-15 12:33:44 +00:00
2022-03-03 18:01:34 +00:00
}
2020-03-25 14:04:02 +00:00
2022-03-03 18:01:34 +00:00
public override void ConfigureServices(IServiceCollection services)
{
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
2020-02-12 10:48:58 +00:00
2022-03-03 18:01:34 +00:00
services.AddMemoryCache();
2020-10-19 19:04:07 +00:00
2022-03-03 18:01:34 +00:00
base.ConfigureServices(services);
2020-10-22 17:57:18 +00:00
2022-03-03 18:01:34 +00:00
DIHelper.TryAdd<FileHandlerService>();
DIHelper.TryAdd<ChunkedUploaderHandlerService>();
DIHelper.TryAdd<DocuSignHandlerService>();
DIHelper.TryAdd<ThirdPartyAppHandlerService>();
2020-02-12 10:48:58 +00:00
2022-03-03 18:01:34 +00:00
NotifyConfigurationExtension.Register(DIHelper);
}
public override void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseCors(builder =>
builder
.AllowAnyOrigin()
.AllowAnyHeader()
.AllowAnyMethod());
2020-07-15 15:27:46 +00:00
2022-03-03 18:01:34 +00:00
base.Configure(app, env);
2020-10-12 16:23:15 +00:00
2022-03-03 18:01:34 +00:00
app.MapWhen(
context => context.Request.Path.ToString().EndsWith("httphandlers/filehandler.ashx"),
appBranch =>
{
appBranch.UseFileHandler();
});
2020-04-13 11:46:26 +00:00
2022-03-03 18:01:34 +00:00
app.MapWhen(
context => context.Request.Path.ToString().EndsWith("ChunkedUploader.ashx"),
appBranch =>
{
appBranch.UseChunkedUploaderHandler();
});
2020-04-20 08:08:04 +00:00
2022-03-03 18:01:34 +00:00
app.MapWhen(
context => context.Request.Path.ToString().EndsWith("ThirdPartyAppHandler.ashx"),
appBranch =>
{
appBranch.UseThirdPartyAppHandler();
});
2020-04-20 12:08:24 +00:00
2022-03-03 18:01:34 +00:00
app.MapWhen(
context => context.Request.Path.ToString().EndsWith("DocuSignHandler.ashx"),
appBranch =>
{
appBranch.UseDocuSignHandler();
});
}
2020-02-12 10:48:58 +00:00
}