Merge branch 'develop' into bugfix/trash-room-title
This commit is contained in:
commit
34bca3442a
@ -113,6 +113,7 @@ public abstract class BaseStartup
|
||||
|
||||
DIHelper.AddControllers();
|
||||
DIHelper.TryAdd<CultureMiddleware>();
|
||||
DIHelper.TryAdd<LoggerMiddleware>();
|
||||
DIHelper.TryAdd<IpSecurityFilter>();
|
||||
DIHelper.TryAdd<PaymentFilter>();
|
||||
DIHelper.TryAdd<ProductSecurityFilter>();
|
||||
@ -290,6 +291,8 @@ public abstract class BaseStartup
|
||||
|
||||
app.UseCultureMiddleware();
|
||||
|
||||
app.UseLoggerMiddleware();
|
||||
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapCustom();
|
||||
|
78
common/ASC.Api.Core/Middleware/LoggerMiddleware.cs
Normal file
78
common/ASC.Api.Core/Middleware/LoggerMiddleware.cs
Normal file
@ -0,0 +1,78 @@
|
||||
// (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
|
||||
|
||||
using Amazon.Runtime.Internal.Transform;
|
||||
|
||||
namespace ASC.Api.Core.Middleware;
|
||||
|
||||
public class LoggerMiddleware
|
||||
{
|
||||
private readonly RequestDelegate _next;
|
||||
|
||||
public LoggerMiddleware(RequestDelegate next)
|
||||
{
|
||||
_next = next;
|
||||
}
|
||||
|
||||
public async Task Invoke(HttpContext context,
|
||||
TenantManager tenantManager,
|
||||
CoreSettings coreSettings,
|
||||
ILogger<LoggerMiddleware> logger)
|
||||
{
|
||||
var tenant = tenantManager.GetCurrentTenant(false, context);
|
||||
|
||||
if (tenant == null)
|
||||
{
|
||||
await _next.Invoke(context);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
var state = new Dictionary<string, object>()
|
||||
{
|
||||
new KeyValuePair<string, object>("tenantId", tenant.Id),
|
||||
new KeyValuePair<string, object>("tenantAlias", tenant.GetTenantDomain(coreSettings, false))
|
||||
};
|
||||
|
||||
if (tenant.MappedDomain != null)
|
||||
{
|
||||
state.Add("tenantMappedDomain", tenant.MappedDomain);
|
||||
}
|
||||
|
||||
using (logger.BeginScope(state.ToArray()))
|
||||
{
|
||||
await _next.Invoke(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class LoggerMiddlewareExtensions
|
||||
{
|
||||
public static IApplicationBuilder UseLoggerMiddleware(this IApplicationBuilder builder)
|
||||
{
|
||||
return builder.UseMiddleware<LoggerMiddleware>();
|
||||
}
|
||||
}
|
@ -114,7 +114,7 @@ public class EmployeeDtoHelper
|
||||
|
||||
if (_httpContext.Check("avatarSmall"))
|
||||
{
|
||||
result.AvatarSmall = await _userPhotoManager.GetSmallPhotoURL(userInfo.Id) + $"?_={cacheKey}";
|
||||
result.AvatarSmall = await _userPhotoManager.GetSmallPhotoURL(userInfo.Id) + $"?hash={cacheKey}";
|
||||
}
|
||||
|
||||
if (result.Id != Guid.Empty)
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
throwConfigExceptions="false"
|
||||
throwConfigExceptions="true"
|
||||
autoReload="true">
|
||||
<extensions>
|
||||
<add assembly="NLog.Web.AspNetCore"/>
|
||||
@ -10,7 +10,6 @@
|
||||
|
||||
<variable name="dir" value="..\Logs\"/>
|
||||
<variable name="name" value="web"/>
|
||||
<conversionPattern value=""/>
|
||||
|
||||
<targets async="true">
|
||||
<default-target-parameters type="File" maxArchiveDays="30" archiveNumbering="DateAndSequence" archiveEvery="Day" enableArchiveFileCompression="true" archiveAboveSize="52428800" archiveDateFormat="MM-dd" layout="${date:format=yyyy-MM-dd HH\:mm\:ss,fff} ${level:uppercase=true} [${threadid}] ${logger} - ${message} ${exception:format=ToString}"/>
|
||||
@ -18,7 +17,7 @@
|
||||
<target name="sql" type="File" fileName="${var:dir}${var:name}.sql.log" layout="${date:universalTime=true:format=yyyy-MM-dd HH\:mm\:ss,fff}|${threadid}|${event-properties:item=elapsed}|${replace:inner=${event-properties:item=commandText}:searchFor=\\r\\n|\\s:replaceWith= :regex=true}|${event-properties:item=parameters}"/>
|
||||
<target name="ownFile-web" type="File" fileName="${var:dir}${var:name}.asp.log" layout="${longdate}|${event-properties:item=EventId_Id}|${uppercase:${level}}|${logger}|${message} ${exception:format=tostring}|url: ${aspnet-request-url}|action: ${aspnet-mvc-action}" />
|
||||
<target type="AWSTarget" name="aws" logGroup="/asc/docspace/cluster/cluster_name/general" region="us-east-1" LogStreamNamePrefix="${hostname} - ${application-context}">
|
||||
<layout xsi:type="JsonLayout" includeAllProperties="true">
|
||||
<layout xsi:type="JsonLayout" includeEventProperties="true" includeScopeProperties="true" maxRecursionLimit="2">
|
||||
<attribute name="date" layout="${date:format=yyyy-MM-dd HH\:mm\:ss,fff}" />
|
||||
<attribute name="level" layout="${level:upperCase=true}"/>
|
||||
<attribute name="instanceId" layout="${hostname}"/>
|
||||
@ -30,7 +29,7 @@
|
||||
</layout>
|
||||
</target>
|
||||
<target type="AWSTarget" name="aws_sql" logGroup="/asc/docspace/cluster/cluster_name/sql" region="us-east-1" LogStreamNamePrefix="${hostname} - ${application-context}">
|
||||
<layout xsi:type="JsonLayout" includeAllProperties="true">
|
||||
<layout xsi:type="JsonLayout" includeEventProperties="true" includeScopeProperties="true">
|
||||
<attribute name="date" layout="${date:universalTime=true:format=yyyy-MM-dd HH\:mm\:ss,fff}" />
|
||||
<attribute name="instanceId" layout="${hostname}"/>
|
||||
<attribute name="applicationContext" layout="${application-context}"/>
|
||||
|
@ -687,6 +687,7 @@ const ViewerBase = (props) => {
|
||||
opacity={state.opacity}
|
||||
getImageCenterXY={getImageCenterXY}
|
||||
setPanelVisible={props.setPanelVisible}
|
||||
handleDefaultAction={handleDefaultAction}
|
||||
handleZoom={handleZoom}
|
||||
handleResetZoom={handleResetZoom}
|
||||
height={state.height}
|
||||
|
@ -3,6 +3,7 @@ import classnames from "classnames";
|
||||
import ViewerLoading from "./viewer-loading";
|
||||
import { useSwipeable } from "../../react-swipeable";
|
||||
import { isIOS, isMobile } from "react-device-detect";
|
||||
import { ActionType } from "./icon";
|
||||
|
||||
import MobileViewer from "./mobile-viewer";
|
||||
function ViewerImage(props) {
|
||||
@ -366,6 +367,10 @@ function ViewerImage(props) {
|
||||
}
|
||||
};
|
||||
|
||||
const handleClick = (e) => {
|
||||
if (e?.detail === 2) props.handleDefaultAction(ActionType.zoomIn);
|
||||
};
|
||||
|
||||
function handleResize(e) {
|
||||
props.onResize();
|
||||
}
|
||||
@ -448,6 +453,7 @@ translateX(${props.left !== null ? props.left + "px" : "auto"}) translateY(${
|
||||
style={imgStyle}
|
||||
ref={imgRef}
|
||||
onMouseDown={handleMouseDown}
|
||||
onClick={handleClick}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
@ -3207,8 +3207,8 @@ public class FileStorageService<T> //: IFileStorageService
|
||||
try
|
||||
{
|
||||
var (fileIntIds, _) = FileOperationsManager.GetIds(fileIds);
|
||||
|
||||
_eventBus.Publish(new ThumbnailRequestedIntegrationEvent(Guid.Empty, _tenantManager.GetCurrentTenant().Id)
|
||||
|
||||
_eventBus.Publish(new ThumbnailRequestedIntegrationEvent(_authContext.CurrentAccount.ID, _tenantManager.GetCurrentTenant().Id)
|
||||
{
|
||||
BaseUrl = _baseCommonLinkUtility.GetFullAbsolutePath(""),
|
||||
FileIds = fileIntIds
|
||||
|
@ -66,16 +66,14 @@ try
|
||||
|
||||
startup.ConfigureServices(builder.Services);
|
||||
|
||||
builder.Host.ConfigureContainer<ContainerBuilder>(containerBuilder =>
|
||||
{
|
||||
startup.ConfigureContainer(containerBuilder);
|
||||
});
|
||||
builder.Host.ConfigureContainer<ContainerBuilder>(startup.ConfigureContainer);
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
startup.Configure(app, app.Environment);
|
||||
|
||||
logger.Info("Starting web host ({applicationContext})...", AppName);
|
||||
|
||||
await app.RunWithTasksAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
Loading…
Reference in New Issue
Block a user