diff --git a/.gitignore b/.gitignore index db7c15d6bc..f656810b2d 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,4 @@ Data/ Logs/ **/.DS_Store .eslintcache +build/deploy/ \ No newline at end of file diff --git a/.nuget/NuGet.Config b/NuGet.Config similarity index 58% rename from .nuget/NuGet.Config rename to NuGet.Config index 0a5bc81077..9ed27897ad 100644 --- a/.nuget/NuGet.Config +++ b/NuGet.Config @@ -3,12 +3,8 @@ - - - - - + diff --git a/build/Jenkinsfile b/build/Jenkinsfile index 362953d125..bdb003dfac 100644 --- a/build/Jenkinsfile +++ b/build/Jenkinsfile @@ -6,14 +6,14 @@ pipeline { stage('Unix') { agent { label 'net-core' } stages { - stage('Backend') { + stage('Frontend') { steps { sh 'yarn install && yarn build' } } - stage('Frontend') { + stage('Backend') { steps { - sh 'dotnet build ASC.Web.sln --configfile .nuget/NuGet.Config' + sh 'dotnet build ASC.Web.sln' } } } @@ -21,14 +21,14 @@ pipeline { stage('Windows') { agent { label 'win-core' } stages { - stage('Backend') { + stage('Frontend') { steps { bat 'yarn install && yarn build' } } - stage('Frontend') { + stage('Backend') { 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/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 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 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.Core.Common/ASC.Core.Common.csproj b/common/ASC.Core.Common/ASC.Core.Common.csproj index ed43ea291b..ecc54d01ec 100644 --- a/common/ASC.Core.Common/ASC.Core.Common.csproj +++ b/common/ASC.Core.Common/ASC.Core.Common.csproj @@ -60,7 +60,7 @@ - + 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.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.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/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..de9788cc99 100644 --- a/common/services/ASC.Notify/ASC.Notify.csproj +++ b/common/services/ASC.Notify/ASC.Notify.csproj @@ -13,7 +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..4895575a9b 100644 --- a/common/services/ASC.TelegramService/ASC.TelegramService.csproj +++ b/common/services/ASC.TelegramService/ASC.TelegramService.csproj @@ -13,7 +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..111a450cbd 100644 --- a/common/services/ASC.UrlShortener.Svc/ASC.UrlShortener.Svc.csproj +++ b/common/services/ASC.UrlShortener.Svc/ASC.UrlShortener.Svc.csproj @@ -13,7 +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/lerna.json b/lerna.json index db648d19ac..d41f705224 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.1.7", + "version": "0.1.9", "npmClient": "yarn", "packages": [ "packages/asc-web-components", diff --git a/package.json b/package.json index e7f03f254d..74f9b645fd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "appserver", "private": true, + "version": "0.1.9", "workspaces": [ "packages/asc-web-components", "packages/asc-web-common", @@ -16,14 +17,16 @@ ], "scripts": { "wipe": "rimraf node_modules yarn.lock web/**/node_modules products/**/node_modules", - "build": "yarn workspaces run build", + "build": "concurrently \"wsrun --parallel build\"", "start": "concurrently \"wsrun --parallel start\"", "start-prod": "concurrently \"wsrun --parallel start-prod\"", "serve": "concurrently \"wsrun --parallel serve\"", "test": "yarn workspace @appserver/components test", "clean": "concurrently \"wsrun --parallel clean\"", "storybook": "yarn workspace @appserver/components storybook", - "storybook-build": "yarn workspace @appserver/components run storybook-build" + "storybook-build": "yarn workspace @appserver/components run storybook-build", + "bump": "lerna version --no-push --no-git-tag-version", + "deploy": "rimraf build/deploy && concurrently \"wsrun --parallel deploy\"" }, "devDependencies": { "lerna": "^3.22.1", diff --git a/packages/asc-web-common/api/files/index.js b/packages/asc-web-common/api/files/index.js index 2101c93d8e..e1b418fb87 100644 --- a/packages/asc-web-common/api/files/index.js +++ b/packages/asc-web-common/api/files/index.js @@ -12,7 +12,7 @@ export function openEdit(fileId, version, doc) { } if (doc) { - params.push(`version=${version}`); + params.push(`doc=${doc}`); } const paramsString = params.length > 0 ? `?${params.join("&")}` : ""; @@ -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", 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); diff --git a/packages/asc-web-common/components/MediaViewer/MediaViewer.js b/packages/asc-web-common/components/MediaViewer/MediaViewer.js index 4e69988480..84bf7582c5 100644 --- a/packages/asc-web-common/components/MediaViewer/MediaViewer.js +++ b/packages/asc-web-common/components/MediaViewer/MediaViewer.js @@ -15,7 +15,7 @@ import CrossIcon from "../../../../public/images/cross.react.svg"; import commonIconsStyles from "@appserver/components/utils/common-icons-style"; const StyledVideoViewer = styled(VideoViewer)` - z-index: 4001; + z-index: 301; `; const mediaTypes = Object.freeze({ audio: 1, @@ -181,12 +181,14 @@ class MediaViewer extends React.Component { } componentWillUnmount() { - this.hammer.off("swipeleft", this.nextMedia); - this.hammer.off("swiperight", this.prevMedia); - this.hammer.off("pinchout", this.prevMedia); - this.hammer.off("pinchin", this.prevMedia); - this.hammer.off("pinchend", this.prevMedia); - this.hammer.off("doubletap", this.prevMedia); + if (this.hammer) { + this.hammer.off("swipeleft", this.nextMedia); + this.hammer.off("swiperight", this.prevMedia); + this.hammer.off("pinchout", this.prevMedia); + this.hammer.off("pinchin", this.prevMedia); + this.hammer.off("pinchend", this.prevMedia); + this.hammer.off("doubletap", this.prevMedia); + } document.removeEventListener("keydown", this.onKeydown, false); document.removeEventListener("keyup", this.onKeyup, false); } diff --git a/packages/asc-web-common/components/MediaViewer/StyledMediaViewer.js b/packages/asc-web-common/components/MediaViewer/StyledMediaViewer.js index ded054cb93..2b382de77d 100644 --- a/packages/asc-web-common/components/MediaViewer/StyledMediaViewer.js +++ b/packages/asc-web-common/components/MediaViewer/StyledMediaViewer.js @@ -6,7 +6,7 @@ const StyledMediaViewer = styled.div` overflow: hidden; .videoViewerOverlay { position: fixed; - z-index: 4000; + z-index: 300; top: 0; left: 0; width: 100%; @@ -15,7 +15,7 @@ const StyledMediaViewer = styled.div` opacity: 0.5; } .mediaViewerToolbox { - z-index: 4001; + z-index: 301; padding-top: 14px; padding-bottom: 14px; height: 20px; @@ -31,7 +31,7 @@ const StyledMediaViewer = styled.div` right: 0; bottom: 5px; margin-right: 10px; - z-index: 4005; + z-index: 305; } .deleteBtnContainer, .downloadBtnContainer { @@ -41,7 +41,7 @@ const StyledMediaViewer = styled.div` line-height: 19px; } .details { - z-index: 4002; + z-index: 302; padding-top: 14px; padding-bottom: 14px; height: 20px; diff --git a/packages/asc-web-common/components/MediaViewer/sub-components/image-viewer.js b/packages/asc-web-common/components/MediaViewer/sub-components/image-viewer.js index 3c5d013e09..0a17b850e0 100644 --- a/packages/asc-web-common/components/MediaViewer/sub-components/image-viewer.js +++ b/packages/asc-web-common/components/MediaViewer/sub-components/image-viewer.js @@ -38,11 +38,11 @@ const StyledMediaDownloadIcon = styled(MediaDownloadIcon)` const StyledViewer = styled(Viewer)` .react-viewer-footer { bottom: 5px !important; - z-index: 4001 !important; + z-index: 301 !important; overflow: visible; } .react-viewer-canvas { - z-index: 4000 !important; + z-index: 300 !important; margin-top: 50px; } .react-viewer-navbar, diff --git a/packages/asc-web-common/components/MediaViewer/sub-components/scroll-button.js b/packages/asc-web-common/components/MediaViewer/sub-components/scroll-button.js index ada8c8a1e7..03f34beec8 100644 --- a/packages/asc-web-common/components/MediaViewer/sub-components/scroll-button.js +++ b/packages/asc-web-common/components/MediaViewer/sub-components/scroll-button.js @@ -4,7 +4,7 @@ import styled from "styled-components"; const ScrollButton = styled.div` cursor: ${(props) => (props.inactive ? "default" : "pointer")}; opacity: ${(props) => (props.inactive ? "0.2" : "1")}; - z-index: 4005; + z-index: 305; position: fixed; top: calc(50% - 20px); diff --git a/packages/asc-web-common/components/MediaViewer/sub-components/video-viewer.js b/packages/asc-web-common/components/MediaViewer/sub-components/video-viewer.js index 1346ec3c21..57f8cfb84b 100644 --- a/packages/asc-web-common/components/MediaViewer/sub-components/video-viewer.js +++ b/packages/asc-web-common/components/MediaViewer/sub-components/video-viewer.js @@ -19,7 +19,7 @@ const StyledControls = styled.div` height: ${(props) => props.height}px; display: block; position: fixed; - z-index: 4001; + z-index: 301; ${(props) => !props.isVideo && "background-color: rgba(11,11,11,0.7);"} top: calc(50% + ${(props) => props.top}px); left: ${(props) => props.left}px; @@ -174,13 +174,13 @@ const StyledVideoViewer = styled.div` height: ${(props) => props.height}px; left: ${(props) => props.left}px; top: calc(50% - ${(props) => props.top / 2}px); - z-index: 4001; + z-index: 301; position: fixed; padding-bottom: 40px; background-color: rgba(11, 11, 11, 0.7); video { - z-index: 4000; + z-index: 300; } } `; 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/constants/index.js b/packages/asc-web-common/constants/index.js index 93ecabe500..420d17124e 100644 --- a/packages/asc-web-common/constants/index.js +++ b/packages/asc-web-common/constants/index.js @@ -163,3 +163,27 @@ 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, +}); + +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/packages/asc-web-common/package.json b/packages/asc-web-common/package.json index 173afdb3b9..ec49558fcc 100644 --- a/packages/asc-web-common/package.json +++ b/packages/asc-web-common/package.json @@ -1,12 +1,13 @@ { "name": "@appserver/common", - "version": "0.0.2", + "version": "0.1.9", "private": true, "scripts": { "build": "echo 'skip it'", "start": "echo 'skip it'", "start-prod": "echo 'skip it'", - "clean": "echo 'skip it'" + "clean": "echo 'skip it'", + "deploy": "echo 'skip it'" }, "api": { "url": "/api/2.0", diff --git a/packages/asc-web-common/store/AuthStore.js b/packages/asc-web-common/store/AuthStore.js index 2058645f7c..56334a47bf 100644 --- a/packages/asc-web-common/store/AuthStore.js +++ b/packages/asc-web-common/store/AuthStore.js @@ -8,7 +8,7 @@ import UserStore from "./UserStore"; import { logout as logoutDesktop, desktopConstants } from "../desktop"; import { combineUrl, isAdmin } from "../utils"; import isEmpty from "lodash/isEmpty"; -import { AppServerConfig } from "../constants"; +import { AppServerConfig, LANGUAGE } from "../constants"; const { proxyURL } = AppServerConfig; class AuthStore { @@ -43,7 +43,14 @@ class AuthStore { return Promise.all(requests); }; - + setLanguage() { + if (this.userStore.user.cultureName) { + localStorage.getItem(LANGUAGE) !== this.userStore.user.cultureName && + localStorage.setItem(LANGUAGE, this.userStore.user.cultureName); + } else { + localStorage.setItem(LANGUAGE, this.settingsStore.culture || "en-US"); + } + } get isLoaded() { let success = false; if (this.isAuthenticated) { @@ -51,6 +58,8 @@ class AuthStore { this.userStore.isLoaded && this.moduleStore.isLoaded && this.settingsStore.isLoaded; + + success && this.setLanguage(); } else { success = this.settingsStore.isLoaded; } 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/packages/asc-web-common/store/UserStore.js b/packages/asc-web-common/store/UserStore.js index 1749587346..0cfa3edc5f 100644 --- a/packages/asc-web-common/store/UserStore.js +++ b/packages/asc-web-common/store/UserStore.js @@ -1,6 +1,5 @@ import { action, makeObservable, observable } from "mobx"; import api from "../api"; -import { LANGUAGE } from "../constants"; class UserStore { user = null; @@ -21,9 +20,7 @@ class UserStore { getCurrentUser = async () => { const user = await api.people.getUser(); - user.cultureName && - localStorage.getItem(LANGUAGE) !== user.cultureName && - localStorage.setItem(LANGUAGE, user.cultureName); + this.setUser(user); }; diff --git a/packages/asc-web-common/utils/index.js b/packages/asc-web-common/utils/index.js index 72c5265702..c29a7bda6a 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; @@ -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; @@ -213,3 +198,29 @@ export function clickBackdrop() { elms[0].click(); } } + +export 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("&")}` : ""; +} + +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/packages/asc-web-components/checkbox/styled-checkbox.js b/packages/asc-web-components/checkbox/styled-checkbox.js index 1829d70bb4..7214d065e5 100644 --- a/packages/asc-web-components/checkbox/styled-checkbox.js +++ b/packages/asc-web-components/checkbox/styled-checkbox.js @@ -15,6 +15,7 @@ const StyledLabel = styled.label` .checkbox { margin-right: 12px; + overflow: visible; } /* ${(props) => diff --git a/packages/asc-web-components/modal-dialog/index.js b/packages/asc-web-components/modal-dialog/index.js index 7e7bbfa8fa..e877714dda 100644 --- a/packages/asc-web-components/modal-dialog/index.js +++ b/packages/asc-web-components/modal-dialog/index.js @@ -14,6 +14,8 @@ import { Dialog, BodyBox, } from "./styled-modal-dialog"; +import Portal from "../portal"; + function Header() { return null; } @@ -127,62 +129,72 @@ class ModalDialog extends React.Component { } }); - return this.state.displayType === "modal" ? ( - - - - - - {header ? header.props.children : null} - - - - - {body ? body.props.children : null} - - {footer ? footer.props.children : null} - - - - ) : ( - + const renderModal = () => { + return this.state.displayType === "modal" ? ( - - - ); + + + + + {header ? header.props.children : null} + + + + + {body ? body.props.children : null} + + {footer ? footer.props.children : null} + + + + ) : ( + + + + + ); + }; + + const modalDialog = renderModal(); + + return ; } } diff --git a/packages/asc-web-components/package.json b/packages/asc-web-components/package.json index 7c62ba355d..c6592ea973 100644 --- a/packages/asc-web-components/package.json +++ b/packages/asc-web-components/package.json @@ -1,6 +1,6 @@ { "name": "@appserver/components", - "version": "0.0.2", + "version": "0.1.9", "private": true, "scripts": { "build": "echo 'skip it'", @@ -12,7 +12,8 @@ "storybook": "start-storybook -p 8082 -s public", "storybook-build": "build-storybook", "storybook-serve": "serve storybook-static -p 8082", - "clean": "echo 'skip it'" + "clean": "echo 'skip it'", + "deploy": "echo 'skip it'" }, "devDependencies": { "@babel/cli": "^7.12.10", @@ -69,8 +70,7 @@ "email-addresses": "^3.1.0", "fast-deep-equal": "^3.1.3", "html-to-react": "^1.4.5", - "lodash": "4.17.19", - "lodash-es": "4.17.15", + "lodash": "4.17.21", "moment": "^2.29.1", "prop-types": "^15.7.2", "punycode": "^2.1.1", 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/products/ASC.CRM/Client/package.json b/products/ASC.CRM/Client/package.json index e4955d13a9..58825e6f10 100644 --- a/products/ASC.CRM/Client/package.json +++ b/products/ASC.CRM/Client/package.json @@ -1,7 +1,6 @@ { "name": "@appserver/crm", - "version": "0.1.7", - "private": "true", + "version": "0.1.9", "homepage": "/products/crm", "title": "ONLYOFFICE", "id": "6743007c-6f95-4d20-8c88-a8601ce5e76d", @@ -9,8 +8,9 @@ "start": "webpack-cli serve", "start-prod": "webpack --mode production && serve dist -p 5014", "build": "webpack --mode production", + "deploy": "mkdirp ../../../build/deploy/products/ASC.CRM/client && cp -r -u dist/* ../../../build/deploy/products/ASC.CRM/client", "serve": "serve dist -p 5014", - "clean": "rm -rf dist" + "clean": "rimraf dist" }, "devDependencies": { "@babel/core": "^7.12.10", @@ -26,9 +26,12 @@ "css-loader": "^3.6.0", "html-webpack-plugin": "4.5.0", "json-loader": "^0.5.7", + "mkdirp": "^1.0.4", + "rimraf": "^3.0.2", "serve": "11.3.2", "source-map-loader": "^1.1.2", "style-loader": "1.2.1", + "terser-webpack-plugin": "^5.1.1", "webpack": "5.14.0", "webpack-cli": "4.5.0", "webpack-dev-server": "3.11.2", @@ -38,14 +41,14 @@ "@babel/runtime": "^7.12.5", "attr-accept": "^2.2.2", "axios": "^0.21.0", + "copy-to-clipboard": "^3.2.0", "email-addresses": "^3.1.0", + "fast-deep-equal": "^3.1.3", "i18next": "^19.8.4", "i18next-http-backend": "^1.1.0", "mobx": "^6.1.1", "mobx-react": "^7.1.0", "moment": "^2.29.1", - "copy-to-clipboard": "^3.2.0", - "fast-deep-equal": "^3.1.3", "prop-types": "^15.7.2", "rc-tree": "^2.1.4", "re-resizable": "^6.9.0", @@ -56,8 +59,8 @@ "react-device-detect": "^1.14.0", "react-dom": "^17.0.1", "react-dropzone": "^11.2.4", - "react-i18next": "^11.7.3", "react-hammerjs": "^1.0.1", + "react-i18next": "^11.7.3", "react-onclickoutside": "^6.9.0", "react-player": "^1.15.3", "react-resize-detector": "^5.2.0", @@ -75,8 +78,8 @@ "resize-image": "^0.1.0", "sass": "^1.29.0", "sass-loader": "^10.1.0", - "sjcl": "^1.0.8", "screenfull": "^5.1.0", + "sjcl": "^1.0.8", "styled-components": "^5.2.1", "workbox-window": "^6.1.1" } 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.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.Calendar/Client/package.json b/products/ASC.Calendar/Client/package.json index f9749b4b3f..24469917e3 100644 --- a/products/ASC.Calendar/Client/package.json +++ b/products/ASC.Calendar/Client/package.json @@ -1,7 +1,6 @@ { "name": "@appserver/calendar", - "version": "0.1.3", - "private": "true", + "version": "0.1.9", "homepage": "/products/calendar", "id": "32d24cb5-7ece-4606-9c94-19216ba42086", "title": "ONLYOFFICE", @@ -9,8 +8,9 @@ "start": "webpack-cli serve", "start-prod": "webpack --mode production && serve dist -p 5017", "build": "webpack --mode production", + "deploy": "mkdirp ../../../build/deploy/products/ASC.Calendar/client && cp -r -u dist/* ../../../build/deploy/products/ASC.Calendar/client", "serve": "serve dist -p 5017", - "clean": "rm -rf dist" + "clean": "rimraf dist" }, "devDependencies": { "@babel/core": "^7.12.10", @@ -26,9 +26,12 @@ "css-loader": "^3.6.0", "html-webpack-plugin": "4.5.0", "json-loader": "^0.5.7", + "mkdirp": "^1.0.4", + "rimraf": "^3.0.2", "serve": "11.3.2", "source-map-loader": "^1.1.2", "style-loader": "1.2.1", + "terser-webpack-plugin": "^5.1.1", "webpack": "5.14.0", "webpack-cli": "4.5.0", "webpack-dev-server": "3.11.2", @@ -38,14 +41,14 @@ "@babel/runtime": "^7.12.5", "attr-accept": "^2.2.2", "axios": "^0.21.0", + "copy-to-clipboard": "^3.2.0", "email-addresses": "^3.1.0", + "fast-deep-equal": "^3.1.3", "i18next": "^19.8.4", "i18next-http-backend": "^1.1.0", "mobx": "^6.1.1", "mobx-react": "^7.1.0", "moment": "^2.29.1", - "copy-to-clipboard": "^3.2.0", - "fast-deep-equal": "^3.1.3", "prop-types": "^15.7.2", "rc-tree": "^2.1.4", "re-resizable": "^6.9.0", @@ -56,8 +59,8 @@ "react-device-detect": "^1.14.0", "react-dom": "^17.0.1", "react-dropzone": "^11.2.4", - "react-i18next": "^11.7.3", "react-hammerjs": "^1.0.1", + "react-i18next": "^11.7.3", "react-onclickoutside": "^6.9.0", "react-player": "^1.15.3", "react-resize-detector": "^5.2.0", @@ -75,8 +78,8 @@ "resize-image": "^0.1.0", "sass": "^1.29.0", "sass-loader": "^10.1.0", - "sjcl": "^1.0.8", "screenfull": "^5.1.0", + "sjcl": "^1.0.8", "styled-components": "^5.2.1", "workbox-window": "^6.1.1" } 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.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.Files/Client/package.json b/products/ASC.Files/Client/package.json index 4760ef355e..7a57fe8518 100644 --- a/products/ASC.Files/Client/package.json +++ b/products/ASC.Files/Client/package.json @@ -1,7 +1,6 @@ { "name": "@appserver/files", - "version": "0.1.7", - "private": "true", + "version": "0.1.9", "homepage": "/products/files", "id": "e67be73d-f9ae-4ce1-8fec-1880cb518cb4", "title": "ONLYOFFICE", @@ -9,8 +8,9 @@ "start": "webpack-cli serve", "start-prod": "webpack --mode production && serve dist -p 5008", "build": "webpack --mode production", + "deploy": "mkdirp ../../../build/deploy/products/ASC.Files/client && cp -r -u dist/* ../../../build/deploy/products/ASC.Files/client", "serve": "serve dist -p 5008", - "clean": "rm -rf dist" + "clean": "rimraf dist" }, "devDependencies": { "@babel/core": "^7.12.10", @@ -28,11 +28,14 @@ "interpolate-html-plugin": "^4.0.0", "json-loader": "^0.5.7", "mini-css-extract-plugin": "^1.3.9", + "mkdirp": "^1.0.4", + "rimraf": "^3.0.2", "sass": "^1.29.0", "sass-loader": "^10.1.0", "serve": "11.3.2", "source-map-loader": "^1.1.2", "style-loader": "1.2.1", + "terser-webpack-plugin": "^5.1.1", "webpack": "5.14.0", "webpack-cli": "4.5.0", "webpack-dev-server": "3.11.2", diff --git a/products/ASC.Files/Client/src/HOCs/withContextOptions.js b/products/ASC.Files/Client/src/HOCs/withContextOptions.js index 8ec66f6c33..84ac08f246 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( @@ -151,11 +151,8 @@ export default function withContextOptions(WrappedComponent) { item, setRemoveItem, setDeleteThirdPartyDialogVisible, - confirmDelete, - setDeleteDialogVisible, t, - deleteFileAction, - deleteFolderAction, + deleteItemAction, isThirdPartyFolder, } = this.props; const { id, title, fileExst, contentLength, folderId, parentId } = item; @@ -167,21 +164,13 @@ export default function withContextOptions(WrappedComponent) { return; } - if (confirmDelete) { - setDeleteDialogVisible(true); - } else { - const translations = { - deleteOperation: t("DeleteOperation"), - }; + const translations = { + deleteOperation: t("DeleteOperation"), + successRemoveFile: t("FileRemoved"), + successRemoveFolder: t("FolderRemoved"), + }; - fileExst || contentLength - ? deleteFileAction(id, folderId, translations) - .then(() => toastr.success(t("FileRemoved"))) - .catch((err) => toastr.error(err)) - : deleteFolderAction(id, parentId, translations) - .then(() => toastr.success(t("FolderRemoved"))) - .catch((err) => toastr.error(err)); - } + deleteItemAction(id, folderId, translations, fileExst || contentLength); }; onClickShare = () => { @@ -426,7 +415,6 @@ export default function withContextOptions(WrappedComponent) { auth, versionHistoryStore, mediaViewerDataStore, - settingsStore, selectedFolderStore, dialogsStore, treeFoldersStore, @@ -442,9 +430,8 @@ export default function withContextOptions(WrappedComponent) { downloadAction, duplicateAction, setThirdpartyInfo, - deleteFileAction, - deleteFolderAction, onSelectItem, + deleteItemAction, } = filesActionsStore; const { setChangeOwnerPanelVisible, @@ -453,7 +440,6 @@ export default function withContextOptions(WrappedComponent) { setDownloadDialogVisible, setRemoveItem, setDeleteThirdPartyDialogVisible, - setDeleteDialogVisible, setSharingPanelVisible, } = dialogsStore; const { isTabletView } = auth.settingsStore; @@ -486,10 +472,7 @@ export default function withContextOptions(WrappedComponent) { setMediaViewerData, setRemoveItem, setDeleteThirdPartyDialogVisible, - confirmDelete: settingsStore.confirmDelete, - setDeleteDialogVisible, - deleteFileAction, - deleteFolderAction, + deleteItemAction, isThirdPartyFolder, onSelectItem, setSharingPanelVisible, 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 ( diff --git a/products/ASC.Files/Client/src/components/Article/Body/TreeSettings.js b/products/ASC.Files/Client/src/components/Article/Body/TreeSettings.js index 2db7a2dbcf..8a0125a8dd 100644 --- a/products/ASC.Files/Client/src/components/Article/Body/TreeSettings.js +++ b/products/ASC.Files/Client/src/components/Article/Body/TreeSettings.js @@ -81,6 +81,7 @@ const PureTreeSettings = ({ history, setIsLoading, t, + isVisitor, }) => { const { setting } = match.params; @@ -168,7 +169,7 @@ const PureTreeSettings = ({ title={t("TreeSettingsAdminSettings")} /> ) : null} - {enableThirdParty ? ( + {enableThirdParty && !isVisitor ? ( - {enableThirdParty && } + {enableThirdParty && !isVisitor && } ); } @@ -107,6 +108,7 @@ class ArticleBodyContent extends React.Component { export default inject( ({ + auth, filesStore, treeFoldersStore, selectedFolderStore, @@ -115,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; @@ -129,6 +135,7 @@ export default inject( selectedTreeNode, filter, enableThirdParty: settingsStore.enableThirdParty, + isVisitor: auth.userStore.user.isVisitor, setIsLoading, fetchFiles, diff --git a/products/ASC.Files/Client/src/components/Badges.js b/products/ASC.Files/Client/src/components/Badges.js index 6e18e4ea52..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 && ( @@ -48,7 +52,7 @@ const Badges = ({ hoverColor="#3B72A7" /> )} - {locked && ( + {locked && accessToEdit && ( )} - {fileStatus === 32 && !isTrashFolder && ( + {(isFavorite || isNewWithFav) && !isTrashFolder && ( )} - {fileStatus === 1 && ( + {isEditing && ( )} {versionGroup > 1 && ( @@ -85,7 +89,7 @@ const Badges = ({ data-id={id} /> )} - {showNew && ( + {(showNew || isNewWithFav) && ( { const file = items[0].title; return ( - - - {t("ConflictResolveTitle")} - - - {singleFile - ? t("ConflictResolveDescription", { file, folder: folderTitle }) - : t("ConflictResolveDescriptionFiles", { - filesCount, - folder: folderTitle, - })} - - - {t("ConflictResolveSelectAction")} - - - - -
- - + + + +
+
+
); } diff --git a/products/ASC.Files/Client/src/components/dialogs/DeleteDialog/index.js b/products/ASC.Files/Client/src/components/dialogs/DeleteDialog/index.js index 9a507b6182..5d3ba9f123 100644 --- a/products/ASC.Files/Client/src/components/dialogs/DeleteDialog/index.js +++ b/products/ASC.Files/Client/src/components/dialogs/DeleteDialog/index.js @@ -77,7 +77,10 @@ class DeleteDialogComponent extends React.Component { } }; - onClose = () => this.props.setDeleteDialogVisible(false); + onClose = () => { + this.props.setRemoveMediaItem(null); + this.props.setDeleteDialogVisible(false); + }; render() { const { visible, t, isLoading } = this.props; @@ -112,69 +115,67 @@ class DeleteDialogComponent extends React.Component { const height = filesHeight + foldersHeight; return ( - - - {title} - -
- {noteText} - - {foldersList.length > 0 && ( - - {t("FoldersModule")}: - - )} - {foldersList.map((item, index) => ( - - ))} + + {title} + +
+ {noteText} + + {foldersList.length > 0 && ( + + {t("FoldersModule")}: + + )} + {foldersList.map((item, index) => ( + + ))} - {filesList.length > 0 && ( - - {t("FilesModule")}: - - )} - {filesList.map((item, index) => ( - - ))} - -
-
- -
+
+ +