Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,5 @@ FakesAssemblies/

# Rider
*/.idea/*
.idea/*
.idea/*
/.claude
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
<PackageId>Geta.NotFoundHandler.Admin</PackageId>
<Title>Admin UI for NotFound Handler for ASP.NET Core and EPiServer</Title>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<PackageId>Geta.NotFoundHandler.Optimizely.Commerce</PackageId>
<Title>NotFound handler Admin UI integration Optimizely Commerce</Title>
<Authors>Geta Digital</Authors>
Expand Down Expand Up @@ -30,7 +30,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="EPiServer.Commerce.Core" Version="14.3.1" />
<PackageReference Include="EPiServer.Commerce.Core" Version="15.0.0-preview1" />
<PackageReference Include="MailKit" Version="4.16.0" />
<PackageReference Include="System.Security.Cryptography.Xml" Version="10.0.7" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,27 @@
using System.Collections.Generic;
using System.Linq;
using EPiServer;
using EPiServer.Applications;
using EPiServer.Core;
using EPiServer.Web;

namespace Geta.NotFoundHandler.Optimizely.Core.AutomaticRedirects
{
public class CmsContentLinkProvider : IContentLinkProvider
{
private readonly ISiteDefinitionRepository _siteDefinitionRepository;
private readonly IApplicationRepository _applicationRepository;
private readonly IContentLoader _contentLoader;

public CmsContentLinkProvider(ISiteDefinitionRepository siteDefinitionRepository, IContentLoader contentLoader)
public CmsContentLinkProvider(IApplicationRepository applicationRepository, IContentLoader contentLoader)
{
_siteDefinitionRepository = siteDefinitionRepository;
_applicationRepository = applicationRepository;
_contentLoader = contentLoader;
}

public IEnumerable<ContentReference> GetAllLinks()
{
var allSites = _siteDefinitionRepository.List();
return allSites.SelectMany(site => _contentLoader.GetDescendents(site.StartPage));
return _applicationRepository.List()
.OfType<IRoutableApplication>()
.SelectMany(app => _contentLoader.GetDescendents(app.EntryPoint));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@

using System;
using System.Linq;
using EPiServer.PlugIn;
using EPiServer.Scheduler;
using Geta.NotFoundHandler.Optimizely.Infrastructure;

namespace Geta.NotFoundHandler.Optimizely.Core.AutomaticRedirects
{
[ScheduledPlugIn(DisplayName = "[Geta NotFoundHandler] Index content URLs",
GUID = "53C743AE-E152-497A-A7E5-7E30F4B5B321",
SortIndex = 5555)]
[ScheduledJob(DisplayName = "[Geta NotFoundHandler] Index content URLs",
GUID = "53C743AE-E152-497A-A7E5-7E30F4B5B321")]
public class IndexContentUrlsJob : ScheduledJobBase
{
private bool _stopped;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,13 @@

using System;
using System.Linq;
using EPiServer.PlugIn;
using EPiServer.Scheduler;
using Geta.NotFoundHandler.Optimizely.Infrastructure;

namespace Geta.NotFoundHandler.Optimizely.Core.AutomaticRedirects
{
[ScheduledPlugIn(DisplayName = "[Geta NotFoundHandler] Register content move redirects",
GUID = "EC96ABEE-5DA4-404F-A0C8-451C77CA4983",
SortIndex = 5555)]
[ScheduledJob(DisplayName = "[Geta NotFoundHandler] Register content move redirects",
GUID = "EC96ABEE-5DA4-404F-A0C8-451C77CA4983")]
public class RegisterMovedContentRedirectsJob : ScheduledJobBase
{
private readonly IContentUrlHistoryLoader _contentUrlHistoryLoader;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
// Copyright (c) Geta Digital. All rights reserved.
// Licensed under Apache-2.0. See the LICENSE file in the project root for more information

using EPiServer.PlugIn;
using EPiServer.Scheduler;
using Geta.NotFoundHandler.Core.Suggestions;

namespace Geta.NotFoundHandler.Optimizely.Core.Suggestions.Jobs;

[ScheduledPlugIn(DisplayName = "[Geta NotFoundHandler] Suggestions cleanup job",
Description = "As suggestions table grow fast we should add a possibility to clean up old suggestions",
GUID = "6AE19CEC-1052-4482-97DF-981076DDD6F2",
SortIndex = 5555)]
[ScheduledJob(DisplayName = "[Geta NotFoundHandler] Suggestions cleanup job",
Description = "As suggestions table grow fast we should add a possibility to clean up old suggestions",
GUID = "6AE19CEC-1052-4482-97DF-981076DDD6F2")]
public class SuggestionsCleanupJob : ScheduledJobBase
{
private readonly ISuggestionsCleanupService _suggestionsCleanupService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
using System.Linq;
using Geta.NotFoundHandler.Data;
using Geta.NotFoundHandler.Optimizely.Core.AutomaticRedirects;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.Security.Cryptography;
using System.Text;
using System.Text.Json;
Comment thread
valdisiljuconoks marked this conversation as resolved.
using System.Text.Json.Serialization;

namespace Geta.NotFoundHandler.Optimizely.Data
{
Expand All @@ -25,18 +25,10 @@ public SqlContentUrlHistoryRepository(IDataExecutor dataExecutor)
_dataExecutor = dataExecutor;
}

private static JsonSerializerSettings JsonSettings
private static readonly JsonSerializerOptions JsonSettings = new()
{
get
{
var settings = new JsonSerializerSettings
{
DateTimeZoneHandling = DateTimeZoneHandling.Utc, Formatting = Formatting.None
};
settings.Converters.Add(new StringEnumConverter());
return settings;
}
}
Converters = { new JsonStringEnumConverter() }
};

private static byte[] CalculateMd5Hash(string input)
{
Expand Down Expand Up @@ -173,14 +165,14 @@ private void Update(ContentUrlHistory entity)

private static string ToJson(ICollection<TypedUrl> urls)
{
return JsonConvert.SerializeObject(urls, JsonSettings);
return JsonSerializer.Serialize(urls, JsonSettings);
}

private static ICollection<TypedUrl> FromJson(string value)
{
return string.IsNullOrEmpty(value)
? new List<TypedUrl>()
: JsonConvert.DeserializeObject<List<TypedUrl>>(value, JsonSettings);
: JsonSerializer.Deserialize<List<TypedUrl>>(value, JsonSettings);
}

private static IEnumerable<ContentUrlHistory> ToContentUrlHistory(DataTable table)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@using EPiServer.Framework.Web.Resources
@using EPiServer.Shell.Navigation
<!DOCTYPE html>
<html lang="en">
<head>
Expand Down Expand Up @@ -31,8 +30,8 @@
</head>
<body>
@Html.AntiForgeryToken()
@Html.CreatePlatformNavigationMenu()
<div @Html.ApplyPlatformNavigation()>
<platform-navigation />
<div>
@RenderBody()
</div>
</body>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
<PackageId>Geta.NotFoundHandler.Optimizely</PackageId>
<Title>NotFound handler Admin UI integration Optimizely</Title>
Expand All @@ -23,7 +23,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="EPiServer.CMS.UI.Core" Version="12.7.0" />
<PackageReference Include="EPiServer.CMS.UI.Core" Version="13.0.2" />
<PackageReference Include="MailKit" Version="4.16.0" />
</ItemGroup>

<ItemGroup>
Expand Down
3 changes: 2 additions & 1 deletion src/Geta.NotFoundHandler.Web/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -201,4 +201,5 @@ FakesAssemblies/
.idea/*

wwwroot
modules
modules/*
!modules/ModulesInclude.proj
12 changes: 6 additions & 6 deletions src/Geta.NotFoundHandler.Web/Geta.NotFoundHandler.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\sub\geta-foundation-core\src\Foundation\Foundation.csproj" />
<ProjectReference Include="..\Geta.NotFoundHandler.Admin\Geta.NotFoundHandler.Admin.csproj"/>
<ProjectReference Include="..\Geta.NotFoundHandler.Optimizely.Commerce\Geta.NotFoundHandler.Optimizely.Commerce.csproj"/>
<ProjectReference Include="..\Geta.NotFoundHandler.Optimizely\Geta.NotFoundHandler.Optimizely.csproj"/>
<ProjectReference Include="..\Geta.NotFoundHandler\Geta.NotFoundHandler.csproj"/>
<ProjectReference Include="..\Geta.NotFoundHandler.Admin\Geta.NotFoundHandler.Admin.csproj" />
<ProjectReference Include="..\Geta.NotFoundHandler.Optimizely.Commerce\Geta.NotFoundHandler.Optimizely.Commerce.csproj" />
<ProjectReference Include="..\Geta.NotFoundHandler.Optimizely\Geta.NotFoundHandler.Optimizely.csproj" />
<ProjectReference Include="..\Geta.NotFoundHandler\Geta.NotFoundHandler.csproj" />
</ItemGroup>

<Import Project="..\..\sub\geta-foundation-core\src\Foundation\modules\ModulesInclude.proj"/>
<Import Project="modules\ModulesInclude.proj" Condition="Exists('modules\ModulesInclude.proj')" />
</Project>
8 changes: 7 additions & 1 deletion src/Geta.NotFoundHandler.Web/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using EPiServer.Authorization;
using EPiServer.Cms.Shell.UI;
using EPiServer.DependencyInjection;
using EPiServer.Framework.Hosting;
using EPiServer.Web.Hosting;
using Geta.NotFoundHandler.Infrastructure.Configuration;
Expand All @@ -25,6 +27,10 @@ public void ConfigureServices(IServiceCollection services)
services.AddNotFoundHandler(o => o.UseSqlServer(_configuration.GetConnectionString("EPiServerDB")),
policy => policy.RequireRole(Roles.CmsAdmins));
services.AddOptimizelyNotFoundHandler();
services.AddAdminUserRegistration(options =>
{
options.Behavior = RegisterAdminUserBehaviors.Enabled;
});
_foundationStartup.ConfigureServices(services);

var moduleName = typeof(ContainerController).Assembly.GetName().Name;
Expand All @@ -33,7 +39,7 @@ public void ConfigureServices(IServiceCollection services)
services.Configure<CompositeFileProviderOptions>(options =>
{
options.BasePathFileProviders.Add(new MappingPhysicalFileProvider(
$"/EPiServer/{moduleName}",
$"/Optimizely/{moduleName}",
string.Empty,
fullPath));
});
Expand Down
17 changes: 10 additions & 7 deletions src/Geta.NotFoundHandler.Web/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,19 @@
"Default": "Warning",
"Microsoft.AspNetCore.Mvc.Razor": "Debug",
"Microsoft.AspNetCore.Mvc.ViewEngines": "Debug"

}
},
"AllowedHosts": "*",
"EPiServer": {
"Find": {
"DefaultIndex": "changeme",
"ServiceUrl": "http://changeme",
"TrackingSanitizerEnabled": true,
"TrackingTimeout": 30000
},
"Optimizely": {
"ContentGraph": {
"GatewayAddress": "https://cg.optimizely.com",
"AppKey": "changeme",
"Secret": "changeme",
"SingleKey": "changeme"
}
},
"EPiServer": {
"OdpVisitorGroupOptions": {
"OdpCookieName": "vuid",
"CacheTimeoutSeconds": 1,
Expand Down
39 changes: 39 additions & 0 deletions src/Geta.NotFoundHandler.Web/modules/ModulesInclude.proj
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
Comment thread
valdisiljuconoks marked this conversation as resolved.
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="15.0">
<!-- Copy all Foundation modules to customer project on build -->
<Target Name="CopyAllFoundationModulesToCustomerProjectOnBuild" BeforeTargets="BeforeBuild">
<PropertyGroup>
<SourceFolder>..\..\sub\geta-foundation-core\src\Foundation\modules</SourceFolder>
<DestinationFolder>modules</DestinationFolder>
</PropertyGroup>

<ItemGroup>
<FilesToCopy Remove="@(FilesToCopy)" />
<FilesToCopy Include="$([MSBuild]::EnsureTrailingSlash('$(SourceFolder)'))**\*.*"/>
</ItemGroup>

<Message Text="Copy all Foundation modules to customer project on build from: [$(SourceFolder)] to: [$(DestinationFolder)]" Importance="high"/>

<Copy SourceFiles="@(FilesToCopy)" DestinationFolder="$([MSBuild]::EnsureTrailingSlash('$(DestinationFolder)'))%(RecursiveDir)"/>
</Target>

<!-- Static assets from Foundation are served via the project reference through ASP.NET Core's
static web assets pipeline in CMS 13. No explicit copy is needed. -->

<!-- *************** Copying Foundation modules from build to publish folder *************** -->
<Target Name="CopyingFoundationModulesFromBuildToPublishFolder" BeforeTargets="PrepareForPublish">
<PropertyGroup>
<SourceFolder>modules</SourceFolder>
<DestinationFolder>$(PublishDir)\modules</DestinationFolder>
</PropertyGroup>

<ItemGroup>
<FilesToCopy Remove="@(FilesToCopy)" />
<FilesToCopy Include="$([MSBuild]::EnsureTrailingSlash('$(SourceFolder)'))**\*.*"/>
</ItemGroup>

<Message Text="Copying Foundation modules from build to publish folder from: [$(SourceFolder)] to: [$(DestinationFolder)]" Importance="high"/>

<Copy SourceFiles="@(FilesToCopy)" DestinationFolder="$([MSBuild]::EnsureTrailingSlash('$(DestinationFolder)'))%(RecursiveDir)"/>
</Target>
</Project>
4 changes: 2 additions & 2 deletions src/Geta.NotFoundHandler/Geta.NotFoundHandler.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<PackageId>Geta.NotFoundHandler</PackageId>
<Title>NotFound Handler for ASP.NET Core</Title>
<Authors>Geta Digital</Authors>
Expand All @@ -28,7 +28,7 @@
<ItemGroup>
<PackageReference Include="Coravel" Version="5.0.4" />
<PackageReference Include="CsvHelper" Version="33.0.0" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="2.1.1" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="6.1.5" />
<PackageReference Include="X.PagedList" Version="8.4.3" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion sub/geta-foundation-core
Loading
Loading