Merge branch 'develop' into feature/new-context-menu
This commit is contained in:
commit
168abcf288
Binary file not shown.
BIN
.nuget/packages/AppLimit.CloudComputing.SharpBox.1.2.0.1.nupkg
Normal file
BIN
.nuget/packages/AppLimit.CloudComputing.SharpBox.1.2.0.1.nupkg
Normal file
Binary file not shown.
Binary file not shown.
BIN
.nuget/packages/Microsoft.Graph.Core.1.6.0.nupkg
Normal file
BIN
.nuget/packages/Microsoft.Graph.Core.1.6.0.nupkg
Normal file
Binary file not shown.
Binary file not shown.
BIN
.nuget/packages/Microsoft.OneDriveSDK.2.1.0.nupkg
Normal file
BIN
.nuget/packages/Microsoft.OneDriveSDK.2.1.0.nupkg
Normal file
Binary file not shown.
Binary file not shown.
BIN
.nuget/packages/Openstack.net.1.8.0.nupkg
Normal file
BIN
.nuget/packages/Openstack.net.1.8.0.nupkg
Normal file
Binary file not shown.
Binary file not shown.
BIN
.nuget/packages/Rackspace.1.0.0.nupkg
Normal file
BIN
.nuget/packages/Rackspace.1.0.0.nupkg
Normal file
Binary file not shown.
Binary file not shown.
BIN
.nuget/packages/SimpleRESTServicesNET60.1.4.0.nupkg
Normal file
BIN
.nuget/packages/SimpleRESTServicesNET60.1.4.0.nupkg
Normal file
Binary file not shown.
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 16
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 16.0.30413.136
|
VisualStudioVersion = 17.0.31903.59
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Files.Tests", "products\ASC.Files\Tests\ASC.Files.Tests.csproj", "{EFB99A37-EF25-4A0F-8D7A-786402B1554C}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Files.Tests", "products\ASC.Files\Tests\ASC.Files.Tests.csproj", "{EFB99A37-EF25-4A0F-8D7A-786402B1554C}"
|
||||||
EndProject
|
EndProject
|
||||||
@ -73,7 +73,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Webhooks.Tests", "commo
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Webhooks.Service", "common\services\ASC.Webhooks.Service\ASC.Webhooks.Service.csproj", "{23310CB9-1A14-4ED5-BF81-8BD38277FEFE}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Webhooks.Service", "common\services\ASC.Webhooks.Service\ASC.Webhooks.Service.csproj", "{23310CB9-1A14-4ED5-BF81-8BD38277FEFE}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ASC.Web.Api.Tests", "common\Tests\ASC.Web.Api.Tests\ASC.Web.Api.Tests.csproj", "{14823E93-C749-4069-9E0A-95E63DE0B254}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Web.Api.Tests", "common\Tests\ASC.Web.Api.Tests\ASC.Web.Api.Tests.csproj", "{14823E93-C749-4069-9E0A-95E63DE0B254}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Data.Backup.Core", "common\ASC.Data.Backup.Core\ASC.Data.Backup.Core.csproj", "{5E948877-52BD-42B9-95A9-0FF37931D0A5}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Data.Encryption", "common\ASC.Data.Encryption\ASC.Data.Encryption.csproj", "{9E572FE2-8C3C-46B2-A314-532F7198B3EB}"
|
||||||
|
EndProject
|
||||||
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.AuditTrail", "common\services\ASC.AuditTrail\ASC.AuditTrail.csproj", "{B53587B7-58F6-48A9-B122-69BEA3E2572A}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@ -209,10 +215,6 @@ Global
|
|||||||
{8FAD3D1B-3ADC-470C-9933-CAE1B95A8599}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{8FAD3D1B-3ADC-470C-9933-CAE1B95A8599}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{8FAD3D1B-3ADC-470C-9933-CAE1B95A8599}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{8FAD3D1B-3ADC-470C-9933-CAE1B95A8599}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{8FAD3D1B-3ADC-470C-9933-CAE1B95A8599}.Release|Any CPU.Build.0 = Release|Any CPU
|
{8FAD3D1B-3ADC-470C-9933-CAE1B95A8599}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{14823E93-C749-4069-9E0A-95E63DE0B254}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{14823E93-C749-4069-9E0A-95E63DE0B254}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{14823E93-C749-4069-9E0A-95E63DE0B254}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{14823E93-C749-4069-9E0A-95E63DE0B254}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{A0475D4F-29B7-490C-85C2-8AFD60118B35}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{A0475D4F-29B7-490C-85C2-8AFD60118B35}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{A0475D4F-29B7-490C-85C2-8AFD60118B35}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{A0475D4F-29B7-490C-85C2-8AFD60118B35}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{A0475D4F-29B7-490C-85C2-8AFD60118B35}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{A0475D4F-29B7-490C-85C2-8AFD60118B35}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
@ -224,7 +226,23 @@ Global
|
|||||||
{23310CB9-1A14-4ED5-BF81-8BD38277FEFE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{23310CB9-1A14-4ED5-BF81-8BD38277FEFE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{23310CB9-1A14-4ED5-BF81-8BD38277FEFE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{23310CB9-1A14-4ED5-BF81-8BD38277FEFE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{23310CB9-1A14-4ED5-BF81-8BD38277FEFE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{23310CB9-1A14-4ED5-BF81-8BD38277FEFE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{23310CB9-1A14-4ED5-BF81-8BD38277FEFE}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection
|
{14823E93-C749-4069-9E0A-95E63DE0B254}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{14823E93-C749-4069-9E0A-95E63DE0B254}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{14823E93-C749-4069-9E0A-95E63DE0B254}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{14823E93-C749-4069-9E0A-95E63DE0B254}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{5E948877-52BD-42B9-95A9-0FF37931D0A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{5E948877-52BD-42B9-95A9-0FF37931D0A5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{5E948877-52BD-42B9-95A9-0FF37931D0A5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{5E948877-52BD-42B9-95A9-0FF37931D0A5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{9E572FE2-8C3C-46B2-A314-532F7198B3EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{9E572FE2-8C3C-46B2-A314-532F7198B3EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{9E572FE2-8C3C-46B2-A314-532F7198B3EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{9E572FE2-8C3C-46B2-A314-532F7198B3EB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{B53587B7-58F6-48A9-B122-69BEA3E2572A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{B53587B7-58F6-48A9-B122-69BEA3E2572A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{B53587B7-58F6-48A9-B122-69BEA3E2572A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{B53587B7-58F6-48A9-B122-69BEA3E2572A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
Platform for building your own scalable online office with ONLYOFFICE modules
|
Platform for building your own scalable online office with ONLYOFFICE modules
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
App Server is a platform for building your own online office by connecting ONLYOFFICE modules packed as separate apps.
|
App Server is a platform for building your own online office by connecting ONLYOFFICE modules packaged as separate apps.
|
||||||
|
|
||||||
## How to install
|
## How to install
|
||||||
[coming soon]
|
[coming soon]
|
||||||
@ -35,4 +35,4 @@ Components source code - [https://github.com/ONLYOFFICE/AppComponents](https://g
|
|||||||
|
|
||||||
## User feedback and support
|
## User feedback and support
|
||||||
|
|
||||||
If you have any problems or question about App Server, use the issues section here, in this repository.
|
If you have any problems or questions about App Server, use the issues section here, in this repository.
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
|
@echo off
|
||||||
|
|
||||||
PUSHD %~dp0..
|
PUSHD %~dp0..
|
||||||
dotnet build ASC.Web.slnf /fl1 /flp1:LogFile=build/ASC.Web.log;Verbosity=Normal
|
dotnet build ASC.Web.slnf /fl1 /flp1:LogFile=build/ASC.Web.log;Verbosity=Normal
|
||||||
@echo off
|
|
||||||
echo.
|
echo.
|
||||||
echo Install nodejs projects dependencies...
|
echo Install nodejs projects dependencies...
|
||||||
echo.
|
echo.
|
||||||
@ -15,6 +16,8 @@ if %errorlevel% == 0 (
|
|||||||
|
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
|
POPD
|
||||||
|
|
||||||
if "%1"=="nopause" goto start
|
if "%1"=="nopause" goto start
|
||||||
pause
|
pause
|
||||||
:start
|
:start
|
@ -1,18 +1,27 @@
|
|||||||
|
@echo off
|
||||||
|
|
||||||
|
echo "##########################################################"
|
||||||
|
echo "######### Start build and deploy #######################"
|
||||||
|
echo "##########################################################"
|
||||||
|
|
||||||
|
echo.
|
||||||
|
|
||||||
PUSHD %~dp0
|
PUSHD %~dp0
|
||||||
call runasadmin.bat "%~dpnx0"
|
call runasadmin.bat "%~dpnx0"
|
||||||
|
|
||||||
if %errorlevel% == 0 (
|
if %errorlevel% == 0 (
|
||||||
|
|
||||||
call start\stop.bat
|
call start\stop.bat nopause
|
||||||
|
|
||||||
PUSHD %~dp0..
|
|
||||||
|
|
||||||
echo "FRONT-END (for start run command 'yarn start' inside the root folder)"
|
echo "FRONT-END (for start run command 'yarn start' inside the root folder)"
|
||||||
call build\build.frontend.bat
|
call build.frontend.bat nopause
|
||||||
|
|
||||||
echo "BACK-END"
|
echo "BACK-END"
|
||||||
call build\build.backend.bat
|
call build.backend.bat nopause
|
||||||
|
|
||||||
start /b call build\start\start.bat
|
call start\start.bat nopause
|
||||||
|
|
||||||
|
echo.
|
||||||
|
|
||||||
pause
|
pause
|
||||||
)
|
)
|
@ -2,3 +2,5 @@ PUSHD %~dp0..
|
|||||||
|
|
||||||
REM call yarn wipe
|
REM call yarn wipe
|
||||||
call yarn install
|
call yarn install
|
||||||
|
|
||||||
|
POPD
|
@ -48,15 +48,24 @@ powershell -Command "(gc build\deploy\nginx\sites-enabled\onlyoffice-studio.conf
|
|||||||
|
|
||||||
REM restart nginx
|
REM restart nginx
|
||||||
echo service nginx stop
|
echo service nginx stop
|
||||||
call sc stop nginx
|
call sc stop nginx > nul
|
||||||
|
|
||||||
REM sleep 5 seconds
|
REM sleep 5 seconds
|
||||||
call ping 127.0.0.1 -n 6 > nul
|
call ping 127.0.0.1 -n 6 > nul
|
||||||
|
|
||||||
echo service nginx start
|
echo service nginx start
|
||||||
call sc start nginx
|
call sc start nginx > nul
|
||||||
|
|
||||||
|
if NOT %errorlevel% == 0 (
|
||||||
|
echo Couldn't restarte Onlyoffice%%~nf service
|
||||||
)
|
)
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
echo.
|
||||||
|
|
||||||
|
POPD
|
||||||
|
|
||||||
if "%1"=="nopause" goto start
|
if "%1"=="nopause" goto start
|
||||||
pause
|
pause
|
||||||
:start
|
:start
|
@ -1,3 +1,9 @@
|
|||||||
|
echo "##########################################################"
|
||||||
|
echo "######### Start build and deploy Personal ##############"
|
||||||
|
echo "##########################################################"
|
||||||
|
|
||||||
|
echo.
|
||||||
|
|
||||||
PUSHD %~dp0
|
PUSHD %~dp0
|
||||||
call runasadmin.bat "%~dpnx0"
|
call runasadmin.bat "%~dpnx0"
|
||||||
if %errorlevel% == 0 (
|
if %errorlevel% == 0 (
|
||||||
|
@ -1,4 +1,11 @@
|
|||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
|
echo "##########################################################"
|
||||||
|
echo "######### Start build and deploy #######################"
|
||||||
|
echo "##########################################################"
|
||||||
|
|
||||||
|
echo.
|
||||||
|
|
||||||
PUSHD %~dp0
|
PUSHD %~dp0
|
||||||
setlocal EnableDelayedExpansion
|
setlocal EnableDelayedExpansion
|
||||||
|
|
||||||
@ -8,15 +15,15 @@ if %errorlevel% == 0 (
|
|||||||
|
|
||||||
call start\stop.bat nopause
|
call start\stop.bat nopause
|
||||||
|
|
||||||
PUSHD %~dp0..
|
|
||||||
|
|
||||||
echo "FRONT-END static"
|
echo "FRONT-END static"
|
||||||
call build\build.static.bat nopause
|
call build.static.bat nopause
|
||||||
|
|
||||||
echo "BACK-END"
|
echo "BACK-END"
|
||||||
call build\build.backend.bat nopause
|
call build.backend.bat nopause
|
||||||
|
|
||||||
call build\start\start.bat nopause
|
call start\start.bat nopause
|
||||||
|
|
||||||
|
echo.
|
||||||
|
|
||||||
pause
|
pause
|
||||||
)
|
)
|
@ -36,7 +36,7 @@ BASE_DIR="/var/www/${PRODUCT}"
|
|||||||
PATH_TO_CONF="/etc/onlyoffice/${PRODUCT}"
|
PATH_TO_CONF="/etc/onlyoffice/${PRODUCT}"
|
||||||
STORAGE_ROOT="${PATH_TO_CONF}/data"
|
STORAGE_ROOT="${PATH_TO_CONF}/data"
|
||||||
LOG_DIR="/var/log/onlyoffice/${PRODUCT}"
|
LOG_DIR="/var/log/onlyoffice/${PRODUCT}"
|
||||||
DOTNET_RUN="/usr/bin/dotnet"
|
DOTNET_RUN="/usr/share/dotnet/dotnet"
|
||||||
APP_URLS="http://0.0.0.0"
|
APP_URLS="http://0.0.0.0"
|
||||||
ENVIRONMENT=" --ENVIRONMENT=production"
|
ENVIRONMENT=" --ENVIRONMENT=production"
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ WORKDIR ${BUILD_PATH}/products/ASC.Files/service/
|
|||||||
COPY --chown=onlyoffice:onlyoffice docker-entrypoint.sh .
|
COPY --chown=onlyoffice:onlyoffice docker-entrypoint.sh .
|
||||||
COPY --from=base --chown=onlyoffice:onlyoffice ${BUILD_PATH}/services/ASC.Files.Service/service/ .
|
COPY --from=base --chown=onlyoffice:onlyoffice ${BUILD_PATH}/services/ASC.Files.Service/service/ .
|
||||||
|
|
||||||
CMD ["ASC.Files.Service.dll", "ASC.Files.Service", "core:products:folder=/var/www/products/", "core:products:subfolder=server"]
|
CMD ["ASC.Files.Service.dll", "ASC.Files.Service", "core:products:folder=/var/www/products/", "core:products:subfolder=server", "disable_elastic=true"]
|
||||||
|
|
||||||
## ASC.Mail ##
|
## ASC.Mail ##
|
||||||
FROM builder AS mail
|
FROM builder AS mail
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
PARAMETERS=${PARAMETERS:-""}
|
||||||
# read parameters
|
# read parameters
|
||||||
if [ -n "$1" ]; then
|
if [ -n "$1" ]; then
|
||||||
DOTNET_RUN="${1}";
|
DOTNET_RUN="${1}";
|
||||||
@ -22,7 +22,6 @@ echo "#-------------------------------------#"
|
|||||||
|
|
||||||
PRODUCT=${PRODUCT:-"onlyoffice"}
|
PRODUCT=${PRODUCT:-"onlyoffice"}
|
||||||
BASE_DIR="/app/${PRODUCT}"
|
BASE_DIR="/app/${PRODUCT}"
|
||||||
PARAMETERS=""
|
|
||||||
PROXY_HOST=${PROXY_HOST:-"proxy"}
|
PROXY_HOST=${PROXY_HOST:-"proxy"}
|
||||||
SHEME=${SHEME:-"http"}
|
SHEME=${SHEME:-"http"}
|
||||||
SERVICE_PORT=${SERVICE_PORT:-"5050"}
|
SERVICE_PORT=${SERVICE_PORT:-"5050"}
|
||||||
|
@ -1,3 +1,18 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
export DOCKER_TAG=$DOCKER_TAG
|
export DOCKER_TAG=$DOCKER_TAG
|
||||||
|
BASE_NAME="appserver"
|
||||||
|
BUILD_NUMBER="$(date "+%Y%m%d%H")"
|
||||||
|
docker-compose -f build.yml push
|
||||||
|
|
||||||
|
# Get docker images name to array
|
||||||
|
arrayImagesName=($(docker image ls | grep "$DOCKER_TAG" | grep "$STATUS" | grep "$BASE_NAME" | awk '{print $1}' ))
|
||||||
|
|
||||||
|
# Modify docker image tag
|
||||||
|
for i in ${!arrayImagesName[@]}; do
|
||||||
|
echo " Modify ${arrayImagesName[$i]}:$DOCKER_TAG "
|
||||||
|
docker image tag ${arrayImagesName[$i]}:$DOCKER_TAG ${arrayImagesName[$i]}:$DOCKER_TAG-$BUILD_NUMBER
|
||||||
|
done
|
||||||
|
|
||||||
|
# Push the same images with a new tag
|
||||||
|
DOCKER_TAG=$DOCKER_TAG-$BUILD_NUMBER
|
||||||
docker-compose -f build.yml push
|
docker-compose -f build.yml push
|
||||||
|
@ -23,6 +23,5 @@ if '%errorlevel%' NEQ '0' (
|
|||||||
exit /B 1
|
exit /B 1
|
||||||
|
|
||||||
:gotAdmin
|
:gotAdmin
|
||||||
pushd "%CD%"
|
|
||||||
CD /D "%~dp0"
|
CD /D "%~dp0"
|
||||||
:--------------------------------------
|
:--------------------------------------
|
33
build/start/command.ps1
Normal file
33
build/start/command.ps1
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
$PSversionMajor = $PSVersionTable.PSVersion | sort-object major | ForEach-Object {$_.major}
|
||||||
|
$PSversionMinor = $PSVersionTable.PSVersion | sort-object minor | ForEach-Object {$_.minor}
|
||||||
|
|
||||||
|
if ($PSversionMajor -lt 7 -or $PSversionMinor -lt 2) {
|
||||||
|
Write-Error "Powershell version must be greater than or equal to 7.2. Press Enter to exit."
|
||||||
|
Pause
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
$WorkDir = "$(Split-Path -Parent $PSScriptRoot)\run";
|
||||||
|
$CommandName = "$($args[0])";
|
||||||
|
|
||||||
|
#Write-Output "Starting $($CommandName) services at time: $(Get-Date -Format HH:mm:ss)"
|
||||||
|
#Write-Output ""
|
||||||
|
|
||||||
|
Get-ChildItem -Path $WorkDir | ForEach-Object -ThrottleLimit 20 -Parallel {
|
||||||
|
$ServiceName = "Onlyoffice$([System.IO.Path]::GetFileNameWithoutExtension($_))";
|
||||||
|
|
||||||
|
switch ( $Using:CommandName )
|
||||||
|
{
|
||||||
|
"start" { Start-Service -InputObject $(Get-Service -Name "$ServiceName") }
|
||||||
|
"stop" { Stop-Service -InputObject $(Get-Service -Name "$ServiceName") }
|
||||||
|
"restart" { Restart-Service -InputObject $(Get-Service -Name "$ServiceName") }
|
||||||
|
}
|
||||||
|
|
||||||
|
if( $? )
|
||||||
|
{
|
||||||
|
Write-Output "$ServiceName $($Using:CommandName) service has been done"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#Write-Output ""
|
||||||
|
#Write-Output "End $($CommandName) services at time: $(Get-Date -Format HH:mm:ss)"
|
@ -3,11 +3,10 @@
|
|||||||
PUSHD %~dp0..
|
PUSHD %~dp0..
|
||||||
call runasadmin.bat "%~dpnx0"
|
call runasadmin.bat "%~dpnx0"
|
||||||
|
|
||||||
|
POPD
|
||||||
|
|
||||||
if %errorlevel% == 0 (
|
if %errorlevel% == 0 (
|
||||||
for /R "run\" %%f in (*.bat) do (
|
pwsh %~dp0/command.ps1 "restart"
|
||||||
call sc stop "Onlyoffice%%~nf"
|
|
||||||
call sc start "Onlyoffice%%~nf"
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
PUSHD %~dp0..
|
PUSHD %~dp0..
|
||||||
call runasadmin.bat "%~dpnx0"
|
call runasadmin.bat "%~dpnx0"
|
||||||
|
|
||||||
|
POPD
|
||||||
|
|
||||||
if %errorlevel% == 0 (
|
if %errorlevel% == 0 (
|
||||||
for /R "run\" %%f in (*.bat) do (
|
pwsh %~dp0/command.ps1 "start"
|
||||||
call sc start "Onlyoffice%%~nf"
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
PUSHD %~dp0..
|
PUSHD %~dp0..
|
||||||
call runasadmin.bat "%~dpnx0"
|
call runasadmin.bat "%~dpnx0"
|
||||||
|
|
||||||
|
POPD
|
||||||
|
|
||||||
if %errorlevel% == 0 (
|
if %errorlevel% == 0 (
|
||||||
for /R "run\" %%f in (*.bat) do (
|
pwsh %~dp0/command.ps1 "stop"
|
||||||
call sc stop "Onlyoffice%%~nf"
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
|
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
@ -17,7 +17,7 @@
|
|||||||
<PackageReference Include="AspNetCore.HealthChecks.NpgSql" Version="5.0.2" />
|
<PackageReference Include="AspNetCore.HealthChecks.NpgSql" Version="5.0.2" />
|
||||||
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="5.0.1" />
|
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="5.0.1" />
|
||||||
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.1" />
|
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.1" />
|
||||||
<PackageReference Include="NLog" Version="4.7.10" />
|
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="6.0.0" />
|
||||||
<PackageReference Include="NLog.Web.AspNetCore" Version="4.13.0" />
|
<PackageReference Include="NLog.Web.AspNetCore" Version="4.13.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ namespace ASC.Api.Core
|
|||||||
if (bool.TryParse(Configuration["core:products"], out var loadProducts))
|
if (bool.TryParse(Configuration["core:products"], out var loadProducts))
|
||||||
{
|
{
|
||||||
LoadProducts = loadProducts;
|
LoadProducts = loadProducts;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void ConfigureServices(IServiceCollection services)
|
public virtual void ConfigureServices(IServiceCollection services)
|
||||||
@ -71,18 +71,18 @@ namespace ASC.Api.Core
|
|||||||
DIHelper.Configure(services);
|
DIHelper.Configure(services);
|
||||||
|
|
||||||
Action<JsonOptions> jsonOptions = options =>
|
Action<JsonOptions> jsonOptions = options =>
|
||||||
{
|
{
|
||||||
options.JsonSerializerOptions.WriteIndented = false;
|
options.JsonSerializerOptions.WriteIndented = false;
|
||||||
options.JsonSerializerOptions.IgnoreNullValues = true;
|
options.JsonSerializerOptions.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull;
|
||||||
options.JsonSerializerOptions.Converters.Add(new ApiDateTimeConverter());
|
options.JsonSerializerOptions.Converters.Add(new ApiDateTimeConverter());
|
||||||
|
|
||||||
if (Converters != null)
|
if (Converters != null)
|
||||||
{
|
{
|
||||||
foreach (var c in Converters)
|
foreach (var c in Converters)
|
||||||
{
|
{
|
||||||
options.JsonSerializerOptions.Converters.Add(c);
|
options.JsonSerializerOptions.Converters.Add(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
services.AddControllers()
|
services.AddControllers()
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ProductVersion>9.0.30729</ProductVersion>
|
<ProductVersion>9.0.30729</ProductVersion>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<FileUpgradeFlags />
|
<FileUpgradeFlags />
|
||||||
<UpgradeBackupLocation />
|
<UpgradeBackupLocation />
|
||||||
<AssemblyTitle>ASC.Common</AssemblyTitle>
|
<AssemblyTitle>ASC.Common</AssemblyTitle>
|
||||||
@ -39,13 +39,12 @@
|
|||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="JWT" Version="6.1.4" />
|
<PackageReference Include="JWT" Version="6.1.4" />
|
||||||
<PackageReference Include="log4net" Version="2.0.11" />
|
<PackageReference Include="log4net" Version="2.0.11" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="5.0.5" />
|
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="6.0.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
|
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="2.2.5" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="5.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="6.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="5.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="5.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.0" />
|
||||||
<PackageReference Include="Microsoft.Windows.Compatibility" Version="5.0.2" />
|
<PackageReference Include="Microsoft.Windows.Compatibility" Version="6.0.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
|
||||||
<!-- <PackageReference Include="Microsoft.CodeQuality.Analyzers" Version="2.9.4">
|
<!-- <PackageReference Include="Microsoft.CodeQuality.Analyzers" Version="2.9.4">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
@ -56,7 +55,6 @@
|
|||||||
</PackageReference> -->
|
</PackageReference> -->
|
||||||
<PackageReference Include="NLog" Version="4.7.10" />
|
<PackageReference Include="NLog" Version="4.7.10" />
|
||||||
<PackageReference Include="NVelocity" Version="1.2.0" />
|
<PackageReference Include="NVelocity" Version="1.2.0" />
|
||||||
<PackageReference Include="System.Runtime.Loader" Version="4.3.0" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Protobuf Include="protos\AscCacheItem.proto" />
|
<Protobuf Include="protos\AscCacheItem.proto" />
|
||||||
|
@ -50,12 +50,14 @@ namespace ASC.Security.Cryptography
|
|||||||
|
|
||||||
public byte[] Encrypt(byte[] data)
|
public byte[] Encrypt(byte[] data)
|
||||||
{
|
{
|
||||||
var hasher = Rijndael.Create();
|
var hasher = Aes.Create();
|
||||||
hasher.Key = EKey();
|
hasher.Key = EKey();
|
||||||
hasher.IV = new byte[hasher.BlockSize >> 3];
|
hasher.IV = new byte[hasher.BlockSize >> 3];
|
||||||
|
|
||||||
using var ms = new MemoryStream();
|
using var ms = new MemoryStream();
|
||||||
using var ss = new CryptoStream(ms, hasher.CreateEncryptor(), CryptoStreamMode.Write);
|
using var ss = new CryptoStream(ms, hasher.CreateEncryptor(), CryptoStreamMode.Write);
|
||||||
ss.Write(data, 0, data.Length);
|
using var plainTextStream = new MemoryStream(data);
|
||||||
|
plainTextStream.CopyTo(ss);
|
||||||
ss.FlushFinalBlock();
|
ss.FlushFinalBlock();
|
||||||
hasher.Clear();
|
hasher.Clear();
|
||||||
return ms.ToArray();
|
return ms.ToArray();
|
||||||
@ -63,23 +65,24 @@ namespace ASC.Security.Cryptography
|
|||||||
|
|
||||||
public string Decrypt(string data)
|
public string Decrypt(string data)
|
||||||
{
|
{
|
||||||
return Encoding.UTF8.GetString(Decrypt(Convert.FromBase64String(data)));
|
return Decrypt(Convert.FromBase64String(data));
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] Decrypt(byte[] data)
|
public string Decrypt(byte[] data)
|
||||||
{
|
{
|
||||||
var hasher = Rijndael.Create();
|
var hasher = Aes.Create();
|
||||||
hasher.Key = EKey();
|
hasher.Key = EKey();
|
||||||
hasher.IV = new byte[hasher.BlockSize >> 3];
|
hasher.IV = new byte[hasher.BlockSize >> 3];
|
||||||
|
|
||||||
using var ms = new MemoryStream(data);
|
using (MemoryStream msDecrypt = new MemoryStream(data))
|
||||||
using var ss = new CryptoStream(ms, hasher.CreateDecryptor(), CryptoStreamMode.Read);
|
using (CryptoStream csDecrypt = new CryptoStream(msDecrypt, hasher.CreateDecryptor(), CryptoStreamMode.Read))
|
||||||
var buffer = new byte[data.Length];
|
using (StreamReader srDecrypt = new StreamReader(csDecrypt))
|
||||||
var size = ss.Read(buffer, 0, buffer.Length);
|
{
|
||||||
hasher.Clear();
|
|
||||||
var newBuffer = new byte[size];
|
// Read the decrypted bytes from the decrypting stream
|
||||||
Array.Copy(buffer, newBuffer, size);
|
// and place them in a string.
|
||||||
return newBuffer;
|
return srDecrypt.ReadToEnd();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] EKey()
|
private byte[] EKey()
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ProductVersion>9.0.30729</ProductVersion>
|
<ProductVersion>9.0.30729</ProductVersion>
|
||||||
<ProjectGuid>{A51D0454-4AFA-46DE-89D4-B03D37E1816C}</ProjectGuid>
|
<ProjectGuid>{A51D0454-4AFA-46DE-89D4-B03D37E1816C}</ProjectGuid>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<FileUpgradeFlags />
|
<FileUpgradeFlags />
|
||||||
<UpgradeBackupLocation />
|
<UpgradeBackupLocation />
|
||||||
<AssemblyTitle>ASC.Core.Common</AssemblyTitle>
|
<AssemblyTitle>ASC.Core.Common</AssemblyTitle>
|
||||||
@ -51,14 +51,13 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="AWSSDK.Core" Version="3.5.1.25" />
|
<PackageReference Include="AWSSDK.Core" Version="3.5.1.25" />
|
||||||
<PackageReference Include="AWSSDK.SimpleEmail" Version="3.5.0.27" />
|
<PackageReference Include="AWSSDK.SimpleEmail" Version="3.5.0.27" />
|
||||||
<PackageReference Include="EntityFramework" Version="6.4.4" />
|
|
||||||
<PackageReference Include="Grpc.Tools" Version="2.32.0">
|
<PackageReference Include="Grpc.Tools" Version="2.32.0">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="MailKit" Version="2.5.1" />
|
<PackageReference Include="MailKit" Version="2.5.1" />
|
||||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="5.0.2" />
|
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.0" />
|
||||||
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="5.0.0" />
|
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="6.0.0" />
|
||||||
<PackageReference Include="Telegram.Bot" Version="15.7.1" />
|
<PackageReference Include="Telegram.Bot" Version="15.7.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -28,7 +28,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net.Http;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.ServiceModel;
|
using System.ServiceModel;
|
||||||
@ -218,16 +218,17 @@ namespace ASC.Core.Billing
|
|||||||
{
|
{
|
||||||
var url = _billingDomain + method;
|
var url = _billingDomain + method;
|
||||||
|
|
||||||
var request = WebRequest.Create(url);
|
var request = new HttpRequestMessage();
|
||||||
request.Method = "POST";
|
request.RequestUri = new Uri(url);
|
||||||
request.Timeout = 60000;
|
request.Method = HttpMethod.Post;
|
||||||
request.ContentType = "application/json";
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(_billingKey))
|
if (!string.IsNullOrEmpty(_billingKey))
|
||||||
{
|
{
|
||||||
request.Headers.Add("Authorization", CreateAuthToken(_billingKey, _billingSecret));
|
request.Headers.Add("Authorization", CreateAuthToken(_billingKey, _billingSecret));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
using var httpClient = new HttpClient();
|
||||||
|
httpClient.Timeout = TimeSpan.FromMilliseconds(60000);
|
||||||
|
|
||||||
var data = new Dictionary<string, List<string>>();
|
var data = new Dictionary<string, List<string>>();
|
||||||
if (!string.IsNullOrEmpty(portalId))
|
if (!string.IsNullOrEmpty(portalId))
|
||||||
{
|
{
|
||||||
@ -244,35 +245,22 @@ namespace ASC.Core.Billing
|
|||||||
data[parameter.Item1].Add(parameter.Item2);
|
data[parameter.Item1].Add(parameter.Item2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var body = JsonSerializer.Serialize(data);
|
|
||||||
|
|
||||||
var bytes = Encoding.UTF8.GetBytes(body ?? "");
|
var body = JsonSerializer.Serialize(data);
|
||||||
request.ContentLength = bytes.Length;
|
request.Content = new StringContent(body, Encoding.UTF8, "application/json");
|
||||||
using (var stream = request.GetRequestStream())
|
|
||||||
{
|
|
||||||
stream.Write(bytes, 0, bytes.Length);
|
|
||||||
}
|
|
||||||
|
|
||||||
string result;
|
string result;
|
||||||
try
|
using (var response = httpClient.Send(request))
|
||||||
|
using (var stream = response.Content.ReadAsStream())
|
||||||
{
|
{
|
||||||
using (var response = request.GetResponse())
|
if (stream == null)
|
||||||
using (var stream = response.GetResponseStream())
|
|
||||||
{
|
{
|
||||||
if (stream == null)
|
throw new BillingNotConfiguredException("Billing response is null");
|
||||||
{
|
}
|
||||||
throw new BillingNotConfiguredException("Billing response is null");
|
using (var readStream = new StreamReader(stream))
|
||||||
}
|
{
|
||||||
using (var readStream = new StreamReader(stream))
|
result = readStream.ReadToEnd();
|
||||||
{
|
|
||||||
result = readStream.ReadToEnd();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
catch (WebException)
|
|
||||||
{
|
|
||||||
request.Abort();
|
|
||||||
throw;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(result))
|
if (string.IsNullOrEmpty(result))
|
||||||
|
@ -155,7 +155,7 @@ namespace ASC.Core.Common.Billing
|
|||||||
{
|
{
|
||||||
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
|
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
|
||||||
const string applicationJson = "application/json";
|
const string applicationJson = "application/json";
|
||||||
var httpClient = new HttpClient { BaseAddress = BaseAddress, Timeout = TimeSpan.FromMinutes(3) };
|
using var httpClient = new HttpClient { BaseAddress = BaseAddress, Timeout = TimeSpan.FromMinutes(3) };
|
||||||
httpClient.DefaultRequestHeaders.TryAddWithoutValidation("accept", applicationJson);
|
httpClient.DefaultRequestHeaders.TryAddWithoutValidation("accept", applicationJson);
|
||||||
httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", applicationJson);
|
httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", applicationJson);
|
||||||
httpClient.DefaultRequestHeaders.TryAddWithoutValidation("X-Avangate-Authentication", CreateAuthHeader());
|
httpClient.DefaultRequestHeaders.TryAddWithoutValidation("X-Avangate-Authentication", CreateAuthHeader());
|
||||||
|
@ -330,7 +330,7 @@ namespace ASC.Core.Billing
|
|||||||
if (BillingClient.Configured)
|
if (BillingClient.Configured)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var quotas = QuotaService.GetTenantQuotas();
|
var quotas = QuotaService.GetTenantQuotas();
|
||||||
var client = GetBillingClient();
|
var client = GetBillingClient();
|
||||||
foreach (var pi in client.GetPayments(GetPortalId(tenantId)))
|
foreach (var pi in client.GetPayments(GetPortalId(tenantId)))
|
||||||
@ -483,7 +483,7 @@ namespace ASC.Core.Billing
|
|||||||
var r = CoreDbContext.Tariffs
|
var r = CoreDbContext.Tariffs
|
||||||
.Where(r => r.Tenant == tenant)
|
.Where(r => r.Tenant == tenant)
|
||||||
.OrderByDescending(r => r.Id)
|
.OrderByDescending(r => r.Id)
|
||||||
.SingleOrDefault();
|
.FirstOrDefault();
|
||||||
|
|
||||||
if (r == null) return Tariff.CreateDefault();
|
if (r == null) return Tariff.CreateDefault();
|
||||||
|
|
||||||
|
@ -28,6 +28,7 @@ using System;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using System.Net.Http;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
using ASC.Common.Module;
|
using ASC.Common.Module;
|
||||||
@ -78,16 +79,21 @@ namespace ASC.Core.Configuration
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var request = WebRequest.Create("http://169.254.169.254/latest/meta-data/public-hostname");
|
var request = new HttpRequestMessage();
|
||||||
request.Timeout = 5000;
|
request.RequestUri = new Uri("http://169.254.169.254/latest/meta-data/public-hostname");
|
||||||
using var responce = request.GetResponse();
|
request.Method = HttpMethod.Get;
|
||||||
using var stream = responce.GetResponseStream();
|
|
||||||
|
using var httpClient = new HttpClient();
|
||||||
|
httpClient.Timeout = TimeSpan.FromMilliseconds(5000);
|
||||||
|
|
||||||
|
using var responce = httpClient.Send(request);
|
||||||
|
using var stream = responce.Content.ReadAsStream();
|
||||||
using var reader = new StreamReader(stream);
|
using var reader = new StreamReader(stream);
|
||||||
return reader.ReadToEnd();
|
return reader.ReadToEnd();
|
||||||
}
|
}
|
||||||
catch (WebException ex)
|
catch (HttpRequestException ex)
|
||||||
{
|
{
|
||||||
if (ex.Status == WebExceptionStatus.ProtocolError)
|
if (ex.StatusCode == HttpStatusCode.NotFound || ex.StatusCode == HttpStatusCode.Conflict)
|
||||||
{
|
{
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
@ -27,8 +27,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.Net.Http;
|
||||||
using System.Net;
|
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@ -40,8 +39,6 @@ using ASC.Core.Billing;
|
|||||||
using Microsoft.AspNetCore.WebUtilities;
|
using Microsoft.AspNetCore.WebUtilities;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
|
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
|
|
||||||
namespace ASC.Core
|
namespace ASC.Core
|
||||||
{
|
{
|
||||||
@ -110,21 +107,15 @@ namespace ASC.Core
|
|||||||
|
|
||||||
var now = DateTime.UtcNow;
|
var now = DateTime.UtcNow;
|
||||||
var actionUrl = "/partnerapi/ActivateKey?code=" + HttpUtility.UrlEncode(key) + "&portal=" + HttpUtility.UrlEncode(TenantManager.GetCurrentTenant().TenantAlias);
|
var actionUrl = "/partnerapi/ActivateKey?code=" + HttpUtility.UrlEncode(key) + "&portal=" + HttpUtility.UrlEncode(TenantManager.GetCurrentTenant().TenantAlias);
|
||||||
using var webClient = new WebClient();
|
|
||||||
webClient.Headers.Add("Authorization", GetPartnerAuthHeader(actionUrl));
|
var request = new HttpRequestMessage();
|
||||||
try
|
request.Headers.Add("Authorization", GetPartnerAuthHeader(actionUrl));
|
||||||
{
|
request.RequestUri = new Uri(partnerUrl + actionUrl);
|
||||||
webClient.DownloadData(partnerUrl + actionUrl);
|
|
||||||
}
|
using var httpClient = new HttpClient();
|
||||||
catch (WebException we)
|
|
||||||
{
|
using var response = httpClient.Send(request);
|
||||||
var error = GetException(we);
|
|
||||||
if (error != null)
|
|
||||||
{
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
tariffService.ClearCache(TenantManager.GetCurrentTenant().TenantId);
|
tariffService.ClearCache(TenantManager.GetCurrentTenant().TenantId);
|
||||||
|
|
||||||
var timeout = DateTime.UtcNow - now - TimeSpan.FromSeconds(5);
|
var timeout = DateTime.UtcNow - now - TimeSpan.FromSeconds(5);
|
||||||
@ -145,27 +136,5 @@ namespace ASC.Core
|
|||||||
return string.Format("ASC :{0}:{1}", now, hash);
|
return string.Format("ASC :{0}:{1}", now, hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Exception GetException(WebException we)
|
|
||||||
{
|
|
||||||
var response = (HttpWebResponse)we.Response;
|
|
||||||
if (response.StatusCode == HttpStatusCode.InternalServerError)
|
|
||||||
{
|
|
||||||
using var stream = response.GetResponseStream();
|
|
||||||
using var reader = new StreamReader(stream, Encoding.UTF8);
|
|
||||||
var result = reader.ReadToEnd();
|
|
||||||
var excInfo = JsonConvert.DeserializeObject<ExceptionJson>(result);
|
|
||||||
return (Exception)Activator.CreateInstance(Type.GetType(excInfo.exceptionType, true), excInfo.exceptionMessage);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private class ExceptionJson
|
|
||||||
{
|
|
||||||
public string message = null;
|
|
||||||
public string exceptionMessage = null;
|
|
||||||
public string exceptionType = null;
|
|
||||||
public string stackTrace = null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace ASC.Core.Common.EF.Model
|
namespace ASC.Core.Common.EF.Model
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace ASC.Core.Common.EF.Model
|
namespace ASC.Core.Common.EF.Model
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace ASC.Core.Common.EF.Model.Mail
|
namespace ASC.Core.Common.EF.Model.Mail
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace ASC.Core.Common.EF.Model.Resource
|
namespace ASC.Core.Common.EF.Model.Resource
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace ASC.Core.Common.EF.Model
|
namespace ASC.Core.Common.EF.Model
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace ASC.Core.Common.EF.Model
|
namespace ASC.Core.Common.EF.Model
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
|
|
||||||
using ASC.Core.Common.EF.Model;
|
using ASC.Core.Common.EF.Model;
|
||||||
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
namespace ASC.Core.Common.EF
|
namespace ASC.Core.Common.EF
|
||||||
{
|
{
|
||||||
|
@ -143,10 +143,7 @@ namespace ASC.Core.Encryption
|
|||||||
var array2 = new char[length];
|
var array2 = new char[length];
|
||||||
var num = 0;
|
var num = 0;
|
||||||
|
|
||||||
using (var rng = new RNGCryptoServiceProvider())
|
array = RandomNumberGenerator.GetBytes(length);
|
||||||
{
|
|
||||||
rng.GetBytes(array);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (var i = 0; i < length; i++)
|
for (var i = 0; i < length; i++)
|
||||||
{
|
{
|
||||||
|
@ -26,8 +26,9 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net.Http;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.ServiceModel;
|
using System.ServiceModel;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -363,13 +364,23 @@ namespace ASC.Core.Notify.Signalr
|
|||||||
{
|
{
|
||||||
if (!IsAvailable()) return "";
|
if (!IsAvailable()) return "";
|
||||||
|
|
||||||
using var webClient = new WebClient();
|
var request = new HttpRequestMessage();
|
||||||
|
request.Headers.Add("Authorization", CreateAuthToken());
|
||||||
|
request.Method = HttpMethod.Post;
|
||||||
|
request.RequestUri = new Uri(GetMethod(method));
|
||||||
|
|
||||||
var jsonData = JsonConvert.SerializeObject(data);
|
var jsonData = JsonConvert.SerializeObject(data);
|
||||||
Log.DebugFormat("Method:{0}, Data:{1}", method, jsonData);
|
Log.DebugFormat("Method:{0}, Data:{1}", method, jsonData);
|
||||||
webClient.Encoding = Encoding.UTF8;
|
|
||||||
webClient.Headers.Add("Authorization", CreateAuthToken());
|
request.Content = new StringContent(jsonData, Encoding.UTF8, "application/json");
|
||||||
webClient.Headers[HttpRequestHeader.ContentType] = "application/json";
|
|
||||||
return webClient.UploadString(GetMethod(method), jsonData);
|
using (var httpClient = new HttpClient())
|
||||||
|
using (var response = httpClient.Send(request))
|
||||||
|
using (var stream = response.Content.ReadAsStream())
|
||||||
|
using (var streamReader = new StreamReader(stream))
|
||||||
|
{
|
||||||
|
return streamReader.ReadToEnd();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private T MakeRequest<T>(string method, object data)
|
private T MakeRequest<T>(string method, object data)
|
||||||
|
@ -138,7 +138,7 @@ namespace ASC.Core.Common.Notify
|
|||||||
|
|
||||||
var buf = id.Concat(d).ToArray();
|
var buf = id.Concat(d).ToArray();
|
||||||
|
|
||||||
using var sha = new SHA256CryptoServiceProvider();
|
using var sha = SHA256.Create();
|
||||||
return Convert.ToBase64String(sha.ComputeHash(buf))
|
return Convert.ToBase64String(sha.ComputeHash(buf))
|
||||||
.Replace('+', '-').Replace('/', '_').Replace("=", ""); // make base64 url safe
|
.Replace('+', '-').Replace('/', '_').Replace("=", ""); // make base64 url safe
|
||||||
}
|
}
|
||||||
|
@ -58,68 +58,56 @@ namespace ASC.Core
|
|||||||
|
|
||||||
public static string GetV(string data, int keyno, bool reverse)
|
public static string GetV(string data, int keyno, bool reverse)
|
||||||
{
|
{
|
||||||
var hasher = Rijndael.Create();
|
var hasher = Aes.Create();
|
||||||
hasher.Key = keyno == 1 ? GetSK1(false) : GetSK2(false);
|
hasher.Key = keyno == 1 ? GetSK1(false) : GetSK2(false);
|
||||||
hasher.IV = new byte[hasher.BlockSize >> 3];
|
hasher.IV = new byte[hasher.BlockSize >> 3];
|
||||||
|
|
||||||
string result;
|
|
||||||
if (reverse)
|
if (reverse)
|
||||||
{
|
{
|
||||||
using var ms = new MemoryStream();
|
using var ms = new MemoryStream();
|
||||||
using var ss = new CryptoStream(ms, hasher.CreateEncryptor(), CryptoStreamMode.Write);
|
using var ss = new CryptoStream(ms, hasher.CreateEncryptor(), CryptoStreamMode.Write);
|
||||||
var buffer = Encoding.Unicode.GetBytes(data);
|
using var plainTextStream = new MemoryStream(Convert.FromBase64String(data));
|
||||||
ss.Write(buffer, 0, buffer.Length);
|
plainTextStream.CopyTo(ss);
|
||||||
ss.FlushFinalBlock();
|
ss.FlushFinalBlock();
|
||||||
hasher.Clear();
|
hasher.Clear();
|
||||||
result = Convert.ToBase64String(ms.ToArray());
|
return Convert.ToBase64String(ms.ToArray());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var bytes = Convert.FromBase64String(data);
|
using var ms = new MemoryStream(Convert.FromBase64String(data));
|
||||||
using var ms = new MemoryStream(bytes);
|
|
||||||
using var ss = new CryptoStream(ms, hasher.CreateDecryptor(), CryptoStreamMode.Read);
|
using var ss = new CryptoStream(ms, hasher.CreateDecryptor(), CryptoStreamMode.Read);
|
||||||
var buffer = new byte[bytes.Length];
|
using var plainTextStream = new MemoryStream();
|
||||||
var size = ss.Read(buffer, 0, buffer.Length);
|
ss.CopyTo(plainTextStream);
|
||||||
hasher.Clear();
|
hasher.Clear();
|
||||||
var newBuffer = new byte[size];
|
return Encoding.Unicode.GetString(plainTextStream.ToArray());
|
||||||
Array.Copy(buffer, newBuffer, size);
|
|
||||||
result = Encoding.Unicode.GetString(newBuffer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static byte[] GetV(byte[] data, int keyno, bool reverse)
|
internal static byte[] GetV(byte[] data, int keyno, bool reverse)
|
||||||
{
|
{
|
||||||
var hasher = Rijndael.Create();
|
var hasher = Aes.Create();
|
||||||
hasher.Key = keyno == 1 ? GetSK1(false) : GetSK2(false);
|
hasher.Key = keyno == 1 ? GetSK1(false) : GetSK2(false);
|
||||||
hasher.IV = new byte[hasher.BlockSize >> 3];
|
hasher.IV = new byte[hasher.BlockSize >> 3];
|
||||||
|
|
||||||
byte[] result;
|
|
||||||
if (reverse)
|
if (reverse)
|
||||||
{
|
{
|
||||||
using var ms = new MemoryStream();
|
using var ms = new MemoryStream();
|
||||||
using var ss = new CryptoStream(ms, hasher.CreateEncryptor(), CryptoStreamMode.Write);
|
using var ss = new CryptoStream(ms, hasher.CreateEncryptor(), CryptoStreamMode.Write);
|
||||||
var buffer = data;
|
using var plainTextStream = new MemoryStream(data);
|
||||||
ss.Write(buffer, 0, buffer.Length);
|
plainTextStream.CopyTo(ss);
|
||||||
ss.FlushFinalBlock();
|
ss.FlushFinalBlock();
|
||||||
hasher.Clear();
|
hasher.Clear();
|
||||||
result = ms.ToArray();
|
return ms.ToArray();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var bytes = data;
|
using var ms = new MemoryStream(data);
|
||||||
using var ms = new MemoryStream(bytes);
|
|
||||||
using var ss = new CryptoStream(ms, hasher.CreateDecryptor(), CryptoStreamMode.Read);
|
using var ss = new CryptoStream(ms, hasher.CreateDecryptor(), CryptoStreamMode.Read);
|
||||||
var buffer = new byte[bytes.Length];
|
using var plainTextStream = new MemoryStream();
|
||||||
var size = ss.Read(buffer, 0, buffer.Length);
|
ss.CopyTo(plainTextStream);
|
||||||
hasher.Clear();
|
hasher.Clear();
|
||||||
var newBuffer = new byte[size];
|
return plainTextStream.ToArray();
|
||||||
Array.Copy(buffer, newBuffer, size);
|
|
||||||
result = newBuffer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
<NoWarn>NU1701</NoWarn>
|
<NoWarn>NU1701</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@ -13,8 +13,6 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.1.0" />
|
|
||||||
<PackageReference Include="Google.Protobuf" Version="3.14.0" />
|
|
||||||
<PackageReference Include="Grpc" Version="2.32.0">
|
<PackageReference Include="Grpc" Version="2.32.0">
|
||||||
<TreatAsUsed>true</TreatAsUsed>
|
<TreatAsUsed>true</TreatAsUsed>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
@ -22,10 +20,7 @@
|
|||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="5.0.1" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="5.0.1" />
|
|
||||||
<PackageReference Include="MySql.Data" Version="8.0.23" />
|
<PackageReference Include="MySql.Data" Version="8.0.23" />
|
||||||
<PackageReference Include="SharpZipLib" Version="1.3.2" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -24,8 +24,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
using ASC.Common.Utils;
|
using ASC.Common.Utils;
|
||||||
using ASC.Data.Backup.Tasks.Modules;
|
using ASC.Data.Backup.Tasks.Modules;
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
|
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
@ -187,15 +187,14 @@ namespace ASC.Data.Encryption
|
|||||||
|
|
||||||
public SymmetricAlgorithm GetCryptographyAlgorithm()
|
public SymmetricAlgorithm GetCryptographyAlgorithm()
|
||||||
{
|
{
|
||||||
return new RijndaelManaged
|
var aes = Aes.Create();
|
||||||
{
|
aes.KeySize = keySize;
|
||||||
KeySize = keySize,
|
aes.BlockSize = blockSize;
|
||||||
BlockSize = blockSize,
|
aes.Key = Key;
|
||||||
Key = Key,
|
aes.IV = IV;
|
||||||
IV = IV,
|
aes.Padding = PaddingMode.PKCS7;
|
||||||
Padding = PaddingMode.PKCS7,
|
aes.Mode = CipherMode.CBC;
|
||||||
Mode = CipherMode.CBC
|
return aes;
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ComputeAndWriteHmacHash(Stream stream)
|
public void ComputeAndWriteHmacHash(Stream stream)
|
||||||
@ -245,10 +244,7 @@ namespace ASC.Data.Encryption
|
|||||||
{
|
{
|
||||||
var random = new byte[length];
|
var random = new byte[length];
|
||||||
|
|
||||||
using (var rng = new RNGCryptoServiceProvider())
|
random = RandomNumberGenerator.GetBytes(length);
|
||||||
{
|
|
||||||
rng.GetBytes(random);
|
|
||||||
}
|
|
||||||
|
|
||||||
return random;
|
return random;
|
||||||
}
|
}
|
||||||
@ -269,7 +265,7 @@ namespace ASC.Data.Encryption
|
|||||||
{
|
{
|
||||||
var hmacKey = new byte[hmacKeyLength];
|
var hmacKey = new byte[hmacKeyLength];
|
||||||
|
|
||||||
using (var sha512 = new SHA512Managed())
|
using (var sha512 = SHA512.Create())
|
||||||
{
|
{
|
||||||
hmacKey = sha512.ComputeHash(Key);
|
hmacKey = sha512.ComputeHash(Key);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||||
@ -10,10 +10,6 @@
|
|||||||
<NoWarn>1701;1702;NU1701;</NoWarn>
|
<NoWarn>1701;1702;NU1701;</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="UAParser" Version="3.1.44" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\web\ASC.Web.Core\ASC.Web.Core.csproj" />
|
<ProjectReference Include="..\..\web\ASC.Web.Core\ASC.Web.Core.csproj" />
|
||||||
<ProjectReference Include="..\ASC.Data.Storage\ASC.Data.Storage.csproj" />
|
<ProjectReference Include="..\ASC.Data.Storage\ASC.Data.Storage.csproj" />
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
|
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
@ -42,9 +42,7 @@
|
|||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="5.0.5" />
|
<PackageReference Include="openstack.net" Version="1.8.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Http.Features" Version="5.0.5" />
|
|
||||||
<PackageReference Include="openstack.net" Version="1.7.9" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -83,7 +83,6 @@ namespace ASC.Data.Storage.DiscStorage
|
|||||||
{
|
{
|
||||||
await context.Response.SendFileAsync(path);
|
await context.Response.SendFileAsync(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
context.Response.ContentType = MimeMapping.GetMimeMapping(path);
|
context.Response.ContentType = MimeMapping.GetMimeMapping(path);
|
||||||
//TODO
|
//TODO
|
||||||
//context.Response.Cache.SetVaryByCustom("*");
|
//context.Response.Cache.SetVaryByCustom("*");
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
using ASC.Common.Utils;
|
using ASC.Common.Utils;
|
||||||
|
|
||||||
|
@ -31,7 +31,6 @@ using System.Collections.Generic;
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@ -760,32 +759,17 @@ namespace ASC.Data.Storage.GoogleCloud
|
|||||||
|
|
||||||
var totalBytes = "*";
|
var totalBytes = "*";
|
||||||
|
|
||||||
var BufferSize = 2 * 4096;
|
|
||||||
|
|
||||||
if (chunkLength != defaultChunkSize)
|
if (chunkLength != defaultChunkSize)
|
||||||
totalBytes = Convert.ToString((chunkNumber - 1) * defaultChunkSize + chunkLength);
|
totalBytes = Convert.ToString((chunkNumber - 1) * defaultChunkSize + chunkLength);
|
||||||
|
|
||||||
var contentRangeHeader = string.Format("bytes {0}-{1}/{2}", bytesRangeStart, bytesRangeEnd, totalBytes);
|
var contentRangeHeader = string.Format("bytes {0}-{1}/{2}", bytesRangeStart, bytesRangeEnd, totalBytes);
|
||||||
|
|
||||||
var request = HttpWebRequest.CreateHttp(uploadUri);
|
var request = new HttpRequestMessage();
|
||||||
|
request.RequestUri = new Uri(uploadUri);
|
||||||
request.Method = HttpMethod.Put.ToString();
|
request.Method = HttpMethod.Put;
|
||||||
request.ContentLength = chunkLength;
|
|
||||||
request.Headers.Add("Content-Range", contentRangeHeader);
|
request.Headers.Add("Content-Range", contentRangeHeader);
|
||||||
|
request.Content = new StreamContent(stream);
|
||||||
|
|
||||||
using (var rs = request.GetRequestStream())
|
|
||||||
{
|
|
||||||
var buffer = new byte[BufferSize];
|
|
||||||
|
|
||||||
int readed;
|
|
||||||
|
|
||||||
while ((readed = stream.Read(buffer, 0, BufferSize)) != 0)
|
|
||||||
{
|
|
||||||
rs.Write(buffer, 0, readed);
|
|
||||||
}
|
|
||||||
|
|
||||||
stream.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
long MAX_RETRIES = 100;
|
long MAX_RETRIES = 100;
|
||||||
int millisecondsTimeout;
|
int millisecondsTimeout;
|
||||||
@ -798,16 +782,15 @@ namespace ASC.Data.Storage.GoogleCloud
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var response = request.GetResponse();
|
using var httpClient = new HttpClient();
|
||||||
var status = ((HttpWebResponse)response).StatusCode;
|
using var response = httpClient.Send(request);
|
||||||
|
var status = response.StatusCode;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
catch (WebException ex)
|
catch (HttpRequestException ex)
|
||||||
{
|
{
|
||||||
var response = (HttpWebResponse)ex.Response;
|
var status = (int)ex.StatusCode;
|
||||||
|
|
||||||
var status = (int)response.StatusCode;
|
|
||||||
|
|
||||||
if (status == 408 || status == 500 || status == 502 || status == 503 || status == 504)
|
if (status == 408 || status == 500 || status == 502 || status == 503 || status == 504)
|
||||||
{
|
{
|
||||||
|
@ -30,6 +30,7 @@ using System.Collections.Generic;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using System.Net.Http;
|
||||||
|
|
||||||
using ASC.Common;
|
using ASC.Common;
|
||||||
using ASC.Common.Logging;
|
using ASC.Common.Logging;
|
||||||
@ -237,10 +238,13 @@ namespace ASC.Data.Storage
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var request = (HttpWebRequest)WebRequest.Create(path);
|
var request = new HttpRequestMessage();
|
||||||
request.Method = "HEAD";
|
request.RequestUri = new Uri(path);
|
||||||
using var resp = (HttpWebResponse)request.GetResponse();
|
request.Method = HttpMethod.Head;
|
||||||
return resp.StatusCode == HttpStatusCode.OK;
|
using var httpClient = new HttpClient();
|
||||||
|
using var response = httpClient.Send(request);
|
||||||
|
|
||||||
|
return response.StatusCode == HttpStatusCode.OK;
|
||||||
}
|
}
|
||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<NoWarn>NU1701</NoWarn>
|
<NoWarn>NU1701</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ namespace ASC.FederatedLogin.Helpers
|
|||||||
ConsumerFactory = consumerFactory;
|
ConsumerFactory = consumerFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string RequestCode<T>(string scope = null, Dictionary<string, string> additionalArgs = null) where T : Consumer, IOAuthProvider, new()
|
public string RequestCode<T>(string scope = null, IDictionary<string, string> additionalArgs = null, IDictionary<string, string> additionalStateArgs = null) where T : Consumer, IOAuthProvider, new()
|
||||||
{
|
{
|
||||||
var loginProvider = ConsumerFactory.Get<T>();
|
var loginProvider = ConsumerFactory.Get<T>();
|
||||||
var requestUrl = loginProvider.CodeUrl;
|
var requestUrl = loginProvider.CodeUrl;
|
||||||
@ -67,7 +67,20 @@ namespace ASC.FederatedLogin.Helpers
|
|||||||
if (!string.IsNullOrEmpty(scope)) query += $"&scope={HttpUtility.UrlEncode(scope)}";
|
if (!string.IsNullOrEmpty(scope)) query += $"&scope={HttpUtility.UrlEncode(scope)}";
|
||||||
|
|
||||||
var u = HttpContextAccessor.HttpContext.Request.GetUrlRewriter();
|
var u = HttpContextAccessor.HttpContext.Request.GetUrlRewriter();
|
||||||
var state = HttpUtility.UrlEncode(new UriBuilder(u.Scheme, u.Host, u.Port, $"thirdparty/{loginProvider.Name.ToLower()}/code").Uri.AbsoluteUri);
|
|
||||||
|
var stateUriBuilder = new UriBuilder(u.Scheme, u.Host, u.Port, $"thirdparty/{loginProvider.Name.ToLower()}/code");
|
||||||
|
|
||||||
|
if (additionalStateArgs != null && additionalStateArgs.Any())
|
||||||
|
{
|
||||||
|
var stateQuery = "";
|
||||||
|
stateQuery = additionalStateArgs.Keys
|
||||||
|
.Where(a => a != null)
|
||||||
|
.Aggregate(stateQuery, (current, a) => a != null ? $"{current}&{a.Trim()}={additionalStateArgs[a] ?? "".Trim()}" : null);
|
||||||
|
|
||||||
|
stateUriBuilder.Query = stateQuery.Substring(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
var state = HttpUtility.UrlEncode(stateUriBuilder.Uri.AbsoluteUri);
|
||||||
query += $"&state={state}";
|
query += $"&state={state}";
|
||||||
|
|
||||||
if (additionalArgs != null)
|
if (additionalArgs != null)
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net.Http;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace ASC.FederatedLogin.Helpers
|
namespace ASC.FederatedLogin.Helpers
|
||||||
@ -38,9 +38,13 @@ namespace ASC.FederatedLogin.Helpers
|
|||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(uri)) throw new ArgumentNullException("uri");
|
if (string.IsNullOrEmpty(uri)) throw new ArgumentNullException("uri");
|
||||||
|
|
||||||
var request = WebRequest.Create(uri);
|
var request = new HttpRequestMessage();
|
||||||
request.Method = method;
|
request.RequestUri = new Uri(uri);
|
||||||
request.Timeout = timeout;
|
request.Method = new HttpMethod(method);
|
||||||
|
|
||||||
|
using var httpClient = new HttpClient();
|
||||||
|
httpClient.Timeout = TimeSpan.FromMilliseconds(timeout);
|
||||||
|
|
||||||
if (headers != null)
|
if (headers != null)
|
||||||
{
|
{
|
||||||
foreach (var key in headers.Keys)
|
foreach (var key in headers.Keys)
|
||||||
@ -49,33 +53,22 @@ namespace ASC.FederatedLogin.Helpers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(contentType))
|
|
||||||
{
|
|
||||||
request.ContentType = contentType;
|
|
||||||
}
|
|
||||||
|
|
||||||
var bytes = Encoding.UTF8.GetBytes(body ?? "");
|
var bytes = Encoding.UTF8.GetBytes(body ?? "");
|
||||||
if (request.Method != "GET" && bytes.Length > 0)
|
if (request.Method != HttpMethod.Get && bytes.Length > 0)
|
||||||
{
|
{
|
||||||
request.ContentLength = bytes.Length;
|
request.Content = new ByteArrayContent(bytes, 0, bytes.Length);
|
||||||
using var stream = request.GetRequestStream();
|
if (!string.IsNullOrEmpty(contentType))
|
||||||
stream.Write(bytes, 0, bytes.Length);
|
{
|
||||||
|
request.Headers.Add("Content-Type", contentType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
using var response = httpClient.Send(request);
|
||||||
{
|
using var stream = response.Content.ReadAsStream();
|
||||||
using var response = request.GetResponse();
|
if (stream == null) return null;
|
||||||
using var stream = response.GetResponseStream();
|
using var readStream = new StreamReader(stream);
|
||||||
if (stream == null) return null;
|
return readStream.ReadToEnd();
|
||||||
using var readStream = new StreamReader(stream);
|
|
||||||
return readStream.ReadToEnd();
|
|
||||||
}
|
|
||||||
catch (WebException)
|
|
||||||
{
|
|
||||||
request.Abort();
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@ -104,10 +105,22 @@ namespace ASC.FederatedLogin
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var profile = ProviderManager.Process(Auth, context, _params);
|
var desktop = _params.ContainsKey("desktop") && _params["desktop"] == "true";
|
||||||
|
IDictionary<string, string> additionalStateArgs = null;
|
||||||
|
|
||||||
|
if (desktop)
|
||||||
|
{
|
||||||
|
additionalStateArgs = context.Request.Query.ToDictionary(r => r.Key, r => r.Value.FirstOrDefault());
|
||||||
|
if (!additionalStateArgs.ContainsKey("desktop"))
|
||||||
|
{
|
||||||
|
additionalStateArgs.Add("desktop", "true");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var profile = ProviderManager.Process(Auth, context, null, additionalStateArgs);
|
||||||
if (profile != null)
|
if (profile != null)
|
||||||
{
|
{
|
||||||
await SendClientData(context, profile);
|
await SendJsCallback(context, profile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (ThreadAbortException)
|
catch (ThreadAbortException)
|
||||||
@ -116,7 +129,7 @@ namespace ASC.FederatedLogin
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
await SendClientData(context, LoginProfile.FromError(Signature, InstanceCrypto, ex));
|
await SendJsCallback(context, LoginProfile.FromError(Signature, InstanceCrypto, ex));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -179,48 +192,16 @@ namespace ASC.FederatedLogin
|
|||||||
get { return false; }
|
get { return false; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task SendClientData(HttpContext context, LoginProfile profile)
|
|
||||||
{
|
|
||||||
switch (Mode)
|
|
||||||
{
|
|
||||||
case LoginMode.Redirect:
|
|
||||||
await RedirectToReturnUrl(context, profile);
|
|
||||||
break;
|
|
||||||
case LoginMode.Popup:
|
|
||||||
await SendJsCallback(context, profile);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task SendJsCallback(HttpContext context, LoginProfile profile)
|
private async Task SendJsCallback(HttpContext context, LoginProfile profile)
|
||||||
{
|
{
|
||||||
//Render a page
|
//Render a page
|
||||||
context.Response.ContentType = "text/html";
|
context.Response.ContentType = "text/html";
|
||||||
await context.Response.WriteAsync(JsCallbackHelper.GetCallbackPage().Replace("%PROFILE%", profile.ToJson()).Replace("%CALLBACK%", Callback));
|
await context.Response.WriteAsync(
|
||||||
}
|
JsCallbackHelper.GetCallbackPage()
|
||||||
|
.Replace("%PROFILE%", $"\"{profile.Serialized}\"")
|
||||||
private async Task RedirectToReturnUrl(HttpContext context, LoginProfile profile)
|
.Replace("%CALLBACK%", Callback)
|
||||||
{
|
.Replace("%DESKTOP%", (Mode == LoginMode.Redirect).ToString().ToLowerInvariant())
|
||||||
var useMinimalProfile = Minimal;
|
);
|
||||||
if (useMinimalProfile)
|
|
||||||
profile = profile.GetMinimalProfile(); //Only id and provider
|
|
||||||
|
|
||||||
if (context.Session != null && !useMinimalProfile)
|
|
||||||
{
|
|
||||||
//Store in session
|
|
||||||
context.Response.Redirect(new Uri(ReturnUrl, UriKind.Absolute).AddProfileSession(profile, context).ToString(), true);
|
|
||||||
}
|
|
||||||
else if (MemoryCache != null && !useMinimalProfile)
|
|
||||||
{
|
|
||||||
context.Response.Redirect(new Uri(ReturnUrl, UriKind.Absolute).AddProfileCache(profile, MemoryCache).ToString(), true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
context.Response.Redirect(new Uri(ReturnUrl, UriKind.Absolute).AddProfile(profile).ToString(), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
await context.Response.CompleteAsync();
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,11 +113,11 @@ namespace ASC.FederatedLogin.LoginProviders
|
|||||||
InstanceCrypto = instanceCrypto;
|
InstanceCrypto = instanceCrypto;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual LoginProfile ProcessAuthoriztion(HttpContext context, IDictionary<string, string> @params)
|
public virtual LoginProfile ProcessAuthoriztion(HttpContext context, IDictionary<string, string> @params, IDictionary<string, string> additionalStateArgs = null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var token = Auth(context, Scopes, out var redirect);
|
var token = Auth(context, Scopes, out var redirect, @params, additionalStateArgs);
|
||||||
|
|
||||||
if (redirect)
|
if (redirect)
|
||||||
{
|
{
|
||||||
@ -136,7 +136,7 @@ namespace ASC.FederatedLogin.LoginProviders
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual OAuth20Token Auth(HttpContext context, string scopes, out bool redirect, Dictionary<string, string> additionalArgs = null)
|
protected virtual OAuth20Token Auth(HttpContext context, string scopes, out bool redirect, IDictionary<string, string> additionalArgs = null, IDictionary<string, string> additionalStateArgs = null)
|
||||||
{
|
{
|
||||||
var error = context.Request.Query["error"];
|
var error = context.Request.Query["error"];
|
||||||
if (!string.IsNullOrEmpty(error))
|
if (!string.IsNullOrEmpty(error))
|
||||||
@ -151,7 +151,7 @@ namespace ASC.FederatedLogin.LoginProviders
|
|||||||
var code = context.Request.Query["code"];
|
var code = context.Request.Query["code"];
|
||||||
if (string.IsNullOrEmpty(code))
|
if (string.IsNullOrEmpty(code))
|
||||||
{
|
{
|
||||||
context.Response.Redirect(OAuth20TokenHelper.RequestCode<T>(scopes, additionalArgs));
|
context.Response.Redirect(OAuth20TokenHelper.RequestCode<T>(scopes, additionalArgs, additionalStateArgs));
|
||||||
redirect = true;
|
redirect = true;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ namespace ASC.FederatedLogin.LoginProviders
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override LoginProfile ProcessAuthoriztion(HttpContext context, IDictionary<string, string> @params)
|
public override LoginProfile ProcessAuthoriztion(HttpContext context, IDictionary<string, string> @params, IDictionary<string, string> additionalStateArgs = null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -142,7 +142,7 @@ namespace ASC.FederatedLogin.LoginProviders
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override OAuth20Token Auth(HttpContext context, string scopes, out bool redirect, Dictionary<string, string> additionalArgs = null)
|
protected override OAuth20Token Auth(HttpContext context, string scopes, out bool redirect, IDictionary<string, string> additionalArgs = null, IDictionary<string, string> additionalStateArgs = null)
|
||||||
{
|
{
|
||||||
var error = context.Request.Query["error"];
|
var error = context.Request.Query["error"];
|
||||||
if (!string.IsNullOrEmpty(error))
|
if (!string.IsNullOrEmpty(error))
|
||||||
|
@ -34,7 +34,7 @@ namespace ASC.FederatedLogin.LoginProviders
|
|||||||
{
|
{
|
||||||
public interface ILoginProvider : IOAuthProvider
|
public interface ILoginProvider : IOAuthProvider
|
||||||
{
|
{
|
||||||
LoginProfile ProcessAuthoriztion(HttpContext context, IDictionary<string, string> @params);
|
LoginProfile ProcessAuthoriztion(HttpContext context, IDictionary<string, string> @params, IDictionary<string, string> additionalStateArgs);
|
||||||
|
|
||||||
LoginProfile GetLoginProfile(string accessToken);
|
LoginProfile GetLoginProfile(string accessToken);
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ namespace ASC.FederatedLogin.LoginProviders
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override LoginProfile ProcessAuthoriztion(HttpContext context, IDictionary<string, string> @params)
|
public override LoginProfile ProcessAuthoriztion(HttpContext context, IDictionary<string, string> @params, IDictionary<string, string> additionalStateArgs = null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -53,7 +53,7 @@ namespace ASC.FederatedLogin.LoginProviders
|
|||||||
ConsumerFactory = consumerFactory;
|
ConsumerFactory = consumerFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LoginProfile ProcessAuthoriztion(HttpContext context, IDictionary<string, string> @params)
|
public LoginProfile ProcessAuthoriztion(HttpContext context, IDictionary<string, string> @params, IDictionary<string, string> additionalStateArgs = null)
|
||||||
{
|
{
|
||||||
var response = Openid.GetResponse();
|
var response = Openid.GetResponse();
|
||||||
if (response == null)
|
if (response == null)
|
||||||
|
@ -71,9 +71,9 @@ namespace ASC.FederatedLogin.LoginProviders
|
|||||||
: ConsumerFactory.GetByKey(providerType) as ILoginProvider;
|
: ConsumerFactory.GetByKey(providerType) as ILoginProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LoginProfile Process(string providerType, HttpContext context, IDictionary<string, string> @params)
|
public LoginProfile Process(string providerType, HttpContext context, IDictionary<string, string> @params, IDictionary<string, string> additionalStateArgs = null)
|
||||||
{
|
{
|
||||||
return GetLoginProvider(providerType).ProcessAuthoriztion(context, @params);
|
return GetLoginProvider(providerType).ProcessAuthoriztion(context, @params, additionalStateArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public LoginProfile GetLoginProfile(string providerType, string accessToken)
|
public LoginProfile GetLoginProfile(string providerType, string accessToken)
|
||||||
|
@ -102,7 +102,7 @@ namespace ASC.FederatedLogin.LoginProviders
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override LoginProfile ProcessAuthoriztion(HttpContext context, IDictionary<string, string> @params)
|
public override LoginProfile ProcessAuthoriztion(HttpContext context, IDictionary<string, string> @params, IDictionary<string, string> additionalStateArgs = null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -111,7 +111,7 @@ namespace ASC.FederatedLogin.LoginProviders
|
|||||||
{
|
{
|
||||||
{ "revoke", "1" }
|
{ "revoke", "1" }
|
||||||
}
|
}
|
||||||
: null);
|
: null, additionalStateArgs);
|
||||||
|
|
||||||
if (redirect)
|
if (redirect)
|
||||||
{
|
{
|
||||||
|
@ -94,7 +94,7 @@ namespace ASC.FederatedLogin.LoginProviders
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override LoginProfile ProcessAuthoriztion(HttpContext context, IDictionary<string, string> @params)
|
public override LoginProfile ProcessAuthoriztion(HttpContext context, IDictionary<string, string> @params, IDictionary<string, string> additionalStateArgs = null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -103,7 +103,7 @@ namespace ASC.FederatedLogin.LoginProviders
|
|||||||
{
|
{
|
||||||
{ "force_confirm", "true" }
|
{ "force_confirm", "true" }
|
||||||
}
|
}
|
||||||
: null);
|
: null, additionalStateArgs);
|
||||||
if (redirect)
|
if (redirect)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
@ -373,7 +373,7 @@ namespace ASC.FederatedLogin.Profile
|
|||||||
|
|
||||||
internal void FromTransport(string transportstring)
|
internal void FromTransport(string transportstring)
|
||||||
{
|
{
|
||||||
var serialized = Encoding.UTF8.GetString(InstanceCrypto.Decrypt(WebEncoders.Base64UrlDecode(transportstring)));
|
var serialized = InstanceCrypto.Decrypt(WebEncoders.Base64UrlDecode(transportstring));
|
||||||
FromSerializedString(serialized);
|
FromSerializedString(serialized);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,12 +2,17 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<script language="javascript" type="text/javascript">
|
<script language="javascript" type="text/javascript">
|
||||||
try {
|
if (%DESKTOP%) {
|
||||||
window.opener.%CALLBACK%(%PROFILE%);
|
localStorage.setItem("profile", %PROFILE%);
|
||||||
|
window.location.href = "/";
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
window.opener.%CALLBACK%(%PROFILE%);
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
}
|
||||||
|
window.close();
|
||||||
}
|
}
|
||||||
catch (ex) {
|
|
||||||
}
|
|
||||||
window.close();
|
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body></body>
|
<body></body>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<ApplicationIcon />
|
<ApplicationIcon />
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
<StartupObject />
|
<StartupObject />
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<ApplicationIcon />
|
<ApplicationIcon />
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
<StartupObject />
|
<StartupObject />
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<ApplicationIcon />
|
<ApplicationIcon />
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
<StartupObject />
|
<StartupObject />
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<AssemblyTitle>ASC.Notify.Textile</AssemblyTitle>
|
<AssemblyTitle>ASC.Notify.Textile</AssemblyTitle>
|
||||||
<Company>Ascensio System SIA</Company>
|
<Company>Ascensio System SIA</Company>
|
||||||
<Product>ASC.Notify.Textile</Product>
|
<Product>ASC.Notify.Textile</Product>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="Current">
|
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="Current">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ProductVersion>9.0.30729</ProductVersion>
|
<ProductVersion>9.0.30729</ProductVersion>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<FileUpgradeFlags>
|
<FileUpgradeFlags>
|
||||||
</FileUpgradeFlags>
|
</FileUpgradeFlags>
|
||||||
<UpgradeBackupLocation>
|
<UpgradeBackupLocation>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<ApplicationIcon />
|
<ApplicationIcon />
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
<StartupObject />
|
<StartupObject />
|
||||||
|
@ -77,7 +77,7 @@ namespace ASC.VoipService.Twilio
|
|||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(settings.GreetingAudio))
|
if (!string.IsNullOrEmpty(settings.GreetingAudio))
|
||||||
{
|
{
|
||||||
response.Play(Uri.EscapeUriString(settings.GreetingAudio));
|
response.Play(Uri.EscapeDataString(settings.GreetingAudio));
|
||||||
}
|
}
|
||||||
|
|
||||||
response.Enqueue(settings.Queue.Name, GetEcho("Enqueue", agent != null), "POST",
|
response.Enqueue(settings.Queue.Name, GetEcho("Enqueue", agent != null), "POST",
|
||||||
@ -129,7 +129,7 @@ namespace ASC.VoipService.Twilio
|
|||||||
if (!string.IsNullOrEmpty(queue.WaitUrl))
|
if (!string.IsNullOrEmpty(queue.WaitUrl))
|
||||||
{
|
{
|
||||||
var gather = new Gather(method: "POST", action: GetEcho("gatherQueue"));
|
var gather = new Gather(method: "POST", action: GetEcho("gatherQueue"));
|
||||||
gather.Play(Uri.EscapeUriString(queue.WaitUrl));
|
gather.Play(Uri.EscapeDataString(queue.WaitUrl));
|
||||||
response.Gather(gather);
|
response.Gather(gather);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -156,7 +156,7 @@ namespace ASC.VoipService.Twilio
|
|||||||
{
|
{
|
||||||
if (to == "hold")
|
if (to == "hold")
|
||||||
{
|
{
|
||||||
return new VoiceResponse().Play(Uri.EscapeUriString(settings.HoldAudio), 0);
|
return new VoiceResponse().Play(Uri.EscapeDataString(settings.HoldAudio), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -199,7 +199,7 @@ namespace ASC.VoipService.Twilio
|
|||||||
{
|
{
|
||||||
return string.IsNullOrEmpty(settings.VoiceMail)
|
return string.IsNullOrEmpty(settings.VoiceMail)
|
||||||
? response.Say("")
|
? response.Say("")
|
||||||
: response.Play(Uri.EscapeUriString(settings.VoiceMail)).Record(method: "POST", action: GetEcho("voiceMail"), maxLength: 30);
|
: response.Play(Uri.EscapeDataString(settings.VoiceMail)).Record(method: "POST", action: GetEcho("voiceMail"), maxLength: 30);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetEcho(string action, bool user = true)
|
public string GetEcho(string action, bool user = true)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
<DefaultItemExcludes>$(DefaultItemExcludes);</DefaultItemExcludes>
|
<DefaultItemExcludes>$(DefaultItemExcludes);</DefaultItemExcludes>
|
||||||
<RazorCompileOnBuild>false</RazorCompileOnBuild>
|
<RazorCompileOnBuild>false</RazorCompileOnBuild>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.1.0" />
|
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.2.0" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="5.0.8" />
|
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="6.0.0" />
|
||||||
<PackageReference Include="Moq" Version="4.14.7" />
|
<PackageReference Include="Moq" Version="4.14.7" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.13.1" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
|
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.1" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -428,8 +428,9 @@ namespace Frontend.Translations.Tests
|
|||||||
.Select(item => item.Key);
|
.Select(item => item.Key);
|
||||||
|
|
||||||
var allJsTranslationKeys = JavaScriptFiles
|
var allJsTranslationKeys = JavaScriptFiles
|
||||||
|
.Where(f => !f.Path.Contains("Banner.js")) // skip Banner.js (translations from firebase)
|
||||||
.SelectMany(j => j.TranslationKeys)
|
.SelectMany(j => j.TranslationKeys)
|
||||||
.Select(k => k.Replace("Common:", "").Replace("Translations:", ""))
|
.Select(k => k.Replace("Common:", "").Replace("Translations:", "").Replace("Home:", ""))
|
||||||
.Distinct();
|
.Distinct();
|
||||||
|
|
||||||
var notFoundJsKeys = allJsTranslationKeys.Except(allEnKeys);
|
var notFoundJsKeys = allJsTranslationKeys.Except(allEnKeys);
|
||||||
@ -811,6 +812,83 @@ namespace Frontend.Translations.Tests
|
|||||||
Assert.AreEqual(0, NotTranslatedToasts.Count, message);
|
Assert.AreEqual(0, NotTranslatedToasts.Count, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void WrongTranslationVariablesTest()
|
||||||
|
{
|
||||||
|
var message = $"Next keys have wrong variables:\r\n\r\n";
|
||||||
|
var regVariables = new Regex("\\{\\{([^\\{].?[^\\}]+)\\}\\}", RegexOptions.Compiled | RegexOptions.Multiline);
|
||||||
|
|
||||||
|
var groupedByLng = TranslationFiles
|
||||||
|
.GroupBy(t => t.Language)
|
||||||
|
.Select(g => new
|
||||||
|
{
|
||||||
|
Language = g.Key,
|
||||||
|
TranslationsWithVariables = g.ToList()
|
||||||
|
.SelectMany(t => t.Translations)
|
||||||
|
.Where(k => k.Value.IndexOf("{{") != -1)
|
||||||
|
.Select(t => new
|
||||||
|
{
|
||||||
|
t.Key,
|
||||||
|
t.Value,
|
||||||
|
Variables = regVariables.Matches(t.Value)
|
||||||
|
.Select(m => m.Groups[1]?.Value?.Trim().Replace(", lowercase", ""))
|
||||||
|
.ToList()
|
||||||
|
})
|
||||||
|
.ToList()
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
var enWithVariables = groupedByLng
|
||||||
|
.Where(t => t.Language == "en")
|
||||||
|
.SelectMany(t => t.TranslationsWithVariables)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
var otherLanguagesWithVariables = groupedByLng
|
||||||
|
.Where(t => t.Language != "en")
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
var i = 0;
|
||||||
|
var errorsCount = 0;
|
||||||
|
|
||||||
|
foreach (var lng in otherLanguagesWithVariables)
|
||||||
|
{
|
||||||
|
foreach (var t in lng.TranslationsWithVariables)
|
||||||
|
{
|
||||||
|
var enKey = enWithVariables
|
||||||
|
.Where(en => en.Key == t.Key)
|
||||||
|
.FirstOrDefault();
|
||||||
|
|
||||||
|
if (enKey == null)
|
||||||
|
{
|
||||||
|
// wrong
|
||||||
|
message += $"{++i}. lng='{lng.Language}' key='{t.Key}' has no 'en' language variant (!!!useless key!!!)\r\n\r\n";
|
||||||
|
errorsCount++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (enKey.Variables.Count != t.Variables.Count)
|
||||||
|
{
|
||||||
|
// wrong
|
||||||
|
message += $"{++i}. lng='{lng.Language}' key='{t.Key}' has less variables then 'en' language have " +
|
||||||
|
$"(en={enKey.Variables.Count}|{lng.Language}={t.Variables.Count})\r\n" +
|
||||||
|
$"'en': '{enKey.Value}'\r\n'{lng.Language}': '{t.Value}'\r\n\r\n";
|
||||||
|
errorsCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!t.Variables.All(v => enKey.Variables.Contains(v)))
|
||||||
|
{
|
||||||
|
// wrong
|
||||||
|
errorsCount++;
|
||||||
|
message += $"{++i}. lng='{lng.Language}' key='{t.Key}' has not equals variables of 'en' language have\r\n\r\n" +
|
||||||
|
$"Have to be:\r\n'{enKey.Value}'\r\n\r\n{string.Join("\r\n", enKey.Variables)}\r\n\r\n" +
|
||||||
|
$"But in real:\r\n'{t.Value}'\r\n\r\n{string.Join("\r\n", t.Variables)} \r\n\r\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Assert.AreEqual(0, errorsCount, message);
|
||||||
|
}
|
||||||
|
|
||||||
/*[Test]
|
/*[Test]
|
||||||
public void TempTest()
|
public void TempTest()
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<StartupObject>AutoMigrationCreator.Program</StartupObject>
|
<StartupObject>AutoMigrationCreator.Program</StartupObject>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
@ -13,11 +13,11 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\..\products\ASC.Files\Core\ASC.Files.Core.csproj" />
|
<ProjectReference Include="..\..\..\products\ASC.Files\Core\ASC.Files.Core.csproj" />
|
||||||
<ProjectReference Include="..\..\ASC.Core.Common\ASC.Core.Common.csproj" />
|
<ProjectReference Include="..\..\ASC.Core.Common\ASC.Core.Common.csproj" />
|
||||||
<PackageReference Include="Microsoft.Build" Version="16.11.0" />
|
<PackageReference Include="Microsoft.Build" Version="17.0.0" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.10">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.0">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="5.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
using ASC.Core.Common.EF;
|
using ASC.Core.Common.EF;
|
||||||
|
|
||||||
using Microsoft.EntityFrameworkCore.Design;
|
using Microsoft.EntityFrameworkCore.Design;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations.Design;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
|
||||||
namespace AutoMigrationCreator
|
namespace AutoMigrationCreator
|
||||||
@ -12,6 +15,10 @@ namespace AutoMigrationCreator
|
|||||||
var serviceCollection = new ServiceCollection();
|
var serviceCollection = new ServiceCollection();
|
||||||
serviceCollection.AddEntityFrameworkDesignTimeServices();
|
serviceCollection.AddEntityFrameworkDesignTimeServices();
|
||||||
serviceCollection.AddDbContextDesignTimeServices(context);
|
serviceCollection.AddDbContextDesignTimeServices(context);
|
||||||
|
serviceCollection.AddSingleton<MigrationsCodeGeneratorDependencies>();
|
||||||
|
serviceCollection.AddSingleton<AnnotationCodeGeneratorDependencies>();
|
||||||
|
serviceCollection.AddSingleton<IAnnotationCodeGenerator, AnnotationCodeGenerator>();
|
||||||
|
serviceCollection.AddSingleton(context.GetService<ITypeMappingSource>());
|
||||||
|
|
||||||
var designTimeServices = serviceCollection.BuildServiceProvider();
|
var designTimeServices = serviceCollection.BuildServiceProvider();
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<AssemblyTitle>ASC.ApiSystem</AssemblyTitle>
|
<AssemblyTitle>ASC.ApiSystem</AssemblyTitle>
|
||||||
<Company>Ascensio System SIA</Company>
|
<Company>Ascensio System SIA</Company>
|
||||||
<Product>ASC.ApiSystem</Product>
|
<Product>ASC.ApiSystem</Product>
|
||||||
@ -17,10 +17,9 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.1.0" />
|
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.2.0" />
|
||||||
<PackageReference Include="Microsoft.AspNet.WebApi.Core" Version="5.2.7" />
|
<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.Systemd" Version="6.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="5.0.1" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -28,7 +28,8 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net.Http;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
@ -169,17 +170,15 @@ namespace ASC.ApiSystem.Controllers
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var webRequest = (HttpWebRequest)WebRequest.Create(url);
|
var request = new HttpRequestMessage();
|
||||||
webRequest.Method = WebRequestMethods.Http.Post;
|
request.Method = HttpMethod.Post;
|
||||||
webRequest.Accept = "application/x-www-form-urlencoded";
|
request.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/x-www-form-urlencoded"));
|
||||||
webRequest.ContentLength = 0;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using var response = webRequest.GetResponse();
|
using var httpClient = new HttpClient();
|
||||||
|
using var response = httpClient.Send(request);
|
||||||
using var stream = response.GetResponseStream();
|
using var stream = response.Content.ReadAsStream();
|
||||||
|
|
||||||
using var reader = new StreamReader(stream, Encoding.UTF8);
|
using var reader = new StreamReader(stream, Encoding.UTF8);
|
||||||
|
|
||||||
var result = reader.ReadToEnd();
|
var result = reader.ReadToEnd();
|
||||||
@ -306,17 +305,16 @@ namespace ASC.ApiSystem.Controllers
|
|||||||
var data = string.Format("secret={0}&remoteip={1}&response={2}", Configuration["recaptcha:private-key"], ip, response);
|
var data = string.Format("secret={0}&remoteip={1}&response={2}", Configuration["recaptcha:private-key"], ip, response);
|
||||||
var url = Configuration["recaptcha:verify-url"] ?? "https://www.recaptcha.net/recaptcha/api/siteverify";
|
var url = Configuration["recaptcha:verify-url"] ?? "https://www.recaptcha.net/recaptcha/api/siteverify";
|
||||||
|
|
||||||
var webRequest = (HttpWebRequest)WebRequest.Create(url);
|
var request = new HttpRequestMessage();
|
||||||
webRequest.Method = WebRequestMethods.Http.Post;
|
request.RequestUri = new Uri(url);
|
||||||
webRequest.ContentType = "application/x-www-form-urlencoded";
|
request.Method = HttpMethod.Post;
|
||||||
webRequest.ContentLength = data.Length;
|
request.Content = new StringContent(data, Encoding.UTF8, "application/x-www-form-urlencoded");
|
||||||
using (var writer = new StreamWriter(webRequest.GetRequestStream()))
|
|
||||||
{
|
using var httpClient = new HttpClient();
|
||||||
writer.Write(data);
|
using var httpClientResponse = httpClient.Send(request);
|
||||||
}
|
using var stream = httpClientResponse.Content.ReadAsStream();
|
||||||
|
using var reader = new StreamReader(stream);
|
||||||
|
|
||||||
using var webResponse = webRequest.GetResponse();
|
|
||||||
using var reader = new StreamReader(webResponse.GetResponseStream());
|
|
||||||
var resp = reader.ReadToEnd();
|
var resp = reader.ReadToEnd();
|
||||||
var resObj = JObject.Parse(resp);
|
var resObj = JObject.Parse(resp);
|
||||||
|
|
||||||
|
@ -26,9 +26,11 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
|
using System.Net.Http;
|
||||||
|
using System.Net.Http.Headers;
|
||||||
|
using System.Text;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
|
|
||||||
using ASC.ApiSystem.Classes;
|
using ASC.ApiSystem.Classes;
|
||||||
@ -337,24 +339,19 @@ namespace ASC.ApiSystem.Controllers
|
|||||||
|
|
||||||
Log.Info(string.Format("CalDav: SendToApi: {0}", url));
|
Log.Info(string.Format("CalDav: SendToApi: {0}", url));
|
||||||
|
|
||||||
var webRequest = (HttpWebRequest)WebRequest.Create(url);
|
var request = new HttpRequestMessage();
|
||||||
webRequest.Method = httpMethod;
|
request.RequestUri = new Uri(url);
|
||||||
webRequest.Accept = "application/json";
|
request.Method = new HttpMethod(httpMethod);
|
||||||
webRequest.ContentType = "application/x-www-form-urlencoded";
|
request.Headers.Accept.Add(MediaTypeWithQualityHeaderValue.Parse("application/json"));
|
||||||
webRequest.ContentLength = 0;
|
|
||||||
|
using var httpClient = new HttpClient();
|
||||||
|
|
||||||
if (data != null)
|
if (data != null)
|
||||||
{
|
{
|
||||||
webRequest.ContentLength = data.Length;
|
request.Content = new StringContent(data, Encoding.UTF8, "application/x-www-form-urlencoded");
|
||||||
|
|
||||||
using var writer = new StreamWriter(webRequest.GetRequestStream());
|
|
||||||
|
|
||||||
writer.Write(data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
using (webRequest.GetResponse())
|
httpClient.Send(request);
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -46,7 +46,6 @@ namespace ASC.ApiSystem
|
|||||||
public async static Task Main(string[] args)
|
public async static Task Main(string[] args)
|
||||||
{
|
{
|
||||||
var host = CreateHostBuilder(args).Build();
|
var host = CreateHostBuilder(args).Build();
|
||||||
|
|
||||||
await host.RunAsync();
|
await host.RunAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,6 +24,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
using ASC.Api.Core;
|
using ASC.Api.Core;
|
||||||
using ASC.ApiSystem.Classes;
|
using ASC.ApiSystem.Classes;
|
||||||
using ASC.ApiSystem.Controllers;
|
using ASC.ApiSystem.Controllers;
|
||||||
@ -66,7 +68,7 @@ namespace ASC.ApiSystem
|
|||||||
.AddJsonOptions(options =>
|
.AddJsonOptions(options =>
|
||||||
{
|
{
|
||||||
options.JsonSerializerOptions.WriteIndented = false;
|
options.JsonSerializerOptions.WriteIndented = false;
|
||||||
options.JsonSerializerOptions.IgnoreNullValues = true;
|
options.JsonSerializerOptions.DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull;
|
||||||
});
|
});
|
||||||
|
|
||||||
services.AddMemoryCache();
|
services.AddMemoryCache();
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<ApplicationIcon />
|
<ApplicationIcon />
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
|
||||||
@ -33,10 +33,9 @@
|
|||||||
<ProjectReference Include="..\..\ASC.Common\ASC.Common.csproj" />
|
<ProjectReference Include="..\..\ASC.Common\ASC.Common.csproj" />
|
||||||
<ProjectReference Include="..\..\ASC.Core.Common\ASC.Core.Common.csproj" />
|
<ProjectReference Include="..\..\ASC.Core.Common\ASC.Core.Common.csproj" />
|
||||||
<ProjectReference Include="..\..\ASC.Data.Encryption\ASC.Data.Encryption.csproj" />
|
<ProjectReference Include="..\..\ASC.Data.Encryption\ASC.Data.Encryption.csproj" />
|
||||||
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.1.0" />
|
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.2.0" />
|
||||||
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="5.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="6.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="5.0.1" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<ApplicationIcon />
|
<ApplicationIcon />
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<RazorCompileOnBuild>false</RazorCompileOnBuild>
|
<RazorCompileOnBuild>false</RazorCompileOnBuild>
|
||||||
@ -21,6 +21,10 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Target>
|
</Target>
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.2.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="6.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\ASC.Data.Backup.Core\ASC.Data.Backup.Core.csproj" />
|
<ProjectReference Include="..\..\ASC.Data.Backup.Core\ASC.Data.Backup.Core.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net5.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<ApplicationIcon />
|
<ApplicationIcon />
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<RazorCompileOnBuild>false</RazorCompileOnBuild>
|
<RazorCompileOnBuild>false</RazorCompileOnBuild>
|
||||||
@ -19,16 +19,15 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.1.0" />
|
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.2.0" />
|
||||||
<PackageReference Include="Google.Protobuf" Version="3.14.0" />
|
<PackageReference Include="Grpc" Version="2.32.0">
|
||||||
<PackageReference Include="Grpc" Version="2.32.0" />
|
<TreatAsUsed>true</TreatAsUsed>
|
||||||
|
</PackageReference>
|
||||||
<PackageReference Include="Grpc.Tools" Version="2.32.0">
|
<PackageReference Include="Grpc.Tools" Version="2.32.0">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="5.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="6.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="5.0.1" />
|
|
||||||
<PackageReference Include="SharpCompress" Version="0.26.0" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user