Merge branch 'release/rc-v1.2.0' of github.com:ONLYOFFICE/AppServer into release/rc-v1.2.0

This commit is contained in:
Tatiana Lopaeva 2023-01-27 10:25:15 +03:00
commit 5d4081da4b
15 changed files with 90 additions and 24 deletions

View File

@ -87,7 +87,7 @@ const EditRoomEvent = ({
return updateFolder(index, newRoom); return updateFolder(index, newRoom);
} }
setFolder(room); setFolder(newRoom);
}; };
const onSave = async (roomParams) => { const onSave = async (roomParams) => {

View File

@ -1,6 +1,7 @@
import styled, { css } from "styled-components"; import styled, { css } from "styled-components";
import { tablet, hugeMobile } from "@docspace/components/utils/device"; import { tablet, hugeMobile } from "@docspace/components/utils/device";
import { isIOS, isFirefox, isMobileOnly } from "react-device-detect"; import { isIOS, isFirefox, isMobileOnly } from "react-device-detect";
import BackgroundPatternReactSvgUrl from "PUBLIC_DIR/images/background.pattern.react.svg?url";
export const Wrapper = styled.div` export const Wrapper = styled.div`
height: ${isIOS && !isFirefox ? "calc(var(--vh, 1vh) * 100)" : "100vh"}; height: ${isIOS && !isFirefox ? "calc(var(--vh, 1vh) * 100)" : "100vh"};
@ -17,7 +18,7 @@ export const Wrapper = styled.div`
width: 100%; width: 100%;
`} `}
background-image: url("/static/images/background.pattern.react.svg"); background-image: url("${BackgroundPatternReactSvgUrl}");
background-repeat: no-repeat; background-repeat: no-repeat;
background-attachment: fixed; background-attachment: fixed;
background-size: 100% 100%; background-size: 100% 100%;

View File

@ -35,6 +35,7 @@ import {
StyledAcceptTerms, StyledAcceptTerms,
} from "./StyledWizard"; } from "./StyledWizard";
import DocspaceLogo from "SRC_DIR/DocspaceLogo"; import DocspaceLogo from "SRC_DIR/DocspaceLogo";
import RefreshReactSvgUrl from "PUBLIC_DIR/images/refresh.react.svg?url";
const emailSettings = new EmailSettings(); const emailSettings = new EmailSettings();
emailSettings.allowDomainPunycode = true; emailSettings.allowDomainPunycode = true;
@ -299,7 +300,7 @@ const Wizard = (props) => {
<StyledLink> <StyledLink>
<IconButton <IconButton
size="12" size="12"
iconName="/static/images/refresh.react.svg" iconName={RefreshReactSvgUrl}
onClick={generatePassword} onClick={generatePassword}
/> />
<Link <Link

View File

@ -112,6 +112,7 @@ const Article = ({
id={"article-container"} id={"article-container"}
showText={showText} showText={showText}
articleOpen={articleOpen} articleOpen={articleOpen}
$withMainButton={withMainButton}
{...rest} {...rest}
> >
<SubArticleHeader showText={showText}> <SubArticleHeader showText={showText}>

View File

@ -80,7 +80,8 @@ const StyledArticle = styled.article`
.scroll-body { .scroll-body {
overflow-x: hidden !important; overflow-x: hidden !important;
height: calc(100% - 200px); height: ${(props) =>
`calc(100% - ${props.$withMainButton ? "200px" : "150px"})`};
padding: 0 20px !important; padding: 0 20px !important;
@media ${tablet} { @media ${tablet} {

View File

@ -1,7 +1,7 @@
import React from "react"; import React from "react";
import Scrollbar from "@docspace/components/scrollbar"; import Scrollbar from "@docspace/components/scrollbar";
const ArticleBody = ({ children }) => { const ArticleBody = ({ children, className }) => {
return ( return (
<Scrollbar className="article-body__scrollbar" stype="mediumBlack"> <Scrollbar className="article-body__scrollbar" stype="mediumBlack">
{children} {children}

View File

@ -7,6 +7,7 @@ html,
body { body {
height: 100%; height: 100%;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0); -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
overscroll-behavior: none;
} }
#root { #root {
min-height: 100%; min-height: 100%;

View File

@ -7,6 +7,7 @@ const GlobalStyle = createGlobalStyle`
${(props) => props?.fonts} ${(props) => props?.fonts}
font-family: 'Open Sans', sans-serif, Arial; font-family: 'Open Sans', sans-serif, Arial;
font-size: 13px; font-size: 13px;
overscroll-behavior: none;
} }
#root { #root {

View File

@ -11,6 +11,7 @@ const GlobalStyle = createGlobalStyle`
${(props: IGlobalStyleProps) => props?.fonts} ${(props: IGlobalStyleProps) => props?.fonts}
font-family: 'Open Sans', sans-serif, Arial; font-family: 'Open Sans', sans-serif, Arial;
font-size: 13px; font-size: 13px;
overscroll-behavior: none;
} }
#root { #root {

View File

@ -0,0 +1,32 @@
// (c) Copyright Ascensio System SIA 2010-2022
//
// This program is a free software product.
// You can redistribute it and/or modify it under the terms
// of the GNU Affero General Public License (AGPL) version 3 as published by the Free Software
// Foundation. In accordance with Section 7(a) of the GNU AGPL its Section 15 shall be amended
// to the effect that Ascensio System SIA expressly excludes the warranty of non-infringement of
// any third-party rights.
//
// This program is distributed WITHOUT ANY WARRANTY, without even the implied warranty
// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For details, see
// the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
//
// You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia, EU, LV-1021.
//
// The interactive user interfaces in modified source and object code versions of the Program must
// display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
//
// Pursuant to Section 7(b) of the License you must retain the original Product logo when
// distributing the program. Pursuant to Section 7(e) we decline to grant you any rights under
// trademark law for use of our trademarks.
//
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Files.Core.ApiModels.RequestDto;
public class AutoCleanupRequestDto
{
public bool Set { get; set; }
public DateToAutoCleanUp Gap { get; set; }
}

View File

@ -2090,6 +2090,11 @@ public class FileStorageService<T> //: IFileStorageService
return _fileOperationsManager.Delete(_authContext.CurrentAccount.ID, _tenantManager.GetCurrentTenant(), folders, files, ignoreException, !deleteAfter, immediately, GetHttpHeaders()); return _fileOperationsManager.Delete(_authContext.CurrentAccount.ID, _tenantManager.GetCurrentTenant(), folders, files, ignoreException, !deleteAfter, immediately, GetHttpHeaders());
} }
public List<FileOperationResult> DeleteItems(string action, List<T> files, List<T> folders, bool ignoreException = false, bool deleteAfter = false, bool immediately = false)
{
return _fileOperationsManager.Delete(_authContext.CurrentAccount.ID, _tenantManager.GetCurrentTenant(), folders, files, ignoreException, !deleteAfter, immediately, GetHttpHeaders());
}
public async Task<List<FileOperationResult>> EmptyTrashAsync() public async Task<List<FileOperationResult>> EmptyTrashAsync()
{ {
var folderDao = GetFolderDao(); var folderDao = GetFolderDao();

View File

@ -214,9 +214,15 @@ public class SettingsController : ApiControllerBase
} }
[HttpPut("settings/autocleanup")] [HttpPut("settings/autocleanup")]
public AutoCleanUpData ChangeAutomaticallyCleanUp(bool set, DateToAutoCleanUp gap) public AutoCleanUpData ChangeAutomaticallyCleanUp(AutoCleanupRequestDto inDto)
{ {
return _fileStorageServiceString.ChangeAutomaticallyCleanUp(set, gap); return _fileStorageServiceString.ChangeAutomaticallyCleanUp(inDto.Set, inDto.Gap);
}
[HttpGet("settings/autocleanup")]
public AutoCleanUpData GetAutomaticallyCleanUp()
{
return _fileStorageServiceString.GetSettingsAutomaticallyCleanUp();
} }
[HttpPut("settings/dafaultaccessrights")] [HttpPut("settings/dafaultaccessrights")]

View File

@ -33,13 +33,11 @@ namespace ASC.Files.AutoCleanUp;
[Singletone] [Singletone]
public class Worker public class Worker
{ {
private readonly TimeSpan _period;
private readonly ILogger<Worker> _logger; private readonly ILogger<Worker> _logger;
private readonly IServiceScopeFactory _serviceScopeFactory; private readonly IServiceScopeFactory _serviceScopeFactory;
public Worker(IConfiguration configuration, ILogger<Worker> logger, IServiceScopeFactory serviceScopeFactory) public Worker(IConfiguration configuration, ILogger<Worker> logger, IServiceScopeFactory serviceScopeFactory)
{ {
_period = TimeSpan.Parse(configuration.GetValue<string>("files:autoCleanUp:period") ?? "0:5:0");
_logger = logger; _logger = logger;
_serviceScopeFactory = serviceScopeFactory; _serviceScopeFactory = serviceScopeFactory;
} }
@ -61,7 +59,6 @@ public class Worker
if (!activeTenantsUsers.Any()) if (!activeTenantsUsers.Any())
{ {
_logger.InfoWaitingForData(_period);
return; return;
} }
@ -82,13 +79,14 @@ public class Worker
await using (var scope = _serviceScopeFactory.CreateAsyncScope()) await using (var scope = _serviceScopeFactory.CreateAsyncScope())
{ {
var tenantManager = scope.ServiceProvider.GetRequiredService<TenantManager>(); var tenantManager = scope.ServiceProvider.GetRequiredService<TenantManager>();
tenantManager.SetCurrentTenant(tenantUser.TenantId);
var authManager = scope.ServiceProvider.GetRequiredService<AuthManager>(); var authManager = scope.ServiceProvider.GetRequiredService<AuthManager>();
var securityContext = scope.ServiceProvider.GetRequiredService<SecurityContext>(); var securityContext = scope.ServiceProvider.GetRequiredService<SecurityContext>();
var daoFactory = scope.ServiceProvider.GetRequiredService<IDaoFactory>(); var daoFactory = scope.ServiceProvider.GetRequiredService<IDaoFactory>();
var fileStorageService = scope.ServiceProvider.GetRequiredService<Web.Files.Services.WCFService.FileStorageService<int>>(); var fileStorageService = scope.ServiceProvider.GetRequiredService<Web.Files.Services.WCFService.FileStorageService<int>>();
var fileDateTime = scope.ServiceProvider.GetRequiredService<FileDateTime>(); var fileDateTime = scope.ServiceProvider.GetRequiredService<FileDateTime>();
tenantManager.SetCurrentTenant(tenantUser.TenantId);
var userAccount = authManager.GetAccountByID(tenantUser.TenantId, tenantUser.UserId); var userAccount = authManager.GetAccountByID(tenantUser.TenantId, tenantUser.UserId);
if (userAccount == ASC.Core.Configuration.Constants.Guest) if (userAccount == ASC.Core.Configuration.Constants.Guest)
@ -102,18 +100,18 @@ public class Worker
var folderDao = daoFactory.GetFolderDao<int>(); var folderDao = daoFactory.GetFolderDao<int>();
var now = DateTime.UtcNow; var now = DateTime.UtcNow;
var filesList = new List<JsonElement>(); var filesList = new List<int>();
var foldersList = new List<JsonElement>(); var foldersList = new List<int>();
var trashId = await folderDao.GetFolderIDTrashAsync(false, tenantUser.UserId); var trashId = await folderDao.GetFolderIDTrashAsync(false, tenantUser.UserId);
foldersList.AddRange((await folderDao.GetFoldersAsync(trashId).ToListAsync()) foldersList.AddRange((await folderDao.GetFoldersAsync(trashId).ToListAsync())
.Where(x => fileDateTime.GetModifiedOnWithAutoCleanUp(x.ModifiedOn, tenantUser.Setting, true) < now) .Where(x => fileDateTime.GetModifiedOnWithAutoCleanUp(x.ModifiedOn, tenantUser.Setting, true) < now)
.Select(f => JsonDocument.Parse(JsonSerializer.Serialize(f.Id)).RootElement)); .Select(f => f.Id));
filesList.AddRange((await fileDao.GetFilesAsync(trashId, null, default(FilterType), false, Guid.Empty, string.Empty, false).ToListAsync()) filesList.AddRange((await fileDao.GetFilesAsync(trashId, null, default(FilterType), false, Guid.Empty, string.Empty, false).ToListAsync())
.Where(x => fileDateTime.GetModifiedOnWithAutoCleanUp(x.ModifiedOn, tenantUser.Setting, true) < now) .Where(x => fileDateTime.GetModifiedOnWithAutoCleanUp(x.ModifiedOn, tenantUser.Setting, true) < now)
.Select(y => JsonDocument.Parse(JsonSerializer.Serialize(y.Id)).RootElement)); .Select(y => y.Id));
_logger.InfoCleanUp(tenantUser.TenantId, trashId); _logger.InfoCleanUp(tenantUser.TenantId, trashId);
@ -130,7 +128,7 @@ public class Worker
break; break;
} }
Thread.Sleep(100); await Task.Delay(100);
} }
_logger.InfoCleanUpFinish(tenantUser.TenantId, trashId); _logger.InfoCleanUpFinish(tenantUser.TenantId, trashId);
@ -150,7 +148,7 @@ public class Worker
.Join(dbContext.WebstudioSettings, a => a.Id, b => b.TenantId, (tenants, settings) => new { tenants, settings }) .Join(dbContext.WebstudioSettings, a => a.Id, b => b.TenantId, (tenants, settings) => new { tenants, settings })
.Where(x => x.tenants.Status == TenantStatus.Active && .Where(x => x.tenants.Status == TenantStatus.Active &&
x.settings.Id == filesSettingsId && x.settings.Id == filesSettingsId &&
JsonExtensions.JsonValue(nameof(x.settings.Data).ToLower(), "AutomaticallyCleanUp.IsAutoCleanUp") == "true") Convert.ToBoolean(JsonExtensions.JsonValue(nameof(x.settings.Data).ToLower(), "AutomaticallyCleanUp.IsAutoCleanUp")) == true)
.Select(r => new TenantUserSettings() .Select(r => new TenantUserSettings()
{ {
TenantId = r.tenants.Id, TenantId = r.tenants.Id,

View File

@ -41,9 +41,11 @@ global using ASC.Core.Common;
global using ASC.Core.Common.EF; global using ASC.Core.Common.EF;
global using ASC.Core.Common.Hosting; global using ASC.Core.Common.Hosting;
global using ASC.Core.Common.Hosting.Interfaces; global using ASC.Core.Common.Hosting.Interfaces;
global using ASC.Core.Common.Quota;
global using ASC.Core.Common.Quota.Features;
global using ASC.Core.Notify.Socket; global using ASC.Core.Notify.Socket;
global using ASC.Core.Users;
global using ASC.Core.Tenants; global using ASC.Core.Tenants;
global using ASC.Core.Users;
global using ASC.ElasticSearch; global using ASC.ElasticSearch;
global using ASC.ElasticSearch.Service; global using ASC.ElasticSearch.Service;
global using ASC.EventBus.Abstractions; global using ASC.EventBus.Abstractions;
@ -54,6 +56,7 @@ global using ASC.Feed.Core;
global using ASC.Feed.Data; global using ASC.Feed.Data;
global using ASC.Files.AutoCleanUp; global using ASC.Files.AutoCleanUp;
global using ASC.Files.Core; global using ASC.Files.Core;
global using ASC.Files.Core.Core;
global using ASC.Files.Core.Core.Entries; global using ASC.Files.Core.Core.Entries;
global using ASC.Files.Core.EF; global using ASC.Files.Core.EF;
global using ASC.Files.Core.Helpers; global using ASC.Files.Core.Helpers;
@ -62,6 +65,8 @@ global using ASC.Files.Core.Log;
global using ASC.Files.Core.Resources; global using ASC.Files.Core.Resources;
global using ASC.Files.Core.Security; global using ASC.Files.Core.Security;
global using ASC.Files.Expired; global using ASC.Files.Expired;
global using ASC.Files.Service;
global using ASC.Files.Service.Extension;
global using ASC.Files.Service.Log; global using ASC.Files.Service.Log;
global using ASC.Files.ThumbnailBuilder; global using ASC.Files.ThumbnailBuilder;
global using ASC.Thumbnail.IntegrationEvents.EventHandling; global using ASC.Thumbnail.IntegrationEvents.EventHandling;
@ -71,6 +76,7 @@ global using ASC.Web.Files.Classes;
global using ASC.Web.Files.Core.Search; global using ASC.Web.Files.Core.Search;
global using ASC.Web.Files.Services.DocumentService; global using ASC.Web.Files.Services.DocumentService;
global using ASC.Web.Files.Services.FFmpegService; global using ASC.Web.Files.Services.FFmpegService;
global using ASC.Web.Files.Services.WCFService;
global using ASC.Web.Files.Utils; global using ASC.Web.Files.Utils;
global using ASC.Web.Studio.Core; global using ASC.Web.Studio.Core;
@ -81,6 +87,5 @@ global using Microsoft.Extensions.Hosting.WindowsServices;
global using Microsoft.Extensions.Logging; global using Microsoft.Extensions.Logging;
global using SixLabors.ImageSharp; global using SixLabors.ImageSharp;
global using ASC.Files.Service.Extension;
global using static ASC.Files.Core.Helpers.DocumentService; global using static ASC.Files.Core.Helpers.DocumentService;
global using ASC.Files.Service;

View File

@ -23,7 +23,7 @@
// All the Product's GUI elements, including illustrations and icon sets, as well as technical writing // All the Product's GUI elements, including illustrations and icon sets, as well as technical writing
// content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0 // content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0
// International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode // International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
namespace ASC.Files.Service; namespace ASC.Files.Service;
public class Startup : BaseWorkerStartup public class Startup : BaseWorkerStartup
{ {
@ -35,8 +35,8 @@ public class Startup : BaseWorkerStartup
{ {
_configuration = configuration; _configuration = configuration;
_hostEnvironment = hostEnvironment; _hostEnvironment = hostEnvironment;
} }
public override void ConfigureServices(IServiceCollection services) public override void ConfigureServices(IServiceCollection services)
{ {
base.ConfigureServices(services); base.ConfigureServices(services);
@ -91,7 +91,20 @@ public class Startup : BaseWorkerStartup
DIHelper.TryAdd<SecurityContext>(); DIHelper.TryAdd<SecurityContext>();
DIHelper.TryAdd<TenantManager>(); DIHelper.TryAdd<TenantManager>();
DIHelper.TryAdd<UserManager>(); DIHelper.TryAdd<UserManager>();
DIHelper.TryAdd<SocketServiceClient>(); DIHelper.TryAdd<SocketServiceClient>();
DIHelper.TryAdd<FileStorageService<int>>();
services.AddScoped<ITenantQuotaFeatureChecker, CountRoomChecker>();
services.AddScoped<CountRoomChecker>();
services.AddScoped<ITenantQuotaFeatureStat<CountRoomFeature, int>, CountRoomCheckerStatistic>();
services.AddScoped<CountRoomCheckerStatistic>();
services.AddScoped<UsersInRoomChecker>();
services.AddScoped<ITenantQuotaFeatureStat<UsersInRoomFeature, int>, UsersInRoomStatistic>();
services.AddScoped<UsersInRoomStatistic>();
services.AddBaseDbContextPool<FilesDbContext>(); services.AddBaseDbContextPool<FilesDbContext>();