Merge branch 'develop' into feature/thirdparty_for_two_frameworks
This commit is contained in:
commit
65684c8d00
14
ASC.Web.sln
14
ASC.Web.sln
@ -79,7 +79,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Data.Encryption", "comm
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Projects", "products\ASC.Projects\Server\ASC.Projects.csproj", "{D1A33923-5680-4B86-A7DA-41E78350D997}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ASC.CRM", "products\ASC.CRM\Server\ASC.CRM.csproj", "{277F4A2C-07CC-4BC5-B4F3-9695BB2DFFB9}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.CRM", "products\ASC.CRM\Server\ASC.CRM.csproj", "{277F4A2C-07CC-4BC5-B4F3-9695BB2DFFB9}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Mail", "products\ASC.Mail\Server\ASC.Mail.csproj", "{137CA67B-D0F5-4746-B8BC-1888D2859B90}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Calendar", "products\ASC.Calendar\Server\ASC.Calendar.csproj", "{F39933F8-7598-492F-9DD3-E25780D68288}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -227,6 +231,14 @@ Global
|
||||
{277F4A2C-07CC-4BC5-B4F3-9695BB2DFFB9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{277F4A2C-07CC-4BC5-B4F3-9695BB2DFFB9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{277F4A2C-07CC-4BC5-B4F3-9695BB2DFFB9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{137CA67B-D0F5-4746-B8BC-1888D2859B90}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{137CA67B-D0F5-4746-B8BC-1888D2859B90}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{137CA67B-D0F5-4746-B8BC-1888D2859B90}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{137CA67B-D0F5-4746-B8BC-1888D2859B90}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{F39933F8-7598-492F-9DD3-E25780D68288}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{F39933F8-7598-492F-9DD3-E25780D68288}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F39933F8-7598-492F-9DD3-E25780D68288}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F39933F8-7598-492F-9DD3-E25780D68288}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -60,6 +60,8 @@ servers_products_name_backend=(ASC.CRM)
|
||||
servers_products_name_backend+=(ASC.Files)
|
||||
servers_products_name_backend+=(ASC.People)
|
||||
servers_products_name_backend+=(ASC.Projects)
|
||||
servers_products_name_backend+=(ASC.Calendar)
|
||||
servers_products_name_backend+=(ASC.Mail)
|
||||
|
||||
# Publish server backend products
|
||||
for i in ${!servers_products_name_backend[@]}; do
|
||||
|
@ -47,10 +47,12 @@
|
||||
# service host #
|
||||
API_SYSTEM_HOST=${CONTAINER_PREFIX}api-system
|
||||
BACKUP_HOST=${CONTAINER_PREFIX}backup
|
||||
CALENDAR_HOST=${CONTAINER_PREFIX}calendar
|
||||
CRM_HOST=${CONTAINER_PREFIX}crm
|
||||
STORAGE_ENCRYPTION_HOST=${CONTAINER_PREFIX}storage-encryption
|
||||
FILES_HOST=${CONTAINER_PREFIX}files
|
||||
FILES_SERVICES_HOST=${CONTAINER_PREFIX}files-services
|
||||
MAIL_HOST=${CONTAINER_PREFIX}mail
|
||||
STORAGE_MIGRATION_HOST=${CONTAINER_PREFIX}storage-migration
|
||||
NOTIFY_HOST=${CONTAINER_PREFIX}notify
|
||||
PEOPLE_SERVER_HOST=${CONTAINER_PREFIX}people-server
|
||||
@ -68,9 +70,11 @@
|
||||
SERVICE_API_SYSTEM=${API_SYSTEM_HOST}:${SERVICE_PORT}
|
||||
SERVICE_BACKUP=${BACKUP_HOST}:${SERVICE_PORT}
|
||||
SERVICE_CRM=${CRM_HOST}:${SERVICE_PORT}
|
||||
SERVICE_CALENDAR=${CALENDAR_HOST}:${SERVICE_PORT}
|
||||
SERVICE_STORAGE_ENCRYPTION=${STORAGE_ENCRYPTION_HOST}:${SERVICE_PORT}
|
||||
SERVICE_FILES=${FILES_HOST}:${SERVICE_PORT}
|
||||
SERVICE_FILES_SERVICES=${FILES_SERVICES_HOST}:${SERVICE_PORT}
|
||||
SERVICE_MAIL=${MAIL_HOST}:${SERVICE_PORT}
|
||||
SERVICE_STORAGE_MIGRATION=${STORAGE_MIGRATION_HOST}:${SERVICE_PORT}
|
||||
SERVICE_NOTIFY=${NOTIFY_HOST}:${SERVICE_PORT}
|
||||
SERVICE_PEOPLE_SERVER=${PEOPLE_SERVER_HOST}:${SERVICE_PORT}
|
||||
|
@ -44,12 +44,20 @@ 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"
|
||||
|
||||
COPY config/mysql/conf.d/mysql.cnf /etc/mysql/conf.d/mysql.cnf
|
||||
COPY config/supervisor/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
||||
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/*
|
||||
|
||||
RUN sed -i 's/Server=.*;Port=/Server=127.0.0.1;Port=/' /app/onlyoffice/config/appsettings.test.json
|
||||
|
||||
COPY config/mysql/conf.d/mysql.cnf /etc/mysql/conf.d/mysql.cnf
|
||||
|
||||
RUN rm -rf /var/lib/apt/lists/*
|
||||
|
||||
@ -107,6 +115,8 @@ COPY --from=base ${SRC_PATH}/web/ASC.Web.Login/dist ${BUILD_PATH}/studio/login
|
||||
COPY --from=base ${SRC_PATH}/products/ASC.People/Client/dist ${BUILD_PATH}/products/ASC.People/client
|
||||
COPY --from=base ${SRC_PATH}/products/ASC.Projects/Client/dist ${BUILD_PATH}/products/ASC.Projects/client
|
||||
COPY --from=base ${SRC_PATH}/web/ASC.Web.Client/dist ${BUILD_PATH}/studio/client
|
||||
COPY --from=base ${SRC_PATH}/products/ASC.Calendar/Client/dist ${BUILD_PATH}/products/ASC.Calendar/client
|
||||
COPY --from=base ${SRC_PATH}/products/ASC.Mail/Client/dist ${BUILD_PATH}/products/ASC.Mail/client
|
||||
|
||||
COPY /config/nginx/templates/upstream.conf.template /etc/nginx/templates/upstream.conf.template
|
||||
|
||||
@ -122,6 +132,8 @@ RUN chown nginx:nginx /etc/nginx/* -R && \
|
||||
sed -i 's/localhost:5020/$service_projects_server/' /etc/nginx/conf.d/onlyoffice.conf && \
|
||||
sed -i 's/localhost:5000/$service_api/' /etc/nginx/conf.d/onlyoffice.conf && \
|
||||
sed -i 's/localhost:5003/$service_studio/' /etc/nginx/conf.d/onlyoffice.conf && \
|
||||
sed -i 's/localhost:5023/$service_calendar/' /etc/nginx/conf.d/onlyoffice.conf && \
|
||||
sed -i 's/localhost:5022/$service_mail/' /etc/nginx/conf.d/onlyoffice.conf && \
|
||||
sed -i 's/localhost:9999/$service_urlshortener/' /etc/nginx/conf.d/onlyoffice.conf && \
|
||||
sed -i 's/172.*/$document_server;/' /etc/nginx/conf.d/onlyoffice.conf && \
|
||||
# configute the image nginx whith less privileged https://hub.docker.com/_/nginx
|
||||
@ -146,6 +158,15 @@ COPY --from=base --chown=onlyoffice:onlyoffice ${BUILD_PATH}/services/ASC.Data.B
|
||||
|
||||
CMD ["ASC.Data.Backup.dll", "ASC.Data.Backup", "core:products:folder=/var/www/products/", "core:products:subfolder=server"]
|
||||
|
||||
## ASC.Calendar ##
|
||||
FROM builder AS calendar
|
||||
WORKDIR ${BUILD_PATH}/products/ASC.Calendar/server/
|
||||
|
||||
COPY --chown=onlyoffice:onlyoffice docker-entrypoint.sh .
|
||||
COPY --from=base --chown=onlyoffice:onlyoffice ${BUILD_PATH}/products/ASC.Calendar/server/ .
|
||||
|
||||
CMD ["ASC.Calendar.dll", "ASC.Calendar"]
|
||||
|
||||
## ASC.CRM ##
|
||||
FROM builder AS crm
|
||||
WORKDIR ${BUILD_PATH}/products/ASC.CRM/server/
|
||||
@ -182,6 +203,15 @@ COPY --from=base --chown=onlyoffice:onlyoffice ${BUILD_PATH}/services/ASC.Files.
|
||||
|
||||
CMD ["ASC.Files.Service.dll", "ASC.Files.Service", "core:products:folder=/var/www/products/", "core:products:subfolder=server"]
|
||||
|
||||
## ASC.Mail ##
|
||||
FROM builder AS mail
|
||||
WORKDIR ${BUILD_PATH}/products/ASC.Mail/server/
|
||||
|
||||
COPY --chown=onlyoffice:onlyoffice docker-entrypoint.sh .
|
||||
COPY --from=base --chown=onlyoffice:onlyoffice ${BUILD_PATH}/products/ASC.Mail/server/ .
|
||||
|
||||
CMD ["ASC.Mail.dll", "ASC.Mail"]
|
||||
|
||||
## ASC.Data.Storage.Migration ##
|
||||
FROM builder AS data_storage_migration
|
||||
WORKDIR ${BUILD_PATH}/services/storage.migration/service/
|
||||
|
@ -29,6 +29,9 @@ x-service:
|
||||
- people_data:/var/www/products/ASC.People/server/
|
||||
- crm_data:/var/www/products/ASC.CRM/server/
|
||||
- project_data:/var/www/products/ASC.Projects/server/
|
||||
- calendar_data:/var/www/products/ASC.Calendar/server/
|
||||
- mail_data:/var/www/products/ASC.Mail/server/
|
||||
|
||||
|
||||
services:
|
||||
onlyoffice-elasticsearch:
|
||||
@ -95,6 +98,11 @@ services:
|
||||
image: "${REPO}/${STATUS}appserver-backup:${SRV_VERSION}"
|
||||
container_name: ${BACKUP_HOST}
|
||||
|
||||
onlyoffice-calendar:
|
||||
<<: *x-service-base
|
||||
image: "${REPO}/${STATUS}appserver-calendar:${SRV_VERSION}"
|
||||
container_name: ${CALENDAR_HOST}
|
||||
|
||||
onlyoffice-crm:
|
||||
<<: *x-service-base
|
||||
image: "${REPO}/${STATUS}appserver-crm:${SRV_VERSION}"
|
||||
@ -115,6 +123,11 @@ services:
|
||||
image: "${REPO}/${STATUS}appserver-files-services:${SRV_VERSION}"
|
||||
container_name: ${FILES_SERVICES_HOST}
|
||||
|
||||
onlyoffice-mail:
|
||||
<<: *x-service-base
|
||||
image: "${REPO}/${STATUS}appserver-mail:${SRV_VERSION}"
|
||||
container_name: ${MAIL_HOST}
|
||||
|
||||
onlyoffice-storage-migration:
|
||||
<<: *x-service-base
|
||||
image: "${REPO}/${STATUS}appserver-storage-migration:${SRV_VERSION}"
|
||||
@ -187,10 +200,12 @@ services:
|
||||
depends_on:
|
||||
- onlyoffice-api-system
|
||||
- onlyoffice-backup
|
||||
- onlyoffice-calendar
|
||||
- onlyoffice-crm
|
||||
- onlyoffice-storage-encryption
|
||||
- onlyoffice-files
|
||||
- onlyoffice-files-services
|
||||
- onlyoffice-mail
|
||||
- onlyoffice-storage-migration
|
||||
- onlyoffice-people-server
|
||||
- onlyoffice-projects-server
|
||||
@ -204,10 +219,12 @@ services:
|
||||
environment:
|
||||
- SERVICE_API_SYSTEM=${SERVICE_API_SYSTEM}
|
||||
- SERVICE_BACKUP=${SERVICE_BACKUP}
|
||||
- SERVICE_CALENDAR=${SERVICE_CALENDAR}
|
||||
- SERVICE_CRM=${SERVICE_CRM}
|
||||
- SERVICE_STORAGE_ENCRYPTION=${SERVICE_STORAGE_ENCRYPTION}
|
||||
- SERVICE_FILES=${SERVICE_FILES}
|
||||
- SERVICE_FILES_SERVICES=${SERVICE_FILES_SERVICES}
|
||||
- SERVICE_MAIL=${SERVICE_MAIL}
|
||||
- SERVICE_STORAGE_MIGRATION=${SERVICE_STORAGE_MIGRATION}
|
||||
- SERVICE_NOTIFY=${SERVICE_NOTIFY}
|
||||
- SERVICE_PEOPLE_SERVER=${SERVICE_PEOPLE_SERVER}
|
||||
@ -240,3 +257,5 @@ volumes:
|
||||
people_data:
|
||||
crm_data:
|
||||
project_data:
|
||||
calendar_data:
|
||||
mail_data:
|
||||
|
@ -15,6 +15,13 @@ services:
|
||||
target: backup
|
||||
image: "${REPO}/${STATUS}appserver-backup:${SRV_VERSION}"
|
||||
|
||||
onlyoffice-calendar:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: "${DOCKERFILE}"
|
||||
target: calendar
|
||||
image: "${REPO}/${STATUS}appserver-calendar:${SRV_VERSION}"
|
||||
|
||||
onlyoffice-crm:
|
||||
build:
|
||||
context: ./
|
||||
@ -43,6 +50,13 @@ services:
|
||||
target: files_services
|
||||
image: "${REPO}/${STATUS}appserver-files-services:${SRV_VERSION}"
|
||||
|
||||
onlyoffice-mail:
|
||||
build:
|
||||
context: ./
|
||||
dockerfile: "${DOCKERFILE}"
|
||||
target: mail
|
||||
image: "${REPO}/${STATUS}appserver-mail:${SRV_VERSION}"
|
||||
|
||||
onlyoffice-storage-migration:
|
||||
build:
|
||||
context: ./
|
||||
|
@ -10,6 +10,11 @@ map $SERVICE_BACKUP $service_backup {
|
||||
$SERVICE_BACKUP $SERVICE_BACKUP;
|
||||
}
|
||||
|
||||
map $SERVICE_CALENDAR $service_calendar {
|
||||
volatile;
|
||||
$SERVICE_CALENDAR $SERVICE_CALENDAR;
|
||||
}
|
||||
|
||||
map $SERVICE_CRM $service_crm {
|
||||
volatile;
|
||||
$SERVICE_CRM $SERVICE_CRM;
|
||||
@ -30,6 +35,11 @@ map $SERVICE_FILES_SERVICES $service_files_services {
|
||||
$SERVICE_FILES_SERVICES $SERVICE_FILES_SERVICES;
|
||||
}
|
||||
|
||||
map $SERVICE_MAIL $service_mail {
|
||||
volatile;
|
||||
$SERVICE_MAIL $SERVICE_MAIL;
|
||||
}
|
||||
|
||||
map $SERVICE_STORAGE_MIGRATION $service_storage_migration {
|
||||
volatile;
|
||||
$SERVICE_STORAGE_MIGRATION $SERVICE_STORAGE_MIGRATION;
|
||||
|
@ -29,6 +29,8 @@ x-service:
|
||||
- people_data:/var/www/products/ASC.People/server/
|
||||
- crm_data:/var/www/products/ASC.CRM/server/
|
||||
- project_data:/var/www/products/ASC.Projects/server/
|
||||
- calendar_data:/var/www/products/ASC.Calendar/server/
|
||||
- mail_data:/var/www/products/ASC.Mail/server/
|
||||
|
||||
services:
|
||||
onlyoffice-notify:
|
||||
@ -47,3 +49,5 @@ volumes:
|
||||
people_data:
|
||||
crm_data:
|
||||
project_data:
|
||||
calendar_data:
|
||||
mail_data:
|
||||
|
2
build/run/CalendarClient.bat
Normal file
2
build/run/CalendarClient.bat
Normal file
@ -0,0 +1,2 @@
|
||||
echo "RUN ASC.Web.Calendar"
|
||||
call set BROWSER=none&&npm start --prefix ../../products/ASC.Calendar/Client
|
2
build/run/CalendarServer.bat
Normal file
2
build/run/CalendarServer.bat
Normal file
@ -0,0 +1,2 @@
|
||||
echo "RUN ASC.Calendar"
|
||||
call dotnet run --project ..\..\products\ASC.Calendar\Server\ASC.Calendar.csproj --no-build --$STORAGE_ROOT=..\..\..\Data --log__dir=..\..\..\Logs --log__name=calendar
|
2
build/run/MailClient.bat
Normal file
2
build/run/MailClient.bat
Normal file
@ -0,0 +1,2 @@
|
||||
echo "RUN ASC.Web.Mail"
|
||||
call set BROWSER=none&&npm start --prefix ../../products/ASC.Mail/Client
|
2
build/run/MailServer.bat
Normal file
2
build/run/MailServer.bat
Normal file
@ -0,0 +1,2 @@
|
||||
echo "RUN ASC.Mail"
|
||||
call dotnet run --project ..\..\products\ASC.Mail\Server\ASC.Mail.csproj --no-build --$STORAGE_ROOT=..\..\..\Data --log__dir=..\..\..\Logs --log__name=mail
|
@ -1,10 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<ApplicationIcon />
|
||||
<OutputType>Library</OutputType>
|
||||
<StartupObject />
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
|
@ -42,12 +42,14 @@ namespace ASC.Api.Core
|
||||
private static int MaxCount = 1000;
|
||||
public IHttpContextAccessor HttpContextAccessor { get; set; }
|
||||
public Tenant tenant;
|
||||
public Tenant Tenant { get { return tenant ??= TenantManager.GetCurrentTenant(HttpContextAccessor.HttpContext); } }
|
||||
public Tenant Tenant { get { return tenant ??= TenantManager.GetCurrentTenant(HttpContextAccessor?.HttpContext); } }
|
||||
|
||||
public ApiContext(IHttpContextAccessor httpContextAccessor, SecurityContext securityContext, TenantManager tenantManager)
|
||||
{
|
||||
if (httpContextAccessor == null || httpContextAccessor.HttpContext == null) return;
|
||||
SecurityContext = securityContext;
|
||||
TenantManager = tenantManager;
|
||||
HttpContextAccessor = httpContextAccessor;
|
||||
if (httpContextAccessor.HttpContext == null) return;
|
||||
|
||||
Count = MaxCount;
|
||||
var query = HttpContextAccessor.HttpContext.Request.Query;
|
||||
@ -85,9 +87,6 @@ namespace ASC.Api.Core
|
||||
{
|
||||
UpdatedSince = Convert.ToDateTime(updatedSince);
|
||||
}
|
||||
|
||||
SecurityContext = securityContext;
|
||||
TenantManager = tenantManager;
|
||||
}
|
||||
|
||||
public string[] Fields { get; set; }
|
||||
|
@ -1,27 +0,0 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:65458/",
|
||||
"sslPort": 0
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"ASC.Api.Core": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "http://localhost:65459/"
|
||||
}
|
||||
}
|
||||
}
|
@ -4,6 +4,8 @@ using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Loader;
|
||||
|
||||
using ASC.Common.Utils;
|
||||
|
||||
using Autofac;
|
||||
using Autofac.Configuration;
|
||||
|
||||
@ -82,13 +84,13 @@ namespace ASC.Common.DependencyInjection
|
||||
|
||||
if (!Path.IsPathRooted(folder))
|
||||
{
|
||||
if (currentDir.EndsWith(Path.Combine(Path.GetFileName(folder), Assembly.GetEntryAssembly().GetName().Name, subfolder)))
|
||||
if (currentDir.EndsWith(CrossPlatform.PathCombine(Path.GetFileName(folder), Assembly.GetEntryAssembly().GetName().Name, subfolder)))
|
||||
{
|
||||
productsDir = Path.GetFullPath(Path.Combine("..", ".."));
|
||||
productsDir = Path.GetFullPath(CrossPlatform.PathCombine("..", ".."));
|
||||
}
|
||||
else
|
||||
{
|
||||
productsDir = Path.GetFullPath(Path.Combine(currentDir, folder));
|
||||
productsDir = Path.GetFullPath(CrossPlatform.PathCombine(currentDir, folder));
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -129,8 +131,8 @@ namespace ASC.Common.DependencyInjection
|
||||
|
||||
string GetFullPath(string n)
|
||||
{
|
||||
var productPath = Path.Combine(productsDir, n, subfolder);
|
||||
return GetPath(Path.Combine(productPath, "bin"), n, SearchOption.AllDirectories) ?? GetPath(productPath, n, SearchOption.TopDirectoryOnly);
|
||||
var productPath = CrossPlatform.PathCombine(productsDir, n, subfolder);
|
||||
return GetPath(CrossPlatform.PathCombine(productPath, "bin"), n, SearchOption.AllDirectories) ?? GetPath(productPath, n, SearchOption.TopDirectoryOnly);
|
||||
}
|
||||
|
||||
static string GetPath(string dirPath, string dll, SearchOption searchOption)
|
||||
@ -155,7 +157,7 @@ namespace ASC.Common.DependencyInjection
|
||||
|
||||
public Assembly Resolving(AssemblyLoadContext context, AssemblyName assemblyName)
|
||||
{
|
||||
var path = Path.Combine(Path.GetDirectoryName(ResolvePath), $"{assemblyName.Name}.dll");
|
||||
var path = CrossPlatform.PathCombine(Path.GetDirectoryName(ResolvePath), $"{assemblyName.Name}.dll");
|
||||
|
||||
if (!File.Exists(path)) return null;
|
||||
|
||||
|
@ -384,7 +384,7 @@ namespace ASC.Common.Logging
|
||||
Configuration = configuration;
|
||||
ConfigurationExtension = configurationExtension;
|
||||
|
||||
LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(Path.Combine(Configuration["pathToConf"], "nlog.config"));
|
||||
LogManager.Configuration = new NLog.Config.XmlLoggingConfiguration(CrossPlatform.PathCombine(Configuration["pathToConf"], "nlog.config"));
|
||||
LogManager.ThrowConfigExceptions = false;
|
||||
|
||||
var settings = ConfigurationExtension.GetSetting<NLogSettings>("log");
|
||||
|
@ -29,6 +29,8 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
using ASC.Common.Utils;
|
||||
|
||||
using NLog;
|
||||
using NLog.Common;
|
||||
using NLog.Targets;
|
||||
@ -87,7 +89,7 @@ namespace ASC.Common.Logging
|
||||
return;
|
||||
|
||||
if (!Path.IsPathRooted(dirPath))
|
||||
dirPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, dirPath);
|
||||
dirPath = CrossPlatform.PathCombine(AppDomain.CurrentDomain.BaseDirectory, dirPath);
|
||||
|
||||
var directory = new DirectoryInfo(dirPath);
|
||||
|
||||
|
53
common/ASC.Common/Utils/CrossPlatformUtils.cs
Normal file
53
common/ASC.Common/Utils/CrossPlatformUtils.cs
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System Limited 2010-2018
|
||||
*
|
||||
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
|
||||
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
|
||||
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
|
||||
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
|
||||
*
|
||||
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
|
||||
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
|
||||
* relevant author attributions when distributing the software. If the display of the logo in its graphic
|
||||
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
|
||||
* in every copy of the program you distribute.
|
||||
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
*/
|
||||
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace ASC.Common.Utils
|
||||
{
|
||||
public static class CrossPlatform
|
||||
{
|
||||
public static string PathCombine(string basePath, params string[] additional)
|
||||
{
|
||||
var splits = additional.Select(s => s.Split(pathSplitCharacters)).ToArray();
|
||||
var totalLength = splits.Sum(arr => arr.Length);
|
||||
var segments = new string[totalLength + 1];
|
||||
segments[0] = basePath;
|
||||
var i = 0;
|
||||
foreach (var split in splits)
|
||||
{
|
||||
foreach (var value in split)
|
||||
{
|
||||
i++;
|
||||
segments[i] = value;
|
||||
}
|
||||
}
|
||||
return Path.Combine(segments);
|
||||
}
|
||||
|
||||
static char[] pathSplitCharacters = new char[] { '/', '\\' };
|
||||
}
|
||||
}
|
@ -54,7 +54,8 @@ namespace ASC.Security.Cryptography
|
||||
|
||||
private readonly ILog log;
|
||||
private static readonly DateTime _from = new DateTime(2010, 01, 01, 0, 0, 0, DateTimeKind.Utc);
|
||||
internal readonly TimeSpan ValidInterval;
|
||||
internal readonly TimeSpan ValidEmailKeyInterval;
|
||||
internal readonly TimeSpan ValidAuthKeyInterval;
|
||||
|
||||
private MachinePseudoKeys MachinePseudoKeys { get; }
|
||||
private TenantManager TenantManager { get; }
|
||||
@ -67,8 +68,13 @@ namespace ASC.Security.Cryptography
|
||||
{
|
||||
validInterval = TimeSpan.FromDays(7);
|
||||
}
|
||||
if (!TimeSpan.TryParse(configuration["auth:validinterval"], out var authValidInterval))
|
||||
{
|
||||
validInterval = TimeSpan.FromDays(7);
|
||||
}
|
||||
|
||||
ValidInterval = validInterval;
|
||||
ValidEmailKeyInterval = validInterval;
|
||||
ValidAuthKeyInterval = authValidInterval;
|
||||
log = options.CurrentValue;
|
||||
}
|
||||
|
||||
@ -232,26 +238,31 @@ namespace ASC.Security.Cryptography
|
||||
switch (type)
|
||||
{
|
||||
case ConfirmType.EmpInvite:
|
||||
checkKeyResult = Provider.ValidateEmailKey(email + type + (int)emplType, key, Provider.ValidInterval);
|
||||
break;
|
||||
checkKeyResult = Provider.ValidateEmailKey(email + type + (int)emplType, key, Provider.ValidEmailKeyInterval);
|
||||
break;
|
||||
|
||||
case ConfirmType.LinkInvite:
|
||||
checkKeyResult = Provider.ValidateEmailKey(type.ToString() + (int)emplType, key, Provider.ValidInterval);
|
||||
break;
|
||||
checkKeyResult = Provider.ValidateEmailKey(type.ToString() + (int)emplType, key, Provider.ValidEmailKeyInterval);
|
||||
break;
|
||||
|
||||
case ConfirmType.PortalOwnerChange:
|
||||
checkKeyResult = Provider.ValidateEmailKey(email + type + uiD.HasValue, key, Provider.ValidInterval);
|
||||
break;
|
||||
checkKeyResult = Provider.ValidateEmailKey(email + type + uiD.HasValue, key, Provider.ValidEmailKeyInterval);
|
||||
break;
|
||||
|
||||
case ConfirmType.EmailChange:
|
||||
checkKeyResult = Provider.ValidateEmailKey(email + type + AuthContext.CurrentAccount.ID, key, Provider.ValidInterval);
|
||||
checkKeyResult = Provider.ValidateEmailKey(email + type + AuthContext.CurrentAccount.ID, key, Provider.ValidEmailKeyInterval);
|
||||
break;
|
||||
case ConfirmType.PasswordChange:
|
||||
|
||||
var hash = Authentication.GetUserPasswordStamp(UserManager.GetUserByEmail(email).ID).ToString("s");
|
||||
|
||||
checkKeyResult = Provider.ValidateEmailKey(email + type + hash, key, Provider.ValidInterval);
|
||||
break;
|
||||
checkKeyResult = Provider.ValidateEmailKey(email + type + hash, key, Provider.ValidEmailKeyInterval);
|
||||
break;
|
||||
|
||||
case ConfirmType.Activation:
|
||||
checkKeyResult = Provider.ValidateEmailKey(email + type + uiD, key, Provider.ValidInterval);
|
||||
break;
|
||||
checkKeyResult = Provider.ValidateEmailKey(email + type + uiD, key, Provider.ValidEmailKeyInterval);
|
||||
break;
|
||||
|
||||
case ConfirmType.ProfileRemove:
|
||||
// validate UiD
|
||||
if (p == 1)
|
||||
@ -261,13 +272,22 @@ namespace ASC.Security.Cryptography
|
||||
return ValidationResult.Invalid;
|
||||
}
|
||||
|
||||
checkKeyResult = Provider.ValidateEmailKey(email + type + uiD, key, Provider.ValidInterval);
|
||||
checkKeyResult = Provider.ValidateEmailKey(email + type + uiD, key, Provider.ValidEmailKeyInterval);
|
||||
break;
|
||||
|
||||
case ConfirmType.Wizard:
|
||||
checkKeyResult = Provider.ValidateEmailKey("" + type, key, Provider.ValidInterval);
|
||||
break;
|
||||
checkKeyResult = Provider.ValidateEmailKey("" + type, key, Provider.ValidEmailKeyInterval);
|
||||
break;
|
||||
|
||||
case ConfirmType.PhoneActivation:
|
||||
case ConfirmType.PhoneAuth:
|
||||
case ConfirmType.TfaActivation:
|
||||
case ConfirmType.TfaAuth:
|
||||
checkKeyResult = Provider.ValidateEmailKey(email + type, key, Provider.ValidAuthKeyInterval);
|
||||
break;
|
||||
|
||||
default:
|
||||
checkKeyResult = Provider.ValidateEmailKey(email + type, key, Provider.ValidInterval);
|
||||
checkKeyResult = Provider.ValidateEmailKey(email + type, key, Provider.ValidEmailKeyInterval);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,7 @@ using System.IO;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
using ASC.Common;
|
||||
using ASC.Common.Utils;
|
||||
using ASC.Core.Encryption;
|
||||
|
||||
using Microsoft.Extensions.Configuration;
|
||||
@ -292,12 +293,12 @@ namespace ASC.Data.Encryption
|
||||
{
|
||||
var dir = string.IsNullOrEmpty(TempDir) ? Path.GetDirectoryName(filePath) : TempDir;
|
||||
var name = Path.GetFileNameWithoutExtension(filePath);
|
||||
var result = Path.Combine(dir, string.Format("{0}_{1}{2}", Storage, name, ext));
|
||||
var result = CrossPlatform.PathCombine(dir, string.Format("{0}_{1}{2}", Storage, name, ext));
|
||||
var index = 1;
|
||||
|
||||
while (File.Exists(result))
|
||||
{
|
||||
result = Path.Combine(dir, string.Format("{0}_{1}({2}){3}", Storage, name, index++, ext));
|
||||
result = CrossPlatform.PathCombine(dir, string.Format("{0}_{1}({2}){3}", Storage, name, index++, ext));
|
||||
}
|
||||
|
||||
return result;
|
||||
|
@ -1,10 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<ApplicationIcon />
|
||||
<OutputType>Library</OutputType>
|
||||
<StartupObject />
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
|
@ -1,27 +0,0 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:64832/",
|
||||
"sslPort": 0
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"ASC.Data.Reassigns": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "http://localhost:64833/"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<ApplicationIcon />
|
||||
<OutputType>Library</OutputType>
|
||||
<StartupObject />
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
|
@ -32,6 +32,7 @@ using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
using ASC.Common.Logging;
|
||||
using ASC.Common.Utils;
|
||||
using ASC.Core;
|
||||
using ASC.Data.Storage.Configuration;
|
||||
using ASC.Security.Cryptography;
|
||||
@ -305,7 +306,7 @@ namespace ASC.Data.Storage
|
||||
var filePaths = ListFilesRelative(domain, path, pattern, recursive);
|
||||
return Array.ConvertAll(
|
||||
filePaths,
|
||||
x => GetUri(domain, Path.Combine(PathUtils.Normalize(path), x)));
|
||||
x => GetUri(domain, CrossPlatform.PathCombine(PathUtils.Normalize(path), x)));
|
||||
}
|
||||
|
||||
public bool IsFile(string path)
|
||||
|
@ -30,6 +30,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
using ASC.Common.Logging;
|
||||
using ASC.Common.Utils;
|
||||
using ASC.Data.Storage;
|
||||
|
||||
using Microsoft.Extensions.Options;
|
||||
@ -177,7 +178,7 @@ namespace ASC.Core.ChunkedUploader
|
||||
|
||||
private string GetPathWithId(string id)
|
||||
{
|
||||
return Path.Combine(StoragePath, id + ".session");
|
||||
return CrossPlatform.PathCombine(StoragePath, id + ".session");
|
||||
}
|
||||
}
|
||||
}
|
@ -30,6 +30,7 @@ using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using ASC.Common.Utils;
|
||||
using ASC.Common.Web;
|
||||
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
@ -103,12 +104,12 @@ namespace ASC.Data.Storage.DiscStorage
|
||||
{
|
||||
var pathInfo = GetRouteValue("pathInfo").Replace('/', Path.DirectorySeparatorChar);
|
||||
|
||||
var path = Path.Combine(physPath, pathInfo);
|
||||
var path = CrossPlatform.PathCombine(physPath, pathInfo);
|
||||
|
||||
var tenant = GetRouteValue("0");
|
||||
if (string.IsNullOrEmpty(tenant))
|
||||
{
|
||||
tenant = Path.Combine(GetRouteValue("t1"), GetRouteValue("t2"), GetRouteValue("t3"));
|
||||
tenant = CrossPlatform.PathCombine(GetRouteValue("t1"), GetRouteValue("t2"), GetRouteValue("t3"));
|
||||
}
|
||||
|
||||
path = path.Replace("{0}", tenant);
|
||||
|
@ -31,6 +31,7 @@ using System.Linq;
|
||||
|
||||
using ASC.Common;
|
||||
using ASC.Common.Logging;
|
||||
using ASC.Common.Utils;
|
||||
using ASC.Core;
|
||||
using ASC.Core.Encryption;
|
||||
using ASC.Data.Storage.Configuration;
|
||||
@ -647,7 +648,7 @@ namespace ASC.Data.Storage.DiscStorage
|
||||
// Copy each file into it's new directory.
|
||||
foreach (var fi in source.GetFiles())
|
||||
{
|
||||
var fp = Path.Combine(target.ToString(), fi.Name);
|
||||
var fp = CrossPlatform.PathCombine(target.ToString(), fi.Name);
|
||||
fi.CopyTo(fp, true);
|
||||
var size = Crypt.GetFileSize(fp);
|
||||
QuotaUsedAdd(newdomain, size);
|
||||
@ -698,7 +699,7 @@ namespace ASC.Data.Storage.DiscStorage
|
||||
{
|
||||
var pathMap = GetPath(domain);
|
||||
//Build Dir
|
||||
var target = Path.Combine(pathMap.PhysicalPath, PathUtils.Normalize(path));
|
||||
var target = CrossPlatform.PathCombine(pathMap.PhysicalPath, PathUtils.Normalize(path));
|
||||
ValidatePath(target);
|
||||
return target;
|
||||
}
|
||||
|
@ -25,8 +25,10 @@
|
||||
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
using System.IO;
|
||||
|
||||
using ASC.Common.Utils;
|
||||
|
||||
namespace ASC.Data.Storage.DiscStorage
|
||||
{
|
||||
internal class MappedPath
|
||||
@ -44,7 +46,7 @@ namespace ASC.Data.Storage.DiscStorage
|
||||
tenant = tenant.Trim('/');
|
||||
|
||||
ppath = PathUtils.ResolvePhysicalPath(ppath, storageConfig);
|
||||
PhysicalPath = ppath.IndexOf('{') == -1 && appendTenant ? Path.Combine(ppath, tenant) : string.Format(ppath, tenant);
|
||||
PhysicalPath = ppath.IndexOf('{') == -1 && appendTenant ? CrossPlatform.PathCombine(ppath, tenant) : string.Format(ppath, tenant);
|
||||
}
|
||||
|
||||
public MappedPath AppendDomain(string domain)
|
||||
@ -52,7 +54,7 @@ namespace ASC.Data.Storage.DiscStorage
|
||||
domain = domain.Replace('.', '_'); //Domain prep. Remove dots
|
||||
return new MappedPath(PathUtils)
|
||||
{
|
||||
PhysicalPath = Path.Combine(PhysicalPath, PathUtils.Normalize(domain, true)),
|
||||
PhysicalPath = CrossPlatform.PathCombine(PhysicalPath, PathUtils.Normalize(domain, true)),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
using ASC.Common;
|
||||
using ASC.Common.Utils;
|
||||
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
@ -113,7 +114,7 @@ namespace ASC.Data.Storage
|
||||
|
||||
if (!Path.IsPathRooted(physPath))
|
||||
{
|
||||
physPath = Path.GetFullPath(Path.Combine(HostEnvironment.ContentRootPath, physPath.Trim(Path.DirectorySeparatorChar)));
|
||||
physPath = Path.GetFullPath(CrossPlatform.PathCombine(HostEnvironment.ContentRootPath, physPath.Trim(Path.DirectorySeparatorChar)));
|
||||
}
|
||||
return physPath;
|
||||
}
|
||||
|
@ -1,27 +0,0 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:63105/",
|
||||
"sslPort": 0
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"ASC.Data.Storage": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "http://localhost:63106/"
|
||||
}
|
||||
}
|
||||
}
|
@ -35,6 +35,7 @@ using ASC.Common;
|
||||
using ASC.Common.Caching;
|
||||
using ASC.Common.Logging;
|
||||
using ASC.Common.Threading.Progress;
|
||||
using ASC.Common.Utils;
|
||||
using ASC.Core;
|
||||
using ASC.Core.Common.Settings;
|
||||
using ASC.Core.Tenants;
|
||||
@ -269,7 +270,7 @@ namespace ASC.Data.Storage
|
||||
foreach (var file in directoryFiles)
|
||||
{
|
||||
var filePath = file.Substring(mappedPath.TrimEnd('/').Length);
|
||||
tasks.Add(StaticUploader.UploadFileAsync(Path.Combine(relativePath, filePath), file, (res) => StepDone()));
|
||||
tasks.Add(StaticUploader.UploadFileAsync(CrossPlatform.PathCombine(relativePath, filePath), file, (res) => StepDone()));
|
||||
}
|
||||
|
||||
await Task.WhenAll(tasks);
|
||||
@ -280,7 +281,7 @@ namespace ASC.Data.Storage
|
||||
foreach (var file in directoryFiles)
|
||||
{
|
||||
var filePath = file.Substring(mappedPath.TrimEnd('/').Length);
|
||||
StaticUploader.UploadFileAsync(Path.Combine(relativePath, filePath), file, (res) => StepDone()).Wait();
|
||||
StaticUploader.UploadFileAsync(CrossPlatform.PathCombine(relativePath, filePath), file, (res) => StepDone()).Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
|
||||
using ASC.Common;
|
||||
using ASC.Common.Utils;
|
||||
using ASC.Core;
|
||||
using ASC.Security.Cryptography;
|
||||
|
||||
@ -75,7 +76,7 @@ namespace ASC.Data.Storage.DiscStorage
|
||||
}
|
||||
|
||||
var storage = storageFactory.GetStorage(tenantManager.GetCurrentTenant().TenantId.ToString(CultureInfo.InvariantCulture), _module);
|
||||
var path = Path.Combine(_path, GetRouteValue("pathInfo").Replace('/', Path.DirectorySeparatorChar));
|
||||
var path = CrossPlatform.PathCombine(_path, GetRouteValue("pathInfo").Replace('/', Path.DirectorySeparatorChar));
|
||||
var header = context.Request.Query[Constants.QUERY_HEADER].FirstOrDefault() ?? "";
|
||||
|
||||
var auth = context.Request.Query[Constants.QUERY_AUTH].FirstOrDefault() ?? "";
|
||||
|
@ -33,6 +33,7 @@ using System.Net;
|
||||
|
||||
using ASC.Common;
|
||||
using ASC.Common.Logging;
|
||||
using ASC.Common.Utils;
|
||||
using ASC.Core;
|
||||
using ASC.Core.Common.Settings;
|
||||
using ASC.Data.Storage.Configuration;
|
||||
@ -219,7 +220,7 @@ namespace ASC.Data.Storage
|
||||
if (Uri.IsWellFormedUriString(path, UriKind.Relative) && HttpContextAccessor?.HttpContext != null)
|
||||
{
|
||||
//Local
|
||||
Existing[path] = File.Exists(Path.Combine(HostEnvironment.ContentRootPath, path));
|
||||
Existing[path] = File.Exists(CrossPlatform.PathCombine(HostEnvironment.ContentRootPath, path));
|
||||
}
|
||||
if (Uri.IsWellFormedUriString(path, UriKind.Absolute))
|
||||
{
|
||||
|
@ -1,10 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<ApplicationIcon />
|
||||
<OutputType>Library</OutputType>
|
||||
<StartupObject />
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
|
@ -28,6 +28,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
using ASC.Common;
|
||||
using ASC.Common.Caching;
|
||||
using ASC.Common.Utils;
|
||||
using ASC.Core;
|
||||
@ -160,5 +161,18 @@ namespace ASC.FederatedLogin.LoginProviders
|
||||
}
|
||||
|
||||
public abstract LoginProfile GetLoginProfile(string accessToken);
|
||||
}
|
||||
|
||||
public class BaseLoginProviderExtension
|
||||
{
|
||||
public static void Register(DIHelper services)
|
||||
{
|
||||
services.TryAdd<BoxLoginProvider>();
|
||||
services.TryAdd<DropboxLoginProvider>();
|
||||
services.TryAdd<OneDriveLoginProvider>();
|
||||
services.TryAdd<DocuSignLoginProvider>();
|
||||
services.TryAdd<GoogleLoginProvider>();
|
||||
services.TryAdd<WordpressLoginProvider>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,27 +0,0 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:58519/",
|
||||
"sslPort": 0
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"ASC.FederatedLogin": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "http://localhost:58520/"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
@ -6,9 +6,6 @@
|
||||
<Company>Ascensio System SIA</Company>
|
||||
<Product>ASC.Notify.Textile</Product>
|
||||
<Copyright>(c) Ascensio System SIA. All rights reserved</Copyright>
|
||||
<ApplicationIcon />
|
||||
<OutputType>Library</OutputType>
|
||||
<StartupObject />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugType>full</DebugType>
|
||||
|
@ -1,27 +0,0 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:56421/",
|
||||
"sslPort": 0
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"ASC.Notify.Textile": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "http://localhost:56422/"
|
||||
}
|
||||
}
|
||||
}
|
@ -303,6 +303,7 @@ namespace ASC.Resource.Manager
|
||||
var bag = new ConcurrentBag<string>();
|
||||
|
||||
var csFiles = Directory.GetFiles(Path.GetFullPath(path), "*.cs", SearchOption.AllDirectories).Except(Directory.GetFiles(Path.GetFullPath(path), "*Resource.Designer.cs", SearchOption.AllDirectories));
|
||||
csFiles = csFiles.Concat(Directory.GetFiles(Path.GetFullPath(path), "*.cshtml", SearchOption.AllDirectories)).ToArray();
|
||||
csFiles = csFiles.Concat(Directory.GetFiles(Path.GetFullPath(path), "*.aspx", SearchOption.AllDirectories)).ToArray();
|
||||
csFiles = csFiles.Concat(Directory.GetFiles(Path.GetFullPath(path), "*.Master", SearchOption.AllDirectories)).ToArray();
|
||||
csFiles = csFiles.Concat(Directory.GetFiles(Path.GetFullPath(path), "*.ascx", SearchOption.AllDirectories)).ToArray();
|
||||
|
@ -19,6 +19,8 @@
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties\" />
|
||||
<Compile Remove="Properties\**" />
|
||||
<EmbeddedResource Remove="Properties\**" />
|
||||
<None Remove="Properties\**" />
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -13,8 +13,11 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Properties\**" />
|
||||
<Compile Remove="VoxImplant\**" />
|
||||
<EmbeddedResource Remove="Properties\**" />
|
||||
<EmbeddedResource Remove="VoxImplant\**" />
|
||||
<None Remove="Properties\**" />
|
||||
<None Remove="VoxImplant\**" />
|
||||
</ItemGroup>
|
||||
|
||||
@ -31,10 +34,6 @@
|
||||
<ProjectReference Include="..\ASC.Core.Common\ASC.Core.Common.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Protobuf Include="protos\CachedVoipItem.proto" />
|
||||
</ItemGroup>
|
||||
|
@ -14,6 +14,8 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNet.WebApi.Core" Version="5.2.7" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="5.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="5.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -24,8 +24,13 @@
|
||||
*/
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using ASC.Common.Utils;
|
||||
|
||||
using Autofac.Extensions.DependencyInjection;
|
||||
|
||||
@ -37,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<Startup>();
|
||||
var builder = webBuilder.UseStartup<Startup>();
|
||||
|
||||
builder.ConfigureKestrel((hostingContext, serverOptions) =>
|
||||
{
|
||||
var kestrelConfig = hostingContext.Configuration.GetSection("Kestrel");
|
||||
|
||||
if (!kestrelConfig.Exists()) return;
|
||||
|
||||
var unixSocket = kestrelConfig.GetValue<string>("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) =>
|
||||
{
|
||||
@ -56,7 +83,7 @@ namespace ASC.ApiSystem
|
||||
var path = buided["pathToConf"];
|
||||
if (!Path.IsPathRooted(path))
|
||||
{
|
||||
path = Path.GetFullPath(Path.Combine(hostingContext.HostingEnvironment.ContentRootPath, path));
|
||||
path = Path.GetFullPath(CrossPlatform.PathCombine(hostingContext.HostingEnvironment.ContentRootPath, path));
|
||||
}
|
||||
|
||||
config.SetBasePath(path);
|
||||
@ -74,6 +101,5 @@ namespace ASC.ApiSystem
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,33 +1,29 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:5010",
|
||||
"sslPort": 0
|
||||
}
|
||||
},
|
||||
{
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": false,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"$STORAGE_ROOT": "../../../Data",
|
||||
"log__name": "apisystem",
|
||||
"log__dir": "../../../Logs"
|
||||
}
|
||||
},
|
||||
"ASC.ApiSystem": {
|
||||
"Kestrel WebServer": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": false,
|
||||
"applicationUrl": "http://localhost:5010",
|
||||
"launchUrl": "http://localhost:5010/portal/test",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"$STORAGE_ROOT": "../../../Data",
|
||||
"log__name": "apisystem",
|
||||
"log__dir": "../../../Logs"
|
||||
"log__dir": "../../../Logs",
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"ASPNETCORE_URLS": "http://localhost:5010"
|
||||
}
|
||||
},
|
||||
"WSL 2 : Ubuntu 20.04": {
|
||||
"commandName": "WSL2",
|
||||
"launchBrowser": false,
|
||||
"launchUrl": "http://localhost:5010/portal/test",
|
||||
"environmentVariables": {
|
||||
"$STORAGE_ROOT": "../../../Data",
|
||||
"log__name": "apisystem",
|
||||
"log__dir": "../../../Logs",
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"ASPNETCORE_URLS": "http://localhost:5010"
|
||||
},
|
||||
"distributionName": "Ubuntu-20.04"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<ApplicationIcon />
|
||||
<OutputType>Library</OutputType>
|
||||
<StartupObject />
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||
|
@ -1,27 +0,0 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:59977/",
|
||||
"sslPort": 44344
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"ASC.AuditTrail": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": true,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "https://localhost:5001;http://localhost:5000"
|
||||
}
|
||||
}
|
||||
}
|
@ -23,6 +23,8 @@
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="5.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="5.0.1" />
|
||||
<PackageReference Include="SharpCompress" Version="0.26.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -34,7 +34,8 @@ using System.Threading;
|
||||
using System.Xml.Linq;
|
||||
|
||||
using ASC.Common;
|
||||
|
||||
using ASC.Common.Utils;
|
||||
|
||||
namespace ASC.Data.Backup
|
||||
{
|
||||
[Scope]
|
||||
@ -103,7 +104,7 @@ namespace ASC.Data.Backup
|
||||
{
|
||||
var map = new ExeConfigurationFileMap
|
||||
{
|
||||
ExeConfigFilename = string.Compare(Path.GetExtension(config), ".config", true) == 0 ? config : Path.Combine(config, "Web.config")
|
||||
ExeConfigFilename = string.Compare(Path.GetExtension(config), ".config", true) == 0 ? config : CrossPlatform.PathCombine(config, "Web.config")
|
||||
};
|
||||
return ConfigurationManager.OpenMappedExeConfiguration(map, ConfigurationUserLevel.None);
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ using System.Xml.XPath;
|
||||
|
||||
using ASC.Common;
|
||||
using ASC.Common.Logging;
|
||||
using ASC.Common.Utils;
|
||||
using ASC.Data.Backup.EF.Context;
|
||||
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
@ -37,7 +38,7 @@ namespace ASC.Data.Backup
|
||||
var file = connectionString.ElementInformation.Source;
|
||||
if ("web.connections.config".Equals(Path.GetFileName(file), StringComparison.InvariantCultureIgnoreCase))
|
||||
{
|
||||
file = Path.Combine(Path.GetDirectoryName(file), "Web.config");
|
||||
file = CrossPlatform.PathCombine(Path.GetDirectoryName(file), "Web.config");
|
||||
}
|
||||
var xconfig = XDocument.Load(file);
|
||||
var provider = xconfig.XPathSelectElement("/configuration/system.data/DbProviderFactories/add[@invariant='" + connectionString.ProviderName + "']");
|
||||
|
@ -32,6 +32,7 @@ using System.Xml.Linq;
|
||||
|
||||
using ASC.Common;
|
||||
using ASC.Common.Logging;
|
||||
using ASC.Common.Utils;
|
||||
using ASC.Data.Storage;
|
||||
|
||||
using Microsoft.Extensions.Options;
|
||||
@ -148,7 +149,7 @@ namespace ASC.Data.Backup
|
||||
|
||||
private string GetBackupPath(FileBackupInfo backupInfo)
|
||||
{
|
||||
return Path.Combine(backupInfo.Module, Path.Combine(backupInfo.Domain, backupInfo.Path.Replace('/', '\\')));
|
||||
return CrossPlatform.PathCombine(backupInfo.Module, CrossPlatform.PathCombine(backupInfo.Domain, backupInfo.Path.Replace('/', '\\')));
|
||||
}
|
||||
|
||||
|
||||
|
@ -28,6 +28,8 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
using ASC.Common.Utils;
|
||||
|
||||
using SharpCompress.Common;
|
||||
using SharpCompress.Readers;
|
||||
using SharpCompress.Writers;
|
||||
@ -65,7 +67,7 @@ namespace ASC.Data.Backup
|
||||
|
||||
public ZipReadOperator(string targetFile)
|
||||
{
|
||||
tmpdir = Path.Combine(Path.GetDirectoryName(targetFile), Path.GetFileNameWithoutExtension(targetFile).Replace('>', '_').Replace(':', '_').Replace('?', '_'));
|
||||
tmpdir = CrossPlatform.PathCombine(Path.GetDirectoryName(targetFile), Path.GetFileNameWithoutExtension(targetFile).Replace('>', '_').Replace(':', '_').Replace('?', '_'));
|
||||
Entries = new List<string>();
|
||||
|
||||
using var stream = File.OpenRead(targetFile);
|
||||
@ -82,7 +84,7 @@ namespace ASC.Data.Backup
|
||||
fullPath = streamReader.ReadToEnd().TrimEnd(char.MinValue);
|
||||
}
|
||||
|
||||
fullPath = Path.Combine(tmpdir, fullPath);
|
||||
fullPath = CrossPlatform.PathCombine(tmpdir, fullPath);
|
||||
|
||||
if (!Directory.Exists(Path.GetDirectoryName(fullPath)))
|
||||
{
|
||||
@ -111,7 +113,7 @@ namespace ASC.Data.Backup
|
||||
|
||||
public Stream GetEntry(string key)
|
||||
{
|
||||
var filePath = Path.Combine(tmpdir, key);
|
||||
var filePath = CrossPlatform.PathCombine(tmpdir, key);
|
||||
return File.Exists(filePath) ? File.Open(filePath, FileMode.Open, FileAccess.ReadWrite, FileShare.Read) : null;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,11 @@
|
||||
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;
|
||||
|
||||
using Autofac.Extensions.DependencyInjection;
|
||||
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
@ -11,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<Startup>();
|
||||
var builder = webBuilder.UseStartup<Startup>();
|
||||
|
||||
builder.ConfigureKestrel((hostingContext, serverOptions) =>
|
||||
{
|
||||
var kestrelConfig = hostingContext.Configuration.GetSection("Kestrel");
|
||||
|
||||
if (!kestrelConfig.Exists()) return;
|
||||
|
||||
var unixSocket = kestrelConfig.GetValue<string>("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) =>
|
||||
{
|
||||
@ -26,7 +57,7 @@ namespace ASC.Data.Backup
|
||||
var path = buided["pathToConf"];
|
||||
if (!Path.IsPathRooted(path))
|
||||
{
|
||||
path = Path.GetFullPath(Path.Combine(hostContext.HostingEnvironment.ContentRootPath, path));
|
||||
path = Path.GetFullPath(CrossPlatform.PathCombine(hostContext.HostingEnvironment.ContentRootPath, path));
|
||||
}
|
||||
config.SetBasePath(path);
|
||||
var env = hostContext.Configuration.GetValue("ENVIRONMENT", "Production");
|
||||
@ -44,10 +75,7 @@ namespace ASC.Data.Backup
|
||||
{"pathToConf", path }
|
||||
}
|
||||
);
|
||||
})
|
||||
.UseConsoleLifetime()
|
||||
.Build()
|
||||
.RunAsync();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,35 +1,31 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:5012/",
|
||||
"sslPort": 0
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": false,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"$STORAGE_ROOT": "../../../Data",
|
||||
"log__name": "backup",
|
||||
"log__dir": "../../../Logs",
|
||||
"core__products__folder": "../../../products"
|
||||
}
|
||||
},
|
||||
"ASC.Data.Backup": {
|
||||
"Kestrel WebServer": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": false,
|
||||
"launchUrl": "http://localhost:5012/api/2.0/backup/backuptmp",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"$STORAGE_ROOT": "../../../Data",
|
||||
"log__name": "backup",
|
||||
"log__dir": "../../../Logs",
|
||||
"core__products__folder": "../../../products"
|
||||
"core__products__folder": "../../../products",
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"ASPNETCORE_URLS": "http://localhost:5012"
|
||||
}
|
||||
},
|
||||
"WSL 2 : Ubuntu 20.04": {
|
||||
"commandName": "WSL2",
|
||||
"launchBrowser": false,
|
||||
"launchUrl": "http://localhost:5012/api/2.0/backup/backuptmp",
|
||||
"environmentVariables": {
|
||||
"$STORAGE_ROOT": "../../../Data",
|
||||
"log__name": "backup",
|
||||
"log__dir": "../../../Logs",
|
||||
"core__products__folder": "../../../products",
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"ASPNETCORE_URLS": "http://localhost:5012"
|
||||
},
|
||||
"applicationUrl": "http://localhost:5012/"
|
||||
"distributionName": "Ubuntu-20.04"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,8 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
using ASC.Common.Utils;
|
||||
|
||||
namespace ASC.Data.Backup.Service
|
||||
{
|
||||
public class BackupSettings
|
||||
@ -52,7 +54,7 @@ namespace ASC.Data.Backup.Service
|
||||
}
|
||||
if (Elements.Count == 0)
|
||||
{
|
||||
return Path.Combine("..", "..", "WebStudio");
|
||||
return CrossPlatform.PathCombine("..", "..", "WebStudio");
|
||||
}
|
||||
if (Elements.Count == 1)
|
||||
{
|
||||
|
@ -34,6 +34,7 @@ using ASC.Common;
|
||||
using ASC.Common.Caching;
|
||||
using ASC.Common.Logging;
|
||||
using ASC.Common.Threading.Progress;
|
||||
using ASC.Common.Utils;
|
||||
using ASC.Core;
|
||||
using ASC.Core.Tenants;
|
||||
using ASC.Data.Backup.Contracts;
|
||||
@ -378,7 +379,7 @@ namespace ASC.Data.Backup.Service
|
||||
var dateTime = coreBaseSettings.Standalone ? DateTime.Now : DateTime.UtcNow;
|
||||
var backupName = string.Format("{0}_{1:yyyy-MM-dd_HH-mm-ss}.{2}", tenantManager.GetTenant(TenantId).TenantAlias, dateTime, ArchiveFormat);
|
||||
|
||||
var tempFile = Path.Combine(TempFolder, backupName);
|
||||
var tempFile = CrossPlatform.PathCombine(TempFolder, backupName);
|
||||
var storagePath = tempFile;
|
||||
try
|
||||
{
|
||||
|
@ -28,7 +28,8 @@ using System;
|
||||
using System.IO;
|
||||
|
||||
using ASC.Common;
|
||||
|
||||
using ASC.Common.Utils;
|
||||
|
||||
namespace ASC.Data.Backup.Storage
|
||||
{
|
||||
[Scope]
|
||||
@ -40,7 +41,7 @@ namespace ASC.Data.Backup.Storage
|
||||
{
|
||||
throw new FileNotFoundException("Directory not found.");
|
||||
}
|
||||
var storagePath = Path.Combine(storageBasePath, Path.GetFileName(localPath));
|
||||
var storagePath = CrossPlatform.PathCombine(storageBasePath, Path.GetFileName(localPath));
|
||||
if (localPath != storagePath)
|
||||
{
|
||||
File.Copy(localPath, storagePath, true);
|
||||
|
@ -36,6 +36,7 @@ using System.Xml.Linq;
|
||||
|
||||
using ASC.Common;
|
||||
using ASC.Common.Logging;
|
||||
using ASC.Common.Utils;
|
||||
using ASC.Core;
|
||||
using ASC.Core.Common.EF;
|
||||
using ASC.Data.Backup.EF.Context;
|
||||
@ -152,9 +153,9 @@ namespace ASC.Data.Backup.Tasks
|
||||
excluded.Add("res_");
|
||||
|
||||
var dir = Path.GetDirectoryName(BackupFilePath);
|
||||
var subDir = Path.Combine(dir, Path.GetFileNameWithoutExtension(BackupFilePath));
|
||||
var schemeDir = Path.Combine(subDir, KeyHelper.GetDatabaseSchema());
|
||||
var dataDir = Path.Combine(subDir, KeyHelper.GetDatabaseData());
|
||||
var subDir = CrossPlatform.PathCombine(dir, Path.GetFileNameWithoutExtension(BackupFilePath));
|
||||
var schemeDir = CrossPlatform.PathCombine(subDir, KeyHelper.GetDatabaseSchema());
|
||||
var dataDir = CrossPlatform.PathCombine(subDir, KeyHelper.GetDatabaseData());
|
||||
|
||||
if (!Directory.Exists(schemeDir))
|
||||
{
|
||||
@ -227,7 +228,7 @@ namespace ASC.Data.Backup.Tasks
|
||||
.FirstOrDefault());
|
||||
creates.Append(";");
|
||||
|
||||
var path = Path.Combine(dir, t);
|
||||
var path = CrossPlatform.PathCombine(dir, t);
|
||||
using (var stream = File.OpenWrite(path))
|
||||
{
|
||||
var bytes = Encoding.UTF8.GetBytes(creates.ToString());
|
||||
@ -326,7 +327,7 @@ namespace ASC.Data.Backup.Tasks
|
||||
}
|
||||
}
|
||||
|
||||
var path = Path.Combine(dir, t);
|
||||
var path = CrossPlatform.PathCombine(dir, t);
|
||||
|
||||
var offset = 0;
|
||||
|
||||
@ -443,11 +444,11 @@ namespace ASC.Data.Backup.Tasks
|
||||
Logger.Debug("begin backup storage");
|
||||
|
||||
var dir = Path.GetDirectoryName(BackupFilePath);
|
||||
var subDir = Path.Combine(dir, Path.GetFileNameWithoutExtension(BackupFilePath));
|
||||
var subDir = CrossPlatform.PathCombine(dir, Path.GetFileNameWithoutExtension(BackupFilePath));
|
||||
|
||||
for (var i = 0; i < files.Count; i += TasksLimit)
|
||||
{
|
||||
var storageDir = Path.Combine(subDir, KeyHelper.GetStorage());
|
||||
var storageDir = CrossPlatform.PathCombine(subDir, KeyHelper.GetStorage());
|
||||
|
||||
if (!Directory.Exists(storageDir))
|
||||
{
|
||||
@ -470,7 +471,7 @@ namespace ASC.Data.Backup.Tasks
|
||||
|
||||
var restoreInfoXml = new XElement("storage_restore", files.Select(file => (object)file.ToXElement()).ToArray());
|
||||
|
||||
var tmpPath = Path.Combine(subDir, KeyHelper.GetStorageRestoreInfoZipKey());
|
||||
var tmpPath = CrossPlatform.PathCombine(subDir, KeyHelper.GetStorageRestoreInfoZipKey());
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(tmpPath));
|
||||
|
||||
using (var tmpFile = File.OpenWrite(tmpPath))
|
||||
@ -490,7 +491,7 @@ namespace ASC.Data.Backup.Tasks
|
||||
private async Task DoDumpFile(BackupFileInfo file, string dir)
|
||||
{
|
||||
var storage = StorageFactory.GetStorage(ConfigPath, file.Tenant.ToString(), file.Module);
|
||||
var filePath = Path.Combine(dir, file.GetZipKey());
|
||||
var filePath = CrossPlatform.PathCombine(dir, file.GetZipKey());
|
||||
var dirName = Path.GetDirectoryName(filePath);
|
||||
|
||||
Logger.DebugFormat("backup file {0}", filePath);
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
using System.IO;
|
||||
|
||||
using ASC.Common.Utils;
|
||||
using ASC.Data.Backup.Tasks.Modules;
|
||||
|
||||
namespace ASC.Data.Backup.Tasks
|
||||
@ -66,7 +67,7 @@ namespace ASC.Data.Backup.Tasks
|
||||
|
||||
public static string GetZipKey(this BackupFileInfo file)
|
||||
{
|
||||
return Path.Combine(file.Module, file.Domain, file.Path);
|
||||
return CrossPlatform.PathCombine(file.Module, file.Domain, file.Path);
|
||||
}
|
||||
|
||||
public static string GetStorage()
|
||||
|
@ -34,6 +34,7 @@ using System.Xml.Linq;
|
||||
using ASC.Common;
|
||||
using ASC.Common.Caching;
|
||||
using ASC.Common.Logging;
|
||||
using ASC.Common.Utils;
|
||||
using ASC.Core;
|
||||
using ASC.Core.Billing;
|
||||
using ASC.Core.Tenants;
|
||||
@ -286,7 +287,7 @@ namespace ASC.Data.Backup.Tasks
|
||||
var key = file.GetZipKey();
|
||||
if (Dump)
|
||||
{
|
||||
key = Path.Combine(KeyHelper.GetStorage(), key);
|
||||
key = CrossPlatform.PathCombine(KeyHelper.GetStorage(), key);
|
||||
}
|
||||
using var stream = dataReader.GetEntry(key);
|
||||
try
|
||||
|
@ -31,6 +31,7 @@ using System.Linq;
|
||||
|
||||
using ASC.Common;
|
||||
using ASC.Common.Logging;
|
||||
using ASC.Common.Utils;
|
||||
using ASC.Core.Tenants;
|
||||
using ASC.Data.Backup.Extensions;
|
||||
using ASC.Data.Backup.Tasks.Modules;
|
||||
@ -246,7 +247,7 @@ namespace ASC.Data.Backup.Tasks
|
||||
if (!Directory.Exists(BackupDirectory ?? DefaultDirectoryName))
|
||||
Directory.CreateDirectory(BackupDirectory ?? DefaultDirectoryName);
|
||||
|
||||
return Path.Combine(BackupDirectory ?? DefaultDirectoryName, tenantAlias + DateTime.UtcNow.ToString("(yyyy-MM-dd HH-mm-ss)") + ".backup");
|
||||
return CrossPlatform.PathCombine(BackupDirectory ?? DefaultDirectoryName, tenantAlias + DateTime.UtcNow.ToString("(yyyy-MM-dd HH-mm-ss)") + ".backup");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -27,6 +27,8 @@
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
using ASC.Common.Utils;
|
||||
|
||||
namespace ASC.Data.Backup.Utils
|
||||
{
|
||||
internal static class PathHelper
|
||||
@ -40,7 +42,7 @@ namespace ASC.Data.Backup.Utils
|
||||
{
|
||||
if (!Path.IsPathRooted(path))
|
||||
{
|
||||
path = Path.Combine(basePath, path);
|
||||
path = CrossPlatform.PathCombine(basePath, path);
|
||||
}
|
||||
return Path.GetFullPath(path);
|
||||
}
|
||||
@ -49,7 +51,7 @@ namespace ASC.Data.Backup.Utils
|
||||
{
|
||||
if (!Path.HasExtension(path))
|
||||
{
|
||||
path = Path.Combine(path, "Web.config");
|
||||
path = CrossPlatform.PathCombine(path, "Web.config");
|
||||
}
|
||||
return ToRootedPath(path);
|
||||
}
|
||||
@ -59,7 +61,7 @@ namespace ASC.Data.Backup.Utils
|
||||
string tempPath;
|
||||
do
|
||||
{
|
||||
tempPath = Path.Combine(tempDir, Path.GetRandomFileName());
|
||||
tempPath = CrossPlatform.PathCombine(tempDir, Path.GetRandomFileName());
|
||||
} while (File.Exists(tempPath));
|
||||
return tempPath;
|
||||
}
|
||||
|
@ -22,6 +22,8 @@
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="5.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="5.0.1" />
|
||||
<PackageReference Include="SharpCompress" Version="0.26.0" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -22,10 +22,14 @@
|
||||
* 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;
|
||||
|
||||
using Autofac.Extensions.DependencyInjection;
|
||||
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
@ -36,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<Startup>();
|
||||
var builder = webBuilder.UseStartup<Startup>();
|
||||
|
||||
builder.ConfigureKestrel((hostingContext, serverOptions) =>
|
||||
{
|
||||
var kestrelConfig = hostingContext.Configuration.GetSection("Kestrel");
|
||||
|
||||
if (!kestrelConfig.Exists()) return;
|
||||
|
||||
var unixSocket = kestrelConfig.GetValue<string>("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) =>
|
||||
{
|
||||
@ -50,7 +81,7 @@ namespace ASC.Data.Storage.Encryption
|
||||
var path = buided["pathToConf"];
|
||||
if (!Path.IsPathRooted(path))
|
||||
{
|
||||
path = Path.GetFullPath(Path.Combine(hostContext.HostingEnvironment.ContentRootPath, path));
|
||||
path = Path.GetFullPath(CrossPlatform.PathCombine(hostContext.HostingEnvironment.ContentRootPath, path));
|
||||
}
|
||||
config.SetBasePath(path);
|
||||
var env = hostContext.Configuration.GetValue("ENVIRONMENT", "Production");
|
||||
@ -67,10 +98,6 @@ namespace ASC.Data.Storage.Encryption
|
||||
.AddJsonFile("kafka.json")
|
||||
.AddJsonFile($"kafka.{env}.json", true)
|
||||
.AddEnvironmentVariables();
|
||||
})
|
||||
.UseConsoleLifetime()
|
||||
.Build()
|
||||
.RunAsync();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,35 +1,29 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:5019/",
|
||||
"sslPort": 0
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": false,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"$STORAGE_ROOT": "../../../Data",
|
||||
"log__name": "Encryption",
|
||||
"log__dir": "../../../Logs",
|
||||
"core__products__folder": "../../../products"
|
||||
}
|
||||
},
|
||||
"ASC.Data.Storage.Encryption": {
|
||||
"Kestrel WebServer": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": false,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"$STORAGE_ROOT": "../../../Data",
|
||||
"log__name": "Encryption",
|
||||
"log__dir": "../../../Logs",
|
||||
"core__products__folder": "../../../products"
|
||||
"core__products__folder": "../../../products",
|
||||
"ASPNETCORE_URLS": "http://localhost:5019",
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"WSL 2 : Ubuntu 20.04": {
|
||||
"commandName": "WSL2",
|
||||
"launchBrowser": false,
|
||||
"environmentVariables": {
|
||||
"$STORAGE_ROOT": "../../../Data",
|
||||
"log__name": "Encryption",
|
||||
"log__dir": "../../../Logs",
|
||||
"core__products__folder": "../../../products",
|
||||
"ASPNETCORE_URLS": "http://localhost:5019",
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "http://localhost:5019/"
|
||||
"distributionName": "Ubuntu-20.04"
|
||||
}
|
||||
}
|
||||
}
|
@ -4,6 +4,11 @@
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="5.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="5.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\ASC.Common\ASC.Common.csproj" />
|
||||
<ProjectReference Include="..\..\ASC.Core.Common\ASC.Core.Common.csproj" />
|
||||
|
@ -6,7 +6,8 @@ using ASC.Common;
|
||||
using ASC.Common.Caching;
|
||||
using ASC.Common.DependencyInjection;
|
||||
using ASC.Common.Logging;
|
||||
|
||||
using ASC.Common.Utils;
|
||||
|
||||
using Autofac;
|
||||
using Autofac.Extensions.DependencyInjection;
|
||||
|
||||
@ -18,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) =>
|
||||
{
|
||||
@ -28,7 +37,7 @@ namespace ASC.Data.Storage.Migration
|
||||
var path = buided["pathToConf"];
|
||||
if (!Path.IsPathRooted(path))
|
||||
{
|
||||
path = Path.GetFullPath(Path.Combine(hostContext.HostingEnvironment.ContentRootPath, path));
|
||||
path = Path.GetFullPath(CrossPlatform.PathCombine(hostContext.HostingEnvironment.ContentRootPath, path));
|
||||
}
|
||||
config.SetBasePath(path);
|
||||
var env = hostContext.Configuration.GetValue("ENVIRONMENT", "Production");
|
||||
@ -63,10 +72,6 @@ namespace ASC.Data.Storage.Migration
|
||||
.ConfigureContainer<ContainerBuilder>((context, builder) =>
|
||||
{
|
||||
builder.Register(context.Configuration);
|
||||
})
|
||||
.UseConsoleLifetime()
|
||||
.Build()
|
||||
.RunAsync();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,36 +1,29 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:5018/",
|
||||
"sslPort": 0
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": false,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"$STORAGE_ROOT": "../../../Data",
|
||||
"log__name": "storage.migration",
|
||||
"log__dir": "../../../Logs",
|
||||
"core__products__folder": "../../../products"
|
||||
}
|
||||
},
|
||||
"ASC.Data.Storage.Migration": {
|
||||
"Kestrel WebServer": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": false,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"$STORAGE_ROOT": "../../../Data",
|
||||
"log__name": "storage.migration",
|
||||
"log__dir": "../../../Logs",
|
||||
"core__products__folder": "../../../products"
|
||||
"core__products__folder": "../../../products",
|
||||
"ASPNETCORE_URLS": "http://localhost:5018",
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"WSL 2 : Ubuntu 20.04": {
|
||||
"commandName": "WSL2",
|
||||
"launchBrowser": false,
|
||||
"environmentVariables": {
|
||||
"$STORAGE_ROOT": "../../../Data",
|
||||
"log__name": "storage.migration",
|
||||
"log__dir": "../../../Logs",
|
||||
"core__products__folder": "../../../products",
|
||||
"ASPNETCORE_URLS": "http://localhost:5018",
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "http://localhost:5018/"
|
||||
"distributionName": "Ubuntu-20.04"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -18,6 +18,11 @@
|
||||
<DebugType>none</DebugType>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Remove="Properties\**" />
|
||||
<EmbeddedResource Remove="Properties\**" />
|
||||
<None Remove="Properties\**" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Remove="protos\SearchItem.proto" />
|
||||
</ItemGroup>
|
||||
@ -37,9 +42,6 @@
|
||||
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Protobuf Include="protos\SearchItem.proto" />
|
||||
</ItemGroup>
|
||||
|
@ -13,6 +13,8 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="5.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="5.0.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -6,6 +6,7 @@ using ASC.Common;
|
||||
using ASC.Common.Caching;
|
||||
using ASC.Common.DependencyInjection;
|
||||
using ASC.Common.Logging;
|
||||
using ASC.Common.Utils;
|
||||
using ASC.Core.Notify.Senders;
|
||||
using ASC.Notify.Config;
|
||||
|
||||
@ -20,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) =>
|
||||
{
|
||||
@ -30,7 +39,7 @@ namespace ASC.Notify
|
||||
var path = buided["pathToConf"];
|
||||
if (!Path.IsPathRooted(path))
|
||||
{
|
||||
path = Path.GetFullPath(Path.Combine(hostContext.HostingEnvironment.ContentRootPath, path));
|
||||
path = Path.GetFullPath(CrossPlatform.PathCombine(hostContext.HostingEnvironment.ContentRootPath, path));
|
||||
}
|
||||
config.SetBasePath(path);
|
||||
var env = hostContext.Configuration.GetValue("ENVIRONMENT", "Production");
|
||||
@ -72,18 +81,6 @@ namespace ASC.Notify
|
||||
.ConfigureContainer<ContainerBuilder>((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();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,35 +1,29 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:5005/",
|
||||
"sslPort": 0
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": false,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"$STORAGE_ROOT": "../../../Data",
|
||||
"log__name": "notify",
|
||||
"log__dir": "../../../Logs",
|
||||
"core__products__folder": "../../../products"
|
||||
}
|
||||
},
|
||||
"ASC.Notify": {
|
||||
"Kestrel WebServer": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": false,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"$STORAGE_ROOT": "../../../Data",
|
||||
"log__name": "notify",
|
||||
"log__dir": "../../../Logs",
|
||||
"core__products__folder": "../../../products"
|
||||
"core__products__folder": "../../../products",
|
||||
"ASPNETCORE_URLS": "http://localhost:5005",
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"WSL 2 : Ubuntu 20.04": {
|
||||
"commandName": "WSL2",
|
||||
"launchBrowser": false,
|
||||
"environmentVariables": {
|
||||
"$STORAGE_ROOT": "../../../Data",
|
||||
"log__name": "notify",
|
||||
"log__dir": "../../../Logs",
|
||||
"core__products__folder": "../../../products",
|
||||
"ASPNETCORE_URLS": "http://localhost:5005",
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "http://localhost:5005/"
|
||||
"distributionName": "Ubuntu-20.04"
|
||||
}
|
||||
}
|
||||
}
|
@ -16,6 +16,8 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="5.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="5.0.1" />
|
||||
<PackageReference Include="WebSocketSharp" Version="1.0.3-rc11" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -32,7 +32,8 @@ using ASC.Common;
|
||||
using ASC.Common.Caching;
|
||||
using ASC.Common.DependencyInjection;
|
||||
using ASC.Common.Logging;
|
||||
|
||||
using ASC.Common.Utils;
|
||||
|
||||
using Autofac;
|
||||
using Autofac.Extensions.DependencyInjection;
|
||||
|
||||
@ -45,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) =>
|
||||
{
|
||||
@ -55,7 +64,7 @@ namespace ASC.Socket.IO.Svc
|
||||
var path = buided["pathToConf"];
|
||||
if (!Path.IsPathRooted(path))
|
||||
{
|
||||
path = Path.GetFullPath(Path.Combine(hostContext.HostingEnvironment.ContentRootPath, path));
|
||||
path = Path.GetFullPath(CrossPlatform.PathCombine(hostContext.HostingEnvironment.ContentRootPath, path));
|
||||
}
|
||||
config.SetBasePath(path);
|
||||
var env = hostContext.Configuration.GetValue("ENVIRONMENT", "Production");
|
||||
@ -89,18 +98,7 @@ namespace ASC.Socket.IO.Svc
|
||||
.ConfigureContainer<ContainerBuilder>((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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,35 +1,29 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:5017/",
|
||||
"sslPort": 0
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": false,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"$STORAGE_ROOT": "../../../Data",
|
||||
"log__name": "socket",
|
||||
"log__dir": "../../../Logs",
|
||||
"core__products__folder": "../../../products"
|
||||
}
|
||||
},
|
||||
"ASC.Socket.IO.Svc": {
|
||||
"Kestrel WebServer": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": false,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"$STORAGE_ROOT": "../../../Data",
|
||||
"log__name": "socket",
|
||||
"log__dir": "../../../Logs",
|
||||
"core__products__folder": "../../../products"
|
||||
"core__products__folder": "../../../products",
|
||||
"ASPNETCORE_URLS": "http://localhost:5001",
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"WSL 2 : Ubuntu 20.04": {
|
||||
"commandName": "WSL2",
|
||||
"launchBrowser": false,
|
||||
"environmentVariables": {
|
||||
"$STORAGE_ROOT": "../../../Data",
|
||||
"log__name": "socket",
|
||||
"log__dir": "../../../Logs",
|
||||
"core__products__folder": "../../../products",
|
||||
"ASPNETCORE_URLS": "http://localhost:5001",
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "https://localhost:5001;http://localhost:5000"
|
||||
"distributionName": "Ubuntu-20.04"
|
||||
}
|
||||
}
|
||||
}
|
@ -87,7 +87,7 @@ namespace ASC.Socket.IO.Svc
|
||||
UseShellExecute = false,
|
||||
FileName = "node",
|
||||
WindowStyle = ProcessWindowStyle.Hidden,
|
||||
Arguments = string.Format("\"{0}\"", Path.GetFullPath(Path.Combine(HostEnvironment.ContentRootPath, settings.Path, "app.js"))),
|
||||
Arguments = string.Format("\"{0}\"", Path.GetFullPath(CrossPlatform.PathCombine(HostEnvironment.ContentRootPath, settings.Path, "app.js"))),
|
||||
WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory
|
||||
};
|
||||
StartInfo.EnvironmentVariables.Add("core.machinekey", Configuration["core:machinekey"]);
|
||||
@ -105,7 +105,7 @@ namespace ASC.Socket.IO.Svc
|
||||
}
|
||||
|
||||
LogDir = Logger.LogDirectory;
|
||||
StartInfo.EnvironmentVariables.Add("logPath", Path.Combine(LogDir, "web.socketio.log"));
|
||||
StartInfo.EnvironmentVariables.Add("logPath", CrossPlatform.PathCombine(LogDir, "web.socketio.log"));
|
||||
StartNode();
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -10,6 +10,11 @@
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="5.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="5.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\web\ASC.Web.Core\ASC.Web.Core.csproj" />
|
||||
<ProjectReference Include="..\..\ASC.Data.Encryption\ASC.Data.Encryption.csproj" />
|
||||
|
@ -6,6 +6,7 @@ using ASC.Common;
|
||||
using ASC.Common.Caching;
|
||||
using ASC.Common.DependencyInjection;
|
||||
using ASC.Common.Logging;
|
||||
using ASC.Common.Utils;
|
||||
using ASC.Core.Notify;
|
||||
using ASC.Notify;
|
||||
using ASC.Web.Studio.Core.Notify;
|
||||
@ -21,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) =>
|
||||
{
|
||||
@ -31,7 +40,7 @@ namespace ASC.Studio.Notify
|
||||
var path = buided["pathToConf"];
|
||||
if (!Path.IsPathRooted(path))
|
||||
{
|
||||
path = Path.GetFullPath(Path.Combine(hostContext.HostingEnvironment.ContentRootPath, path));
|
||||
path = Path.GetFullPath(CrossPlatform.PathCombine(hostContext.HostingEnvironment.ContentRootPath, path));
|
||||
}
|
||||
config.SetBasePath(path);
|
||||
var env = hostContext.Configuration.GetValue("ENVIRONMENT", "Production");
|
||||
@ -66,18 +75,6 @@ namespace ASC.Studio.Notify
|
||||
.ConfigureContainer<ContainerBuilder>((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();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,33 +1,27 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:5006/",
|
||||
"sslPort": 0
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": false,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"$STORAGE_ROOT": "../../../Data",
|
||||
"log__name": "studio.notify",
|
||||
"log__dir": "../../../Logs"
|
||||
}
|
||||
},
|
||||
"ASC.Studio.Notify": {
|
||||
"Kestrel WebServer": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": false,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"$STORAGE_ROOT": "../../../Data",
|
||||
"log__name": "studio.notify",
|
||||
"log__dir": "../../../Logs"
|
||||
"log__dir": "../../../Logs",
|
||||
"ASPNETCORE_URLS": "http://localhost:5006",
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"WSL 2 : Ubuntu 20.04": {
|
||||
"commandName": "WSL2",
|
||||
"launchBrowser": false,
|
||||
"environmentVariables": {
|
||||
"$STORAGE_ROOT": "../../../Data",
|
||||
"log__name": "studio.notify",
|
||||
"log__dir": "../../../Logs",
|
||||
"ASPNETCORE_URLS": "http://localhost:5006",
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "http://localhost:5006/"
|
||||
"distributionName": "Ubuntu-20.04"
|
||||
}
|
||||
}
|
||||
}
|
@ -13,6 +13,8 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="5.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="5.0.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="Telegram.Bot" Version="15.7.1" />
|
||||
</ItemGroup>
|
||||
|
@ -22,10 +22,14 @@
|
||||
* 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;
|
||||
|
||||
using Autofac.Extensions.DependencyInjection;
|
||||
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
@ -36,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<Startup>();
|
||||
var builder = webBuilder.UseStartup<Startup>();
|
||||
|
||||
builder.ConfigureKestrel((hostingContext, serverOptions) =>
|
||||
{
|
||||
var kestrelConfig = hostingContext.Configuration.GetSection("Kestrel");
|
||||
|
||||
if (!kestrelConfig.Exists()) return;
|
||||
|
||||
var unixSocket = kestrelConfig.GetValue<string>("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) =>
|
||||
{
|
||||
@ -50,7 +81,7 @@ namespace ASC.TelegramService
|
||||
var path = buided["pathToConf"];
|
||||
if (!Path.IsPathRooted(path))
|
||||
{
|
||||
path = Path.GetFullPath(Path.Combine(hostContext.HostingEnvironment.ContentRootPath, path));
|
||||
path = Path.GetFullPath(CrossPlatform.PathCombine(hostContext.HostingEnvironment.ContentRootPath, path));
|
||||
}
|
||||
config.SetBasePath(path);
|
||||
var env = hostContext.Configuration.GetValue("ENVIRONMENT", "Production");
|
||||
@ -67,10 +98,6 @@ namespace ASC.TelegramService
|
||||
.AddJsonFile("kafka.json")
|
||||
.AddJsonFile($"kafka.{env}.json", true)
|
||||
.AddEnvironmentVariables();
|
||||
})
|
||||
.UseConsoleLifetime()
|
||||
.Build()
|
||||
.RunAsync();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,35 +1,29 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:51702/",
|
||||
"sslPort": 0
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": false,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"$STORAGE_ROOT": "../../../Data",
|
||||
"log__name": "telegram",
|
||||
"log__dir": "../../../Logs",
|
||||
"core__products__folder": "../../../products"
|
||||
}
|
||||
},
|
||||
"ASC.TelegramService": {
|
||||
"Kestrel WebServer": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": false,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"$STORAGE_ROOT": "../../../Data",
|
||||
"log__name": "telegram",
|
||||
"log__dir": "../../../Logs",
|
||||
"core__products__folder": "../../../products"
|
||||
"core__products__folder": "../../../products",
|
||||
"ASPNETCORE_URLS": "http://localhost:51702",
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"WSL 2 : Ubuntu 20.04": {
|
||||
"commandName": "WSL2",
|
||||
"launchBrowser": false,
|
||||
"environmentVariables": {
|
||||
"$STORAGE_ROOT": "../../../Data",
|
||||
"log__name": "telegram",
|
||||
"log__dir": "../../../Logs",
|
||||
"core__products__folder": "../../../products",
|
||||
"ASPNETCORE_URLS": "http://localhost:51702",
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "http://localhost:51702/"
|
||||
"distributionName": "Ubuntu-20.04"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -21,5 +21,10 @@
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="5.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="5.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
@ -26,13 +26,15 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using ASC.Common;
|
||||
using ASC.Common.Caching;
|
||||
using ASC.Common.DependencyInjection;
|
||||
using ASC.Common.Logging;
|
||||
|
||||
using ASC.Common.Utils;
|
||||
|
||||
using Autofac;
|
||||
using Autofac.Extensions.DependencyInjection;
|
||||
|
||||
@ -44,18 +46,26 @@ 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();
|
||||
var path = buided["pathToConf"];
|
||||
if (!Path.IsPathRooted(path))
|
||||
{
|
||||
path = Path.GetFullPath(Path.Combine(hostContext.HostingEnvironment.ContentRootPath, path));
|
||||
path = Path.GetFullPath(CrossPlatform.PathCombine(hostContext.HostingEnvironment.ContentRootPath, path));
|
||||
}
|
||||
config.SetBasePath(path);
|
||||
var env = hostContext.Configuration.GetValue("ENVIRONMENT", "Production");
|
||||
@ -88,18 +98,6 @@ namespace ASC.Thumbnails.Svc
|
||||
.ConfigureContainer<ContainerBuilder>((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();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,35 +1,29 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:5016/",
|
||||
"sslPort": 0
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": false,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"$STORAGE_ROOT": "../../../Data",
|
||||
"log__name": "thumbnails",
|
||||
"log__dir": "../../../Logs",
|
||||
"core__products__folder": "../../../products"
|
||||
}
|
||||
},
|
||||
"ASC.Thumbnails.Svc": {
|
||||
"Kestrel WebServer": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": false,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"$STORAGE_ROOT": "../../../Data",
|
||||
"log__name": "thumbnails",
|
||||
"log__dir": "../../../Logs",
|
||||
"core__products__folder": "../../../products"
|
||||
"core__products__folder": "../../../products",
|
||||
"ASPNETCORE_URLS": "http://localhost:5016",
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"WSL 2 : Ubuntu 20.04": {
|
||||
"commandName": "WSL2",
|
||||
"launchBrowser": false,
|
||||
"environmentVariables": {
|
||||
"$STORAGE_ROOT": "../../../Data",
|
||||
"log__name": "thumbnails",
|
||||
"log__dir": "../../../Logs",
|
||||
"core__products__folder": "../../../products",
|
||||
"ASPNETCORE_URLS": "http://localhost:5016",
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "http://localhost:5016/"
|
||||
"distributionName": "Ubuntu-20.04"
|
||||
}
|
||||
}
|
||||
}
|
@ -67,7 +67,7 @@ namespace ASC.Thumbnails.Svc
|
||||
UseShellExecute = false,
|
||||
FileName = "node",
|
||||
WindowStyle = ProcessWindowStyle.Hidden,
|
||||
Arguments = string.Format("\"{0}\"", Path.GetFullPath(Path.Combine(HostEnvironment.ContentRootPath, settings.Path, "index.js"))),
|
||||
Arguments = string.Format("\"{0}\"", Path.GetFullPath(CrossPlatform.PathCombine(HostEnvironment.ContentRootPath, settings.Path, "index.js"))),
|
||||
WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory
|
||||
};
|
||||
|
||||
@ -77,7 +77,7 @@ namespace ASC.Thumbnails.Svc
|
||||
savePath += "/";
|
||||
}
|
||||
StartInfo.EnvironmentVariables.Add("port", settings.Port);
|
||||
StartInfo.EnvironmentVariables.Add("logPath", Path.Combine(Logger.LogDirectory, "web.thumbnails.log"));
|
||||
StartInfo.EnvironmentVariables.Add("logPath", CrossPlatform.PathCombine(Logger.LogDirectory, "web.thumbnails.log"));
|
||||
StartInfo.EnvironmentVariables.Add("savePath", Path.GetFullPath(savePath));
|
||||
|
||||
StartNode(cancellationToken);
|
||||
|
@ -13,6 +13,8 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="5.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="5.0.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -31,7 +31,8 @@ using System.Threading.Tasks;
|
||||
using ASC.Common;
|
||||
using ASC.Common.DependencyInjection;
|
||||
using ASC.Common.Logging;
|
||||
|
||||
using ASC.Common.Utils;
|
||||
|
||||
using Autofac;
|
||||
using Autofac.Extensions.DependencyInjection;
|
||||
|
||||
@ -43,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(Path.Combine(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<string, string>
|
||||
{
|
||||
{"pathToConf", path }
|
||||
}
|
||||
);
|
||||
})
|
||||
.ConfigureServices((hostContext, services) =>
|
||||
{
|
||||
services.AddMemoryCache();
|
||||
var diHelper = new DIHelper(services);
|
||||
LogNLogExtension.ConfigureLog(diHelper, "ASC.UrlShortener.Svc");
|
||||
services.AddHostedService<UrlShortenerServiceLauncher>();
|
||||
diHelper.TryAdd<UrlShortenerServiceLauncher>();
|
||||
})
|
||||
.ConfigureContainer<ContainerBuilder>((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<string, string>
|
||||
{
|
||||
{"pathToConf", path }
|
||||
}
|
||||
);
|
||||
})
|
||||
.ConfigureServices((hostContext, services) =>
|
||||
{
|
||||
services.AddMemoryCache();
|
||||
|
||||
var diHelper = new DIHelper(services);
|
||||
|
||||
LogNLogExtension.ConfigureLog(diHelper, "ASC.UrlShortener.Svc");
|
||||
services.AddHostedService<UrlShortenerServiceLauncher>();
|
||||
diHelper.TryAdd<UrlShortenerServiceLauncher>();
|
||||
})
|
||||
.ConfigureContainer<ContainerBuilder>((context, builder) =>
|
||||
{
|
||||
builder.Register(context.Configuration, false, false);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,35 +1,29 @@
|
||||
{
|
||||
"iisSettings": {
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:5015/",
|
||||
"sslPort": 0
|
||||
}
|
||||
},
|
||||
"profiles": {
|
||||
"IIS Express": {
|
||||
"commandName": "IISExpress",
|
||||
"launchBrowser": false,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"$STORAGE_ROOT": "../../../Data",
|
||||
"log__name": "urlshortener",
|
||||
"log__dir": "../../../Logs",
|
||||
"core__products__folder": "../../../products"
|
||||
}
|
||||
},
|
||||
"ASC.UrlShortener.Svc": {
|
||||
"Kestrel WebServer": {
|
||||
"commandName": "Project",
|
||||
"launchBrowser": false,
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"$STORAGE_ROOT": "../../../Data",
|
||||
"log__name": "urlshortener",
|
||||
"log__dir": "../../../Logs",
|
||||
"core__products__folder": "../../../products"
|
||||
"core__products__folder": "../../../products",
|
||||
"ASPNETCORE_URLS": "http://localhost:5017",
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
},
|
||||
"WSL 2 : Ubuntu 20.04": {
|
||||
"commandName": "WSL2",
|
||||
"launchBrowser": false,
|
||||
"environmentVariables": {
|
||||
"$STORAGE_ROOT": "../../../Data",
|
||||
"log__name": "urlshortener",
|
||||
"log__dir": "../../../Logs",
|
||||
"core__products__folder": "../../../products",
|
||||
"ASPNETCORE_URLS": "http://localhost:5017",
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"applicationUrl": "http://localhost:5015/"
|
||||
"distributionName": "Ubuntu-20.04"
|
||||
}
|
||||
}
|
||||
}
|
@ -116,7 +116,7 @@ namespace ASC.UrlShortener.Svc
|
||||
UseShellExecute = false,
|
||||
FileName = "node",
|
||||
WindowStyle = ProcessWindowStyle.Hidden,
|
||||
Arguments = string.Format("\"{0}\"", Path.GetFullPath(Path.Combine(hostEnvironment.ContentRootPath, path))),
|
||||
Arguments = string.Format("\"{0}\"", Path.GetFullPath(CrossPlatform.PathCombine(hostEnvironment.ContentRootPath, path))),
|
||||
WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory
|
||||
};
|
||||
|
||||
@ -146,7 +146,7 @@ namespace ASC.UrlShortener.Svc
|
||||
}
|
||||
}
|
||||
|
||||
startInfo.EnvironmentVariables.Add("logPath", Path.GetFullPath(Path.Combine(hostEnvironment.ContentRootPath, log.LogDirectory, "web.urlshortener.log")));
|
||||
startInfo.EnvironmentVariables.Add("logPath", Path.GetFullPath(CrossPlatform.PathCombine(hostEnvironment.ContentRootPath, log.LogDirectory, "web.urlshortener.log")));
|
||||
|
||||
return startInfo;
|
||||
}
|
||||
|
@ -4,6 +4,12 @@
|
||||
"Default": "Information",
|
||||
"Microsoft": "Warning",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
},
|
||||
"EventLog": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.Hosting.Lifetime": "Information"
|
||||
}
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
|
@ -35,6 +35,24 @@
|
||||
}
|
||||
],
|
||||
"instanceScope": "InstancePerLifetimeScope"
|
||||
},
|
||||
{
|
||||
"type": "ASC.Mail.Configuration.ProductEntryPoint, ASC.Mail",
|
||||
"services": [
|
||||
{
|
||||
"type": "ASC.Web.Core.IWebItem, ASC.Web.Core"
|
||||
}
|
||||
],
|
||||
"instanceScope": "InstancePerLifetimeScope"
|
||||
},
|
||||
{
|
||||
"type": "ASC.Calendar.Configuration.ProductEntryPoint, ASC.Calendar",
|
||||
"services": [
|
||||
{
|
||||
"type": "ASC.Web.Core.IWebItem, ASC.Web.Core"
|
||||
}
|
||||
],
|
||||
"instanceScope": "InstancePerLifetimeScope"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
9
config/nginx/onlyoffice-calendar.conf
Normal file
9
config/nginx/onlyoffice-calendar.conf
Normal file
@ -0,0 +1,9 @@
|
||||
server {
|
||||
listen 5017;
|
||||
root /var/www/products/ASC.Calendar/client;
|
||||
index index.html;
|
||||
|
||||
location / {
|
||||
try_files $uri /index.html =404;
|
||||
}
|
||||
}
|
9
config/nginx/onlyoffice-mail.conf
Normal file
9
config/nginx/onlyoffice-mail.conf
Normal file
@ -0,0 +1,9 @@
|
||||
server {
|
||||
listen 5016;
|
||||
root /var/www/products/ASC.Mail/client;
|
||||
index index.html;
|
||||
|
||||
location / {
|
||||
try_files $uri /index.html =404;
|
||||
}
|
||||
}
|
@ -90,6 +90,11 @@ server {
|
||||
root $public_root;
|
||||
try_files /offline/$basename /index.html =404;
|
||||
}
|
||||
|
||||
location ~* /thirdparty/ {
|
||||
root $public_root;
|
||||
try_files /thirdparty/third-party.html /index.html =404;
|
||||
}
|
||||
}
|
||||
|
||||
location /login {
|
||||
@ -150,6 +155,16 @@ server {
|
||||
proxy_pass http://localhost:5021;
|
||||
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
|
||||
}
|
||||
|
||||
location ~* /mail {
|
||||
proxy_pass http://localhost:5022;
|
||||
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
|
||||
}
|
||||
|
||||
location ~* /calendar {
|
||||
proxy_pass http://localhost:5023;
|
||||
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
|
||||
}
|
||||
}
|
||||
|
||||
location /storage {
|
||||
@ -292,6 +307,68 @@ server {
|
||||
try_files /$basename /index.html =404;
|
||||
}
|
||||
|
||||
location ~* (/httphandlers/filehandler.ashx|ChunkedUploader.ashx) {
|
||||
proxy_pass http://localhost:5007;
|
||||
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
|
||||
}
|
||||
}
|
||||
|
||||
location ~* /mail {
|
||||
#rewrite products/mail/(.*) /$1 break;
|
||||
proxy_pass http://localhost:5016;
|
||||
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
|
||||
|
||||
location ~* /sockjs-node {
|
||||
rewrite products/projects(.*)/sockjs-node/(.*) /$2/$3 break;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_set_header Host $host;
|
||||
|
||||
proxy_pass http://localhost:5016;
|
||||
|
||||
proxy_redirect off;
|
||||
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
}
|
||||
|
||||
location ~* /(manifest.json|service-worker.js|appIcon.png|bg-error.png) {
|
||||
root $public_root;
|
||||
try_files /$basename /index.html =404;
|
||||
}
|
||||
|
||||
location ~* (/httphandlers/filehandler.ashx|ChunkedUploader.ashx) {
|
||||
proxy_pass http://localhost:5007;
|
||||
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
|
||||
}
|
||||
}
|
||||
|
||||
location ~* /calendar {
|
||||
#rewrite products/calendar/(.*) /$1 break;
|
||||
proxy_pass http://localhost:5017;
|
||||
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
|
||||
|
||||
location ~* /sockjs-node {
|
||||
rewrite products/projects(.*)/sockjs-node/(.*) /$2/$3 break;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $remote_addr;
|
||||
proxy_set_header Host $host;
|
||||
|
||||
proxy_pass http://localhost:5017;
|
||||
|
||||
proxy_redirect off;
|
||||
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "upgrade";
|
||||
}
|
||||
|
||||
location ~* /(manifest.json|service-worker.js|appIcon.png|bg-error.png) {
|
||||
root $public_root;
|
||||
try_files /$basename /index.html =404;
|
||||
}
|
||||
|
||||
location ~* (/httphandlers/filehandler.ashx|ChunkedUploader.ashx) {
|
||||
proxy_pass http://localhost:5007;
|
||||
proxy_set_header X-REWRITER-URL $X_REWRITER_URL;
|
||||
|
@ -28,6 +28,14 @@
|
||||
"name": "🚀 @appserver/projects",
|
||||
"path": "products\\ASC.Projects\\Client"
|
||||
},
|
||||
{
|
||||
"name": "🚀 @appserver/mail",
|
||||
"path": "products\\ASC.Mail\\Client"
|
||||
},
|
||||
{
|
||||
"name": "🚀 @appserver/calendar",
|
||||
"path": "products\\ASC.Calendar\\Client"
|
||||
},
|
||||
{
|
||||
"name": "🚀 @appserver/studio",
|
||||
"path": "web\\ASC.Web.Client"
|
||||
|
@ -1,13 +1,18 @@
|
||||
{
|
||||
"version": "0.1.3",
|
||||
"version": "0.1.8",
|
||||
"npmClient": "yarn",
|
||||
"packages": [
|
||||
"packages/asc-web-components",
|
||||
"packages/asc-web-common",
|
||||
"web/ASC.Web.Login",
|
||||
"web/ASC.Web.Client",
|
||||
"web/ASC.Web.Editor",
|
||||
"products/ASC.People/Client",
|
||||
"products/ASC.Files/Client"
|
||||
"products/ASC.Files/Client",
|
||||
"products/ASC.CRM/Client",
|
||||
"products/ASC.Projects/Client",
|
||||
"products/ASC.Mail/Client",
|
||||
"products/ASC.Calendar/Client"
|
||||
],
|
||||
"useWorkspaces": true
|
||||
}
|
||||
|
@ -10,7 +10,9 @@
|
||||
"products/ASC.People/Client",
|
||||
"products/ASC.Files/Client",
|
||||
"products/ASC.CRM/Client",
|
||||
"products/ASC.Projects/Client"
|
||||
"products/ASC.Projects/Client",
|
||||
"products/ASC.Mail/Client",
|
||||
"products/ASC.Calendar/Client"
|
||||
],
|
||||
"scripts": {
|
||||
"wipe": "rimraf node_modules yarn.lock web/**/node_modules products/**/node_modules",
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user