diff --git a/README.md b/README.md index af02fc7..a74a8d0 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # pwakit -aiming to provide tools to facilitate building PWAs (Progressive Web Apps) with ASP.NET Core +aiming to provide tools to facilitate building PWAs (Progressive Web Apps) with ASP.NET Core [Documentation at cloudscribe.com](https://www.cloudscribe.com/cloudscribe-pwakit) diff --git a/demos/cloudscribe.DemoWeb/Program.cs b/demos/cloudscribe.DemoWeb/Program.cs index 5a68746..3f67110 100644 --- a/demos/cloudscribe.DemoWeb/Program.cs +++ b/demos/cloudscribe.DemoWeb/Program.cs @@ -1,5 +1,4 @@ -using Microsoft.AspNetCore; -using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; diff --git a/demos/cloudscribe.DemoWeb/cloudscribe.DemoWeb.csproj b/demos/cloudscribe.DemoWeb/cloudscribe.DemoWeb.csproj index d3b7bef..426c76d 100644 --- a/demos/cloudscribe.DemoWeb/cloudscribe.DemoWeb.csproj +++ b/demos/cloudscribe.DemoWeb/cloudscribe.DemoWeb.csproj @@ -1,7 +1,7 @@  - net8.0 + net10.0 cloudscribe.DemoWeb-779D298B-C8F9-443A-BE6A-DB87C4EF59CB false @@ -37,37 +37,37 @@ - - - - - - - - + + + + + + + + - - - + + + - - - - - + + + + + - - - - + + + + - - - - - - - + + + + + + + diff --git a/demos/cloudscribe.DemoWeb/wwwroot/rss-style.xsl b/demos/cloudscribe.DemoWeb/wwwroot/rss-style.xsl new file mode 100644 index 0000000..51cd5e1 --- /dev/null +++ b/demos/cloudscribe.DemoWeb/wwwroot/rss-style.xsl @@ -0,0 +1,46 @@ + + + + + + + + <xsl:value-of select="/rss/channel/title"/> + + + + + + +
+

+ +

+

+ +

