From 2d8b085d02832b1cca0a4d15bd222170efba77ed Mon Sep 17 00:00:00 2001 From: Alexey Bannov Date: Fri, 23 Apr 2021 16:54:12 +0300 Subject: [PATCH 01/84] add support WindowsService/systemd for IHostBuilder listen unix socket if it setup for Kestrel Web Server --- .../ASC.ApiSystem/ASC.ApiSystem.csproj | 2 + common/services/ASC.ApiSystem/Program.cs | 40 +++++-- .../ASC.Data.Backup/ASC.Data.Backup.csproj | 2 + common/services/ASC.Data.Backup/Program.cs | 48 ++++++-- .../ASC.Data.Storage.Encryption.csproj | 2 + .../ASC.Data.Storage.Encryption/Program.cs | 43 +++++-- .../ASC.Data.Storage.Migration.csproj | 5 + .../ASC.Data.Storage.Migration/Program.cs | 20 ++-- common/services/ASC.Notify/ASC.Notify.csproj | 2 + common/services/ASC.Notify/Program.cs | 26 ++--- .../ASC.Socket.IO.Svc.csproj | 2 + common/services/ASC.Socket.IO.Svc/Program.cs | 33 +++--- .../ASC.Studio.Notify.csproj | 5 + common/services/ASC.Studio.Notify/Program.cs | 26 ++--- .../ASC.TelegramService.csproj | 2 + .../services/ASC.TelegramService/Program.cs | 43 +++++-- .../ASC.Thumbnails.Svc.csproj | 5 + common/services/ASC.Thumbnails.Svc/Program.cs | 33 +++--- .../ASC.UrlShortener.Svc.csproj | 2 + .../services/ASC.UrlShortener.Svc/Program.cs | 109 +++++++++--------- config/appsettings.json | 6 + products/ASC.CRM/Server/ASC.CRM.csproj | 5 + products/ASC.CRM/Server/Program.cs | 58 +++++----- products/ASC.Files/Server/ASC.Files.csproj | 2 + products/ASC.Files/Server/Program.cs | 38 ++++-- .../Service/ASC.Files.Service.csproj | 5 + products/ASC.Files/Service/Program.cs | 28 ++--- products/ASC.People/Server/ASC.People.csproj | 5 + products/ASC.People/Server/Program.cs | 32 ++++- .../ASC.Projects/Server/ASC.Projects.csproj | 4 +- products/ASC.Projects/Server/Program.cs | 32 ++++- web/ASC.Web.Api/ASC.Web.Api.csproj | 2 + web/ASC.Web.Api/Program.cs | 42 +++++-- web/ASC.Web.Studio/ASC.Web.Studio.csproj | 2 + web/ASC.Web.Studio/Program.cs | 44 +++++-- 35 files changed, 516 insertions(+), 239 deletions(-) diff --git a/common/services/ASC.ApiSystem/ASC.ApiSystem.csproj b/common/services/ASC.ApiSystem/ASC.ApiSystem.csproj index b2b33868a8..fdf210a60c 100644 --- a/common/services/ASC.ApiSystem/ASC.ApiSystem.csproj +++ b/common/services/ASC.ApiSystem/ASC.ApiSystem.csproj @@ -14,6 +14,8 @@ + + diff --git a/common/services/ASC.ApiSystem/Program.cs b/common/services/ASC.ApiSystem/Program.cs index 8d38eb1f0a..53b4778c65 100644 --- a/common/services/ASC.ApiSystem/Program.cs +++ b/common/services/ASC.ApiSystem/Program.cs @@ -24,8 +24,11 @@ */ +using System; using System.Collections.Generic; using System.IO; +using System.Runtime.InteropServices; +using System.Threading.Tasks; using ASC.Common.Utils; @@ -39,18 +42,40 @@ namespace ASC.ApiSystem { public class Program { - public static void Main(string[] args) - { - CreateHostBuilder(args).Build().Run(); + public async static Task Main(string[] args) + { + var host = CreateHostBuilder(args).Build(); + + await host.RunAsync(); } - public static IHostBuilder CreateHostBuilder(string[] args) - { - return Host.CreateDefaultBuilder(args) + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .UseSystemd() + .UseWindowsService() .UseServiceProviderFactory(new AutofacServiceProviderFactory()) .ConfigureWebHostDefaults(webBuilder => { - webBuilder.UseStartup(); + var builder = webBuilder.UseStartup(); + + builder.ConfigureKestrel((hostingContext, serverOptions) => + { + var kestrelConfig = hostingContext.Configuration.GetSection("Kestrel"); + + if (!kestrelConfig.Exists()) return; + + var unixSocket = kestrelConfig.GetValue("ListenUnixSocket"); + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + if (!String.IsNullOrWhiteSpace(unixSocket)) + { + unixSocket = String.Format(unixSocket, hostingContext.HostingEnvironment.ApplicationName.Replace("ASC.", "").Replace(".", "")); + + serverOptions.ListenUnixSocket(unixSocket); + } + } + }); }) .ConfigureAppConfiguration((hostingContext, config) => { @@ -76,6 +101,5 @@ namespace ASC.ApiSystem }); }); - } } } diff --git a/common/services/ASC.Data.Backup/ASC.Data.Backup.csproj b/common/services/ASC.Data.Backup/ASC.Data.Backup.csproj index a9b9e5afa7..d76c4348fb 100644 --- a/common/services/ASC.Data.Backup/ASC.Data.Backup.csproj +++ b/common/services/ASC.Data.Backup/ASC.Data.Backup.csproj @@ -23,6 +23,8 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + + diff --git a/common/services/ASC.Data.Backup/Program.cs b/common/services/ASC.Data.Backup/Program.cs index d420b11033..bccee04c6a 100644 --- a/common/services/ASC.Data.Backup/Program.cs +++ b/common/services/ASC.Data.Backup/Program.cs @@ -1,5 +1,7 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.IO; +using System.Runtime.InteropServices; using System.Threading.Tasks; using ASC.Common.Utils; @@ -13,14 +15,41 @@ using Microsoft.Extensions.Hosting; namespace ASC.Data.Backup { public class Program - { - public static async Task Main(string[] args) - { - await Host.CreateDefaultBuilder(args) + { + public async static Task Main(string[] args) + { + var host = CreateHostBuilder(args).Build(); + + await host.RunAsync(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .UseSystemd() + .UseWindowsService() .UseServiceProviderFactory(new AutofacServiceProviderFactory()) .ConfigureWebHostDefaults(webBuilder => { - webBuilder.UseStartup(); + var builder = webBuilder.UseStartup(); + + builder.ConfigureKestrel((hostingContext, serverOptions) => + { + var kestrelConfig = hostingContext.Configuration.GetSection("Kestrel"); + + if (!kestrelConfig.Exists()) return; + + var unixSocket = kestrelConfig.GetValue("ListenUnixSocket"); + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + if (!String.IsNullOrWhiteSpace(unixSocket)) + { + unixSocket = String.Format(unixSocket, hostingContext.HostingEnvironment.ApplicationName.Replace("ASC.", "").Replace(".", "")); + + serverOptions.ListenUnixSocket(unixSocket); + } + } + }); }) .ConfigureAppConfiguration((hostContext, config) => { @@ -46,10 +75,7 @@ namespace ASC.Data.Backup {"pathToConf", path } } ); - }) - .UseConsoleLifetime() - .Build() - .RunAsync(); - } + }); + } } diff --git a/common/services/ASC.Data.Storage.Encryption/ASC.Data.Storage.Encryption.csproj b/common/services/ASC.Data.Storage.Encryption/ASC.Data.Storage.Encryption.csproj index 8ad075f7a1..cf68a5f7eb 100644 --- a/common/services/ASC.Data.Storage.Encryption/ASC.Data.Storage.Encryption.csproj +++ b/common/services/ASC.Data.Storage.Encryption/ASC.Data.Storage.Encryption.csproj @@ -22,6 +22,8 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + + diff --git a/common/services/ASC.Data.Storage.Encryption/Program.cs b/common/services/ASC.Data.Storage.Encryption/Program.cs index 4714b8acd4..f630a09f6a 100644 --- a/common/services/ASC.Data.Storage.Encryption/Program.cs +++ b/common/services/ASC.Data.Storage.Encryption/Program.cs @@ -22,8 +22,10 @@ * Pursuant to Section 7 3(e) we decline to grant you any rights under trademark law for use of our trademarks. * */ +using System; using System.Collections.Generic; using System.IO; +using System.Runtime.InteropServices; using System.Threading.Tasks; using ASC.Common.Utils; @@ -38,13 +40,40 @@ namespace ASC.Data.Storage.Encryption { public class Program { - public static async Task Main(string[] args) - { - await Host.CreateDefaultBuilder(args) + public async static Task Main(string[] args) + { + var host = CreateHostBuilder(args).Build(); + + await host.RunAsync(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .UseSystemd() + .UseWindowsService() .UseServiceProviderFactory(new AutofacServiceProviderFactory()) .ConfigureWebHostDefaults(webBuilder => { - webBuilder.UseStartup(); + var builder = webBuilder.UseStartup(); + + builder.ConfigureKestrel((hostingContext, serverOptions) => + { + var kestrelConfig = hostingContext.Configuration.GetSection("Kestrel"); + + if (!kestrelConfig.Exists()) return; + + var unixSocket = kestrelConfig.GetValue("ListenUnixSocket"); + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + if (!String.IsNullOrWhiteSpace(unixSocket)) + { + unixSocket = String.Format(unixSocket, hostingContext.HostingEnvironment.ApplicationName.Replace("ASC.", "").Replace(".", "")); + + serverOptions.ListenUnixSocket(unixSocket); + } + } + }); }) .ConfigureAppConfiguration((hostContext, config) => { @@ -69,10 +98,6 @@ namespace ASC.Data.Storage.Encryption .AddJsonFile("kafka.json") .AddJsonFile($"kafka.{env}.json", true) .AddEnvironmentVariables(); - }) - .UseConsoleLifetime() - .Build() - .RunAsync(); - } + }); } } diff --git a/common/services/ASC.Data.Storage.Migration/ASC.Data.Storage.Migration.csproj b/common/services/ASC.Data.Storage.Migration/ASC.Data.Storage.Migration.csproj index 2b3b00aab4..2f88670730 100644 --- a/common/services/ASC.Data.Storage.Migration/ASC.Data.Storage.Migration.csproj +++ b/common/services/ASC.Data.Storage.Migration/ASC.Data.Storage.Migration.csproj @@ -4,6 +4,11 @@ net5.0 + + + + + diff --git a/common/services/ASC.Data.Storage.Migration/Program.cs b/common/services/ASC.Data.Storage.Migration/Program.cs index a3af304668..39e84558dc 100644 --- a/common/services/ASC.Data.Storage.Migration/Program.cs +++ b/common/services/ASC.Data.Storage.Migration/Program.cs @@ -19,9 +19,17 @@ namespace ASC.Data.Storage.Migration { public class Program { - public static async Task Main(string[] args) - { - await Host.CreateDefaultBuilder(args) + public async static Task Main(string[] args) + { + var host = CreateHostBuilder(args).Build(); + + await host.RunAsync(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .UseSystemd() + .UseWindowsService() .UseServiceProviderFactory(new AutofacServiceProviderFactory()) .ConfigureAppConfiguration((hostContext, config) => { @@ -64,10 +72,6 @@ namespace ASC.Data.Storage.Migration .ConfigureContainer((context, builder) => { builder.Register(context.Configuration); - }) - .UseConsoleLifetime() - .Build() - .RunAsync(); - } + }); } } diff --git a/common/services/ASC.Notify/ASC.Notify.csproj b/common/services/ASC.Notify/ASC.Notify.csproj index 412a5e62e2..cfe2a6763e 100644 --- a/common/services/ASC.Notify/ASC.Notify.csproj +++ b/common/services/ASC.Notify/ASC.Notify.csproj @@ -13,6 +13,8 @@ + + diff --git a/common/services/ASC.Notify/Program.cs b/common/services/ASC.Notify/Program.cs index 4d51a67ecc..2f329aa41a 100644 --- a/common/services/ASC.Notify/Program.cs +++ b/common/services/ASC.Notify/Program.cs @@ -21,9 +21,17 @@ namespace ASC.Notify { public class Program { - public static async Task Main(string[] args) + public async static Task Main(string[] args) { - var host = Host.CreateDefaultBuilder(args) + var host = CreateHostBuilder(args).Build(); + + await host.RunAsync(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .UseSystemd() + .UseWindowsService() .UseServiceProviderFactory(new AutofacServiceProviderFactory()) .ConfigureAppConfiguration((hostContext, config) => { @@ -73,18 +81,6 @@ namespace ASC.Notify .ConfigureContainer((context, builder) => { builder.Register(context.Configuration); - }) - .UseConsoleLifetime() - .Build(); - - using (host) - { - // Start the host - await host.StartAsync(); - - // Wait for the host to shutdown - await host.WaitForShutdownAsync(); - } - } + }); } } diff --git a/common/services/ASC.Socket.IO.Svc/ASC.Socket.IO.Svc.csproj b/common/services/ASC.Socket.IO.Svc/ASC.Socket.IO.Svc.csproj index 8237da9e8e..85a8432814 100644 --- a/common/services/ASC.Socket.IO.Svc/ASC.Socket.IO.Svc.csproj +++ b/common/services/ASC.Socket.IO.Svc/ASC.Socket.IO.Svc.csproj @@ -16,6 +16,8 @@ + + diff --git a/common/services/ASC.Socket.IO.Svc/Program.cs b/common/services/ASC.Socket.IO.Svc/Program.cs index 62cec4c062..3275a7c1d1 100644 --- a/common/services/ASC.Socket.IO.Svc/Program.cs +++ b/common/services/ASC.Socket.IO.Svc/Program.cs @@ -46,9 +46,17 @@ namespace ASC.Socket.IO.Svc { public class Program { - public static async Task Main(string[] args) - { - var host = Host.CreateDefaultBuilder(args) + public async static Task Main(string[] args) + { + var host = CreateHostBuilder(args).Build(); + + await host.RunAsync(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .UseSystemd() + .UseWindowsService() .UseServiceProviderFactory(new AutofacServiceProviderFactory()) .ConfigureAppConfiguration((hostContext, config) => { @@ -90,18 +98,7 @@ namespace ASC.Socket.IO.Svc .ConfigureContainer((context, builder) => { builder.Register(context.Configuration, false, false); - }) - .UseConsoleLifetime() - .Build(); - - using (host) - { - // Start the host - await host.StartAsync(); - - // Wait for the host to shutdown - await host.WaitForShutdownAsync(); - } - } - } -} + }); + } +} + diff --git a/common/services/ASC.Studio.Notify/ASC.Studio.Notify.csproj b/common/services/ASC.Studio.Notify/ASC.Studio.Notify.csproj index 145215fa33..3cbedf75cd 100644 --- a/common/services/ASC.Studio.Notify/ASC.Studio.Notify.csproj +++ b/common/services/ASC.Studio.Notify/ASC.Studio.Notify.csproj @@ -10,6 +10,11 @@ false + + + + + diff --git a/common/services/ASC.Studio.Notify/Program.cs b/common/services/ASC.Studio.Notify/Program.cs index e8afa4aafe..803ef994fa 100644 --- a/common/services/ASC.Studio.Notify/Program.cs +++ b/common/services/ASC.Studio.Notify/Program.cs @@ -22,9 +22,17 @@ namespace ASC.Studio.Notify { public class Program { - public static async Task Main(string[] args) + public async static Task Main(string[] args) { - var host = Host.CreateDefaultBuilder(args) + var host = CreateHostBuilder(args).Build(); + + await host.RunAsync(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .UseSystemd() + .UseWindowsService() .UseServiceProviderFactory(new AutofacServiceProviderFactory()) .ConfigureAppConfiguration((hostContext, config) => { @@ -67,18 +75,6 @@ namespace ASC.Studio.Notify .ConfigureContainer((context, builder) => { builder.Register(context.Configuration); - }) - .UseConsoleLifetime() - .Build(); - - using (host) - { - // Start the host - await host.StartAsync(); - - // Wait for the host to shutdown - await host.WaitForShutdownAsync(); - } - } + }); } } diff --git a/common/services/ASC.TelegramService/ASC.TelegramService.csproj b/common/services/ASC.TelegramService/ASC.TelegramService.csproj index de373e69a2..aaced03570 100644 --- a/common/services/ASC.TelegramService/ASC.TelegramService.csproj +++ b/common/services/ASC.TelegramService/ASC.TelegramService.csproj @@ -13,6 +13,8 @@ + + diff --git a/common/services/ASC.TelegramService/Program.cs b/common/services/ASC.TelegramService/Program.cs index 7824c415c9..237602576e 100644 --- a/common/services/ASC.TelegramService/Program.cs +++ b/common/services/ASC.TelegramService/Program.cs @@ -22,8 +22,10 @@ * Pursuant to Section 7 3(e) we decline to grant you any rights under trademark law for use of our trademarks. * */ +using System; using System.Collections.Generic; using System.IO; +using System.Runtime.InteropServices; using System.Threading.Tasks; using ASC.Common.Utils; @@ -38,13 +40,40 @@ namespace ASC.TelegramService { public class Program { - public static async Task Main(string[] args) - { - await Host.CreateDefaultBuilder(args) + public async static Task Main(string[] args) + { + var host = CreateHostBuilder(args).Build(); + + await host.RunAsync(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .UseSystemd() + .UseWindowsService() .UseServiceProviderFactory(new AutofacServiceProviderFactory()) .ConfigureWebHostDefaults(webBuilder => { - webBuilder.UseStartup(); + var builder = webBuilder.UseStartup(); + + builder.ConfigureKestrel((hostingContext, serverOptions) => + { + var kestrelConfig = hostingContext.Configuration.GetSection("Kestrel"); + + if (!kestrelConfig.Exists()) return; + + var unixSocket = kestrelConfig.GetValue("ListenUnixSocket"); + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + if (!String.IsNullOrWhiteSpace(unixSocket)) + { + unixSocket = String.Format(unixSocket, hostingContext.HostingEnvironment.ApplicationName.Replace("ASC.", "").Replace(".", "")); + + serverOptions.ListenUnixSocket(unixSocket); + } + } + }); }) .ConfigureAppConfiguration((hostContext, config) => { @@ -69,10 +98,6 @@ namespace ASC.TelegramService .AddJsonFile("kafka.json") .AddJsonFile($"kafka.{env}.json", true) .AddEnvironmentVariables(); - }) - .UseConsoleLifetime() - .Build() - .RunAsync(); - } + }); } } diff --git a/common/services/ASC.Thumbnails.Svc/ASC.Thumbnails.Svc.csproj b/common/services/ASC.Thumbnails.Svc/ASC.Thumbnails.Svc.csproj index 6a7d3d8ae2..7f0181cd2b 100644 --- a/common/services/ASC.Thumbnails.Svc/ASC.Thumbnails.Svc.csproj +++ b/common/services/ASC.Thumbnails.Svc/ASC.Thumbnails.Svc.csproj @@ -21,5 +21,10 @@ + + + + + \ No newline at end of file diff --git a/common/services/ASC.Thumbnails.Svc/Program.cs b/common/services/ASC.Thumbnails.Svc/Program.cs index 5018f6e5f5..9d5d897dc7 100644 --- a/common/services/ASC.Thumbnails.Svc/Program.cs +++ b/common/services/ASC.Thumbnails.Svc/Program.cs @@ -26,6 +26,7 @@ using System.Collections.Generic; using System.IO; +using System.Reflection; using System.Threading.Tasks; using ASC.Common; @@ -45,11 +46,19 @@ using Microsoft.Extensions.Hosting; namespace ASC.Thumbnails.Svc { public class Program - { - public static async Task Main(string[] args) - { - var host = Host.CreateDefaultBuilder(args) - .UseServiceProviderFactory(new AutofacServiceProviderFactory()) + { + public async static Task Main(string[] args) + { + var host = CreateHostBuilder(args).Build(); + + await host.RunAsync(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .UseSystemd() + .UseWindowsService() + .UseServiceProviderFactory(new AutofacServiceProviderFactory()) .ConfigureAppConfiguration((hostContext, config) => { var buided = config.Build(); @@ -89,18 +98,6 @@ namespace ASC.Thumbnails.Svc .ConfigureContainer((context, builder) => { builder.Register(context.Configuration, false, false); - }) - .UseConsoleLifetime() - .Build(); - - using (host) - { - // Start the host - await host.StartAsync(); - - // Wait for the host to shutdown - await host.WaitForShutdownAsync(); - } - } + }); } } diff --git a/common/services/ASC.UrlShortener.Svc/ASC.UrlShortener.Svc.csproj b/common/services/ASC.UrlShortener.Svc/ASC.UrlShortener.Svc.csproj index cc1faf4b6a..4add2d7682 100644 --- a/common/services/ASC.UrlShortener.Svc/ASC.UrlShortener.Svc.csproj +++ b/common/services/ASC.UrlShortener.Svc/ASC.UrlShortener.Svc.csproj @@ -13,6 +13,8 @@ + + diff --git a/common/services/ASC.UrlShortener.Svc/Program.cs b/common/services/ASC.UrlShortener.Svc/Program.cs index e7c00badb8..46384b30f0 100644 --- a/common/services/ASC.UrlShortener.Svc/Program.cs +++ b/common/services/ASC.UrlShortener.Svc/Program.cs @@ -44,59 +44,60 @@ using Microsoft.Extensions.Hosting; namespace ASC.UrlShortener.Svc { public class Program - { - public static async Task Main(string[] args) - { - var host = Host.CreateDefaultBuilder(args) - .UseServiceProviderFactory(new AutofacServiceProviderFactory()) - .ConfigureAppConfiguration((hostContext, config) => - { - var buided = config.Build(); - var path = buided["pathToConf"]; - if (!Path.IsPathRooted(path)) - { - path = Path.GetFullPath(CrossPlatform.PathCombine(hostContext.HostingEnvironment.ContentRootPath, path)); - } - config.SetBasePath(path); - var env = hostContext.Configuration.GetValue("ENVIRONMENT", "Production"); - config - .AddJsonFile("appsettings.json") - .AddJsonFile($"appsettings.{env}.json", true) - .AddJsonFile($"urlshortener.{env}.json", true) - .AddJsonFile("storage.json") - .AddJsonFile("kafka.json") - .AddJsonFile($"kafka.{env}.json", true) - .AddEnvironmentVariables() - .AddCommandLine(args) - .AddInMemoryCollection(new Dictionary - { - {"pathToConf", path } - } - ); - }) - .ConfigureServices((hostContext, services) => - { - services.AddMemoryCache(); - var diHelper = new DIHelper(services); - LogNLogExtension.ConfigureLog(diHelper, "ASC.UrlShortener.Svc"); - services.AddHostedService(); - diHelper.TryAdd(); - }) - .ConfigureContainer((context, builder) => - { - builder.Register(context.Configuration, false, false); - }) - .UseConsoleLifetime() - .Build(); - - using (host) - { - // Start the host - await host.StartAsync(); - - // Wait for the host to shutdown - await host.WaitForShutdownAsync(); - } - } + { + public async static Task Main(string[] args) + { + var host = CreateHostBuilder(args).Build(); + + await host.RunAsync(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .UseSystemd() + .UseWindowsService() + .UseServiceProviderFactory(new AutofacServiceProviderFactory()) + .ConfigureAppConfiguration((hostContext, config) => + { + var buided = config.Build(); + var path = buided["pathToConf"]; + + if (!Path.IsPathRooted(path)) + { + path = Path.GetFullPath(CrossPlatform.PathCombine(hostContext.HostingEnvironment.ContentRootPath, path)); + } + + config.SetBasePath(path); + + var env = hostContext.Configuration.GetValue("ENVIRONMENT", "Production"); + + config.AddJsonFile("appsettings.json") + .AddJsonFile($"appsettings.{env}.json", true) + .AddJsonFile($"urlshortener.{env}.json", true) + .AddJsonFile("storage.json") + .AddJsonFile("kafka.json") + .AddJsonFile($"kafka.{env}.json", true) + .AddEnvironmentVariables() + .AddCommandLine(args) + .AddInMemoryCollection(new Dictionary + { + {"pathToConf", path } + } + ); + }) + .ConfigureServices((hostContext, services) => + { + services.AddMemoryCache(); + + var diHelper = new DIHelper(services); + + LogNLogExtension.ConfigureLog(diHelper, "ASC.UrlShortener.Svc"); + services.AddHostedService(); + diHelper.TryAdd(); + }) + .ConfigureContainer((context, builder) => + { + builder.Register(context.Configuration, false, false); + }); } } diff --git a/config/appsettings.json b/config/appsettings.json index 867844c665..ef1f609431 100644 --- a/config/appsettings.json +++ b/config/appsettings.json @@ -4,6 +4,12 @@ "Default": "Information", "Microsoft": "Warning", "Microsoft.Hosting.Lifetime": "Information" + }, + "EventLog": { + "LogLevel": { + "Default": "Information", + "Microsoft.Hosting.Lifetime": "Information" + } } }, "AllowedHosts": "*", diff --git a/products/ASC.CRM/Server/ASC.CRM.csproj b/products/ASC.CRM/Server/ASC.CRM.csproj index 552230915b..482cb429ff 100644 --- a/products/ASC.CRM/Server/ASC.CRM.csproj +++ b/products/ASC.CRM/Server/ASC.CRM.csproj @@ -4,6 +4,11 @@ net5.0 + + + + + diff --git a/products/ASC.CRM/Server/Program.cs b/products/ASC.CRM/Server/Program.cs index 891db21768..40cb0088ae 100644 --- a/products/ASC.CRM/Server/Program.cs +++ b/products/ASC.CRM/Server/Program.cs @@ -1,5 +1,8 @@ +using System; using System.Collections.Generic; using System.IO; +using System.Runtime.InteropServices; +using System.Threading.Tasks; using ASC.Common.DependencyInjection; using ASC.Common.Utils; @@ -15,18 +18,40 @@ namespace ASC.CRM { public class Program { - public static void Main(string[] args) + public async static Task Main(string[] args) { - CreateHostBuilder(args).Build().Run(); + var host = CreateHostBuilder(args).Build(); + + await host.RunAsync(); } - public static IHostBuilder CreateHostBuilder(string[] args) - { - return Host.CreateDefaultBuilder(args) + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .UseSystemd() + .UseWindowsService() .UseServiceProviderFactory(new AutofacServiceProviderFactory()) .ConfigureWebHostDefaults(webBuilder => { - webBuilder.UseStartup(); + var builder = webBuilder.UseStartup(); + + builder.ConfigureKestrel((hostingContext, serverOptions) => + { + var kestrelConfig = hostingContext.Configuration.GetSection("Kestrel"); + + if (!kestrelConfig.Exists()) return; + + var unixSocket = kestrelConfig.GetValue("ListenUnixSocket"); + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + if (!String.IsNullOrWhiteSpace(unixSocket)) + { + unixSocket = String.Format(unixSocket, hostingContext.HostingEnvironment.ApplicationName.Replace("ASC.", "").Replace(".", "")); + + serverOptions.ListenUnixSocket(unixSocket); + } + } + }); }) .ConfigureAppConfiguration((hostingContext, config) => { @@ -54,25 +79,6 @@ namespace ASC.CRM .ConfigureContainer((context, builder) => { builder.Register(context.Configuration, true, false); - }); - - - //if (!FilesIntegration.IsRegisteredFileSecurityProvider("crm", "crm_common")) - //{ - // FilesIntegration.RegisterFileSecurityProvider("crm", "crm_common", new FileSecurityProvider()); - //} - - ////Register prodjects' calendar events - //CalendarManager.Instance.RegistryCalendarProvider(userid => - //{ - // if (WebItemSecurity.IsAvailableForUser(WebItemManager.CRMProductID, userid)) - // { - // return new List { new CRMCalendar(userid) }; - // } - // return new List(); - //}); - - - } + });//if (!FilesIntegration.IsRegisteredFileSecurityProvider("crm", "crm_common"))//{// FilesIntegration.RegisterFileSecurityProvider("crm", "crm_common", new FileSecurityProvider());//}////Register prodjects' calendar events//CalendarManager.Instance.RegistryCalendarProvider(userid =>//{// if (WebItemSecurity.IsAvailableForUser(WebItemManager.CRMProductID, userid))// {// return new List { new CRMCalendar(userid) };// }// return new List();//}); } } diff --git a/products/ASC.Files/Server/ASC.Files.csproj b/products/ASC.Files/Server/ASC.Files.csproj index 800e64b831..f6efe51f4d 100644 --- a/products/ASC.Files/Server/ASC.Files.csproj +++ b/products/ASC.Files/Server/ASC.Files.csproj @@ -29,6 +29,8 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + + diff --git a/products/ASC.Files/Server/Program.cs b/products/ASC.Files/Server/Program.cs index a6972128fc..f77229ebc7 100644 --- a/products/ASC.Files/Server/Program.cs +++ b/products/ASC.Files/Server/Program.cs @@ -1,5 +1,8 @@ +using System; using System.Collections.Generic; using System.IO; +using System.Runtime.InteropServices; +using System.Threading.Tasks; using ASC.Common.Utils; @@ -13,18 +16,40 @@ namespace ASC.Files { public class Program { - public static void Main(string[] args) + public async static Task Main(string[] args) { - CreateHostBuilder(args).Build().Run(); + var host = CreateHostBuilder(args).Build(); + + await host.RunAsync(); } - public static IHostBuilder CreateHostBuilder(string[] args) - { - return Host.CreateDefaultBuilder(args) + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .UseSystemd() + .UseWindowsService() .UseServiceProviderFactory(new AutofacServiceProviderFactory()) .ConfigureWebHostDefaults(webBuilder => { - webBuilder.UseStartup(); + var builder = webBuilder.UseStartup(); + + builder.ConfigureKestrel((hostingContext, serverOptions) => + { + var kestrelConfig = hostingContext.Configuration.GetSection("Kestrel"); + + if (!kestrelConfig.Exists()) return; + + var unixSocket = kestrelConfig.GetValue("ListenUnixSocket"); + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + if (!String.IsNullOrWhiteSpace(unixSocket)) + { + unixSocket = String.Format(unixSocket, hostingContext.HostingEnvironment.ApplicationName.Replace("ASC.", "").Replace(".", "")); + + serverOptions.ListenUnixSocket(unixSocket); + } + } + }); }) .ConfigureAppConfiguration((hostingContext, config) => { @@ -49,6 +74,5 @@ namespace ASC.Files {"pathToConf", path} }); }); - } } } diff --git a/products/ASC.Files/Service/ASC.Files.Service.csproj b/products/ASC.Files/Service/ASC.Files.Service.csproj index 87023872f5..9a906ef46a 100644 --- a/products/ASC.Files/Service/ASC.Files.Service.csproj +++ b/products/ASC.Files/Service/ASC.Files.Service.csproj @@ -9,6 +9,11 @@ none false + + + + + diff --git a/products/ASC.Files/Service/Program.cs b/products/ASC.Files/Service/Program.cs index 93094ed7f3..be0b9f6e00 100644 --- a/products/ASC.Files/Service/Program.cs +++ b/products/ASC.Files/Service/Program.cs @@ -22,9 +22,17 @@ namespace ASC.Files.Service { public class Program { - public static async Task Main(string[] args) + public async static Task Main(string[] args) { - var host = Host.CreateDefaultBuilder(args) + var host = CreateHostBuilder(args).Build(); + + await host.RunAsync(); + } + + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .UseSystemd() + .UseWindowsService() .UseServiceProviderFactory(new AutofacServiceProviderFactory()) .ConfigureAppConfiguration((hostContext, config) => { @@ -74,19 +82,7 @@ namespace ASC.Files.Service }) .ConfigureContainer((context, builder) => { - builder.Register(context.Configuration, true, false, "search.json", "feed.json"); - }) - .UseConsoleLifetime() - .Build(); - - using (host) - { - // Start the host - await host.StartAsync(); - - // Wait for the host to shutdown - await host.WaitForShutdownAsync(); - } - } + builder.Register(context.Configuration, true, false, "search.json", "feed.json"); + }); } } diff --git a/products/ASC.People/Server/ASC.People.csproj b/products/ASC.People/Server/ASC.People.csproj index 37404ff39a..7f39c0e52f 100644 --- a/products/ASC.People/Server/ASC.People.csproj +++ b/products/ASC.People/Server/ASC.People.csproj @@ -22,6 +22,11 @@ false 1701;1702;NU1701 + + + + + diff --git a/products/ASC.People/Server/Program.cs b/products/ASC.People/Server/Program.cs index e7f28e6c59..ad38283077 100644 --- a/products/ASC.People/Server/Program.cs +++ b/products/ASC.People/Server/Program.cs @@ -1,5 +1,8 @@ +using System; using System.Collections.Generic; using System.IO; +using System.Runtime.InteropServices; +using System.Threading.Tasks; using ASC.Common.Utils; @@ -13,18 +16,41 @@ namespace ASC.People { public class Program { - public static void Main(string[] args) + public async static Task Main(string[] args) { - CreateHostBuilder(args).Build().Run(); + var host = CreateHostBuilder(args).Build(); + + await host.RunAsync(); } public static IHostBuilder CreateHostBuilder(string[] args) { return Host.CreateDefaultBuilder(args) + .UseSystemd() + .UseWindowsService() .UseServiceProviderFactory(new AutofacServiceProviderFactory()) .ConfigureWebHostDefaults(webBuilder => { - webBuilder.UseStartup(); + var builder = webBuilder.UseStartup(); + + builder.ConfigureKestrel((hostingContext, serverOptions) => + { + var kestrelConfig = hostingContext.Configuration.GetSection("Kestrel"); + + if (!kestrelConfig.Exists()) return; + + var unixSocket = kestrelConfig.GetValue("ListenUnixSocket"); + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + if (!String.IsNullOrWhiteSpace(unixSocket)) + { + unixSocket = String.Format(unixSocket, hostingContext.HostingEnvironment.ApplicationName.Replace("ASC.", "").Replace(".", "")); + + serverOptions.ListenUnixSocket(unixSocket); + } + } + }); }) .ConfigureAppConfiguration((hostingContext, config) => { diff --git a/products/ASC.Projects/Server/ASC.Projects.csproj b/products/ASC.Projects/Server/ASC.Projects.csproj index 4dadc00ae8..b98d7ec7ca 100644 --- a/products/ASC.Projects/Server/ASC.Projects.csproj +++ b/products/ASC.Projects/Server/ASC.Projects.csproj @@ -1,10 +1,12 @@ - + net5.0 + + diff --git a/products/ASC.Projects/Server/Program.cs b/products/ASC.Projects/Server/Program.cs index 1849a83f7c..03825b906a 100644 --- a/products/ASC.Projects/Server/Program.cs +++ b/products/ASC.Projects/Server/Program.cs @@ -1,6 +1,9 @@ +using System; using System.Collections.Generic; using System.IO; +using System.Runtime.InteropServices; +using System.Threading.Tasks; using ASC.Common.Utils; @@ -14,17 +17,40 @@ namespace ASC.Projects { public class Program { - public static void Main(string[] args) + public async static Task Main(string[] args) { - CreateHostBuilder(args).Build().Run(); + var host = CreateHostBuilder(args).Build(); + + await host.RunAsync(); } public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) + .UseSystemd() + .UseWindowsService() .UseServiceProviderFactory(new AutofacServiceProviderFactory()) .ConfigureWebHostDefaults(webBuilder => { - webBuilder.UseStartup(); + var builder = webBuilder.UseStartup(); + + builder.ConfigureKestrel((hostingContext, serverOptions) => + { + var kestrelConfig = hostingContext.Configuration.GetSection("Kestrel"); + + if (!kestrelConfig.Exists()) return; + + var unixSocket = kestrelConfig.GetValue("ListenUnixSocket"); + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + if (!String.IsNullOrWhiteSpace(unixSocket)) + { + unixSocket = String.Format(unixSocket, hostingContext.HostingEnvironment.ApplicationName.Replace("ASC.", "").Replace(".", "")); + + serverOptions.ListenUnixSocket(unixSocket); + } + } + }); }) .ConfigureAppConfiguration((hostingContext, config) => { diff --git a/web/ASC.Web.Api/ASC.Web.Api.csproj b/web/ASC.Web.Api/ASC.Web.Api.csproj index 9eeb2cad4a..d883fc7cc6 100644 --- a/web/ASC.Web.Api/ASC.Web.Api.csproj +++ b/web/ASC.Web.Api/ASC.Web.Api.csproj @@ -24,6 +24,8 @@ + + diff --git a/web/ASC.Web.Api/Program.cs b/web/ASC.Web.Api/Program.cs index 3590902c39..6d45dda336 100644 --- a/web/ASC.Web.Api/Program.cs +++ b/web/ASC.Web.Api/Program.cs @@ -1,5 +1,8 @@ +using System; using System.Collections.Generic; using System.IO; +using System.Runtime.InteropServices; +using System.Threading.Tasks; using ASC.Common.Utils; @@ -13,19 +16,41 @@ using Microsoft.Extensions.Hosting; namespace ASC.Web.Api { public class Program - { - public static void Main(string[] args) - { - CreateHostBuilder(args).Build().Run(); + { + public async static Task Main(string[] args) + { + var host = CreateHostBuilder(args).Build(); + + await host.RunAsync(); } - public static IHostBuilder CreateHostBuilder(string[] args) - { - return Host.CreateDefaultBuilder(args) + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .UseSystemd() + .UseWindowsService() .UseServiceProviderFactory(new AutofacServiceProviderFactory()) .ConfigureWebHostDefaults(webBuilder => { - webBuilder.UseStartup(); + var builder = webBuilder.UseStartup(); + + builder.ConfigureKestrel((hostingContext, serverOptions) => + { + var kestrelConfig = hostingContext.Configuration.GetSection("Kestrel"); + + if (!kestrelConfig.Exists()) return; + + var unixSocket = kestrelConfig.GetValue("ListenUnixSocket"); + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + if (!String.IsNullOrWhiteSpace(unixSocket)) + { + unixSocket = String.Format(unixSocket, hostingContext.HostingEnvironment.ApplicationName.Replace("ASC.", "").Replace(".", "")); + + serverOptions.ListenUnixSocket(unixSocket); + } + } + }); }) .ConfigureAppConfiguration((hostingContext, config) => { @@ -51,6 +76,5 @@ namespace ASC.Web.Api } ); }); - } } } diff --git a/web/ASC.Web.Studio/ASC.Web.Studio.csproj b/web/ASC.Web.Studio/ASC.Web.Studio.csproj index f552b97467..452353b683 100644 --- a/web/ASC.Web.Studio/ASC.Web.Studio.csproj +++ b/web/ASC.Web.Studio/ASC.Web.Studio.csproj @@ -19,6 +19,8 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + + diff --git a/web/ASC.Web.Studio/Program.cs b/web/ASC.Web.Studio/Program.cs index 0d6cace028..c80746edd5 100644 --- a/web/ASC.Web.Studio/Program.cs +++ b/web/ASC.Web.Studio/Program.cs @@ -1,5 +1,8 @@ +using System; using System.Collections.Generic; using System.IO; +using System.Runtime.InteropServices; +using System.Threading.Tasks; using ASC.Common.Utils; @@ -13,18 +16,41 @@ namespace ASC.Web.Studio { public class Program { - public static void Main(string[] args) - { - CreateWebHostBuilder(args).Build().Run(); + public async static Task Main(string[] args) + { + var host = CreateHostBuilder(args).Build(); + + await host.RunAsync(); } - public static IHostBuilder CreateWebHostBuilder(string[] args) - { - return Host.CreateDefaultBuilder(args) + public static IHostBuilder CreateHostBuilder(string[] args) => + Host.CreateDefaultBuilder(args) + .UseSystemd() + .UseWindowsService() .UseServiceProviderFactory(new AutofacServiceProviderFactory()) - .ConfigureWebHostDefaults(w => + .ConfigureWebHostDefaults(webBuilder => { - w.UseStartup(); + var builder = webBuilder.UseStartup(); + + builder.ConfigureKestrel((hostingContext, serverOptions) => + { + var kestrelConfig = hostingContext.Configuration.GetSection("Kestrel"); + + if (!kestrelConfig.Exists()) return; + + var unixSocket = kestrelConfig.GetValue("ListenUnixSocket"); + + if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) + { + if (!String.IsNullOrWhiteSpace(unixSocket)) + { + unixSocket = String.Format(unixSocket, hostingContext.HostingEnvironment.ApplicationName.Replace("ASC.", "").Replace(".", "")); + + serverOptions.ListenUnixSocket(unixSocket); + } + } + }); + }) .ConfigureAppConfiguration((hostingContext, config) => { @@ -48,7 +74,7 @@ namespace ASC.Web.Studio {"pathToConf", path } } ); + }); - } } } From 7f436ef3cbece8fac8dc7c13b67286bf0d51ab8c Mon Sep 17 00:00:00 2001 From: Alexey Bannov Date: Tue, 27 Apr 2021 19:25:03 +0300 Subject: [PATCH 02/84] add support WindowsService/systemd for IHostBuilder --- .../ASC.Calendar/Server/ASC.Calendar.csproj | 2 ++ products/ASC.Calendar/Server/Program.cs | 11 ++++++--- .../Server/Properties/launchSettings.json | 24 +++++++++---------- products/ASC.Mail/Server/ASC.Mail.csproj | 2 ++ products/ASC.Mail/Server/Program.cs | 9 +++++-- .../Server/Properties/launchSettings.json | 24 +++++++++---------- 6 files changed, 41 insertions(+), 31 deletions(-) diff --git a/products/ASC.Calendar/Server/ASC.Calendar.csproj b/products/ASC.Calendar/Server/ASC.Calendar.csproj index ca5c7813a7..cf1455a2e5 100644 --- a/products/ASC.Calendar/Server/ASC.Calendar.csproj +++ b/products/ASC.Calendar/Server/ASC.Calendar.csproj @@ -5,6 +5,8 @@ + + diff --git a/products/ASC.Calendar/Server/Program.cs b/products/ASC.Calendar/Server/Program.cs index 18d2580a14..4a73ada4f7 100644 --- a/products/ASC.Calendar/Server/Program.cs +++ b/products/ASC.Calendar/Server/Program.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.IO; +using System.Threading.Tasks; using Autofac.Extensions.DependencyInjection; @@ -12,19 +13,23 @@ namespace ASC.Calendar { public class Program { - public static void Main(string[] args) + public async static Task Main(string[] args) { - CreateHostBuilder(args).Build().Run(); + var host = CreateHostBuilder(args).Build(); + + await host.RunAsync(); } public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) + .UseSystemd() + .UseWindowsService() .UseServiceProviderFactory(new AutofacServiceProviderFactory()) .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup(); }) - .ConfigureAppConfiguration((hostingContext, config) => + .ConfigureAppConfiguration((hostingContext, config) => { var buided = config.Build(); var path = buided["pathToConf"]; diff --git a/products/ASC.Calendar/Server/Properties/launchSettings.json b/products/ASC.Calendar/Server/Properties/launchSettings.json index 54fab6d0e0..484ee9d02d 100644 --- a/products/ASC.Calendar/Server/Properties/launchSettings.json +++ b/products/ASC.Calendar/Server/Properties/launchSettings.json @@ -1,31 +1,29 @@ { - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:5023", - "sslPort": 0 - } - }, "profiles": { - "IIS Express": { - "commandName": "IISExpress", + "Kestrel WebServer": { + "commandName": "Project", + "launchBrowser": false, + "launchUrl": "http://localhost:5023/api/2.0/calendar/info", "environmentVariables": { "$STORAGE_ROOT": "../../../Data", "log__dir": "../../../Logs", "log__name": "calendar", + "ASPNETCORE_URLS": "http://localhost:5023", "ASPNETCORE_ENVIRONMENT": "Development" } }, - "ASC.Calendar": { - "commandName": "Project", + "WSL 2 : Ubuntu 20.04": { + "commandName": "WSL2", + "launchBrowser": false, + "launchUrl": "http://localhost:5023/api/2.0/calendar/info", "environmentVariables": { "$STORAGE_ROOT": "../../../Data", "log__dir": "../../../Logs", "log__name": "calendar", + "ASPNETCORE_URLS": "http://localhost:5023", "ASPNETCORE_ENVIRONMENT": "Development" }, - "applicationUrl": "http://localhost:5023" + "distributionName": "Ubuntu-20.04" } } } \ No newline at end of file diff --git a/products/ASC.Mail/Server/ASC.Mail.csproj b/products/ASC.Mail/Server/ASC.Mail.csproj index 09c228d1dc..3a859f6e63 100644 --- a/products/ASC.Mail/Server/ASC.Mail.csproj +++ b/products/ASC.Mail/Server/ASC.Mail.csproj @@ -5,6 +5,8 @@ + + diff --git a/products/ASC.Mail/Server/Program.cs b/products/ASC.Mail/Server/Program.cs index d8707387b0..c28b41b694 100644 --- a/products/ASC.Mail/Server/Program.cs +++ b/products/ASC.Mail/Server/Program.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.IO; +using System.Threading.Tasks; using Autofac.Extensions.DependencyInjection; @@ -12,13 +13,17 @@ namespace ASC.Mail { public class Program { - public static void Main(string[] args) + public async static Task Main(string[] args) { - CreateHostBuilder(args).Build().Run(); + var host = CreateHostBuilder(args).Build(); + + await host.RunAsync(); } public static IHostBuilder CreateHostBuilder(string[] args) => Host.CreateDefaultBuilder(args) + .UseSystemd() + .UseWindowsService() .UseServiceProviderFactory(new AutofacServiceProviderFactory()) .ConfigureWebHostDefaults(webBuilder => { diff --git a/products/ASC.Mail/Server/Properties/launchSettings.json b/products/ASC.Mail/Server/Properties/launchSettings.json index 87ed2daba7..9709fdd598 100644 --- a/products/ASC.Mail/Server/Properties/launchSettings.json +++ b/products/ASC.Mail/Server/Properties/launchSettings.json @@ -1,31 +1,29 @@ { - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:5022", - "sslPort": 0 - } - }, "profiles": { - "IIS Express": { - "commandName": "IISExpress", + "Kestrel WebServer": { + "commandName": "Project", + "launchBrowser": false, + "launchUrl": "http://localhost:5022/api/2.0/mail/info", "environmentVariables": { "$STORAGE_ROOT": "../../../Data", "log__dir": "../../../Logs", "log__name": "mail", + "ASPNETCORE_URLS": "http://localhost:5022", "ASPNETCORE_ENVIRONMENT": "Development" } }, - "ASC.Mail": { - "commandName": "Project", + "WSL 2 : Ubuntu 20.04": { + "commandName": "WSL2", + "launchBrowser": false, + "launchUrl": "http://localhost:5022/api/2.0/mail/info", "environmentVariables": { "$STORAGE_ROOT": "../../../Data", "log__dir": "../../../Logs", "log__name": "mail", + "ASPNETCORE_URLS": "http://localhost:5022", "ASPNETCORE_ENVIRONMENT": "Development" }, - "applicationUrl": "http://localhost:5022" + "distributionName": "Ubuntu-20.04" } } } \ No newline at end of file From fc4a58966c0d4be22ea26b3ce6ca5a3247d97c2e Mon Sep 17 00:00:00 2001 From: Ilya Oleshko Date: Wed, 28 Apr 2021 14:03:59 +0300 Subject: [PATCH 03/84] Web: Bumped version to 0.1.9 --- products/ASC.CRM/Client/package.json | 2 +- products/ASC.Calendar/Client/package.json | 2 +- products/ASC.Files/Client/package.json | 2 +- products/ASC.Mail/Client/package.json | 2 +- products/ASC.People/Client/package.json | 2 +- products/ASC.Projects/Client/package.json | 2 +- web/ASC.Web.Client/package.json | 2 +- web/ASC.Web.Editor/package.json | 2 +- web/ASC.Web.Login/package.json | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/products/ASC.CRM/Client/package.json b/products/ASC.CRM/Client/package.json index ba69f5fce3..4651418db1 100644 --- a/products/ASC.CRM/Client/package.json +++ b/products/ASC.CRM/Client/package.json @@ -1,6 +1,6 @@ { "name": "@appserver/crm", - "version": "0.1.8", + "version": "0.1.9", "private": "true", "homepage": "/products/crm", "title": "ONLYOFFICE", diff --git a/products/ASC.Calendar/Client/package.json b/products/ASC.Calendar/Client/package.json index f9749b4b3f..b86e234fe8 100644 --- a/products/ASC.Calendar/Client/package.json +++ b/products/ASC.Calendar/Client/package.json @@ -1,6 +1,6 @@ { "name": "@appserver/calendar", - "version": "0.1.3", + "version": "0.1.9", "private": "true", "homepage": "/products/calendar", "id": "32d24cb5-7ece-4606-9c94-19216ba42086", diff --git a/products/ASC.Files/Client/package.json b/products/ASC.Files/Client/package.json index e0bb11fc77..c30ab50371 100644 --- a/products/ASC.Files/Client/package.json +++ b/products/ASC.Files/Client/package.json @@ -1,6 +1,6 @@ { "name": "@appserver/files", - "version": "0.1.8", + "version": "0.1.9", "private": "true", "homepage": "/products/files", "id": "e67be73d-f9ae-4ce1-8fec-1880cb518cb4", diff --git a/products/ASC.Mail/Client/package.json b/products/ASC.Mail/Client/package.json index 7334d2e1e4..0f8fd2f24f 100644 --- a/products/ASC.Mail/Client/package.json +++ b/products/ASC.Mail/Client/package.json @@ -1,6 +1,6 @@ { "name": "@appserver/mail", - "version": "0.1.3", + "version": "0.1.9", "private": "true", "homepage": "/products/mail", "id": "2a923037-8b2d-487b-9a22-5ac0918acf3f", diff --git a/products/ASC.People/Client/package.json b/products/ASC.People/Client/package.json index 5f9e2806e0..b6c4ed30c4 100644 --- a/products/ASC.People/Client/package.json +++ b/products/ASC.People/Client/package.json @@ -1,6 +1,6 @@ { "name": "@appserver/people", - "version": "0.1.8", + "version": "0.1.9", "private": "true", "homepage": "/products/people", "id": "f4d98afd-d336-4332-8778-3c6945c81ea0", diff --git a/products/ASC.Projects/Client/package.json b/products/ASC.Projects/Client/package.json index f6eac37e4a..f62b86cde4 100644 --- a/products/ASC.Projects/Client/package.json +++ b/products/ASC.Projects/Client/package.json @@ -1,6 +1,6 @@ { "name": "@appserver/projects", - "version": "0.1.8", + "version": "0.1.9", "private": "true", "homepage": "/products/projects", "id": "1e044602-43b5-4d79-82f3-fd6208a11960", diff --git a/web/ASC.Web.Client/package.json b/web/ASC.Web.Client/package.json index 9bee0930b6..43ef4aa119 100644 --- a/web/ASC.Web.Client/package.json +++ b/web/ASC.Web.Client/package.json @@ -1,6 +1,6 @@ { "name": "@appserver/studio", - "version": "0.1.8", + "version": "0.1.9", "private": "true", "homepage": "", "title": "ONLYOFFICE", diff --git a/web/ASC.Web.Editor/package.json b/web/ASC.Web.Editor/package.json index 39ba2a9bf9..9fb25c62c4 100644 --- a/web/ASC.Web.Editor/package.json +++ b/web/ASC.Web.Editor/package.json @@ -1,6 +1,6 @@ { "name": "@appserver/editor", - "version": "0.1.8", + "version": "0.1.9", "private": "true", "homepage": "/products/files/doceditor", "title": "ONLYOFFICE", diff --git a/web/ASC.Web.Login/package.json b/web/ASC.Web.Login/package.json index d4030ca1e9..d497ce91f1 100644 --- a/web/ASC.Web.Login/package.json +++ b/web/ASC.Web.Login/package.json @@ -1,6 +1,6 @@ { "name": "@appserver/login", - "version": "0.1.8", + "version": "0.1.9", "private": "true", "homepage": "/login", "title": "ONLYOFFICE", From 584a88c02507fcdb72bae07c7f114f4415b6ee12 Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Wed, 28 Apr 2021 14:35:49 +0300 Subject: [PATCH 04/84] Web: Files: fixed context menu of share --- products/ASC.Files/Client/src/store/FilesStore.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/products/ASC.Files/Client/src/store/FilesStore.js b/products/ASC.Files/Client/src/store/FilesStore.js index 690b9d8d2f..3ebaba3a79 100644 --- a/products/ASC.Files/Client/src/store/FilesStore.js +++ b/products/ASC.Files/Client/src/store/FilesStore.js @@ -383,8 +383,8 @@ class FilesStore { isRecycleBinFolder, isPrivacyFolder, isRecentFolder, - isShareFolder, - isCommonFolder, + shareFolder: isShareFolder, + commonFolder: isCommonFolder, isFavoritesFolder, isThirdPartyFolder, isMyFolder, From 6527fa7da712d98d9e78f15e5399faf96fd9d199 Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Wed, 28 Apr 2021 16:17:23 +0300 Subject: [PATCH 05/84] Web: Files: fixed isAccessedSelected --- products/ASC.Files/Client/src/store/FilesStore.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/products/ASC.Files/Client/src/store/FilesStore.js b/products/ASC.Files/Client/src/store/FilesStore.js index 3ebaba3a79..0538a1f46f 100644 --- a/products/ASC.Files/Client/src/store/FilesStore.js +++ b/products/ASC.Files/Client/src/store/FilesStore.js @@ -1080,9 +1080,8 @@ class FilesStore { get isAccessedSelected() { return ( - (this.selection.length && - this.selection.every((x) => x.access === 1 || x.access === 0)) || - (this.authStore.isAdmin && this.selection.length) + this.selection.length && + this.selection.every((x) => x.access === 1 || x.access === 0) ); } From a34b6d96e95541d7ecca965fd359b3f67b461648 Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Wed, 28 Apr 2021 16:41:15 +0300 Subject: [PATCH 06/84] Web: Files: removed moveTo action from header for shared folder --- .../ASC.Files/Client/src/pages/Home/Section/Header/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/products/ASC.Files/Client/src/pages/Home/Section/Header/index.js b/products/ASC.Files/Client/src/pages/Home/Section/Header/index.js index 5d01672709..811d62cd24 100644 --- a/products/ASC.Files/Client/src/pages/Home/Section/Header/index.js +++ b/products/ASC.Files/Client/src/pages/Home/Section/Header/index.js @@ -440,6 +440,10 @@ class SectionHeaderContent extends React.Component { menu.splice(4, 1); } + if (isShareFolder) { + menu.splice(4, 1); + } + return menu; }; @@ -593,7 +597,7 @@ export default inject( isPrivacyFolder, isFavoritesFolder, isRecentFolder, - isShareFolder, + shareFolder: isShareFolder, } = treeFoldersStore; const { setAction } = fileActionStore; const { From ea74579f8a15953a4500c5d2eec2b563a6233202 Mon Sep 17 00:00:00 2001 From: Ilya Oleshko Date: Wed, 28 Apr 2021 16:56:10 +0300 Subject: [PATCH 07/84] Web: Files: Store: Fixed displaying badges for new files at favorites --- products/ASC.Files/Client/src/components/Badges.js | 10 +++++++--- products/ASC.Files/Client/src/store/FilesStore.js | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/products/ASC.Files/Client/src/components/Badges.js b/products/ASC.Files/Client/src/components/Badges.js index 80466b3893..edc3844f1d 100644 --- a/products/ASC.Files/Client/src/components/Badges.js +++ b/products/ASC.Files/Client/src/components/Badges.js @@ -24,6 +24,10 @@ const Badges = ({ }) => { const { id, locked, fileStatus, versionGroup, title, fileExst } = item; + const isFavorite = fileStatus === 32; + const isEditing = fileStatus === 1; + const isNewWithFav = fileStatus === 34; + return fileExst ? (
{/* TODO: Uncomment after fix conversation {canConvert && !isTrashFolder && ( @@ -57,7 +61,7 @@ const Badges = ({ onClick={onClickLock} /> )} - {fileStatus === 32 && !isTrashFolder && ( + {(isFavorite || isNewWithFav) && !isTrashFolder && ( )} - {fileStatus === 1 && ( + {isEditing && ( )} {versionGroup > 1 && ( @@ -85,7 +89,7 @@ const Badges = ({ data-id={id} /> )} - {showNew && ( + {(showNew || isNewWithFav) && ( Date: Wed, 28 Apr 2021 17:03:06 +0300 Subject: [PATCH 08/84] Web: Files: HOC: Added missing folder id for copy link action --- products/ASC.Files/Client/src/HOCs/withContextOptions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/products/ASC.Files/Client/src/HOCs/withContextOptions.js b/products/ASC.Files/Client/src/HOCs/withContextOptions.js index 8ec66f6c33..f1a16b066f 100644 --- a/products/ASC.Files/Client/src/HOCs/withContextOptions.js +++ b/products/ASC.Files/Client/src/HOCs/withContextOptions.js @@ -83,7 +83,7 @@ export default function withContextOptions(WrappedComponent) { onClickLinkForPortal = () => { const { item, homepage, t } = this.props; - const { fileExst, canOpenPlayer, webUrl } = item; + const { fileExst, canOpenPlayer, webUrl, id } = item; const isFile = !!fileExst; copy( From 127c240d9e5136cb121546b727be2981f743dbaa Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Wed, 28 Apr 2021 18:08:03 +0300 Subject: [PATCH 09/84] Web: Files: fixed default selected folder for visitor --- .../Client/src/components/Article/Body/index.js | 10 +++++++--- products/ASC.Files/Client/src/pages/Home/index.js | 10 +++++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/products/ASC.Files/Client/src/components/Article/Body/index.js b/products/ASC.Files/Client/src/components/Article/Body/index.js index bfca33dfdb..2b2020eec1 100644 --- a/products/ASC.Files/Client/src/components/Article/Body/index.js +++ b/products/ASC.Files/Client/src/components/Article/Body/index.js @@ -117,10 +117,14 @@ export default inject( }) => { const { fetchFiles, filter, setIsLoading } = filesStore; const { treeFolders, setSelectedNode, setTreeFolders } = treeFoldersStore; + + const selectedNode = treeFoldersStore.selectedTreeNode; + const selectedTreeNode = - treeFoldersStore.selectedTreeNode.length > 0 && - treeFoldersStore.selectedTreeNode[0] !== "@my" - ? treeFoldersStore.selectedTreeNode + selectedNode.length > 0 && + selectedNode[0] !== "@my" && + selectedNode[0] !== "@common" + ? selectedNode : [selectedFolderStore.id + ""]; const { setNewFilesPanelVisible, setNewFilesIds } = dialogsStore; diff --git a/products/ASC.Files/Client/src/pages/Home/index.js b/products/ASC.Files/Client/src/pages/Home/index.js index 4683c599c0..08ae56ba52 100644 --- a/products/ASC.Files/Client/src/pages/Home/index.js +++ b/products/ASC.Files/Client/src/pages/Home/index.js @@ -30,7 +30,13 @@ import config from "../../../package.json"; class PureHome extends React.Component { componentDidMount() { - const { fetchFiles, homepage, setIsLoading, setFirstLoad } = this.props; + const { + fetchFiles, + homepage, + setIsLoading, + setFirstLoad, + isVisitor, + } = this.props; const reg = new RegExp(`${homepage}((/?)$|/filter)`, "gm"); //TODO: Always find? const match = window.location.pathname.match(reg); @@ -41,6 +47,7 @@ class PureHome extends React.Component { if (!filterObj) { filterObj = FilesFilter.getDefault(); + if (isVisitor) filterObj.folder = "@common"; const folderId = filterObj.folder; setIsLoading(true); fetchFiles(folderId, filterObj).finally(() => { @@ -364,6 +371,7 @@ export default inject( viewAs, uploaded, isRecycleBinFolder, + isVisitor: auth.userStore.user.isVisitor, primaryProgressDataVisible, primaryProgressDataPercent, From 90a5a79d03c48b8d9707a6771cd4ba3e940bfe42 Mon Sep 17 00:00:00 2001 From: AlexeySafronov Date: Thu, 29 Apr 2021 12:45:33 +0300 Subject: [PATCH 10/84] Web: Files: Added encodeURIComponent (e-mail shared link issue) --- .../Client/src/components/panels/SharingPanel/SharingRow.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/products/ASC.Files/Client/src/components/panels/SharingPanel/SharingRow.js b/products/ASC.Files/Client/src/components/panels/SharingPanel/SharingRow.js index 12cc31c764..09675fc0b0 100644 --- a/products/ASC.Files/Client/src/components/panels/SharingPanel/SharingRow.js +++ b/products/ASC.Files/Client/src/components/panels/SharingPanel/SharingRow.js @@ -49,7 +49,11 @@ class SharingRow extends React.Component { const subject = t("ShareEmailSubject", { itemName }); const body = t("ShareEmailBody", { itemName, shareLink }); - window.open(`mailto:?subject=${subject}&body=${body}`); + window.open( + `mailto:?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent( + body + )}` + ); }; onShareTwitter = () => { From 61695dfb5fc31f77830ca62111a76ba87f71cdf0 Mon Sep 17 00:00:00 2001 From: AlexeySafronov Date: Thu, 29 Apr 2021 13:44:37 +0300 Subject: [PATCH 11/84] Web: Files: Hide Facebook share link (new FB SDK required) --- packages/asc-web-common/utils/index.js | 11 ++++ .../panels/SharingPanel/SharingRow.js | 54 +++++++++++++------ 2 files changed, 48 insertions(+), 17 deletions(-) diff --git a/packages/asc-web-common/utils/index.js b/packages/asc-web-common/utils/index.js index 72c5265702..51cea4bd2b 100644 --- a/packages/asc-web-common/utils/index.js +++ b/packages/asc-web-common/utils/index.js @@ -213,3 +213,14 @@ export function clickBackdrop() { elms[0].click(); } } + +export default function objectToGetParams(object) { + const params = Object.entries(object) + .filter(([, value]) => value !== undefined && value !== null) + .map( + ([key, value]) => + `${encodeURIComponent(key)}=${encodeURIComponent(String(value))}` + ); + + return params.length > 0 ? `?${params.join("&")}` : ""; +} diff --git a/products/ASC.Files/Client/src/components/panels/SharingPanel/SharingRow.js b/products/ASC.Files/Client/src/components/panels/SharingPanel/SharingRow.js index 09675fc0b0..7bd7f2d735 100644 --- a/products/ASC.Files/Client/src/components/panels/SharingPanel/SharingRow.js +++ b/products/ASC.Files/Client/src/components/panels/SharingPanel/SharingRow.js @@ -10,6 +10,7 @@ import AccessComboBox from "./AccessComboBox"; //import equal from "fast-deep-equal/react"; import { getAccessIcon } from "../../../helpers/files-helpers"; import { ReactSVG } from "react-svg"; +import objectToGetParams from "@appserver/common/utils"; class SharingRow extends React.Component { constructor(props) { @@ -49,23 +50,42 @@ class SharingRow extends React.Component { const subject = t("ShareEmailSubject", { itemName }); const body = t("ShareEmailBody", { itemName, shareLink }); - window.open( - `mailto:?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent( - body - )}` - ); + const mailtoLink = + "mailto:" + + objectToGetParams({ + subject, + body, + }); + + window.open(mailtoLink); }; onShareTwitter = () => { - const encodedLink = encodeURIComponent(this.props.item.sharedTo.shareLink); - window.open(`https://twitter.com/intent/tweet?text=${encodedLink}`); + const { item } = this.props; + const { shareLink } = item.sharedTo; + + const twitterLink = + "https://twitter.com/intent/tweet" + + objectToGetParams({ + text: shareLink, + }); + + window.open(twitterLink); }; - onShareFacebook = () => { - window.open( - `https://www.facebook.com/sharer/sharer.php?u=${this.props.item.sharedTo.shareLink}` - ); - }; + // onShareFacebook = () => { + // const { item, selection } = this.props; + // const { shareLink } = item.sharedTo; + + // const facebookLink = + // "https://www.facebook.com/sharer/sharer.php" + + // objectToGetParams({ + // u: shareLink, + // t: selection.title ? selection.title : selection[0].title, + // }); + + // window.open(facebookLink); + // }; render() { //console.log("SharingRow render"); @@ -124,11 +144,11 @@ class SharingRow extends React.Component { label: `${t("ShareVia")} e-mail`, onClick: this.onShareEmail, }, - { - key: "linkItem_3", - label: `${t("ShareVia")} Facebook`, - onClick: this.onShareFacebook, - }, + // { + // key: "linkItem_3", + // label: `${t("ShareVia")} Facebook`, + // onClick: this.onShareFacebook, + // }, { key: "linkItem_4", label: `${t("ShareVia")} Twitter`, From 7c9d646df9b5f757721934f2a5d2d3f4f57fb7ce Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Thu, 29 Apr 2021 14:45:13 +0300 Subject: [PATCH 12/84] Web: Files: fixed context menu options --- products/ASC.Files/Client/src/store/FilesStore.js | 7 +++++-- products/ASC.Files/Client/src/store/TreeFoldersStore.js | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/products/ASC.Files/Client/src/store/FilesStore.js b/products/ASC.Files/Client/src/store/FilesStore.js index 93ac1910bc..09f3a1aa4f 100644 --- a/products/ASC.Files/Client/src/store/FilesStore.js +++ b/products/ASC.Files/Client/src/store/FilesStore.js @@ -383,13 +383,16 @@ class FilesStore { isRecycleBinFolder, isPrivacyFolder, isRecentFolder, - shareFolder: isShareFolder, - commonFolder: isCommonFolder, + isCommon, + isShare, isFavoritesFolder, isThirdPartyFolder, isMyFolder, } = this.treeFoldersStore; + const isShareFolder = isCommon(item.rootFolderType); + const isCommonFolder = isShare(item.rootFolderType); + const { isDesktopClient } = this.settingsStore; if (isFile) { diff --git a/products/ASC.Files/Client/src/store/TreeFoldersStore.js b/products/ASC.Files/Client/src/store/TreeFoldersStore.js index 97ed1699b0..b978794dca 100644 --- a/products/ASC.Files/Client/src/store/TreeFoldersStore.js +++ b/products/ASC.Files/Client/src/store/TreeFoldersStore.js @@ -48,6 +48,9 @@ class TreeFoldersStore { if (rootItem) rootItem.newItems -= count; }; + isCommon = (commonType) => commonType === FolderType.COMMON; + isShare = (shareType) => shareType === FolderType.SHARE; + get myFolder() { return this.treeFolders.find((x) => x.rootFolderName === "@my"); } From ad4049908329d47c38196d186ba3ece5781ed840 Mon Sep 17 00:00:00 2001 From: Ilya Oleshko Date: Thu, 29 Apr 2021 14:51:36 +0300 Subject: [PATCH 13/84] Web: Files: Settings: Fixed displaying common settings for visitors --- .../src/pages/Settings/Section/Body/index.js | 83 +++++++++++-------- 1 file changed, 47 insertions(+), 36 deletions(-) diff --git a/products/ASC.Files/Client/src/pages/Settings/Section/Body/index.js b/products/ASC.Files/Client/src/pages/Settings/Section/Body/index.js index 9e31b08160..ad3272ebce 100644 --- a/products/ASC.Files/Client/src/pages/Settings/Section/Body/index.js +++ b/products/ASC.Files/Client/src/pages/Settings/Section/Body/index.js @@ -51,6 +51,7 @@ const SectionBodyContent = ({ myFolderId, commonFolderId, t, + isVisitor, }) => { const onChangeStoreForceSave = () => { setStoreForceSave(!storeForceSave, "storeForceSave"); @@ -134,42 +135,51 @@ const SectionBodyContent = ({ onChange={onChangeDeleteConfirm} isChecked={confirmDelete} /> - console.log(e)} - isChecked={false} - /> - console.log(e)} - isChecked={false} - /> - console.log(e)} - isChecked={false} - /> - - {t("StoringFileVersion")} - - - + {!isVisitor && ( + <> + console.log(e)} + isChecked={false} + /> + + console.log(e)} + isChecked={false} + /> + console.log(e)} + isChecked={false} + /> + + )} + {!isVisitor && ( + <> + + {t("StoringFileVersion")} + + + + + )} ); }; @@ -240,6 +250,7 @@ export default inject( treeFolders, myFolderId, commonFolderId, + isVisitor: auth.userStore.user.isVisitor, setUpdateIfExist, setStoreOriginal, From 12972dafa790cc3f9de12ffefa359f7d889a39b9 Mon Sep 17 00:00:00 2001 From: Ilya Oleshko Date: Thu, 29 Apr 2021 15:02:57 +0300 Subject: [PATCH 14/84] Web: Files: Store: Fixed displaying share context option if not accessed --- products/ASC.Files/Client/src/store/FilesStore.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/products/ASC.Files/Client/src/store/FilesStore.js b/products/ASC.Files/Client/src/store/FilesStore.js index 09f3a1aa4f..58154a90c6 100644 --- a/products/ASC.Files/Client/src/store/FilesStore.js +++ b/products/ASC.Files/Client/src/store/FilesStore.js @@ -500,12 +500,7 @@ class FilesStore { ]); } - if ( - isCommonFolder || - isFavoritesFolder || - isPrivacyFolder || - isRecentFolder - ) { + if (isFavoritesFolder || isPrivacyFolder || isRecentFolder) { fileOptions = this.removeOptions(fileOptions, [ "copy", "move-to", @@ -549,6 +544,7 @@ class FilesStore { "rename", "block-unblock-version", "copy", + "sharing-settings", ]); } From 1e05b2a216932df531b8b13ba84ea36c30ea1abe Mon Sep 17 00:00:00 2001 From: Sergey Kirichenko Date: Thu, 29 Apr 2021 15:27:50 +0300 Subject: [PATCH 15/84] Del files in base image (#239) Co-authored-by: Alexey Golubev --- build/install/docker/Dockerfile-app | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/build/install/docker/Dockerfile-app b/build/install/docker/Dockerfile-app index 2ab5d1bdd3..1c14684454 100644 --- a/build/install/docker/Dockerfile-app +++ b/build/install/docker/Dockerfile-app @@ -44,7 +44,18 @@ RUN echo "nameserver 8.8.8.8" | tee /etc/resolv.conf > /dev/null && \ cd ${SRC_PATH}/build/install/common/ && \ bash build-frontend.sh -sp ${SRC_PATH} && \ bash build-backend.sh -sp ${SRC_PATH} -ar "--disable-parallel" && \ - bash publish-backend.sh -sp ${SRC_PATH} -bp ${BUILD_PATH} -ar "--disable-parallel" + bash publish-backend.sh -sp ${SRC_PATH} -bp ${BUILD_PATH} -ar "--disable-parallel" && \ + rm -rf ${SRC_PATH}/common/* && \ + rm -rf ${SRC_PATH}/web/ASC.Web.Core/* && \ + rm -rf ${SRC_PATH}/web/ASC.Web.Studio/* && \ + rm -rf ${SRC_PATH}/products/ASC.Calendar/Server/* && \ + rm -rf ${SRC_PATH}/products/ASC.CRM/Server/* && \ + rm -rf ${SRC_PATH}/products/ASC.Files/Server/* && \ + rm -rf ${SRC_PATH}/products/ASC.Files/Service/* && \ + rm -rf ${SRC_PATH}/products/ASC.Mail/Server/* && \ + rm -rf ${SRC_PATH}/products/ASC.People/Server/* && \ + rm -rf ${SRC_PATH}/products/ASC.Projects/Server/* + COPY config/mysql/conf.d/mysql.cnf /etc/mysql/conf.d/mysql.cnf From 804be561fb46ffea6c4794005cd4b36b9aa7f047 Mon Sep 17 00:00:00 2001 From: Ilya Oleshko Date: Thu, 29 Apr 2021 16:17:18 +0300 Subject: [PATCH 16/84] Web: Files: Store: Fixed displaying delete context option if not accessed --- products/ASC.Files/Client/src/store/FilesStore.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/products/ASC.Files/Client/src/store/FilesStore.js b/products/ASC.Files/Client/src/store/FilesStore.js index 58154a90c6..349bb9ab5f 100644 --- a/products/ASC.Files/Client/src/store/FilesStore.js +++ b/products/ASC.Files/Client/src/store/FilesStore.js @@ -605,7 +605,7 @@ class FilesStore { } if (isShareFolder) { - fileOptions = this.removeOptions(fileOptions, ["move-to"]); + fileOptions = this.removeOptions(fileOptions, ["move-to", "delete"]); } return fileOptions; From f4cf18748508028fb0da44651e45d3f59037bf1c Mon Sep 17 00:00:00 2001 From: Ilya Oleshko Date: Thu, 29 Apr 2021 16:26:34 +0300 Subject: [PATCH 17/84] Web: Files: Dialogs: Fixed setting login information at webdav connections --- .../components/dialogs/ConnectDialog/index.js | 18 +++++++++++++----- .../dialogs/ThirdPartyDialog/index.js | 2 ++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/products/ASC.Files/Client/src/components/dialogs/ConnectDialog/index.js b/products/ASC.Files/Client/src/components/dialogs/ConnectDialog/index.js index 8dde20814a..80ae61783b 100644 --- a/products/ASC.Files/Client/src/components/dialogs/ConnectDialog/index.js +++ b/products/ASC.Files/Client/src/components/dialogs/ConnectDialog/index.js @@ -31,7 +31,15 @@ const PureConnectDialogContainer = (props) => { openConnectWindow, setConnectDialogVisible, } = props; - const { corporate, title, link, token, provider_id, provider_key } = item; + const { + corporate, + title, + link, + token, + provider_id, + provider_key, + key, + } = item; const provider = providers.find( (el) => el.provider_key === item.provider_key @@ -105,13 +113,13 @@ const PureConnectDialogContainer = (props) => { setIsLoading(true); saveThirdParty( - null, - null, - null, + urlValue, + loginValue, + passwordValue, oAuthToken, isCorporate, customerTitle, - provider_key, + provider_key || key, provider_id ) .then((folderData) => { diff --git a/products/ASC.Files/Client/src/components/dialogs/ThirdPartyDialog/index.js b/products/ASC.Files/Client/src/components/dialogs/ThirdPartyDialog/index.js index 5435344d51..f13f131be2 100644 --- a/products/ASC.Files/Client/src/components/dialogs/ThirdPartyDialog/index.js +++ b/products/ASC.Files/Client/src/components/dialogs/ThirdPartyDialog/index.js @@ -52,6 +52,7 @@ const ServiceItem = (props) => { const dataProps = { "data-link": capabilityLink, "data-title": capabilityName, + "data-key": capabilityName, }; return ; @@ -222,6 +223,7 @@ const ThirdPartyDialog = (props) => { onClick={onShowService} className="service-item service-text" data-title={webDavConnectItem[0]} + data-key={webDavConnectItem[0]} > {t("ConnextOtherAccount")} From a116672441662e7e248efa4f13f8803e7839e5b2 Mon Sep 17 00:00:00 2001 From: Ilya Oleshko Date: Thu, 29 Apr 2021 16:50:53 +0300 Subject: [PATCH 18/84] Web: Files: Dialogs: Fixed setting login information at webdav connections from article --- .../Client/src/components/Article/Body/ThirdPartyList.js | 1 + 1 file changed, 1 insertion(+) diff --git a/products/ASC.Files/Client/src/components/Article/Body/ThirdPartyList.js b/products/ASC.Files/Client/src/components/Article/Body/ThirdPartyList.js index 03564bd4ba..1ff52801e1 100644 --- a/products/ASC.Files/Client/src/components/Article/Body/ThirdPartyList.js +++ b/products/ASC.Files/Client/src/components/Article/Body/ThirdPartyList.js @@ -80,6 +80,7 @@ const ServiceItem = (props) => { const dataProps = { "data-link": capabilityLink, "data-title": capabilityName, + "data-key": capabilityName, }; return ( From 23ed6b9d84dd01bc8bc440a53c5dc35dfbd26de1 Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Fri, 30 Apr 2021 11:12:34 +0300 Subject: [PATCH 19/84] Web: Files: fixed isAuthenticated for Firefox --- products/ASC.Files/Client/src/Files.jsx | 2 +- products/ASC.Files/Client/src/store/FilesStore.js | 4 ++-- products/ASC.Files/Client/src/store/index.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/products/ASC.Files/Client/src/Files.jsx b/products/ASC.Files/Client/src/Files.jsx index 82b3c9db14..fedb996e47 100644 --- a/products/ASC.Files/Client/src/Files.jsx +++ b/products/ASC.Files/Client/src/Files.jsx @@ -127,7 +127,7 @@ const Files = inject(({ auth, filesStore }) => { setEncryptionKeys: auth.settingsStore.setEncryptionKeys, loadFilesInfo: async () => { //await auth.init(); - await filesStore.initFiles(); + await filesStore.initFiles(auth.isAuthenticated); //TODO: fixed Firefox isAuthenticated bug auth.setProductVersion(config.version); }, }; diff --git a/products/ASC.Files/Client/src/store/FilesStore.js b/products/ASC.Files/Client/src/store/FilesStore.js index 09f3a1aa4f..6ae8d7f110 100644 --- a/products/ASC.Files/Client/src/store/FilesStore.js +++ b/products/ASC.Files/Client/src/store/FilesStore.js @@ -118,10 +118,10 @@ class FilesStore { : { label: "TooltipElementsMoveMessage", filesCount }; } - initFiles = () => { + initFiles = (isAuthenticated) => { if (this.isInit) return; + //TODO: this.authStore.isAuthenticated returned false in Firefox - const { isAuthenticated } = this.authStore; const { getPortalCultures, isDesktopClient, diff --git a/products/ASC.Files/Client/src/store/index.js b/products/ASC.Files/Client/src/store/index.js index 8c9435b4d5..7f3c8e6804 100644 --- a/products/ASC.Files/Client/src/store/index.js +++ b/products/ASC.Files/Client/src/store/index.js @@ -17,7 +17,7 @@ import PrimaryProgressDataStore from "./PrimaryProgressDataStore"; import VersionHistoryStore from "./VersionHistoryStore"; import dialogsStore from "./DialogsStore"; -import store from "studio/store"; +import store from "studio/store"; //TODO: creates a new store (FireFox problem) const formatsStore = new FormatsStore( iconFormatsStore, From 56997c5cb890967a01ff40319900bc43dbfb852f Mon Sep 17 00:00:00 2001 From: AlexeySafronov Date: Fri, 30 Apr 2021 13:42:57 +0300 Subject: [PATCH 20/84] Thirdparty: Fix Token can't be null on WebDav (login/password issue) --- .../ASC.Files/Core/Core/FileStorageService.cs | 2 +- .../Core/Thirdparty/ProviderAccountDao.cs | 26 ++++++++++++++----- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/products/ASC.Files/Core/Core/FileStorageService.cs b/products/ASC.Files/Core/Core/FileStorageService.cs index e02c0aa51f..d21216e12a 100644 --- a/products/ASC.Files/Core/Core/FileStorageService.cs +++ b/products/ASC.Files/Core/Core/FileStorageService.cs @@ -1225,7 +1225,7 @@ namespace ASC.Web.Files.Services.WCFService } catch (Exception e) { - throw GenerateException(e); + throw GenerateException(e.InnerException ?? e); } } else diff --git a/products/ASC.Files/Core/Core/Thirdparty/ProviderAccountDao.cs b/products/ASC.Files/Core/Core/Thirdparty/ProviderAccountDao.cs index 25065a381e..c2423c2f26 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/ProviderAccountDao.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/ProviderAccountDao.cs @@ -367,7 +367,9 @@ namespace ASC.Files.Thirdparty { Id = id, Title = customerTitle, - Token = EncryptPassword(authData.Token), + Token = EncryptPassword(authData.Token), + Url = authData.Url, + UserName = authData.Login, Password = EncryptPassword(authData.Password), UserId = owner, FolderType = type, @@ -390,10 +392,11 @@ namespace ASC.Files.Thirdparty var createOn = TenantUtil.DateTimeFromUtc(input.CreateOn); var authData = new AuthData(input.Url, input.UserName, DecryptPassword(input.Password), token); - if (string.IsNullOrEmpty(token)) throw new ArgumentException("Token can't be null"); - if (key == ProviderTypes.Box) - { + { + if (string.IsNullOrEmpty(token)) + throw new ArgumentException("Token can't be null"); + var box = ServiceProvider.GetService(); box.ID = id; box.CustomerTitle = providerTitle; @@ -406,7 +409,10 @@ namespace ASC.Files.Thirdparty } if (key == ProviderTypes.DropboxV2) - { + { + if (string.IsNullOrEmpty(token)) + throw new ArgumentException("Token can't be null"); + var drop = ServiceProvider.GetService(); drop.ID = id; drop.CustomerTitle = providerTitle; @@ -436,7 +442,10 @@ namespace ASC.Files.Thirdparty } if (key == ProviderTypes.GoogleDrive) - { + { + if (string.IsNullOrEmpty(token)) + throw new ArgumentException("Token can't be null"); + var gd = ServiceProvider.GetService(); gd.ID = id; gd.CustomerTitle = providerTitle; @@ -450,7 +459,10 @@ namespace ASC.Files.Thirdparty } if (key == ProviderTypes.OneDrive) - { + { + if (string.IsNullOrEmpty(token)) + throw new ArgumentException("Token can't be null"); + var od = ServiceProvider.GetService(); od.ID = id; od.CustomerTitle = providerTitle; From d55b39a653f2f4457593d436986f8f168cfffce6 Mon Sep 17 00:00:00 2001 From: AlexeySafronov Date: Fri, 30 Apr 2021 14:02:58 +0300 Subject: [PATCH 21/84] Web: Files: Added and fix AutoFocus, tabulation and close on errors in ConnectDialog --- .../PageLayout/sub-components/section-body.js | 2 +- packages/asc-web-common/utils/index.js | 15 --------------- .../src/components/dialogs/ConnectDialog/index.js | 2 +- 3 files changed, 2 insertions(+), 17 deletions(-) diff --git a/packages/asc-web-common/components/PageLayout/sub-components/section-body.js b/packages/asc-web-common/components/PageLayout/sub-components/section-body.js index c912e4f656..5b661a2aa2 100644 --- a/packages/asc-web-common/components/PageLayout/sub-components/section-body.js +++ b/packages/asc-web-common/components/PageLayout/sub-components/section-body.js @@ -111,7 +111,7 @@ class SectionBody extends React.Component { const focusProps = autoFocus ? { ref: this.focusRef, - tabIndex: 1, + tabIndex: -1, } : {}; diff --git a/packages/asc-web-common/utils/index.js b/packages/asc-web-common/utils/index.js index 51cea4bd2b..36c67e82ec 100644 --- a/packages/asc-web-common/utils/index.js +++ b/packages/asc-web-common/utils/index.js @@ -147,21 +147,6 @@ export function isAdmin(currentUser, currentProductId) { return currentUser.isAdmin || currentUser.isOwner || isProductAdmin; } -// export function combineUrl(host = "", ...params) { -// let url = host.replace(/\/+$/, ""); - -// params.forEach((part) => { -// const newPart = part.trim().replace(/^\/+/, ""); -// url += newPart -// ? url.length > 0 && url[url.length - 1] === "/" -// ? newPart -// : `/${newPart}` -// : ""; -// }); - -// return url; -// } - import combineUrlFunc from "./combineUrl"; export const combineUrl = combineUrlFunc; diff --git a/products/ASC.Files/Client/src/components/dialogs/ConnectDialog/index.js b/products/ASC.Files/Client/src/components/dialogs/ConnectDialog/index.js index 80ae61783b..5cb076d602 100644 --- a/products/ASC.Files/Client/src/components/dialogs/ConnectDialog/index.js +++ b/products/ASC.Files/Client/src/components/dialogs/ConnectDialog/index.js @@ -163,7 +163,6 @@ const PureConnectDialogContainer = (props) => { }) .catch((err) => { toastr.error(err); - onClose(); setIsLoading(false); }); }, [ @@ -242,6 +241,7 @@ const PureConnectDialogContainer = (props) => { errorMessage={t("RequiredFieldMessage")} > Date: Fri, 30 Apr 2021 15:19:11 +0300 Subject: [PATCH 22/84] Web: added store to webpack.config, fixed Firefox store problems --- products/ASC.Files/Client/src/Files.jsx | 2 +- products/ASC.Files/Client/src/store/FilesStore.js | 5 +++-- products/ASC.Files/Client/src/store/index.js | 2 +- web/ASC.Web.Client/webpack.config.js | 3 +++ 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/products/ASC.Files/Client/src/Files.jsx b/products/ASC.Files/Client/src/Files.jsx index fedb996e47..82b3c9db14 100644 --- a/products/ASC.Files/Client/src/Files.jsx +++ b/products/ASC.Files/Client/src/Files.jsx @@ -127,7 +127,7 @@ const Files = inject(({ auth, filesStore }) => { setEncryptionKeys: auth.settingsStore.setEncryptionKeys, loadFilesInfo: async () => { //await auth.init(); - await filesStore.initFiles(auth.isAuthenticated); //TODO: fixed Firefox isAuthenticated bug + await filesStore.initFiles(); auth.setProductVersion(config.version); }, }; diff --git a/products/ASC.Files/Client/src/store/FilesStore.js b/products/ASC.Files/Client/src/store/FilesStore.js index c9a75cfad0..65a65158fe 100644 --- a/products/ASC.Files/Client/src/store/FilesStore.js +++ b/products/ASC.Files/Client/src/store/FilesStore.js @@ -118,9 +118,10 @@ class FilesStore { : { label: "TooltipElementsMoveMessage", filesCount }; } - initFiles = (isAuthenticated) => { + initFiles = () => { if (this.isInit) return; - //TODO: this.authStore.isAuthenticated returned false in Firefox + + const { isAuthenticated } = this.authStore; const { getPortalCultures, diff --git a/products/ASC.Files/Client/src/store/index.js b/products/ASC.Files/Client/src/store/index.js index 7f3c8e6804..8c9435b4d5 100644 --- a/products/ASC.Files/Client/src/store/index.js +++ b/products/ASC.Files/Client/src/store/index.js @@ -17,7 +17,7 @@ import PrimaryProgressDataStore from "./PrimaryProgressDataStore"; import VersionHistoryStore from "./VersionHistoryStore"; import dialogsStore from "./DialogsStore"; -import store from "studio/store"; //TODO: creates a new store (FireFox problem) +import store from "studio/store"; const formatsStore = new FormatsStore( iconFormatsStore, diff --git a/web/ASC.Web.Client/webpack.config.js b/web/ASC.Web.Client/webpack.config.js index 66b6d16438..0081b55a92 100644 --- a/web/ASC.Web.Client/webpack.config.js +++ b/web/ASC.Web.Client/webpack.config.js @@ -166,6 +166,9 @@ const config = { singleton: true, requiredVersion: deps["react-dom"], }, + "./src/store": { + singleton: true, + }, }, }), new HtmlWebpackPlugin({ From bec269051065bb77c09734083905955dde23d97b Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Fri, 30 Apr 2021 16:47:47 +0300 Subject: [PATCH 23/84] Web: fixed files productName --- packages/asc-web-common/utils/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/asc-web-common/utils/index.js b/packages/asc-web-common/utils/index.js index 36c67e82ec..bf1e78243a 100644 --- a/packages/asc-web-common/utils/index.js +++ b/packages/asc-web-common/utils/index.js @@ -133,7 +133,7 @@ export function isAdmin(currentUser, currentProductId) { productName = "people"; break; case "e67be73d-f9ae-4ce1-8fec-1880cb518cb4": - productName = "documents"; + productName = "files"; break; default: break; From 7ba67cf63a9ecf95bb8dbbd116e26bb06c0399e8 Mon Sep 17 00:00:00 2001 From: AlexeySafronov Date: Fri, 30 Apr 2021 17:25:26 +0300 Subject: [PATCH 24/84] Web: Fix click on webView link on ComingSoonPage (CRM, Projects, Mail, Calendar) --- packages/asc-web-common/utils/index.js | 17 ++++++++++++++++- products/ASC.CRM/Client/src/pages/Home/index.js | 13 ++++++------- .../ASC.Calendar/Client/src/pages/Home/index.js | 12 +++++------- .../panels/SharingPanel/SharingRow.js | 2 +- .../ASC.Mail/Client/src/pages/Home/index.js | 12 +++++------- .../ASC.Projects/Client/src/pages/Home/index.js | 14 +++++++------- 6 files changed, 40 insertions(+), 30 deletions(-) diff --git a/packages/asc-web-common/utils/index.js b/packages/asc-web-common/utils/index.js index 36c67e82ec..a7112ce992 100644 --- a/packages/asc-web-common/utils/index.js +++ b/packages/asc-web-common/utils/index.js @@ -199,7 +199,7 @@ export function clickBackdrop() { } } -export default function objectToGetParams(object) { +export function objectToGetParams(object) { const params = Object.entries(object) .filter(([, value]) => value !== undefined && value !== null) .map( @@ -209,3 +209,18 @@ export default function objectToGetParams(object) { return params.length > 0 ? `?${params.join("&")}` : ""; } + +export function toCommunityHostname(hostname) { + let communityHostname; + try { + communityHostname = + hostname.indexOf("m.") > -1 + ? hostname.substring(2, hostname.length) + : hostname; + } catch (e) { + console.error(e); + communityHostname = hostname; + } + + return communityHostname; +} diff --git a/products/ASC.CRM/Client/src/pages/Home/index.js b/products/ASC.CRM/Client/src/pages/Home/index.js index 111f615fc7..85416c95a8 100644 --- a/products/ASC.CRM/Client/src/pages/Home/index.js +++ b/products/ASC.CRM/Client/src/pages/Home/index.js @@ -19,7 +19,7 @@ import { setDocumentTitle } from "../../helpers/utils"; import { inject } from "mobx-react"; import i18n from "../../i18n"; import { I18nextProvider } from "react-i18next"; -import { combineUrl, deleteCookie } from "@appserver/common/utils"; +import { toCommunityHostname, deleteCookie } from "@appserver/common/utils"; const commonStyles = ` .link-box { @@ -121,12 +121,11 @@ const Body = ({ modules, match, isLoaded, setCurrentProductId, t, tReady }) => { const { error } = match.params; const { pathname, protocol, hostname } = window.location; const currentModule = modules.find((m) => m.link === pathname); - const { id, title, imageUrl, link, originUrl, helpUrl } = currentModule; - const url = originUrl ? originUrl : link; - const webLink = combineUrl( - protocol + "//" + hostname, - `${url}?desktop_view=true` - ); + const { id, title, imageUrl, /*link, originUrl,*/ helpUrl } = currentModule; + //const url = originUrl ? originUrl : link; + const communityHostname = toCommunityHostname(hostname); + const webLink = `${protocol}//${communityHostname}/Products/CRM/?desktop_view=true`; + const appLink = isIOS ? id === "2A923037-8B2D-487b-9A22-5AC0918ACF3F" ? "message:" diff --git a/products/ASC.Calendar/Client/src/pages/Home/index.js b/products/ASC.Calendar/Client/src/pages/Home/index.js index 111f615fc7..222e670c9b 100644 --- a/products/ASC.Calendar/Client/src/pages/Home/index.js +++ b/products/ASC.Calendar/Client/src/pages/Home/index.js @@ -19,7 +19,7 @@ import { setDocumentTitle } from "../../helpers/utils"; import { inject } from "mobx-react"; import i18n from "../../i18n"; import { I18nextProvider } from "react-i18next"; -import { combineUrl, deleteCookie } from "@appserver/common/utils"; +import { toCommunityHostname, deleteCookie } from "@appserver/common/utils"; const commonStyles = ` .link-box { @@ -121,12 +121,10 @@ const Body = ({ modules, match, isLoaded, setCurrentProductId, t, tReady }) => { const { error } = match.params; const { pathname, protocol, hostname } = window.location; const currentModule = modules.find((m) => m.link === pathname); - const { id, title, imageUrl, link, originUrl, helpUrl } = currentModule; - const url = originUrl ? originUrl : link; - const webLink = combineUrl( - protocol + "//" + hostname, - `${url}?desktop_view=true` - ); + const { id, title, imageUrl, /*link, originUrl,*/ helpUrl } = currentModule; + //const url = originUrl ? originUrl : link; + const communityHostname = toCommunityHostname(hostname); + const webLink = `${protocol}//${communityHostname}/addons/calendar/?desktop_view=true`; const appLink = isIOS ? id === "2A923037-8B2D-487b-9A22-5AC0918ACF3F" ? "message:" diff --git a/products/ASC.Files/Client/src/components/panels/SharingPanel/SharingRow.js b/products/ASC.Files/Client/src/components/panels/SharingPanel/SharingRow.js index 7bd7f2d735..f5383ae766 100644 --- a/products/ASC.Files/Client/src/components/panels/SharingPanel/SharingRow.js +++ b/products/ASC.Files/Client/src/components/panels/SharingPanel/SharingRow.js @@ -10,7 +10,7 @@ import AccessComboBox from "./AccessComboBox"; //import equal from "fast-deep-equal/react"; import { getAccessIcon } from "../../../helpers/files-helpers"; import { ReactSVG } from "react-svg"; -import objectToGetParams from "@appserver/common/utils"; +import { objectToGetParams } from "@appserver/common/utils"; class SharingRow extends React.Component { constructor(props) { diff --git a/products/ASC.Mail/Client/src/pages/Home/index.js b/products/ASC.Mail/Client/src/pages/Home/index.js index 111f615fc7..aaa0e58a4a 100644 --- a/products/ASC.Mail/Client/src/pages/Home/index.js +++ b/products/ASC.Mail/Client/src/pages/Home/index.js @@ -19,7 +19,7 @@ import { setDocumentTitle } from "../../helpers/utils"; import { inject } from "mobx-react"; import i18n from "../../i18n"; import { I18nextProvider } from "react-i18next"; -import { combineUrl, deleteCookie } from "@appserver/common/utils"; +import { deleteCookie, toCommunityHostname } from "@appserver/common/utils"; const commonStyles = ` .link-box { @@ -121,12 +121,10 @@ const Body = ({ modules, match, isLoaded, setCurrentProductId, t, tReady }) => { const { error } = match.params; const { pathname, protocol, hostname } = window.location; const currentModule = modules.find((m) => m.link === pathname); - const { id, title, imageUrl, link, originUrl, helpUrl } = currentModule; - const url = originUrl ? originUrl : link; - const webLink = combineUrl( - protocol + "//" + hostname, - `${url}?desktop_view=true` - ); + const { id, title, imageUrl, /*link, originUrl,*/ helpUrl } = currentModule; + //const url = originUrl ? originUrl : link; + const communityHostname = toCommunityHostname(hostname); + const webLink = `${protocol}//${communityHostname}/addons/mail/?desktop_view=true`; const appLink = isIOS ? id === "2A923037-8B2D-487b-9A22-5AC0918ACF3F" ? "message:" diff --git a/products/ASC.Projects/Client/src/pages/Home/index.js b/products/ASC.Projects/Client/src/pages/Home/index.js index 111f615fc7..7b05068718 100644 --- a/products/ASC.Projects/Client/src/pages/Home/index.js +++ b/products/ASC.Projects/Client/src/pages/Home/index.js @@ -19,7 +19,7 @@ import { setDocumentTitle } from "../../helpers/utils"; import { inject } from "mobx-react"; import i18n from "../../i18n"; import { I18nextProvider } from "react-i18next"; -import { combineUrl, deleteCookie } from "@appserver/common/utils"; +import { toCommunityHostname, deleteCookie } from "@appserver/common/utils"; const commonStyles = ` .link-box { @@ -121,12 +121,12 @@ const Body = ({ modules, match, isLoaded, setCurrentProductId, t, tReady }) => { const { error } = match.params; const { pathname, protocol, hostname } = window.location; const currentModule = modules.find((m) => m.link === pathname); - const { id, title, imageUrl, link, originUrl, helpUrl } = currentModule; - const url = originUrl ? originUrl : link; - const webLink = combineUrl( - protocol + "//" + hostname, - `${url}?desktop_view=true` - ); + const { id, title, imageUrl, /*link, originUrl,*/ helpUrl } = currentModule; + + //const url = originUrl ? originUrl : link; + const communityHostname = toCommunityHostname(hostname); + const webLink = `${protocol}//${communityHostname}/Products/Projects/?desktop_view=true`; + const appLink = isIOS ? id === "2A923037-8B2D-487b-9A22-5AC0918ACF3F" ? "message:" From c8f48d1861d90023147bfe9298965d77ab7c6a69 Mon Sep 17 00:00:00 2001 From: pavelbannov Date: Fri, 30 Apr 2021 17:43:26 +0300 Subject: [PATCH 25/84] Resource: profile removed --- .../PublicResources/Resource.Designer.cs | 11 +++- .../PublicResources/Resource.de.resx | 66 ++++++++++++++++++- .../PublicResources/Resource.es.resx | 66 ++++++++++++++++++- .../PublicResources/Resource.fr.resx | 66 ++++++++++++++++++- .../PublicResources/Resource.it.resx | 66 ++++++++++++++++++- .../PublicResources/Resource.resx | 7 +- .../PublicResources/Resource.ru.resx | 66 ++++++++++++++++++- 7 files changed, 335 insertions(+), 13 deletions(-) diff --git a/web/ASC.Web.Core/PublicResources/Resource.Designer.cs b/web/ASC.Web.Core/PublicResources/Resource.Designer.cs index c3cb8c1481..a6ff2dd9ca 100644 --- a/web/ASC.Web.Core/PublicResources/Resource.Designer.cs +++ b/web/ASC.Web.Core/PublicResources/Resource.Designer.cs @@ -19,7 +19,7 @@ namespace ASC.Web.Core.PublicResources { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class Resource { @@ -1950,6 +1950,15 @@ namespace ASC.Web.Core.PublicResources { } } + /// + /// Looks up a localized string similar to Profile has been removed. + /// + public static string ProfileRemoved { + get { + return ResourceManager.GetString("ProfileRemoved", resourceCulture); + } + } + /// /// Looks up a localized string similar to Data reassign process for {0} is not complete.. /// diff --git a/web/ASC.Web.Core/PublicResources/Resource.de.resx b/web/ASC.Web.Core/PublicResources/Resource.de.resx index 5b51f25a42..9ebf002865 100644 --- a/web/ASC.Web.Core/PublicResources/Resource.de.resx +++ b/web/ASC.Web.Core/PublicResources/Resource.de.resx @@ -1,5 +1,64 @@  + @@ -53,10 +112,10 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=5.0.5.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=5.0.5.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Das Feld mit dem Prüfcode darf nicht leer sein @@ -752,4 +811,7 @@ Neues + + Das Profil wurde gelöscht + \ No newline at end of file diff --git a/web/ASC.Web.Core/PublicResources/Resource.es.resx b/web/ASC.Web.Core/PublicResources/Resource.es.resx index 6733c1d541..e3da70fee8 100644 --- a/web/ASC.Web.Core/PublicResources/Resource.es.resx +++ b/web/ASC.Web.Core/PublicResources/Resource.es.resx @@ -1,5 +1,64 @@  + @@ -53,10 +112,10 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=5.0.5.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=5.0.5.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Campo de código de validación no puede estar vacío @@ -715,4 +774,7 @@ Qué hay de nuevo + + Perfil ha sido eliminado + \ No newline at end of file diff --git a/web/ASC.Web.Core/PublicResources/Resource.fr.resx b/web/ASC.Web.Core/PublicResources/Resource.fr.resx index da2e892699..93639c3960 100644 --- a/web/ASC.Web.Core/PublicResources/Resource.fr.resx +++ b/web/ASC.Web.Core/PublicResources/Resource.fr.resx @@ -1,5 +1,64 @@  + @@ -53,10 +112,10 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=5.0.5.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=5.0.5.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Le champ du code de validation ne peut pas être vide @@ -750,4 +809,7 @@ Quoi de neuf + + Le profil a été supprimé + \ No newline at end of file diff --git a/web/ASC.Web.Core/PublicResources/Resource.it.resx b/web/ASC.Web.Core/PublicResources/Resource.it.resx index c051cfded0..1356131a6a 100644 --- a/web/ASC.Web.Core/PublicResources/Resource.it.resx +++ b/web/ASC.Web.Core/PublicResources/Resource.it.resx @@ -1,5 +1,64 @@  + @@ -53,10 +112,10 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=5.0.5.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=5.0.5.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Il campo Valida codice non può essere vuoto @@ -707,4 +766,7 @@ Cosa c'è di nuovo + + Il profilo è stato eliminato + \ No newline at end of file diff --git a/web/ASC.Web.Core/PublicResources/Resource.resx b/web/ASC.Web.Core/PublicResources/Resource.resx index bf9175aa54..18604633bc 100644 --- a/web/ASC.Web.Core/PublicResources/Resource.resx +++ b/web/ASC.Web.Core/PublicResources/Resource.resx @@ -53,10 +53,10 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=5.0.5.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=5.0.5.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Validation code field cannot be empty @@ -748,4 +748,7 @@ What's New + + Profile has been removed + \ No newline at end of file diff --git a/web/ASC.Web.Core/PublicResources/Resource.ru.resx b/web/ASC.Web.Core/PublicResources/Resource.ru.resx index c7722cb4ee..8ccfc9971d 100644 --- a/web/ASC.Web.Core/PublicResources/Resource.ru.resx +++ b/web/ASC.Web.Core/PublicResources/Resource.ru.resx @@ -1,5 +1,64 @@  + @@ -53,10 +112,10 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=5.0.5.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=5.0.5.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 Поле кода подтверждения не может быть пустым @@ -748,4 +807,7 @@ Новенькое + + Профиль удален + \ No newline at end of file From 7c1283c26fa605042f3d1b5ef02b7ff564e14810 Mon Sep 17 00:00:00 2001 From: AlexeySafronov Date: Fri, 30 Apr 2021 18:01:16 +0300 Subject: [PATCH 26/84] Web: Fix login redirect on Editor not authorized link opening --- web/ASC.Web.Editor/src/Editor.jsx | 9 +++++++-- web/ASC.Web.Editor/webpack.config.js | 8 +++----- web/ASC.Web.Login/public/index.html | 6 +++--- web/ASC.Web.Login/webpack.config.js | 11 ++++++----- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/web/ASC.Web.Editor/src/Editor.jsx b/web/ASC.Web.Editor/src/Editor.jsx index 6378cb7268..1912a9378a 100644 --- a/web/ASC.Web.Editor/src/Editor.jsx +++ b/web/ASC.Web.Editor/src/Editor.jsx @@ -12,7 +12,6 @@ import { getObjectByLocation, //showLoader, //hideLoader, - tryRedirectTo, } from "@appserver/common/utils"; import { getDocServiceUrl, @@ -96,7 +95,13 @@ const Editor = () => { const success = await checkIsAuthenticated(); if (!doc && !success) { - return tryRedirectTo(combineUrl(AppServerConfig.proxyURL, "/login")); + window.open( + combineUrl(AppServerConfig.proxyURL, "/login"), + "_self", + "", + true + ); + return; } if (success) { diff --git a/web/ASC.Web.Editor/webpack.config.js b/web/ASC.Web.Editor/webpack.config.js index 9abfa2d270..5532be957d 100644 --- a/web/ASC.Web.Editor/webpack.config.js +++ b/web/ASC.Web.Editor/webpack.config.js @@ -7,6 +7,7 @@ const TerserPlugin = require("terser-webpack-plugin"); const { InjectManifest } = require("workbox-webpack-plugin"); const combineUrl = require("@appserver/common/utils/combineUrl"); const AppServerConfig = require("@appserver/common/constants/AppServerConfig"); +const { proxyURL } = AppServerConfig; const path = require("path"); const pkg = require("./package.json"); @@ -134,12 +135,9 @@ const config = { name: "editor", filename: "remoteEntry.js", remotes: { - studio: `studio@${combineUrl( - AppServerConfig.proxyURL, - "/remoteEntry.js" - )}`, + studio: `studio@${combineUrl(proxyURL, "/remoteEntry.js")}`, files: `files@${combineUrl( - AppServerConfig.proxyURL, + proxyURL, "/products/files/remoteEntry.js" )}`, }, diff --git a/web/ASC.Web.Login/public/index.html b/web/ASC.Web.Login/public/index.html index 233846fb8f..9fb410b356 100644 --- a/web/ASC.Web.Login/public/index.html +++ b/web/ASC.Web.Login/public/index.html @@ -11,14 +11,14 @@ manifest.json provides metadata used when your web app is added to the homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/ --> - + - + - + Date: Fri, 30 Apr 2021 18:13:18 +0300 Subject: [PATCH 27/84] Files: fixed recent files --- .../Services/DocumentService/Configuration.cs | 3 +- products/ASC.Files/Core/Utils/EntryManager.cs | 47 ++++++++++++++----- 2 files changed, 36 insertions(+), 14 deletions(-) diff --git a/products/ASC.Files/Core/Services/DocumentService/Configuration.cs b/products/ASC.Files/Core/Services/DocumentService/Configuration.cs index 55dcd5cdda..e7ef3547cf 100644 --- a/products/ASC.Files/Core/Services/DocumentService/Configuration.cs +++ b/products/ASC.Files/Core/Services/DocumentService/Configuration.cs @@ -485,8 +485,7 @@ namespace ASC.Web.Files.Services.DocumentService } var folderDao = DaoFactory.GetFolderDao(); - var fileDao = DaoFactory.GetFileDao(); - var files = entryManager.GetRecent(folderDao, fileDao, filter, false, Guid.Empty, string.Empty, false); + var files = entryManager.GetRecent(filter, false, Guid.Empty, string.Empty, false).Cast>(); var listRecent = from file in files where !Equals(_configuration.Document.Info.File.ID, file.ID) diff --git a/products/ASC.Files/Core/Utils/EntryManager.cs b/products/ASC.Files/Core/Utils/EntryManager.cs index dcb8179d2d..cdd7396e9b 100644 --- a/products/ASC.Files/Core/Utils/EntryManager.cs +++ b/products/ASC.Files/Core/Utils/EntryManager.cs @@ -384,9 +384,7 @@ namespace ASC.Web.Files.Utils } else if (parent.FolderType == FolderType.Recent) { - var folderDao = DaoFactory.GetFolderDao(); - var fileDao = DaoFactory.GetFileDao(); - var files = GetRecent(folderDao, fileDao, filter, subjectGroup, subjectId, searchText, searchInContent); + var files = GetRecent(filter, subjectGroup, subjectId, searchText, searchInContent); entries = entries.Concat(files); CalculateTotal(); @@ -545,23 +543,48 @@ namespace ASC.Web.Files.Utils return folderList; } - public IEnumerable> GetRecent(IFolderDao folderDao, IFileDao fileDao, FilterType filter, bool subjectGroup, Guid subjectId, string searchText, bool searchInContent) + public IEnumerable GetRecent(FilterType filter, bool subjectGroup, Guid subjectId, string searchText, bool searchInContent) { - var tagDao = DaoFactory.GetTagDao(); + var tagDao = DaoFactory.GetTagDao(); var tags = tagDao.GetTags(AuthContext.CurrentAccount.ID, TagType.Recent).ToList(); - var fileIds = tags.Where(tag => tag.EntryType == FileEntryType.File).Select(tag => (T)Convert.ChangeType(tag.EntryId, typeof(T))).ToArray(); - var files = fileDao.GetFilesFiltered(fileIds, filter, subjectGroup, subjectId, searchText, searchInContent); - files = files.Where(file => file.RootFolderType != FolderType.TRASH).ToList(); + var fileIds = tags.Where(tag => tag.EntryType == FileEntryType.File).ToList(); - files = FileSecurity.FilterRead(files).ToList(); + List files = GetRecentByIds(fileIds.Where(r => r.EntryId is int).Select(r=> (int)r.EntryId), filter, subjectGroup, subjectId, searchText, searchInContent).ToList(); + files.AddRange(GetRecentByIds(fileIds.Where(r => r.EntryId is string).Select(r => (string)r.EntryId), filter, subjectGroup, subjectId, searchText, searchInContent)); - CheckFolderId(folderDao, files); + var listFileIds = fileIds.Select(tag => tag.EntryId).ToList(); - var listFileIds = fileIds.ToList(); - files = files.OrderBy(file => listFileIds.IndexOf(file.ID)).ToList(); + files = files.OrderBy(file => + { + var fileId = ""; + if (file is File fileInt) + { + fileId = fileInt.ID.ToString(); + } + else if (file is File fileString) + { + fileId = fileString.ID; + } + + return listFileIds.IndexOf(fileId); + }).ToList(); return files; + + IEnumerable GetRecentByIds(IEnumerable fileIds, FilterType filter, bool subjectGroup, Guid subjectId, string searchText, bool searchInContent) + { + var folderDao = DaoFactory.GetFolderDao(); + var fileDao = DaoFactory.GetFileDao(); + var files = fileDao.GetFilesFiltered(fileIds, filter, subjectGroup, subjectId, searchText, searchInContent); + files = files.Where(file => file.RootFolderType != FolderType.TRASH).ToList(); + + files = FileSecurity.FilterRead(files).ToList(); + + CheckFolderId(folderDao, files); + + return files; + } } public void GetFavorites(IFolderDao folderDao, IFileDao fileDao, FilterType filter, bool subjectGroup, Guid subjectId, string searchText, bool searchInContent, out IEnumerable> folders, out IEnumerable> files) From fc7bfcea500720d0639858952e83ec6d8201b1c0 Mon Sep 17 00:00:00 2001 From: pavelbannov Date: Fri, 30 Apr 2021 18:13:42 +0300 Subject: [PATCH 28/84] Files: fixed onedrive --- .../Core/Core/Thirdparty/OneDrive/OneDriveDaoBase.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/products/ASC.Files/Core/Core/Thirdparty/OneDrive/OneDriveDaoBase.cs b/products/ASC.Files/Core/Core/Thirdparty/OneDrive/OneDriveDaoBase.cs index c2384647a1..a9f75348be 100644 --- a/products/ASC.Files/Core/Core/Thirdparty/OneDrive/OneDriveDaoBase.cs +++ b/products/ASC.Files/Core/Core/Thirdparty/OneDrive/OneDriveDaoBase.cs @@ -37,9 +37,8 @@ using ASC.Files.Core; using ASC.Files.Core.EF; using ASC.Web.Core.Files; using ASC.Web.Files.Classes; -using ASC.Web.Studio.Core; - -using Microsoft.Extensions.DependencyInjection; +using ASC.Web.Studio.Core; + using Microsoft.Extensions.Options; using Microsoft.OneDrive.Sdk; @@ -171,7 +170,7 @@ namespace ASC.Files.Thirdparty.OneDrive if (onedriveFile.File == null) return null; - var file = ServiceProvider.GetService>(); + var file = GetFile(); file.ID = MakeId(onedriveFile.Id); file.ContentLength = onedriveFile.Size.HasValue ? (long)onedriveFile.Size : 0; From 0dbadc63947613d3c79895c1fc8ca58e35795b65 Mon Sep 17 00:00:00 2001 From: Alexey Bannov Date: Fri, 30 Apr 2021 18:41:23 +0300 Subject: [PATCH 29/84] from Microsoft.NET.Sdk.Web to Microsoft.NET.Sdk for ClassLibrary Projects --- common/ASC.Api.Core/ASC.Api.Core.csproj | 5 +---- common/ASC.Data.Reassigns/ASC.Data.Reassigns.csproj | 5 +---- common/ASC.Data.Storage/ASC.Data.Storage.csproj | 5 +---- common/ASC.FederatedLogin/ASC.FederatedLogin.csproj | 5 +---- common/ASC.Notify.Textile/ASC.Notify.Textile.csproj | 5 +---- common/services/ASC.AuditTrail/ASC.AuditTrail.csproj | 5 +---- web/ASC.Web.Core/ASC.Web.Core.csproj | 5 +---- 7 files changed, 7 insertions(+), 28 deletions(-) diff --git a/common/ASC.Api.Core/ASC.Api.Core.csproj b/common/ASC.Api.Core/ASC.Api.Core.csproj index 8c2b537fa4..a6f4e553ce 100644 --- a/common/ASC.Api.Core/ASC.Api.Core.csproj +++ b/common/ASC.Api.Core/ASC.Api.Core.csproj @@ -1,10 +1,7 @@ - + net5.0 - - Library - diff --git a/common/ASC.Data.Reassigns/ASC.Data.Reassigns.csproj b/common/ASC.Data.Reassigns/ASC.Data.Reassigns.csproj index 8a14afe88c..0d6760d0a0 100644 --- a/common/ASC.Data.Reassigns/ASC.Data.Reassigns.csproj +++ b/common/ASC.Data.Reassigns/ASC.Data.Reassigns.csproj @@ -1,10 +1,7 @@ - + net5.0 - - Library - diff --git a/common/ASC.Data.Storage/ASC.Data.Storage.csproj b/common/ASC.Data.Storage/ASC.Data.Storage.csproj index 9d6cca42c3..df0b9c8f57 100644 --- a/common/ASC.Data.Storage/ASC.Data.Storage.csproj +++ b/common/ASC.Data.Storage/ASC.Data.Storage.csproj @@ -1,10 +1,7 @@ - + net5.0 - - Library - diff --git a/common/ASC.FederatedLogin/ASC.FederatedLogin.csproj b/common/ASC.FederatedLogin/ASC.FederatedLogin.csproj index f4043aa003..8e7bd5a699 100644 --- a/common/ASC.FederatedLogin/ASC.FederatedLogin.csproj +++ b/common/ASC.FederatedLogin/ASC.FederatedLogin.csproj @@ -1,10 +1,7 @@ - + net5.0 - - Library - diff --git a/common/ASC.Notify.Textile/ASC.Notify.Textile.csproj b/common/ASC.Notify.Textile/ASC.Notify.Textile.csproj index d88f119483..1027372d1f 100644 --- a/common/ASC.Notify.Textile/ASC.Notify.Textile.csproj +++ b/common/ASC.Notify.Textile/ASC.Notify.Textile.csproj @@ -1,4 +1,4 @@ - + 9.0.30729 net5.0 @@ -6,9 +6,6 @@ Ascensio System SIA ASC.Notify.Textile (c) Ascensio System SIA. All rights reserved - - Library - full diff --git a/common/services/ASC.AuditTrail/ASC.AuditTrail.csproj b/common/services/ASC.AuditTrail/ASC.AuditTrail.csproj index 86d5b9db3c..c59abe326f 100644 --- a/common/services/ASC.AuditTrail/ASC.AuditTrail.csproj +++ b/common/services/ASC.AuditTrail/ASC.AuditTrail.csproj @@ -1,10 +1,7 @@ - + net5.0 - - Library - diff --git a/web/ASC.Web.Core/ASC.Web.Core.csproj b/web/ASC.Web.Core/ASC.Web.Core.csproj index 812ae6a8fa..9eaf1b56ef 100644 --- a/web/ASC.Web.Core/ASC.Web.Core.csproj +++ b/web/ASC.Web.Core/ASC.Web.Core.csproj @@ -1,10 +1,7 @@ - + net5.0 - - Library - From 90229e7a672904a7aa3487bf9068ad91d101eabc Mon Sep 17 00:00:00 2001 From: pavelbannov Date: Sun, 2 May 2021 19:47:21 +0300 Subject: [PATCH 30/84] Files: fixed favorites --- products/ASC.Files/Core/Utils/EntryManager.cs | 61 +++++++++++++------ 1 file changed, 42 insertions(+), 19 deletions(-) diff --git a/products/ASC.Files/Core/Utils/EntryManager.cs b/products/ASC.Files/Core/Utils/EntryManager.cs index cdd7396e9b..b70659146a 100644 --- a/products/ASC.Files/Core/Utils/EntryManager.cs +++ b/products/ASC.Files/Core/Utils/EntryManager.cs @@ -394,7 +394,7 @@ namespace ASC.Web.Files.Utils var fileDao = DaoFactory.GetFileDao(); var folderDao = DaoFactory.GetFolderDao(); - GetFavorites(folderDao, fileDao, filter, subjectGroup, subjectId, searchText, searchInContent, out var folders, out var files); + var (files, folders) = GetFavorites(filter, subjectGroup, subjectId, searchText, searchInContent); entries = entries.Concat(folders); entries = entries.Concat(files); @@ -587,34 +587,57 @@ namespace ASC.Web.Files.Utils } } - public void GetFavorites(IFolderDao folderDao, IFileDao fileDao, FilterType filter, bool subjectGroup, Guid subjectId, string searchText, bool searchInContent, out IEnumerable> folders, out IEnumerable> files) + public (IEnumerable, IEnumerable) GetFavorites(FilterType filter, bool subjectGroup, Guid subjectId, string searchText, bool searchInContent) { - folders = new List>(); - files = new List>(); var fileSecurity = FileSecurity; - var tagDao = DaoFactory.GetTagDao(); + var tagDao = DaoFactory.GetTagDao(); var tags = tagDao.GetTags(AuthContext.CurrentAccount.ID, TagType.Favorite); - if (filter == FilterType.None || filter == FilterType.FoldersOnly) + var fileIds = tags.Where(tag => tag.EntryType == FileEntryType.File).ToList(); + var folderIds = tags.Where(tag => tag.EntryType == FileEntryType.Folder).ToList(); + + var (filesInt, foldersInt) = GetFavoritesById(fileIds.Where(r => r.EntryId is int).Select(r => (int)r.EntryId), folderIds.Where(r => r.EntryId is int).Select(r => (int)r.EntryId), filter, subjectGroup, subjectId, searchText, searchInContent); + var (filesString, foldersString) = GetFavoritesById(fileIds.Where(r => r.EntryId is string).Select(r => (string)r.EntryId), folderIds.Where(r => r.EntryId is string).Select(r => (string)r.EntryId), filter, subjectGroup, subjectId, searchText, searchInContent); + + var files = new List(); + files.AddRange(filesInt); + files.AddRange(filesString); + + var folders = new List(); + folders.AddRange(foldersInt); + folders.AddRange(foldersString); + + return (files, folders); + + (IEnumerable, IEnumerable) GetFavoritesById(IEnumerable fileIds, IEnumerable folderIds, FilterType filter, bool subjectGroup, Guid subjectId, string searchText, bool searchInContent) { - var folderIds = tags.Where(tag => tag.EntryType == FileEntryType.Folder).Select(tag => (T)Convert.ChangeType(tag.EntryId, typeof(T))).ToList(); - folders = folderDao.GetFolders(folderIds, filter, subjectGroup, subjectId, searchText, false, false); - folders = folders.Where(folder => folder.RootFolderType != FolderType.TRASH).ToList(); + var folderDao = DaoFactory.GetFolderDao(); + var fileDao = DaoFactory.GetFileDao(); + var folders = new List>(); + var files = new List>(); + var fileSecurity = FileSecurity; - folders = fileSecurity.FilterRead(folders).ToList(); + if (filter == FilterType.None || filter == FilterType.FoldersOnly) + { + folders = folderDao.GetFolders(folderIds, filter, subjectGroup, subjectId, searchText, false, false); + folders = folders.Where(folder => folder.RootFolderType != FolderType.TRASH).ToList(); - CheckFolderId(folderDao, folders); - } + folders = fileSecurity.FilterRead(folders).ToList(); - if (filter != FilterType.FoldersOnly) - { - var fileIds = tags.Where(tag => tag.EntryType == FileEntryType.File).Select(tag => (T)Convert.ChangeType(tag.EntryId, typeof(T))).ToArray(); - files = fileDao.GetFilesFiltered(fileIds, filter, subjectGroup, subjectId, searchText, searchInContent); - files = files.Where(file => file.RootFolderType != FolderType.TRASH).ToList(); + CheckFolderId(folderDao, folders); + } - files = fileSecurity.FilterRead(files).ToList(); + if (filter != FilterType.FoldersOnly) + { + files = fileDao.GetFilesFiltered(fileIds, filter, subjectGroup, subjectId, searchText, searchInContent); + files = files.Where(file => file.RootFolderType != FolderType.TRASH).ToList(); - CheckFolderId(folderDao, folders); + files = fileSecurity.FilterRead(files).ToList(); + + CheckFolderId(folderDao, folders); + } + + return (files, folders); } } From bdc681f94a194faf821c0367c1888c4087ed2540 Mon Sep 17 00:00:00 2001 From: AlexeySafronov Date: Tue, 4 May 2021 11:18:24 +0300 Subject: [PATCH 31/84] Web: Files: Fix favorite flag setup (thirdParty issue) --- packages/asc-web-common/api/files/index.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/asc-web-common/api/files/index.js b/packages/asc-web-common/api/files/index.js index 8f65a23448..e1b418fb87 100644 --- a/packages/asc-web-common/api/files/index.js +++ b/packages/asc-web-common/api/files/index.js @@ -638,8 +638,7 @@ export function getSettingsFiles() { } export function markAsFavorite(ids) { - let items = ids.map((id) => +id); - const data = { fileIds: items }; + const data = { fileIds: ids }; const options = { method: "post", url: "/files/favorites", @@ -650,8 +649,7 @@ export function markAsFavorite(ids) { } export function removeFromFavorite(ids) { - let items = ids.map((id) => +id); - const data = { fileIds: items }; + const data = { fileIds: ids }; const options = { method: "delete", url: "/files/favorites", From 13c0a462809d4c42b823f69e0a53300411d87fd8 Mon Sep 17 00:00:00 2001 From: Ilya Oleshko Date: Tue, 4 May 2021 11:19:08 +0300 Subject: [PATCH 32/84] Web: Files: Store: Fixed displaying delete context option for folder if not accessed --- products/ASC.Files/Client/src/store/FilesStore.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/products/ASC.Files/Client/src/store/FilesStore.js b/products/ASC.Files/Client/src/store/FilesStore.js index 65a65158fe..0c8b47bbc6 100644 --- a/products/ASC.Files/Client/src/store/FilesStore.js +++ b/products/ASC.Files/Client/src/store/FilesStore.js @@ -636,7 +636,10 @@ class FilesStore { } if (isShareFolder) { - folderOptions = this.removeOptions(folderOptions, ["move-to"]); + folderOptions = this.removeOptions(folderOptions, [ + "move-to", + "delete", + ]); } if (isRecycleBinFolder) { From 026306d7cae38208ffa8c4b48cff95360e42db2d Mon Sep 17 00:00:00 2001 From: AlexeySafronov Date: Tue, 4 May 2021 15:35:09 +0300 Subject: [PATCH 33/84] Web: Login: Fix hard-coded list of trusted domains on registration --- packages/asc-web-common/constants/index.js | 10 +++++ .../asc-web-common/store/SettingsStore.js | 3 +- .../Controllers/SettingsController.cs | 6 +++ .../src/sub-components/register-container.js | 13 ++++++- .../sub-components/register-modal-dialog.js | 38 +++++++++++++------ 5 files changed, 56 insertions(+), 14 deletions(-) diff --git a/packages/asc-web-common/constants/index.js b/packages/asc-web-common/constants/index.js index 93ecabe500..fb718fd2d0 100644 --- a/packages/asc-web-common/constants/index.js +++ b/packages/asc-web-common/constants/index.js @@ -163,3 +163,13 @@ export const LoaderStyle = { import config from "./AppServerConfig"; export const AppServerConfig = config; + +/** + * Enum for Tenant trusted domains on registration. + * @readonly + */ +export const TenantTrustedDomainsType = Object.freeze({ + None: 0, + Custom: 1, + All: 2, +}); diff --git a/packages/asc-web-common/store/SettingsStore.js b/packages/asc-web-common/store/SettingsStore.js index 7af2896457..9b0334fe9b 100644 --- a/packages/asc-web-common/store/SettingsStore.js +++ b/packages/asc-web-common/store/SettingsStore.js @@ -13,7 +13,8 @@ class SettingsStore { culture = "en-US"; cultures = []; trustedDomains = []; - trustedDomainsType = 1; + trustedDomainsType = 0; + trustedDomains = []; timezone = "UTC"; timezones = []; utcOffset = "00:00:00"; diff --git a/web/ASC.Web.Api/Controllers/SettingsController.cs b/web/ASC.Web.Api/Controllers/SettingsController.cs index 3b218ff60e..20a80129b2 100644 --- a/web/ASC.Web.Api/Controllers/SettingsController.cs +++ b/web/ASC.Web.Api/Controllers/SettingsController.cs @@ -323,6 +323,12 @@ namespace ASC.Api.Settings Tenant.TrustedDomains.Count > 0) || Tenant.TrustedDomainsType == TenantTrustedDomainsType.All; + if (settings.EnabledJoin.GetValueOrDefault(false)) + { + settings.TrustedDomainsType = Tenant.TrustedDomainsType; + settings.TrustedDomains = Tenant.TrustedDomains; + } + var studioAdminMessageSettings = SettingsManager.Load(); settings.EnableAdmMess = studioAdminMessageSettings.Enable || TenantExtra.IsNotPaid(); diff --git a/web/ASC.Web.Login/src/sub-components/register-container.js b/web/ASC.Web.Login/src/sub-components/register-container.js index db474f768d..65330f29a2 100644 --- a/web/ASC.Web.Login/src/sub-components/register-container.js +++ b/web/ASC.Web.Login/src/sub-components/register-container.js @@ -27,7 +27,12 @@ const StyledRegister = styled(Box)` `; const Register = (props) => { - const { enabledJoin, isAuthenticated } = props; + const { + enabledJoin, + isAuthenticated, + trustedDomainsType, + trustedDomains, + } = props; const [visible, setVisible] = useState(false); const [loading, setLoading] = useState(false); @@ -78,6 +83,8 @@ const Register = (props) => { loading={loading} email={email} emailErr={emailErr} + trustedDomainsType={trustedDomainsType} + trustedDomains={trustedDomains} t={t} onChangeEmail={onChangeEmail} onRegisterModalClose={onRegisterModalClose} @@ -98,9 +105,11 @@ Register.propTypes = { export default inject(({ auth }) => { const { settingsStore, isAuthenticated, language } = auth; - const { enabledJoin } = settingsStore; + const { enabledJoin, trustedDomainsType, trustedDomains } = settingsStore; return { enabledJoin, + trustedDomainsType, + trustedDomains, isAuthenticated, language, }; diff --git a/web/ASC.Web.Login/src/sub-components/register-modal-dialog.js b/web/ASC.Web.Login/src/sub-components/register-modal-dialog.js index af6cc5b2bd..de1963575f 100644 --- a/web/ASC.Web.Login/src/sub-components/register-modal-dialog.js +++ b/web/ASC.Web.Login/src/sub-components/register-modal-dialog.js @@ -8,16 +8,7 @@ import ModalDialog from "@appserver/components/modal-dialog"; import FieldContainer from "@appserver/components/field-container"; import ModalDialogContainer from "./modal-dialog-container"; - -const domains = ["mail.ru", "gmail.com", "yandex.ru"]; -const domainList = domains.map((domain, i) => ( - - - {domain} - {i === domains.length - 1 ? "." : ", "} - - -)); +import { TenantTrustedDomainsType } from "@appserver/common/constants"; const RegisterModalDialog = ({ visible, @@ -28,7 +19,30 @@ const RegisterModalDialog = ({ onChangeEmail, onRegisterModalClose, onSendRegisterRequest, + trustedDomainsType, + trustedDomains, }) => { + const getDomains = () => { + return trustedDomains.map((domain, i) => ( + + + {domain} + {i === trustedDomains.length - 1 ? "." : ", "} + + + )); + }; + + const getDomainsBlock = () => { + return trustedDomainsType === TenantTrustedDomainsType.Custom ? ( + <> + {t("RegisterTextBodyBeforeDomainsList")} {getDomains()}{" "} + + ) : ( + <> + ); + }; + return ( - {t("RegisterTextBodyBeforeDomainsList")} {domainList}{" "} + {getDomainsBlock()} {t("RegisterTextBodyAfterDomainsList")} @@ -100,6 +114,8 @@ RegisterModalDialog.propTypes = { onChangeEmail: PropTypes.func.isRequired, onSendRegisterRequest: PropTypes.func.isRequired, onRegisterModalClose: PropTypes.func.isRequired, + trustedDomainsType: PropTypes.number, + trustedDomains: PropTypes.array, }; export default RegisterModalDialog; From 6600c44900af57d316aa394be58ca2404e6074ae Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Tue, 4 May 2021 16:41:03 +0300 Subject: [PATCH 34/84] Web: Files: fixed display filter --- .../src/pages/Home/Section/Filter/index.js | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/products/ASC.Files/Client/src/pages/Home/Section/Filter/index.js b/products/ASC.Files/Client/src/pages/Home/Section/Filter/index.js index 8c5fa759b4..381c0c1cd3 100644 --- a/products/ASC.Files/Client/src/pages/Home/Section/Filter/index.js +++ b/products/ASC.Files/Client/src/pages/Home/Section/Filter/index.js @@ -261,18 +261,11 @@ class SectionFilterContent extends React.Component { render() { //console.log("Filter render"); const selectedFilterData = this.getSelectedFilterData(); - const { - t, - firstLoad, - sectionWidth, - tReady, - isAnyItems, - filterSearch, - } = this.props; + const { t, sectionWidth, tReady, isFiltered } = this.props; const filterColumnCount = window.innerWidth < 500 ? {} : { filterColumnCount: 3 }; - return !isAnyItems && !filterSearch ? null : !tReady ? ( + return !isFiltered ? null : !tReady ? ( ) : ( { const { - firstLoad, fetchFiles, filter, setIsLoading, @@ -309,24 +301,22 @@ export default inject(({ auth, filesStore, selectedFolderStore }) => { const { user } = auth.userStore; const { customNames, culture } = auth.settingsStore; - const isAnyItems = !!files.length || !!folders.length; - const filterSearch = filter.search; + + const { search, filterType } = filter; + const isFiltered = !!files.length || !!folders.length || search || filterType; return { customNames, user, - firstLoad, selectedFolderId: selectedFolderStore.id, selectedItem: filter.selectedItem, filter, viewAs, + isFiltered, setIsLoading, fetchFiles, setViewAs, - - isAnyItems, - filterSearch, }; })( withRouter( From 35ef6c27bf9b9a37573b798174fa45b22d097b65 Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Tue, 4 May 2021 17:42:06 +0300 Subject: [PATCH 35/84] Web: Files: removed file format for unselected items --- packages/asc-web-common/constants/index.js | 14 +++ .../dialogs/DownloadDialog/DownloadContent.js | 95 +++++++++++-------- .../dialogs/DownloadDialog/index.js | 45 ++++----- .../ASC.Files/Client/src/store/FilesStore.js | 7 +- 4 files changed, 85 insertions(+), 76 deletions(-) diff --git a/packages/asc-web-common/constants/index.js b/packages/asc-web-common/constants/index.js index fb718fd2d0..420d17124e 100644 --- a/packages/asc-web-common/constants/index.js +++ b/packages/asc-web-common/constants/index.js @@ -173,3 +173,17 @@ export const TenantTrustedDomainsType = Object.freeze({ Custom: 1, All: 2, }); + +export const FilesFormats = Object.freeze({ + OriginalFormat: 0, + TxtFormat: 1, + DocxFormat: 2, + OdtFormat: 3, + OdsFormat: 4, + OdpFormat: 5, + PdfFormat: 6, + RtfFormat: 7, + XlsxFormat: 8, + PptxFormat: 9, + CustomFormat: 10, +}); diff --git a/products/ASC.Files/Client/src/components/dialogs/DownloadDialog/DownloadContent.js b/products/ASC.Files/Client/src/components/dialogs/DownloadDialog/DownloadContent.js index 54a6d91284..c748ee8b79 100644 --- a/products/ASC.Files/Client/src/components/dialogs/DownloadDialog/DownloadContent.js +++ b/products/ASC.Files/Client/src/components/dialogs/DownloadDialog/DownloadContent.js @@ -5,6 +5,7 @@ import RowContainer from "@appserver/components/row-container"; import Text from "@appserver/components/text"; import LinkWithDropdown from "@appserver/components/link-with-dropdown"; import styled from "styled-components"; +import { FilesFormats } from "@appserver/common/constants"; const StyledDownloadContent = styled.div` .row_content, @@ -19,7 +20,6 @@ const DownloadContent = (props) => { checkedTitle, indeterminateTitle, items, - formatKeys, onSelectFormat, onRowSelect, getItemIcon, @@ -35,7 +35,7 @@ const DownloadContent = (props) => { label: t("OriginalFormat"), onClick: onSelectFormat.bind( this, - formatKeys.OriginalFormat, + FilesFormats.OriginalFormat, item, "document" ), @@ -45,7 +45,7 @@ const DownloadContent = (props) => { label: ".txt", onClick: onSelectFormat.bind( this, - formatKeys.TxtFormat, + FilesFormats.TxtFormat, item, "document" ), @@ -55,7 +55,7 @@ const DownloadContent = (props) => { label: ".docx", onClick: onSelectFormat.bind( this, - formatKeys.DocxFormat, + FilesFormats.DocxFormat, item, "document" ), @@ -65,7 +65,7 @@ const DownloadContent = (props) => { label: ".odt", onClick: onSelectFormat.bind( this, - formatKeys.OdtFormat, + FilesFormats.OdtFormat, item, "document" ), @@ -75,7 +75,7 @@ const DownloadContent = (props) => { label: ".pdf", onClick: onSelectFormat.bind( this, - formatKeys.PdfFormat, + FilesFormats.PdfFormat, item, "document" ), @@ -85,7 +85,7 @@ const DownloadContent = (props) => { label: ".rtf", onClick: onSelectFormat.bind( this, - formatKeys.RtfFormat, + FilesFormats.RtfFormat, item, "document" ), @@ -95,7 +95,7 @@ const DownloadContent = (props) => { label: t("CustomFormat"), onClick: onSelectFormat.bind( this, - formatKeys.CustomFormat, + FilesFormats.CustomFormat, item, "document" ), @@ -108,7 +108,7 @@ const DownloadContent = (props) => { label: t("OriginalFormat"), onClick: onSelectFormat.bind( this, - formatKeys.OriginalFormat, + FilesFormats.OriginalFormat, item, "presentation" ), @@ -118,7 +118,7 @@ const DownloadContent = (props) => { label: ".odp", onClick: onSelectFormat.bind( this, - formatKeys.OdpFormat, + FilesFormats.OdpFormat, item, "presentation" ), @@ -128,7 +128,7 @@ const DownloadContent = (props) => { label: ".pdf", onClick: onSelectFormat.bind( this, - formatKeys.PdfFormat, + FilesFormats.PdfFormat, item, "presentation" ), @@ -138,7 +138,7 @@ const DownloadContent = (props) => { label: ".pptx", onClick: onSelectFormat.bind( this, - formatKeys.PptxFormat, + FilesFormats.PptxFormat, item, "presentation" ), @@ -148,7 +148,7 @@ const DownloadContent = (props) => { label: t("CustomFormat"), onClick: onSelectFormat.bind( this, - formatKeys.CustomFormat, + FilesFormats.CustomFormat, item, "presentation" ), @@ -161,7 +161,7 @@ const DownloadContent = (props) => { label: t("OriginalFormat"), onClick: onSelectFormat.bind( this, - formatKeys.OriginalFormat, + FilesFormats.OriginalFormat, item, "spreadsheet" ), @@ -171,7 +171,7 @@ const DownloadContent = (props) => { label: ".odp", onClick: onSelectFormat.bind( this, - formatKeys.OdsFormat, + FilesFormats.OdsFormat, item, "spreadsheet" ), @@ -181,7 +181,7 @@ const DownloadContent = (props) => { label: ".pdf", onClick: onSelectFormat.bind( this, - formatKeys.PdfFormat, + FilesFormats.PdfFormat, item, "spreadsheet" ), @@ -191,7 +191,7 @@ const DownloadContent = (props) => { label: ".xlsx", onClick: onSelectFormat.bind( this, - formatKeys.XlsxFormat, + FilesFormats.XlsxFormat, item, "spreadsheet" ), @@ -201,7 +201,7 @@ const DownloadContent = (props) => { label: t("CustomFormat"), onClick: onSelectFormat.bind( this, - formatKeys.CustomFormat, + FilesFormats.CustomFormat, item, "spreadsheet" ), @@ -256,18 +256,22 @@ const DownloadContent = (props) => { <> - {t("ConvertInto")} + {(checkedTitle || indeterminateTitle) && t("ConvertInto")} - - {documentsTitle} - + {checkedTitle || indeterminateTitle ? ( + + {documentsTitle} + + ) : ( + <> + )} )} @@ -297,19 +301,26 @@ const DownloadContent = (props) => { {file.title} <> - - {file.checked && t("ConvertInto")} - - - {format} - + {file.checked && ( + + {t("ConvertInto")} + + )} + + {file.checked ? ( + + {format} + + ) : ( + <> + )} ); diff --git a/products/ASC.Files/Client/src/components/dialogs/DownloadDialog/index.js b/products/ASC.Files/Client/src/components/dialogs/DownloadDialog/index.js index 5067872d36..7d1827a44b 100644 --- a/products/ASC.Files/Client/src/components/dialogs/DownloadDialog/index.js +++ b/products/ASC.Files/Client/src/components/dialogs/DownloadDialog/index.js @@ -13,20 +13,7 @@ import { downloadFormatFiles } from "@appserver/common/api/files"; import { TIMEOUT } from "../../../helpers/constants"; import DownloadContent from "./DownloadContent"; import { inject, observer } from "mobx-react"; - -const formatKeys = Object.freeze({ - OriginalFormat: 0, - TxtFormat: 1, - DocxFormat: 2, - OdtFormat: 3, - OdsFormat: 4, - OdpFormat: 5, - PdfFormat: 6, - RtfFormat: 7, - XlsxFormat: 8, - PptxFormat: 9, - CustomFormat: 10, -}); +import { FilesFormats } from "@appserver/common/constants"; class DownloadDialogComponent extends React.Component { constructor(props) { @@ -39,9 +26,9 @@ class DownloadDialogComponent extends React.Component { presentations: sortedFiles.presentations, other: sortedFiles.other, - documentsTitleFormat: formatKeys.OriginalFormat, - spreadsheetsTitleFormat: formatKeys.OriginalFormat, - presentationsTitleFormat: formatKeys.OriginalFormat, + documentsTitleFormat: FilesFormats.OriginalFormat, + spreadsheetsTitleFormat: FilesFormats.OriginalFormat, + presentationsTitleFormat: FilesFormats.OriginalFormat, checkedDocTitle: true, checkedSpreadsheetTitle: true, @@ -192,8 +179,8 @@ class DownloadDialogComponent extends React.Component { if (!file) { for (let file of newDocuments) { file.format = - format === formatKeys.CustomFormat || file.fileExst === format - ? formatKeys.OriginalFormat + format === FilesFormats.CustomFormat || file.fileExst === format + ? FilesFormats.OriginalFormat : format; } this.setState({ @@ -207,7 +194,7 @@ class DownloadDialogComponent extends React.Component { newDoc.format = format; this.setState({ documents: newDocuments, - documentsTitleFormat: formatKeys.CustomFormat, + documentsTitleFormat: FilesFormats.CustomFormat, }); } } @@ -216,8 +203,8 @@ class DownloadDialogComponent extends React.Component { if (!file) { for (let file of newSpreadsheets) { file.format = - format === formatKeys.CustomFormat || file.fileExst === format - ? formatKeys.OriginalFormat + format === FilesFormats.CustomFormat || file.fileExst === format + ? FilesFormats.OriginalFormat : format; } this.setState({ @@ -231,7 +218,7 @@ class DownloadDialogComponent extends React.Component { newSpreadsheet.format = format; this.setState({ spreadsheets: newSpreadsheets, - spreadsheetsTitleFormat: formatKeys.CustomFormat, + spreadsheetsTitleFormat: FilesFormats.CustomFormat, }); } } @@ -240,8 +227,8 @@ class DownloadDialogComponent extends React.Component { if (!file) { for (let file of newPresentations) { file.format = - format === formatKeys.CustomFormat || file.fileExst === format - ? formatKeys.OriginalFormat + format === FilesFormats.CustomFormat || file.fileExst === format + ? FilesFormats.OriginalFormat : format; } this.setState({ @@ -255,7 +242,7 @@ class DownloadDialogComponent extends React.Component { newPresentation.format = format; this.setState({ presentations: newPresentations, - presentationsTitleFormat: formatKeys.CustomFormat, + presentationsTitleFormat: FilesFormats.CustomFormat, }); } } @@ -427,6 +414,9 @@ class DownloadDialogComponent extends React.Component { indeterminateOtherTitle, } = this.state; + console.log("this.props", this.props); + console.log("this.state", this.state); + const otherLength = other.length; const showOther = otherLength > 1; @@ -451,7 +441,6 @@ class DownloadDialogComponent extends React.Component { checkedTitle={checkedDocTitle} indeterminateTitle={indeterminateDocTitle} items={documents} - formatKeys={formatKeys} onSelectFormat={this.onSelectFormat} onRowSelect={this.onRowSelect} getItemIcon={this.getItemIcon} @@ -467,7 +456,6 @@ class DownloadDialogComponent extends React.Component { checkedTitle={checkedSpreadsheetTitle} indeterminateTitle={indeterminateSpreadsheetTitle} items={spreadsheets} - formatKeys={formatKeys} onSelectFormat={this.onSelectFormat} onRowSelect={this.onRowSelect} getItemIcon={this.getItemIcon} @@ -483,7 +471,6 @@ class DownloadDialogComponent extends React.Component { checkedTitle={checkedPresentationTitle} indeterminateTitle={indeterminatePresentationTitle} items={presentations} - formatKeys={formatKeys} onSelectFormat={this.onSelectFormat} onRowSelect={this.onRowSelect} getItemIcon={this.getItemIcon} diff --git a/products/ASC.Files/Client/src/store/FilesStore.js b/products/ASC.Files/Client/src/store/FilesStore.js index 65a65158fe..ffbdd8cab5 100644 --- a/products/ASC.Files/Client/src/store/FilesStore.js +++ b/products/ASC.Files/Client/src/store/FilesStore.js @@ -6,6 +6,7 @@ import { FileType, FileAction, AppServerConfig, + FilesFormats, } from "@appserver/common/constants"; import history from "@appserver/common/history"; import { createTreeFolders } from "../helpers/files-helpers"; @@ -1025,10 +1026,6 @@ class FilesStore { } = this.formatsStore.iconFormatsStore; const { canWebEdit } = this.formatsStore.docserviceStore; - const formatKeys = Object.freeze({ - OriginalFormat: 0, - }); - let sortedFiles = { documents: [], spreadsheets: [], @@ -1038,7 +1035,7 @@ class FilesStore { for (let item of this.selection) { item.checked = true; - item.format = formatKeys.OriginalFormat; + item.format = FilesFormats.OriginalFormat; if (item.fileExst) { if (isSpreadsheet(item.fileExst)) { From 8c160d01caacd1b3b9609f6ffff2d76401b7222f Mon Sep 17 00:00:00 2001 From: Sergey Kirichenko Date: Thu, 29 Apr 2021 15:27:50 +0300 Subject: [PATCH 36/84] Del files in base image (#239) Co-authored-by: Alexey Golubev (cherry picked from commit 1e05b2a216932df531b8b13ba84ea36c30ea1abe) --- build/install/docker/Dockerfile-app | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/build/install/docker/Dockerfile-app b/build/install/docker/Dockerfile-app index 2ab5d1bdd3..1c14684454 100644 --- a/build/install/docker/Dockerfile-app +++ b/build/install/docker/Dockerfile-app @@ -44,7 +44,18 @@ RUN echo "nameserver 8.8.8.8" | tee /etc/resolv.conf > /dev/null && \ cd ${SRC_PATH}/build/install/common/ && \ bash build-frontend.sh -sp ${SRC_PATH} && \ bash build-backend.sh -sp ${SRC_PATH} -ar "--disable-parallel" && \ - bash publish-backend.sh -sp ${SRC_PATH} -bp ${BUILD_PATH} -ar "--disable-parallel" + bash publish-backend.sh -sp ${SRC_PATH} -bp ${BUILD_PATH} -ar "--disable-parallel" && \ + rm -rf ${SRC_PATH}/common/* && \ + rm -rf ${SRC_PATH}/web/ASC.Web.Core/* && \ + rm -rf ${SRC_PATH}/web/ASC.Web.Studio/* && \ + rm -rf ${SRC_PATH}/products/ASC.Calendar/Server/* && \ + rm -rf ${SRC_PATH}/products/ASC.CRM/Server/* && \ + rm -rf ${SRC_PATH}/products/ASC.Files/Server/* && \ + rm -rf ${SRC_PATH}/products/ASC.Files/Service/* && \ + rm -rf ${SRC_PATH}/products/ASC.Mail/Server/* && \ + rm -rf ${SRC_PATH}/products/ASC.People/Server/* && \ + rm -rf ${SRC_PATH}/products/ASC.Projects/Server/* + COPY config/mysql/conf.d/mysql.cnf /etc/mysql/conf.d/mysql.cnf From 5de10774a283d0b807ef4b5c7c82283aa09776fe Mon Sep 17 00:00:00 2001 From: SuhorukovAnton <62381554+SuhorukovAnton@users.noreply.github.com> Date: Tue, 4 May 2021 18:38:26 +0300 Subject: [PATCH 37/84] replace nuget: first version --- .nuget/NuGet.Config => NuGet.Config | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) rename .nuget/NuGet.Config => NuGet.Config (80%) diff --git a/.nuget/NuGet.Config b/NuGet.Config similarity index 80% rename from .nuget/NuGet.Config rename to NuGet.Config index 0a5bc81077..4c8085b2e9 100644 --- a/.nuget/NuGet.Config +++ b/NuGet.Config @@ -3,12 +3,9 @@ - - - - + From 48427fd4715302097d079c86c5d75165e81b3210 Mon Sep 17 00:00:00 2001 From: pavelbannov Date: Tue, 4 May 2021 20:23:38 +0300 Subject: [PATCH 38/84] Files: fixed SetFileStatus for thirdparty files --- products/ASC.Files/Core/Core/FileStorageService.cs | 2 +- products/ASC.Files/Core/Utils/EntryManager.cs | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/products/ASC.Files/Core/Core/FileStorageService.cs b/products/ASC.Files/Core/Core/FileStorageService.cs index d21216e12a..476ac503f4 100644 --- a/products/ASC.Files/Core/Core/FileStorageService.cs +++ b/products/ASC.Files/Core/Core/FileStorageService.cs @@ -382,7 +382,7 @@ namespace ASC.Web.Files.Services.WCFService } } - EntryManager.SetFileStatus(entries.OfType>().Where(r => r.ID != null).ToList()); + EntryManager.SetFileStatus(entries); return new ItemList(entries); } diff --git a/products/ASC.Files/Core/Utils/EntryManager.cs b/products/ASC.Files/Core/Utils/EntryManager.cs index b70659146a..23e2556c19 100644 --- a/products/ASC.Files/Core/Utils/EntryManager.cs +++ b/products/ASC.Files/Core/Utils/EntryManager.cs @@ -471,7 +471,7 @@ namespace ASC.Web.Files.Utils if (0 < count) entries = entries.Take(count); } - SetFileStatus(entries.OfType>().Where(r => r != null && r.ID != null && r.FileEntryType == FileEntryType.File).ToList()); + SetFileStatus(entries.Where(r => r != null && r.FileEntryType == FileEntryType.File).ToList()); return entries; void CalculateTotal() @@ -824,6 +824,12 @@ namespace ASC.Web.Files.Utils SetFileStatus(new List>(1) { file }); } + public void SetFileStatus(IEnumerable files) + { + SetFileStatus(files.OfType>().Where(r=> r.ID != 0)); + SetFileStatus(files.OfType>().Where(r=> !string.IsNullOrEmpty(r.ID))); + } + public void SetFileStatus(IEnumerable> files) { var tagDao = DaoFactory.GetTagDao(); From 605f7d749e3c5f9576a5d8f2a74888d4989348f7 Mon Sep 17 00:00:00 2001 From: AlexeySafronov Date: Tue, 4 May 2021 22:14:42 +0300 Subject: [PATCH 39/84] Web: Components: FloatingButton: Added rotation on percent === 0 --- .../FloatingButton/StyledFloatingButton.js | 35 ++++++++++++++----- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/packages/asc-web-common/components/FloatingButton/StyledFloatingButton.js b/packages/asc-web-common/components/FloatingButton/StyledFloatingButton.js index 70051d0516..4d94cd5863 100644 --- a/packages/asc-web-common/components/FloatingButton/StyledFloatingButton.js +++ b/packages/asc-web-common/components/FloatingButton/StyledFloatingButton.js @@ -1,4 +1,4 @@ -import styled from "styled-components"; +import styled, { keyframes, css } from "styled-components"; const backgroundColor = "none"; const color = "#2DA7DB"; @@ -11,6 +11,15 @@ const StyledCircleWrap = styled.div` cursor: pointer; `; +const rotate360 = keyframes` + from { + transform: rotate(0deg); + } + to { + transform: rotate(360deg); + } +`; + const StyledCircle = styled.div` .circle__mask, .circle__fill { @@ -20,14 +29,24 @@ const StyledCircle = styled.div` border-radius: 50%; } - .circle__mask { - clip: rect(0px, 54px, 54px, 27px); - } + ${(props) => + props.percent > 0 + ? css` + .circle__mask { + clip: rect(0px, 54px, 54px, 27px); + } - .circle__fill { - animation: fill-rotate ease-in-out none; - transform: rotate(${(props) => props.percent * 1.8}deg); - } + .circle__fill { + animation: fill-rotate ease-in-out none; + transform: rotate(${(props) => props.percent * 1.8}deg); + } + ` + : css` + .circle__fill { + animation: ${rotate360} 2s linear infinite; + transform: translate(0); + } + `} .circle__mask .circle__fill { clip: rect(0px, 27px, 54px, 0px); From 4aecce0565b22726005b2c2024735b2dae0a0336 Mon Sep 17 00:00:00 2001 From: AlexeySafronov Date: Wed, 5 May 2021 10:33:13 +0300 Subject: [PATCH 40/84] Web: Files: Fix Download files from third-party --- .../Core/Services/WCFService/FileOperations/FileOperation.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/products/ASC.Files/Core/Services/WCFService/FileOperations/FileOperation.cs b/products/ASC.Files/Core/Services/WCFService/FileOperations/FileOperation.cs index 4c1f095a0d..dd94a21a24 100644 --- a/products/ASC.Files/Core/Services/WCFService/FileOperations/FileOperation.cs +++ b/products/ASC.Files/Core/Services/WCFService/FileOperations/FileOperation.cs @@ -358,7 +358,8 @@ namespace ASC.Web.Files.Services.WCFService.FileOperations protected void ProgressStep(TId folderId = default, TId fileId = default) { - if (folderId.Equals(default(TId)) && fileId.Equals(default(TId)) + if (folderId == null && fileId == null + || folderId.Equals(default(TId)) && fileId.Equals(default(TId)) || !folderId.Equals(default(TId)) && Folders.Contains(folderId) || !fileId.Equals(default(TId)) && Files.Contains(fileId)) { From 32abd05d10334d8a095dac21a9426d800e92abb1 Mon Sep 17 00:00:00 2001 From: AlexeySafronov Date: Wed, 5 May 2021 11:21:21 +0300 Subject: [PATCH 41/84] Web: Hide user-select on Desktop Editors --- web/ASC.Web.Client/src/Shell.jsx | 4 ++++ web/ASC.Web.Client/src/custom.scss | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/web/ASC.Web.Client/src/Shell.jsx b/web/ASC.Web.Client/src/Shell.jsx index 10ec8c7ceb..3f8a6022e6 100644 --- a/web/ASC.Web.Client/src/Shell.jsx +++ b/web/ASC.Web.Client/src/Shell.jsx @@ -262,6 +262,10 @@ const ShellWrapper = inject(({ auth }) => { init(); auth.settingsStore.setModuleInfo(config.homepage, "home"); auth.setProductVersion(config.version); + + if (auth.settingsStore.isDesktopClient) { + document.body.classList.add("desktop"); + } }, //isThirdPartyResponse, isLoaded, diff --git a/web/ASC.Web.Client/src/custom.scss b/web/ASC.Web.Client/src/custom.scss index cbde4e195a..84bb0c7753 100644 --- a/web/ASC.Web.Client/src/custom.scss +++ b/web/ASC.Web.Client/src/custom.scss @@ -23,3 +23,12 @@ body { body.loading * { cursor: wait !important; } + +body.desktop { + user-select: none; + -moz-user-select: none; + -khtml-user-select: none; + -webkit-user-select: none; + -o-user-select: none; + mozuserselect: none; +} From abfb65f42edca0408320ce84df7271b05e25a83e Mon Sep 17 00:00:00 2001 From: AlexeySafronov Date: Wed, 5 May 2021 11:29:48 +0300 Subject: [PATCH 42/84] Web: Client: Fix height on Desktop Editors --- web/ASC.Web.Client/src/Shell.jsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web/ASC.Web.Client/src/Shell.jsx b/web/ASC.Web.Client/src/Shell.jsx index 3f8a6022e6..3211e77dff 100644 --- a/web/ASC.Web.Client/src/Shell.jsx +++ b/web/ASC.Web.Client/src/Shell.jsx @@ -143,7 +143,7 @@ const ComingSoonRoute = (props) => ( ); const Shell = ({ items = [], page = "home", ...rest }) => { - const { isLoaded, loadBaseInfo, modules } = rest; + const { isLoaded, loadBaseInfo, modules, isDesktop } = rest; useEffect(() => { try { @@ -224,7 +224,7 @@ const Shell = ({ items = [], page = "home", ...rest }) => { <> {isEditor ? <> : } -
+
@@ -270,6 +270,7 @@ const ShellWrapper = inject(({ auth }) => { //isThirdPartyResponse, isLoaded, modules: auth.moduleStore.modules, + isDesktop: auth.settingsStore.isDesktopClient, }; })(observer(Shell)); From 85f5b3c775c71d2263011b18045e041f5ce48d42 Mon Sep 17 00:00:00 2001 From: pavelbannov Date: Wed, 5 May 2021 11:45:13 +0300 Subject: [PATCH 43/84] fix Bug 49858 --- .../Server/Controllers/PeopleController.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/products/ASC.People/Server/Controllers/PeopleController.cs b/products/ASC.People/Server/Controllers/PeopleController.cs index f96df70fee..67b299cc4b 100644 --- a/products/ASC.People/Server/Controllers/PeopleController.cs +++ b/products/ASC.People/Server/Controllers/PeopleController.cs @@ -420,14 +420,14 @@ namespace ASC.Employee.Core.Controllers } [Create] - [Authorize(AuthenticationSchemes = "confirm", Roles = "LinkInvite,Administrators")] + [Authorize(AuthenticationSchemes = "confirm", Roles = "LinkInvite,Everyone")] public EmployeeWraperFull AddMemberFromBody([FromBody]MemberModel memberModel) { return AddMember(memberModel); } [Create] - [Authorize(AuthenticationSchemes = "confirm", Roles = "LinkInvite,Administrators")] + [Authorize(AuthenticationSchemes = "confirm", Roles = "LinkInvite,Everyone")] [Consumes("application/x-www-form-urlencoded")] public EmployeeWraperFull AddMemberFromForm([FromForm]MemberModel memberModel) { @@ -1104,14 +1104,14 @@ namespace ASC.Employee.Core.Controllers } [Update("{userid}/password")] - [Authorize(AuthenticationSchemes = "confirm", Roles = "PasswordChange,EmailChange,Activation,EmailActivation,Administrators")] + [Authorize(AuthenticationSchemes = "confirm", Roles = "PasswordChange,EmailChange,Activation,EmailActivation,Everyone")] public EmployeeWraperFull ChangeUserPasswordFromBody(Guid userid, [FromBody]MemberModel memberModel) { return ChangeUserPassword(userid, memberModel); } [Update("{userid}/password")] - [Authorize(AuthenticationSchemes = "confirm", Roles = "PasswordChange,EmailChange,Activation,EmailActivation,Administrators")] + [Authorize(AuthenticationSchemes = "confirm", Roles = "PasswordChange,EmailChange,Activation,EmailActivation,Everyone")] [Consumes("application/x-www-form-urlencoded")] public EmployeeWraperFull ChangeUserPasswordFromForm(Guid userid, [FromForm] MemberModel memberModel) { @@ -1242,14 +1242,14 @@ namespace ASC.Employee.Core.Controllers } [Update("activationstatus/{activationstatus}")] - [Authorize(AuthenticationSchemes = "confirm", Roles = "Activation,Administrators")] + [Authorize(AuthenticationSchemes = "confirm", Roles = "Activation,Everyone")] public IEnumerable UpdateEmployeeActivationStatusFromBody(EmployeeActivationStatus activationstatus, [FromBody]UpdateMembersModel model) { return UpdateEmployeeActivationStatus(activationstatus, model); } [Update("activationstatus/{activationstatus}")] - [Authorize(AuthenticationSchemes = "confirm", Roles = "Activation,Administrators")] + [Authorize(AuthenticationSchemes = "confirm", Roles = "Activation,Everyone")] [Consumes("application/x-www-form-urlencoded")] public IEnumerable UpdateEmployeeActivationStatusFromForm(EmployeeActivationStatus activationstatus, [FromForm] UpdateMembersModel model) { From 9705508e612369853a8c8e3f83e6f4abac219164 Mon Sep 17 00:00:00 2001 From: AlexeySafronov Date: Wed, 5 May 2021 12:06:03 +0300 Subject: [PATCH 44/84] Web: Client: Fix About page base url setup --- web/ASC.Web.Client/src/Shell.jsx | 4 --- .../src/components/pages/About/index.js | 32 +++++++++++++------ 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/web/ASC.Web.Client/src/Shell.jsx b/web/ASC.Web.Client/src/Shell.jsx index 3211e77dff..6586575b01 100644 --- a/web/ASC.Web.Client/src/Shell.jsx +++ b/web/ASC.Web.Client/src/Shell.jsx @@ -3,7 +3,6 @@ import { Router, Switch, Route } from "react-router-dom"; import { inject, observer } from "mobx-react"; import NavMenu from "./components/NavMenu"; import Main from "./components/Main"; -import Box from "@appserver/components/box"; import PrivateRoute from "@appserver/common/components/PrivateRoute"; import PublicRoute from "@appserver/common/components/PublicRoute"; import ErrorBoundary from "@appserver/common/components/ErrorBoundary"; @@ -254,8 +253,6 @@ const Shell = ({ items = [], page = "home", ...rest }) => { const ShellWrapper = inject(({ auth }) => { const { init, isLoaded } = auth; - const pathname = window.location.pathname.toLowerCase(); - //const isThirdPartyResponse = pathname.indexOf("thirdparty") !== -1; return { loadBaseInfo: () => { @@ -267,7 +264,6 @@ const ShellWrapper = inject(({ auth }) => { document.body.classList.add("desktop"); } }, - //isThirdPartyResponse, isLoaded, modules: auth.moduleStore.modules, isDesktop: auth.settingsStore.isDesktopClient, diff --git a/web/ASC.Web.Client/src/components/pages/About/index.js b/web/ASC.Web.Client/src/components/pages/About/index.js index 01e3462297..5865863acc 100644 --- a/web/ASC.Web.Client/src/components/pages/About/index.js +++ b/web/ASC.Web.Client/src/components/pages/About/index.js @@ -8,6 +8,8 @@ import styled from "styled-components"; import { isMobile } from "react-device-detect"; import { setDocumentTitle } from "../../../helpers/utils"; import i18n from "./i18n"; +import config from "../../../../package.json"; +import { inject } from "mobx-react"; const BodyStyle = styled.div` margin-top: ${isMobile ? "80px" : "24px"}; @@ -191,14 +193,24 @@ const Body = () => { ); }; -const About = ({ language }) => ( - - - - - - - -); +const About = ({ language, setModuleInfo }) => { + useEffect(() => { + setModuleInfo(config.homepage, "home"); + }, []); -export default About; + return ( + + + + + + + + ); +}; + +export default inject(({ auth }) => { + return { + setModuleInfo: auth.settingsStore.setModuleInfo, + }; +})(About); From 7f059353c76e224c5d15dbaa8bd55ba18ac645ed Mon Sep 17 00:00:00 2001 From: pavelbannov Date: Wed, 5 May 2021 14:48:15 +0300 Subject: [PATCH 45/84] Files: fix thridparty opitons --- .../FileOperations/FileOperation.cs | 7 +- .../Server/Controllers/FilesController.cs | 72 +++++++++---------- 2 files changed, 39 insertions(+), 40 deletions(-) diff --git a/products/ASC.Files/Core/Services/WCFService/FileOperations/FileOperation.cs b/products/ASC.Files/Core/Services/WCFService/FileOperations/FileOperation.cs index dd94a21a24..9d6cde8229 100644 --- a/products/ASC.Files/Core/Services/WCFService/FileOperations/FileOperation.cs +++ b/products/ASC.Files/Core/Services/WCFService/FileOperations/FileOperation.cs @@ -358,10 +358,9 @@ namespace ASC.Web.Files.Services.WCFService.FileOperations protected void ProgressStep(TId folderId = default, TId fileId = default) { - if (folderId == null && fileId == null - || folderId.Equals(default(TId)) && fileId.Equals(default(TId)) - || !folderId.Equals(default(TId)) && Folders.Contains(folderId) - || !fileId.Equals(default(TId)) && Files.Contains(fileId)) + if (Equals(folderId, default(TId)) && Equals(fileId, default(TId)) + || !Equals(folderId, default(TId)) && Folders.Contains(folderId) + || !Equals(fileId, default(TId)) && Files.Contains(fileId)) { processed++; PublishTaskInfo(); diff --git a/products/ASC.Files/Server/Controllers/FilesController.cs b/products/ASC.Files/Server/Controllers/FilesController.cs index 6094dcfe23..ebd8fe94e3 100644 --- a/products/ASC.Files/Server/Controllers/FilesController.cs +++ b/products/ASC.Files/Server/Controllers/FilesController.cs @@ -473,13 +473,13 @@ namespace ASC.Api.Documents /// If True, upload documents in original formats as well /// Keep status conversation after finishing /// Uploaded file - [Create("{folderId}/upload", DisableFormat = true)] + [Create("{folderId}/upload")] public List> UploadFileFromBody(string folderId, [FromBody]UploadModel uploadModel) { return FilesControllerHelperString.UploadFile(folderId, uploadModel); } - [Create("{folderId}/upload", DisableFormat = true)] + [Create("{folderId}/upload")] [Consumes("application/x-www-form-urlencoded")] public List> UploadFileFromForm(string folderId, [FromForm]UploadModel uploadModel) { @@ -540,7 +540,7 @@ namespace ASC.Api.Documents /// Keep status conversation after finishing /// Uploads /// - [Create("{folderId}/insert", order: int.MaxValue, DisableFormat = true)] + [Create("{folderId}/insert", order: int.MaxValue)] public FileWrapper InsertFile(string folderId, [FromForm] InsertFileModel model) { return FilesControllerHelperString.InsertFile(folderId, model.File.OpenReadStream(), model.Title, model.CreateNewIfExist, model.KeepConvertStatus); @@ -566,7 +566,7 @@ namespace ASC.Api.Documents /// /// false - [Update("{fileId}/update", DisableFormat = true)] + [Update("{fileId}/update")] public FileWrapper UpdateFileStreamFromForm(string fileId, [FromForm]FileStreamModel model) { return FilesControllerHelperString.UpdateFileStream(model.File.OpenReadStream(), fileId, model.Encrypted, model.Forcesave); @@ -590,7 +590,7 @@ namespace ASC.Api.Documents /// /// Files /// - [Update("file/{fileId}/saveediting", DisableFormat = true)] + [Update("file/{fileId}/saveediting")] public FileWrapper SaveEditingFromForm(string fileId, [FromForm]SaveEditingModel model) { using var stream = model.Stream.OpenReadStream(); @@ -612,13 +612,13 @@ namespace ASC.Api.Documents /// /// Files /// - [Create("file/{fileId}/startedit", DisableFormat = true)] + [Create("file/{fileId}/startedit")] public object StartEditFromBody(string fileId, [FromBody]StartEditModel model) { return FilesControllerHelperString.StartEdit(fileId, model.EditingAlone, model.Doc); } - [Create("file/{fileId}/startedit", DisableFormat = true)] + [Create("file/{fileId}/startedit")] [Consumes("application/x-www-form-urlencoded")] public object StartEditFromForm(string fileId, [FromForm]StartEditModel model) { @@ -648,7 +648,7 @@ namespace ASC.Api.Documents /// /// Files /// - [Read("file/{fileId}/trackeditfile", DisableFormat = true)] + [Read("file/{fileId}/trackeditfile")] public KeyValuePair TrackEditFile(string fileId, Guid tabId, string docKeyForTrack, string doc, bool isFinish) { return FilesControllerHelperString.TrackEditFile(fileId, tabId, docKeyForTrack, doc, isFinish); @@ -669,7 +669,7 @@ namespace ASC.Api.Documents /// Files /// [AllowAnonymous] - [Read("file/{fileId}/openedit", DisableFormat = true)] + [Read("file/{fileId}/openedit")] public Configuration OpenEdit(string fileId, int version, string doc) { return FilesControllerHelperString.OpenEdit(fileId, version, doc); @@ -715,13 +715,13 @@ namespace ASC.Api.Documents /// /// ]]> /// - [Create("{folderId}/upload/create_session", DisableFormat = true)] + [Create("{folderId}/upload/create_session")] public object CreateUploadSessionFromBody(string folderId, [FromBody]SessionModel sessionModel) { return FilesControllerHelperString.CreateUploadSession(folderId, sessionModel.FileName, sessionModel.FileSize, sessionModel.RelativePath, sessionModel.Encrypted); } - [Create("{folderId}/upload/create_session", DisableFormat = true)] + [Create("{folderId}/upload/create_session")] [Consumes("application/x-www-form-urlencoded")] public object CreateUploadSessionFromForm(string folderId, [FromForm]SessionModel sessionModel) { @@ -792,13 +792,13 @@ namespace ASC.Api.Documents /// File title /// File contents /// Folder contents - [Create("{folderId}/text", DisableFormat = true)] + [Create("{folderId}/text")] public FileWrapper CreateTextFileFromBody(string folderId, [FromBody]CreateTextOrHtmlFileModel model) { return CreateTextFile(folderId, model); } - [Create("{folderId}/text", DisableFormat = true)] + [Create("{folderId}/text")] [Consumes("application/x-www-form-urlencoded")] public FileWrapper CreateTextFileFromForm(string folderId, [FromForm]CreateTextOrHtmlFileModel model) { @@ -837,13 +837,13 @@ namespace ASC.Api.Documents /// File title /// File contents /// Folder contents - [Create("{folderId}/html", DisableFormat = true)] + [Create("{folderId}/html")] public FileWrapper CreateHtmlFileFromBody(string folderId, [FromBody]CreateTextOrHtmlFileModel model) { return CreateHtmlFile(folderId, model); } - [Create("{folderId}/html", DisableFormat = true)] + [Create("{folderId}/html")] [Consumes("application/x-www-form-urlencoded")] public FileWrapper CreateHtmlFileFromForm(string folderId, [FromForm]CreateTextOrHtmlFileModel model) { @@ -981,13 +981,13 @@ namespace ASC.Api.Documents /// File title /// In case the extension for the file title differs from DOCX/XLSX/PPTX and belongs to one of the known text, spreadsheet or presentation formats, it will be changed to DOCX/XLSX/PPTX accordingly. If the file extension is not set or is unknown, the DOCX extension will be added to the file title. /// New file info - [Create("{folderId}/file", DisableFormat = true)] + [Create("{folderId}/file")] public FileWrapper CreateFileFromBody(string folderId, [FromBody]CreateFileModel model) { return FilesControllerHelperString.CreateFile(folderId, model.Title, model.TemplateId, model.EnableExternalExt); } - [Create("{folderId}/file", DisableFormat = true)] + [Create("{folderId}/file")] [Consumes("application/x-www-form-urlencoded")] public FileWrapper CreateFileFromForm(string folderId, [FromForm]CreateFileModel model) { @@ -1088,7 +1088,7 @@ namespace ASC.Api.Documents /// /// Folders /// Parent folders - [Read("folder/{folderId}/path", DisableFormat = true)] + [Read("folder/{folderId}/path")] public IEnumerable GetFolderPath(string folderId) { return FilesControllerHelperString.GetFolderPath(folderId); @@ -1112,7 +1112,7 @@ namespace ASC.Api.Documents return FilesControllerHelperString.GetFileInfo(fileId, version); } - [Read("file/{fileId:int}", DisableFormat = true)] + [Read("file/{fileId:int}")] public FileWrapper GetFileInfo(int fileId, int version = -1) { return FilesControllerHelperInt.GetFileInfo(fileId, version); @@ -1181,7 +1181,7 @@ namespace ASC.Api.Documents /// File operations /// /// Operation result - [Update("file/{fileId}/checkconversion", DisableFormat = true)] + [Update("file/{fileId}/checkconversion")] public IEnumerable> StartConversion(string fileId) { return FilesControllerHelperString.StartConversion(fileId); @@ -1201,7 +1201,7 @@ namespace ASC.Api.Documents /// /// /// Operation result - [Read("file/{fileId}/checkconversion", DisableFormat = true)] + [Read("file/{fileId}/checkconversion")] public IEnumerable> CheckConversion(string fileId, bool start) { return FilesControllerHelperString.CheckConversion(fileId, start); @@ -1413,7 +1413,7 @@ namespace ASC.Api.Documents /// Files /// File ID /// File information - [Read("file/{fileId}/history", DisableFormat = true)] + [Read("file/{fileId}/history")] public IEnumerable> GetFileVersionInfo(string fileId) { return FilesControllerHelperString.GetFileVersionInfo(fileId); @@ -1433,13 +1433,13 @@ namespace ASC.Api.Documents /// Mark as version or revision /// Files /// - [Update("file/{fileId}/history", DisableFormat = true)] + [Update("file/{fileId}/history")] public IEnumerable> ChangeHistoryFromBody(string fileId, [FromBody]ChangeHistoryModel model) { return FilesControllerHelperString.ChangeHistory(fileId, model.Version, model.ContinueVersion); } - [Update("file/{fileId}/history", DisableFormat = true)] + [Update("file/{fileId}/history")] [Consumes("application/x-www-form-urlencoded")] public IEnumerable> ChangeHistoryFromForm(string fileId, [FromForm]ChangeHistoryModel model) { @@ -1459,13 +1459,13 @@ namespace ASC.Api.Documents return FilesControllerHelperInt.ChangeHistory(fileId, model.Version, model.ContinueVersion); } - [Update("file/{fileId}/lock", DisableFormat = true)] + [Update("file/{fileId}/lock")] public FileWrapper LockFileFromBody(string fileId, [FromBody]LockFileModel model) { return FilesControllerHelperString.LockFile(fileId, model.LockFile); } - [Update("file/{fileId}/lock", DisableFormat = true)] + [Update("file/{fileId}/lock")] [Consumes("application/x-www-form-urlencoded")] public FileWrapper LockFileFromForm(string fileId, [FromForm]LockFileModel model) { @@ -1485,13 +1485,13 @@ namespace ASC.Api.Documents return FilesControllerHelperInt.LockFile(fileId, model.LockFile); } - [Update("file/{fileId}/comment", DisableFormat = true)] + [Update("file/{fileId}/comment")] public object UpdateCommentFromBody(string fileId, [FromBody]UpdateCommentModel model) { return FilesControllerHelperString.UpdateComment(fileId, model.Version, model.Comment); } - [Update("file/{fileId}/comment", DisableFormat = true)] + [Update("file/{fileId}/comment")] [Consumes("application/x-www-form-urlencoded")] public object UpdateCommentFromForm(string fileId, [FromForm]UpdateCommentModel model) { @@ -1518,7 +1518,7 @@ namespace ASC.Api.Documents /// Sharing /// File ID /// Shared file information - [Read("file/{fileId}/share", DisableFormat = true)] + [Read("file/{fileId}/share")] public IEnumerable GetFileSecurityInfo(string fileId) { return FilesControllerHelperString.GetFileSecurityInfo(fileId); @@ -1537,7 +1537,7 @@ namespace ASC.Api.Documents /// Folder ID /// Sharing /// Shared folder information - [Read("folder/{folderId}/share", DisableFormat = true)] + [Read("folder/{folderId}/share")] public IEnumerable GetFolderSecurityInfo(string folderId) { return FilesControllerHelperString.GetFolderSecurityInfo(folderId); @@ -1581,13 +1581,13 @@ namespace ASC.Api.Documents /// Each of the FileShareParams must contain two parameters: 'ShareTo' - ID of the user with whom we want to share and 'Access' - access type which we want to grant to the user (Read, ReadWrite, etc) /// /// Shared file information - [Update("file/{fileId}/share", DisableFormat = true)] + [Update("file/{fileId}/share")] public IEnumerable SetFileSecurityInfoFromBody(string fileId, [FromBody]SecurityInfoModel model) { return FilesControllerHelperString.SetFileSecurityInfo(fileId, model.Share, model.Notify, model.SharingMessage); } - [Update("file/{fileId}/share", DisableFormat = true)] + [Update("file/{fileId}/share")] [Consumes("application/x-www-form-urlencoded")] public IEnumerable SetFileSecurityInfoFromForm(string fileId, [FromForm]SecurityInfoModel model) { @@ -1641,13 +1641,13 @@ namespace ASC.Api.Documents /// /// Sharing /// Shared folder information - [Update("folder/{folderId}/share", DisableFormat = true)] + [Update("folder/{folderId}/share")] public IEnumerable SetFolderSecurityInfoFromBody(string folderId, [FromBody]SecurityInfoModel model) { return FilesControllerHelperString.SetFolderSecurityInfo(folderId, model.Share, model.Notify, model.SharingMessage); } - [Update("folder/{folderId}/share", DisableFormat = true)] + [Update("folder/{folderId}/share")] [Consumes("application/x-www-form-urlencoded")] public IEnumerable SetFolderSecurityInfoFromForm(string folderId, [FromForm]SecurityInfoModel model) { @@ -1693,13 +1693,13 @@ namespace ASC.Api.Documents /// Access right /// Files /// Shared file link - [Update("{fileId}/sharedlink", DisableFormat = true)] + [Update("{fileId}/sharedlink")] public object GenerateSharedLinkFromBody(string fileId, [FromBody]GenerateSharedLinkModel model) { return FilesControllerHelperString.GenerateSharedLink(fileId, model.Share); } - [Update("{fileId}/sharedlink", DisableFormat = true)] + [Update("{fileId}/sharedlink")] [Consumes("application/x-www-form-urlencoded")] public object GenerateSharedLinkFromForm(string fileId, [FromForm]GenerateSharedLinkModel model) { From 3435b49b721303f27a2c632d951ff9029e8e24e4 Mon Sep 17 00:00:00 2001 From: SuhorukovAnton <62381554+SuhorukovAnton@users.noreply.github.com> Date: Wed, 5 May 2021 14:48:34 +0300 Subject: [PATCH 46/84] replace_nuget: delete configfile --- build/Jenkinsfile | 8 ++++---- build/install/common/build-backend.sh | 2 +- build/install/docker/Dockerfile | 2 +- build/install/rpm/SPECS/build.spec | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/build/Jenkinsfile b/build/Jenkinsfile index 362953d125..df0e36bfc4 100644 --- a/build/Jenkinsfile +++ b/build/Jenkinsfile @@ -13,7 +13,7 @@ pipeline { } stage('Frontend') { steps { - sh 'dotnet build ASC.Web.sln --configfile .nuget/NuGet.Config' + sh 'dotnet build ASC.Web.sln' } } } @@ -28,7 +28,7 @@ pipeline { } stage('Frontend') { steps { - bat 'dotnet build ASC.Web.sln --configfile .nuget\\NuGet.Config' + bat 'dotnet build ASC.Web.sln' } } } @@ -62,7 +62,7 @@ pipeline { } stage('Files') { steps { - sh "dotnet build ASC.Web.sln --configfile .nuget/NuGet.Config && cd ${env.WORKSPACE}/products/ASC.Files/Tests/ && dotnet test ASC.Files.Tests.csproj -r linux-x64 -l \"console;verbosity=detailed\"" + sh "dotnet build ASC.Web.sln && cd ${env.WORKSPACE}/products/ASC.Files/Tests/ && dotnet test ASC.Files.Tests.csproj -r linux-x64 -l \"console;verbosity=detailed\"" } } } @@ -90,7 +90,7 @@ pipeline { } stage('Files') { steps { - bat "dotnet build ASC.Web.sln --configfile .nuget\\NuGet.Config && cd ${env.WORKSPACE}\\products\\ASC.Files\\Tests\\ && dotnet test ASC.Files.Tests.csproj" + bat "dotnet build ASC.Web.sln && cd ${env.WORKSPACE}\\products\\ASC.Files\\Tests\\ && dotnet test ASC.Files.Tests.csproj" } } } diff --git a/build/install/common/build-backend.sh b/build/install/common/build-backend.sh index 3b85f0ae5e..8b9326dd0b 100644 --- a/build/install/common/build-backend.sh +++ b/build/install/common/build-backend.sh @@ -42,7 +42,7 @@ done echo "== BACK-END-BUILD ==" cd ${SRC_PATH} -dotnet restore ASC.Web.sln --configfile .nuget/NuGet.Config ${ARGS} +dotnet restore ASC.Web.sln${ARGS} dotnet build ASC.Web.sln ${ARGS} echo "== Build ASC.Thumbnails ==" diff --git a/build/install/docker/Dockerfile b/build/install/docker/Dockerfile index 52a939ba13..51d78ab1f3 100644 --- a/build/install/docker/Dockerfile +++ b/build/install/docker/Dockerfile @@ -140,7 +140,7 @@ RUN cd /app/onlyoffice/src/ && \ cp -f config/nginx/onlyoffice*.conf /etc/nginx/conf.d/ && \ mkdir -p /etc/nginx/includes/ && cp -f config/nginx/includes/onlyoffice*.conf /etc/nginx/includes/ && \ sed -e 's/#//' -i /etc/nginx/conf.d/onlyoffice.conf && \ - dotnet restore ASC.Web.sln --configfile .nuget/NuGet.Config && \ + dotnet restore ASC.Web.sln && \ dotnet build -r linux-x64 ASC.Web.sln && \ cd products/ASC.People/Server && \ dotnet -d publish --no-build --self-contained -r linux-x64 -o /var/www/products/ASC.People/server && \ diff --git a/build/install/rpm/SPECS/build.spec b/build/install/rpm/SPECS/build.spec index 48e02766ac..94fc98e0e1 100644 --- a/build/install/rpm/SPECS/build.spec +++ b/build/install/rpm/SPECS/build.spec @@ -48,7 +48,7 @@ npm i && cd ../../../) npm run-script build --prefix products/ASC.People/Client cd %{_builddir}/AppServer-%GIT_BRANCH/ -dotnet restore ASC.Web.sln --configfile .nuget/NuGet.Config +dotnet restore ASC.Web.sln dotnet build -r linux-x64 ASC.Web.sln cd products/ASC.People/Server dotnet -d publish --no-build --self-contained -r linux-x64 -o %{_builddir}%{_var}/www/appserver/products/ASC.People/server From d7ea692b3eb4f0bff149f6dc8908861d294c3834 Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Wed, 5 May 2021 15:29:18 +0300 Subject: [PATCH 47/84] Web: Client: fixed styles for createUser confirm --- .../components/pages/Confirm/sub-components/createUser.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/web/ASC.Web.Client/src/components/pages/Confirm/sub-components/createUser.js b/web/ASC.Web.Client/src/components/pages/Confirm/sub-components/createUser.js index b4c8755c1e..9ff3275594 100644 --- a/web/ASC.Web.Client/src/components/pages/Confirm/sub-components/createUser.js +++ b/web/ASC.Web.Client/src/components/pages/Confirm/sub-components/createUser.js @@ -21,6 +21,7 @@ import PageLayout from "@appserver/common/components/PageLayout"; import { combineUrl, createPasswordHash } from "@appserver/common/utils"; import { AppServerConfig, providersData } from "@appserver/common/constants"; import { isMobile } from "react-device-detect"; +import { desktop } from "@appserver/components/utils/device"; const inputWidth = "400px"; @@ -49,6 +50,10 @@ const ConfirmContainer = styled.div` .start-basis { align-items: flex-start; ${isMobile && `margin-top: 56px;`} + + @media ${desktop} { + min-width: 604px; + } } .margin-left { From 3365d1a1dcd0a7635ab181d38b1ea647dad6e953 Mon Sep 17 00:00:00 2001 From: gopienkonikita Date: Wed, 5 May 2021 15:48:19 +0300 Subject: [PATCH 48/84] Web: Client: added showCopyLink prop to password-input component, fixed displaying "copy email and password" link --- .../password-input/index.js | 30 +++++++++++-------- .../Confirm/sub-components/createUser.js | 7 +++-- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/packages/asc-web-components/password-input/index.js b/packages/asc-web-components/password-input/index.js index 764f46b9f7..0bb3df4b3d 100644 --- a/packages/asc-web-components/password-input/index.js +++ b/packages/asc-web-components/password-input/index.js @@ -423,6 +423,7 @@ class PasswordInput extends React.Component { simpleView, hideNewPasswordButton, isDisabled, + showCopyLink, } = this.props; const { copyLabel, disableCopyAction } = this.state; @@ -461,18 +462,20 @@ class PasswordInput extends React.Component { ) : null}
{this.renderTextTooltip()} - - - {copyLabel} - - + {showCopyLink && ( + + + {copyLabel} + + + )} )} @@ -549,6 +552,8 @@ PasswordInput.propTypes = { tooltipOffsetLeft: PropTypes.number, /** Set simple view of password input (without tooltips, password progress bar and several additional buttons (copy and generate password) */ simpleView: PropTypes.bool, + /** Sets the link to copy the password visible */ + showCopyLink: PropTypes.bool, }; PasswordInput.defaultProps = { @@ -579,6 +584,7 @@ PasswordInput.defaultProps = { digits: false, specSymbols: false, }, + showCopyLink: true, }; export default PasswordInput; diff --git a/web/ASC.Web.Client/src/components/pages/Confirm/sub-components/createUser.js b/web/ASC.Web.Client/src/components/pages/Confirm/sub-components/createUser.js index 9ff3275594..c38141800e 100644 --- a/web/ASC.Web.Client/src/components/pages/Confirm/sub-components/createUser.js +++ b/web/ASC.Web.Client/src/components/pages/Confirm/sub-components/createUser.js @@ -390,10 +390,12 @@ class Confirm extends React.PureComponent { }; render() { - const { settings, t, greetingTitle, providers } = this.props; - //console.log("createUser render"); + const { settings, t, greetingTitle, providers } = this.props; + const { email, password } = this.state; + const showCopyLink = !!email.trim() || !!password.trim(); + return !settings ? ( ) : ( @@ -500,6 +502,7 @@ class Confirm extends React.PureComponent { passwordSettings={settings} isDisabled={this.state.isLoading} onKeyDown={this.onKeyPress} + showCopyLink={showCopyLink} />