2020-02-12 10:48:58 +00:00
|
|
|
|
2020-03-25 14:04:02 +00:00
|
|
|
using System.Text;
|
2020-07-15 12:33:44 +00:00
|
|
|
using System.Text.Json.Serialization;
|
2020-03-25 14:04:02 +00:00
|
|
|
|
2020-05-14 15:52:06 +00:00
|
|
|
using ASC.Api.Core;
|
2020-02-26 10:01:12 +00:00
|
|
|
using ASC.Api.Documents;
|
2020-02-17 08:58:14 +00:00
|
|
|
using ASC.Common;
|
2020-04-13 11:46:26 +00:00
|
|
|
using ASC.Web.Files;
|
2020-04-20 08:08:04 +00:00
|
|
|
using ASC.Web.Files.HttpHandlers;
|
2020-07-15 12:33:44 +00:00
|
|
|
|
2020-02-12 10:48:58 +00:00
|
|
|
using Microsoft.AspNetCore.Builder;
|
|
|
|
using Microsoft.AspNetCore.Hosting;
|
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
using Microsoft.Extensions.Hosting;
|
|
|
|
|
|
|
|
namespace ASC.Files
|
|
|
|
{
|
2020-07-07 20:00:39 +00:00
|
|
|
public class Startup : BaseStartup
|
2020-07-15 12:33:44 +00:00
|
|
|
{
|
|
|
|
public override string[] LogParams { get => new string[] { "ASC.Files" }; }
|
|
|
|
public override JsonConverter[] Converters { get => new JsonConverter[] { new FileEntryWrapperConverter() }; }
|
|
|
|
|
2020-02-12 10:48:58 +00:00
|
|
|
public Startup(IConfiguration configuration, IHostEnvironment hostEnvironment)
|
2020-07-07 20:00:39 +00:00
|
|
|
: base(configuration, hostEnvironment)
|
2020-07-15 12:33:44 +00:00
|
|
|
{
|
|
|
|
|
2020-02-12 10:48:58 +00:00
|
|
|
}
|
|
|
|
|
2020-07-07 20:00:39 +00:00
|
|
|
public override void ConfigureServices(IServiceCollection services)
|
2020-02-12 10:48:58 +00:00
|
|
|
{
|
2020-03-25 14:04:02 +00:00
|
|
|
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
|
|
|
|
2020-02-12 10:48:58 +00:00
|
|
|
services.AddMemoryCache();
|
|
|
|
|
2020-02-17 08:58:14 +00:00
|
|
|
var diHelper = new DIHelper(services);
|
2020-02-12 10:48:58 +00:00
|
|
|
|
2020-02-26 10:01:12 +00:00
|
|
|
diHelper
|
2020-07-16 09:08:20 +00:00
|
|
|
.AddApiProductEntryPointService()
|
2020-02-26 10:01:12 +00:00
|
|
|
.AddDocumentsControllerService()
|
2020-04-13 11:46:26 +00:00
|
|
|
.AddEncryptionControllerService()
|
2020-04-20 08:08:04 +00:00
|
|
|
.AddFileHandlerService()
|
2020-04-20 12:08:24 +00:00
|
|
|
.AddChunkedUploaderHandlerService()
|
2020-04-20 12:32:24 +00:00
|
|
|
.AddThirdPartyAppHandlerService()
|
|
|
|
.AddDocuSignHandlerService();
|
2020-02-12 13:50:38 +00:00
|
|
|
|
2020-07-07 20:00:39 +00:00
|
|
|
base.ConfigureServices(services);
|
2020-02-12 10:48:58 +00:00
|
|
|
}
|
|
|
|
|
2020-07-07 20:00:39 +00:00
|
|
|
public override void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
2020-02-12 10:48:58 +00:00
|
|
|
{
|
2020-07-07 20:00:39 +00:00
|
|
|
base.Configure(app, env);
|
2020-02-12 10:48:58 +00:00
|
|
|
|
2020-04-13 11:46:26 +00:00
|
|
|
app.MapWhen(
|
|
|
|
context => context.Request.Path.ToString().EndsWith("httphandlers/filehandler.ashx"),
|
|
|
|
appBranch =>
|
|
|
|
{
|
|
|
|
appBranch.UseFileHandler();
|
|
|
|
});
|
|
|
|
|
2020-04-20 08:08:04 +00:00
|
|
|
app.MapWhen(
|
|
|
|
context => context.Request.Path.ToString().EndsWith("ChunkedUploader.ashx"),
|
|
|
|
appBranch =>
|
|
|
|
{
|
|
|
|
appBranch.UseChunkedUploaderHandler();
|
|
|
|
});
|
|
|
|
|
2020-04-20 12:08:24 +00:00
|
|
|
app.MapWhen(
|
|
|
|
context => context.Request.Path.ToString().EndsWith("ThirdPartyAppHandler.ashx"),
|
|
|
|
appBranch =>
|
|
|
|
{
|
|
|
|
appBranch.UseThirdPartyAppHandler();
|
|
|
|
});
|
|
|
|
|
2020-04-20 12:32:24 +00:00
|
|
|
app.MapWhen(
|
|
|
|
context => context.Request.Path.ToString().EndsWith("DocuSignHandler.ashx"),
|
|
|
|
appBranch =>
|
|
|
|
{
|
|
|
|
appBranch.UseDocuSignHandler();
|
|
|
|
});
|
2020-02-12 10:48:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|