+
+
+ + + +
+ + +
+
\ No newline at end of file diff --git a/demos/cloudscribe.DemoWeb/wwwroot/rss.css b/demos/cloudscribe.DemoWeb/wwwroot/rss.css new file mode 100644 index 0000000..145910c --- /dev/null +++ b/demos/cloudscribe.DemoWeb/wwwroot/rss.css @@ -0,0 +1,59 @@ +* { + box-sizing: border-box; + font-family: sans-serif; + line-height: 1.4; + margin: 0; + padding: 0; +} + +html { + background: #FFFFFF; + color: #212529; +} + +body { + padding: 1.5rem; +} + +a { + color: #337ab7; +} + + a:hover { + color: #296292; + } + +main, header { + margin-block-end: 3rem; + margin-inline: auto; + max-inline-size: 80ch; +} + +article { + margin-block-end: 3rem; +} + +h1 { + font-size: 2.5rem; + line-height: 1.2; + margin-block: 1rem; +} + +h2 { + font-size: 2rem; + margin-block: 2rem; +} + +h3 { + font-size: 1.75rem; + margin-block: 1rem; +} + +p { + font-size: 1.25rem; + margin-block-end: 1rem; +} + +small { + font-size: 1rem; +} \ No newline at end of file diff --git a/src/cloudscribe.PwaKit.Integration.CloudscribeCore/NavigationRuntimeCacheItemProvider.cs b/src/cloudscribe.PwaKit.Integration.CloudscribeCore/NavigationRuntimeCacheItemProvider.cs index 73d5509..7a34e9d 100644 --- a/src/cloudscribe.PwaKit.Integration.CloudscribeCore/NavigationRuntimeCacheItemProvider.cs +++ b/src/cloudscribe.PwaKit.Integration.CloudscribeCore/NavigationRuntimeCacheItemProvider.cs @@ -1,9 +1,11 @@ -using cloudscribe.PwaKit.Interfaces; +using cloudscribe.PwaKit.Interfaces; using cloudscribe.PwaKit.Models; using cloudscribe.Web.Navigation; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.Infrastructure; +using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Routing; +using Microsoft.AspNetCore.Routing; using System.Collections.Generic; using System.Threading.Tasks; @@ -16,21 +18,21 @@ public NavigationRuntimeCacheItemProvider( IEnumerable permissionResolvers, IEnumerable navigationNodeServiceWorkerFilters, IUrlHelperFactory urlHelperFactory, - IActionContextAccessor actionContextAccesor + IHttpContextAccessor contextAccessor ) { _siteMapTreeBuilder = siteMapTreeBuilder; _permissionResolvers = permissionResolvers; _navigationNodeServiceWorkerFilters = navigationNodeServiceWorkerFilters; _urlHelperFactory = urlHelperFactory; - _actionContextAccesor = actionContextAccesor; + _contextAccessor = contextAccessor; } private readonly NavigationTreeBuilderService _siteMapTreeBuilder; private readonly IUrlHelperFactory _urlHelperFactory; - private readonly IActionContextAccessor _actionContextAccesor; + private readonly IHttpContextAccessor _contextAccessor; private readonly IEnumerable _permissionResolvers; private readonly IEnumerable _navigationNodeServiceWorkerFilters; @@ -42,7 +44,12 @@ public async Task> GetItems() var result = new List(); var rootNode = await _siteMapTreeBuilder.GetTree(); - var urlHelper = _urlHelperFactory.GetUrlHelper(_actionContextAccesor.ActionContext); + var actionContext = new ActionContext( + _contextAccessor.HttpContext, + _contextAccessor.HttpContext.GetRouteData(), + new ActionDescriptor() + ); + var urlHelper = _urlHelperFactory.GetUrlHelper(actionContext); foreach (var navNode in rootNode.Flatten()) { bool include = true; diff --git a/src/cloudscribe.PwaKit.Integration.CloudscribeCore/NetworkOnlyUrlProvider.cs b/src/cloudscribe.PwaKit.Integration.CloudscribeCore/NetworkOnlyUrlProvider.cs index f65c7b9..545471b 100644 --- a/src/cloudscribe.PwaKit.Integration.CloudscribeCore/NetworkOnlyUrlProvider.cs +++ b/src/cloudscribe.PwaKit.Integration.CloudscribeCore/NetworkOnlyUrlProvider.cs @@ -1,10 +1,11 @@ -using cloudscribe.PwaKit.Interfaces; +using cloudscribe.PwaKit.Interfaces; using cloudscribe.PwaKit.Models; using cloudscribe.Web.Navigation; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.Infrastructure; +using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Routing; +using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.Options; using System.Collections.Generic; using System.Threading.Tasks; @@ -17,14 +18,14 @@ public NetworkOnlyUrlProvider( NavigationTreeBuilderService siteMapTreeBuilder, IEnumerable permissionResolvers, IUrlHelperFactory urlHelperFactory, - IActionContextAccessor actionContextAccesor, + IHttpContextAccessor contextAccessor, IOptions optionsAccessor ) { _siteMapTreeBuilder = siteMapTreeBuilder; _permissionResolvers = permissionResolvers; _urlHelperFactory = urlHelperFactory; - _actionContextAccesor = actionContextAccesor; + _contextAccessor = contextAccessor; _options = optionsAccessor.Value; _networkOnlyControllers = new List() @@ -46,7 +47,7 @@ IOptions optionsAccessor private readonly NavigationTreeBuilderService _siteMapTreeBuilder; private readonly IEnumerable _permissionResolvers; private readonly IUrlHelperFactory _urlHelperFactory; - private readonly IActionContextAccessor _actionContextAccesor; + private readonly IHttpContextAccessor _contextAccessor; private readonly PwaNetworkOnlyUrlOptions _options; private List _networkOnlyControllers; @@ -79,7 +80,12 @@ public async Task> GetNetworkOnlyUrls(PwaOptions options, HttpConte var rootNode = await _siteMapTreeBuilder.GetTree(); - var urlHelper = _urlHelperFactory.GetUrlHelper(_actionContextAccesor.ActionContext); + var actionContext = new ActionContext( + _contextAccessor.HttpContext, + _contextAccessor.HttpContext.GetRouteData(), + new ActionDescriptor() + ); + var urlHelper = _urlHelperFactory.GetUrlHelper(actionContext); foreach (var navNode in rootNode.Flatten()) { if(await WouldRenderNode(navNode)) diff --git a/src/cloudscribe.PwaKit.Integration.CloudscribeCore/cloudscribe.PwaKit.Integration.CloudscribeCore.csproj b/src/cloudscribe.PwaKit.Integration.CloudscribeCore/cloudscribe.PwaKit.Integration.CloudscribeCore.csproj index 350b4ee..3b2939b 100644 --- a/src/cloudscribe.PwaKit.Integration.CloudscribeCore/cloudscribe.PwaKit.Integration.CloudscribeCore.csproj +++ b/src/cloudscribe.PwaKit.Integration.CloudscribeCore/cloudscribe.PwaKit.Integration.CloudscribeCore.csproj @@ -2,8 +2,8 @@ Integration between cloudscribe.Core and cloudscribe.PwaKit - 8.6.0 - net8.0 + 10.0.0 + net10.0 Joe Audette true pwa,serviceworker,cloudscribe @@ -39,7 +39,7 @@ - + diff --git a/src/cloudscribe.PwaKit.Integration.SimpleContent/cloudscribe.PwaKit.Integration.SimpleContent.csproj b/src/cloudscribe.PwaKit.Integration.SimpleContent/cloudscribe.PwaKit.Integration.SimpleContent.csproj index 8fb3d06..b75a6e9 100644 --- a/src/cloudscribe.PwaKit.Integration.SimpleContent/cloudscribe.PwaKit.Integration.SimpleContent.csproj +++ b/src/cloudscribe.PwaKit.Integration.SimpleContent/cloudscribe.PwaKit.Integration.SimpleContent.csproj @@ -2,8 +2,8 @@ Integration between cloudscribe.SimpleContent and cloudscribe.PwaKit - 8.6.0 - net8.0 + 10.0.0 + net10.0 Joe Audette pwa,serviceworker,cloudscribe icon.png @@ -22,7 +22,7 @@
- +
diff --git a/src/cloudscribe.PwaKit.Storage.EFCore.Common/cloudscribe.PwaKit.Storage.EFCore.Common.csproj b/src/cloudscribe.PwaKit.Storage.EFCore.Common/cloudscribe.PwaKit.Storage.EFCore.Common.csproj index 3ca863b..4e9fe1d 100644 --- a/src/cloudscribe.PwaKit.Storage.EFCore.Common/cloudscribe.PwaKit.Storage.EFCore.Common.csproj +++ b/src/cloudscribe.PwaKit.Storage.EFCore.Common/cloudscribe.PwaKit.Storage.EFCore.Common.csproj @@ -2,8 +2,8 @@ EFCore common code for cloudscribe.PwaKit - 8.6.0 - net8.0 + 10.0.0 + net10.0 Joe Audette pwa,serviceworker,cloudscribe icon.png @@ -18,10 +18,10 @@ - - - - + + + + diff --git a/src/cloudscribe.PwaKit.Storage.EFCore.MSSQL/cloudscribe.PwaKit.Storage.EFCore.MSSQL.csproj b/src/cloudscribe.PwaKit.Storage.EFCore.MSSQL/cloudscribe.PwaKit.Storage.EFCore.MSSQL.csproj index a1918dc..2326831 100644 --- a/src/cloudscribe.PwaKit.Storage.EFCore.MSSQL/cloudscribe.PwaKit.Storage.EFCore.MSSQL.csproj +++ b/src/cloudscribe.PwaKit.Storage.EFCore.MSSQL/cloudscribe.PwaKit.Storage.EFCore.MSSQL.csproj @@ -2,8 +2,8 @@ Microsoft SqlServer storage for cloudscribe.PwaKit - 8.6.0 - net8.0 + 10.0.0 + net10.0 Joe Audette pwa,serviceworker,cloudscribe icon.png @@ -22,13 +22,13 @@ - - - - - - - + + + + + + + diff --git a/src/cloudscribe.PwaKit.Storage.EFCore.MySql/cloudscribe.PwaKit.Storage.EFCore.MySql.csproj b/src/cloudscribe.PwaKit.Storage.EFCore.MySql/cloudscribe.PwaKit.Storage.EFCore.MySql.csproj index c7de4b1..599995a 100644 --- a/src/cloudscribe.PwaKit.Storage.EFCore.MySql/cloudscribe.PwaKit.Storage.EFCore.MySql.csproj +++ b/src/cloudscribe.PwaKit.Storage.EFCore.MySql/cloudscribe.PwaKit.Storage.EFCore.MySql.csproj @@ -2,8 +2,8 @@ MySql storage for cloudscribe.PwaKit - 8.6.0 - net8.0 + 10.0.0 + net10.0 Joe Audette pwa,serviceworker,cloudscribe icon.png @@ -22,12 +22,13 @@ - - - - - - + + + + + + + diff --git a/src/cloudscribe.PwaKit.Storage.EFCore.PostgreSql/cloudscribe.PwaKit.Storage.EFCore.PostgreSql.csproj b/src/cloudscribe.PwaKit.Storage.EFCore.PostgreSql/cloudscribe.PwaKit.Storage.EFCore.PostgreSql.csproj index 9e17e6d..6b10e01 100644 --- a/src/cloudscribe.PwaKit.Storage.EFCore.PostgreSql/cloudscribe.PwaKit.Storage.EFCore.PostgreSql.csproj +++ b/src/cloudscribe.PwaKit.Storage.EFCore.PostgreSql/cloudscribe.PwaKit.Storage.EFCore.PostgreSql.csproj @@ -2,8 +2,8 @@ PostgreSql storage for cloudscribe.PwaKit - 8.6.0 - net8.0 + 10.0.0 + net10.0 Joe Audette pwa,serviceworker,cloudscribe icon.png @@ -22,13 +22,13 @@ - - - - - - - + + + + + + + diff --git a/src/cloudscribe.PwaKit.Storage.EFCore.SQLite/cloudscribe.PwaKit.Storage.EFCore.SQLite.csproj b/src/cloudscribe.PwaKit.Storage.EFCore.SQLite/cloudscribe.PwaKit.Storage.EFCore.SQLite.csproj index 49f9efe..9385ce8 100644 --- a/src/cloudscribe.PwaKit.Storage.EFCore.SQLite/cloudscribe.PwaKit.Storage.EFCore.SQLite.csproj +++ b/src/cloudscribe.PwaKit.Storage.EFCore.SQLite/cloudscribe.PwaKit.Storage.EFCore.SQLite.csproj @@ -2,8 +2,8 @@ SQLite storage for cloudscribe.PwaKit - 8.6.0 - net8.0 + 10.0.0 + net10.0 Joe Audette pwa,serviceworker,cloudscribe icon.png @@ -22,12 +22,12 @@ - - - - - - + + + + + + diff --git a/src/cloudscribe.PwaKit.Storage.NoDb/cloudscribe.PwaKit.Storage.NoDb.csproj b/src/cloudscribe.PwaKit.Storage.NoDb/cloudscribe.PwaKit.Storage.NoDb.csproj index 357997d..b294bdd 100644 --- a/src/cloudscribe.PwaKit.Storage.NoDb/cloudscribe.PwaKit.Storage.NoDb.csproj +++ b/src/cloudscribe.PwaKit.Storage.NoDb/cloudscribe.PwaKit.Storage.NoDb.csproj @@ -2,8 +2,8 @@ NoDb storage for cloudscribe.PwaKit - 8.6.0 - net8.0 + 10.0.0 + net10.0 Joe Audette pwa,serviceworker,cloudscribe icon.png @@ -23,7 +23,7 @@ - + diff --git a/src/cloudscribe.PwaKit/ServiceWorkerTagHelperComponent.cs b/src/cloudscribe.PwaKit/ServiceWorkerTagHelperComponent.cs index f9cf2d0..cf19939 100644 --- a/src/cloudscribe.PwaKit/ServiceWorkerTagHelperComponent.cs +++ b/src/cloudscribe.PwaKit/ServiceWorkerTagHelperComponent.cs @@ -1,9 +1,10 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.Infrastructure; +using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Routing; using Microsoft.AspNetCore.Razor.TagHelpers; +using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Options; using System; @@ -18,18 +19,15 @@ internal class ServiceWorkerTagHelperComponent : TagHelperComponent private IHttpContextAccessor _contextAccessor; private PwaOptions _options; private IUrlHelperFactory _urlHelperFactory; - private IActionContextAccessor _actionContextAccesor; public ServiceWorkerTagHelperComponent( IUrlHelperFactory urlHelperFactory, - IActionContextAccessor actionContextAccesor, IWebHostEnvironment env, IHttpContextAccessor accessor, IOptions pwaOptionsAccessor ) { _urlHelperFactory = urlHelperFactory; - _actionContextAccesor = actionContextAccesor; _env = env; _contextAccessor = accessor; _options = pwaOptionsAccessor.Value; @@ -41,7 +39,12 @@ IOptions pwaOptionsAccessor private string BuildScript() { - var urlHelper = _urlHelperFactory.GetUrlHelper(_actionContextAccesor.ActionContext); + var actionContext = new ActionContext( + _contextAccessor.HttpContext, + _contextAccessor.HttpContext.GetRouteData(), + new ActionDescriptor() + ); + var urlHelper = _urlHelperFactory.GetUrlHelper(actionContext); var url = urlHelper.Action("Init", "Pwa"); var script = "\r\n\t"; diff --git a/src/cloudscribe.PwaKit/Services/ServiceWorker/OfflinePageUrlProvider.cs b/src/cloudscribe.PwaKit/Services/ServiceWorker/OfflinePageUrlProvider.cs index f381a90..a6064f2 100644 --- a/src/cloudscribe.PwaKit/Services/ServiceWorker/OfflinePageUrlProvider.cs +++ b/src/cloudscribe.PwaKit/Services/ServiceWorker/OfflinePageUrlProvider.cs @@ -1,7 +1,9 @@ using cloudscribe.PwaKit.Interfaces; +using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.Infrastructure; +using Microsoft.AspNetCore.Mvc.Abstractions; using Microsoft.AspNetCore.Mvc.Routing; +using Microsoft.AspNetCore.Routing; namespace cloudscribe.PwaKit.Services { @@ -9,22 +11,27 @@ public class OfflinePageUrlProvider : IOfflinePageUrlProvider { public OfflinePageUrlProvider( IUrlHelperFactory urlHelperFactory, - IActionContextAccessor actionContextAccesor, + IHttpContextAccessor contextAccessor, IPwaRouteNameProvider pwaRouteNameProvider ) { _urlHelperFactory = urlHelperFactory; - _actionContextAccesor = actionContextAccesor; + _contextAccessor = contextAccessor; _pwaRouteNameProvider = pwaRouteNameProvider; } private readonly IUrlHelperFactory _urlHelperFactory; - private readonly IActionContextAccessor _actionContextAccesor; + private readonly IHttpContextAccessor _contextAccessor; private readonly IPwaRouteNameProvider _pwaRouteNameProvider; public string GetOfflineUrl() { - var urlHelper = _urlHelperFactory.GetUrlHelper(_actionContextAccesor.ActionContext); + var actionContext = new ActionContext( + _contextAccessor.HttpContext, + _contextAccessor.HttpContext.GetRouteData(), + new ActionDescriptor() + ); + var urlHelper = _urlHelperFactory.GetUrlHelper(actionContext); return urlHelper.RouteUrl(_pwaRouteNameProvider.GetOfflinePageRouteName()); } diff --git a/src/cloudscribe.PwaKit/cloudscribe.PwaKit.csproj b/src/cloudscribe.PwaKit/cloudscribe.PwaKit.csproj index 876a66c..d264b1d 100644 --- a/src/cloudscribe.PwaKit/cloudscribe.PwaKit.csproj +++ b/src/cloudscribe.PwaKit/cloudscribe.PwaKit.csproj @@ -2,8 +2,8 @@ A set of tools for building a dynamic serviceworker at runtime for ASP.NET Core - 8.6.0 - net8.0 + 10.0.0 + net10.0 Joe Audette true pwa,serviceworker,manifest,cloudscribe @@ -38,14 +38,26 @@ - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/update_version.ps1 b/update_version.ps1 index 15f706a..d8f11bb 100644 --- a/update_version.ps1 +++ b/update_version.ps1 @@ -16,9 +16,9 @@ $directory = "src" # Define the old & new versions -$oldVersion = '8\.5' # slash needed ! -$newVersion = "8.6.0" -$newWildcardVersion = "8.6.*" +$oldVersion = '8\.7' # slash needed ! +$newVersion = "8.8.0" +$newWildcardVersion = "8.8.*" # Get all .csproj files in the directory and subdirectories