Clean up + Removed old SignalR code

Signed-off-by: Bjarke Berg <mail@bergmania.dk>
This commit is contained in:
Bjarke Berg
2020-10-01 07:09:54 +02:00
parent 26ad4a332f
commit 3607dd14f1
9 changed files with 1 additions and 103 deletions

View File

@@ -68,7 +68,6 @@ namespace Umbraco.Tests.Integration.TestServerTest
builder.ConfigureServices((c, s) =>
{
c.HostingEnvironment = TestHelper.GetWebHostEnvironment();
s.AddSignalR();
});
// call startup
@@ -142,6 +141,7 @@ namespace Umbraco.Tests.Integration.TestServerTest
.WithRuntimeMinifier()
.WithBackOffice()
.WithBackOfficeIdentity()
.WithPreview()
//.WithMiniProfiler() // we don't want this running in tests
.WithMvcAndRazor(mvcBuilding: mvcBuilder =>
{

View File

@@ -1,5 +0,0 @@
@using Umbraco.Web.PublishedModels;
@inherits Umbraco.Web.Common.AspNetCore.UmbracoViewPage
@{
Layout = null;
}

View File

@@ -1,5 +0,0 @@
@using Umbraco.Web.PublishedModels;
@inherits Umbraco.Web.Common.AspNetCore.UmbracoViewPage
@{
Layout = null;
}

View File

@@ -1,5 +0,0 @@
@using Umbraco.Web.PublishedModels;
@inherits Umbraco.Web.Common.AspNetCore.UmbracoViewPage
@{
Layout = null;
}

View File

@@ -1,12 +0,0 @@
namespace Umbraco.Web.SignalR
{
public interface IPreviewHub
{
// define methods implemented by client
// ReSharper disable InconsistentNaming
void refreshed(int id);
// ReSharper restore InconsistentNaming
}
}

View File

@@ -1,7 +0,0 @@
using Microsoft.AspNet.SignalR;
namespace Umbraco.Web.SignalR
{
public class PreviewHub : Hub<IPreviewHub>
{ }
}

View File

@@ -1,47 +0,0 @@
using System;
using Microsoft.AspNet.SignalR;
using Umbraco.Core.Cache;
using Umbraco.Core.Composing;
using Umbraco.Core.Sync;
using Umbraco.Web.Cache;
namespace Umbraco.Web.SignalR
{
public class PreviewHubComponent : IComponent
{
private readonly Lazy<IHubContext<IPreviewHub>> _hubContext;
// using a lazy arg here means that we won't create the hub until necessary
// and therefore we won't have too bad an impact on boot time
public PreviewHubComponent(Lazy<IHubContext<IPreviewHub>> hubContext)
{
_hubContext = hubContext;
}
public void Initialize()
{
// ContentService.Saved is too soon - the content cache is not ready yet,
// so use the content cache refresher event, because when it triggers
// the cache has already been notified of the changes
ContentCacheRefresher.CacheUpdated += HandleCacheUpdated;
}
public void Terminate()
{
ContentCacheRefresher.CacheUpdated -= HandleCacheUpdated;
}
private void HandleCacheUpdated(ContentCacheRefresher sender, CacheRefresherEventArgs args)
{
if (args.MessageType != MessageType.RefreshByPayload) return;
var payloads = (ContentCacheRefresher.JsonPayload[])args.MessageObject;
var hubContextInstance = _hubContext.Value;
foreach (var payload in payloads)
{
var id = payload.Id; // keep it simple for now, ignore ChangeTypes
hubContextInstance.Clients.All.refreshed(id);
}
}
}
}

View File

@@ -1,17 +0,0 @@
using Microsoft.AspNet.SignalR;
using Umbraco.Core;
using Umbraco.Core.Composing;
namespace Umbraco.Web.SignalR
{
[RuntimeLevel(MinLevel = RuntimeLevel.Run)]
public class PreviewHubComposer : ComponentComposer<PreviewHubComponent>, ICoreComposer
{
public override void Compose(Composition composition)
{
base.Compose(composition);
composition.RegisterUnique(_ => GlobalHost.ConnectionManager.GetHubContext<PreviewHub, IPreviewHub>());
}
}
}

View File

@@ -214,7 +214,6 @@
<Compile Include="Mvc\ContainerControllerFactory.cs" />
<Compile Include="OwinExtensions.cs" />
<Compile Include="Security\BackOfficeCookieAuthenticationProvider.cs" />
<Compile Include="SignalR\PreviewHubComposer.cs" />
<Compile Include="WebAssets\CDF\ClientDependencyConfiguration.cs" />
<Compile Include="UmbracoApplicationBase.cs" />
<Compile Include="WebApi\Filters\HttpQueryStringModelBinder.cs" />
@@ -233,9 +232,6 @@
<Compile Include="Security\AuthenticationExtensions.cs" />
<Compile Include="Security\UmbracoSecureDataFormat.cs" />
<Compile Include="Security\UmbracoAuthTicketDataProtector.cs" />
<Compile Include="SignalR\IPreviewHub.cs" />
<Compile Include="SignalR\PreviewHub.cs" />
<Compile Include="SignalR\PreviewHubComponent.cs" />
<Compile Include="UmbracoModule.cs" />
<Compile Include="WebApi\EnableDetailedErrorsAttribute.cs" />
<Compile Include="WebApi\Filters\AppendUserModifiedHeaderAttribute.cs" />