Skip to content

Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.

Remove Pwa - will be available as a separate plugin

KrzysztofPajak98c4daa563e2
diff --git a/src/Core/Grand.Infrastructure/Configuration/AppConfig.cs b/src/Core/Grand.Infrastructure/Configuration/AppConfig.cs
index 5a2d25d8d..701fb1a5c 100644
--- a/src/Core/Grand.Infrastructure/Configuration/AppConfig.cs
+++ b/src/Core/Grand.Infrastructure/Configuration/AppConfig.cs
@@ -165,12 +165,6 @@ namespace Grand.Infrastructure.Configuration
/// </summary>
public bool LoadAllUrlEntitiesOnStartup { get; set; }
- /// <summary>
- /// Enable minimal Progressive Web App.
- /// </summary>
- public bool EnableProgressiveWebApp { get; set; }
- public int ServiceWorkerStrategy { get; set; }
-
/// <summary>
/// Gets or sets a value of "Cache-Control" header value for static content
/// </summary>
diff --git a/src/Web/Grand.Web.Common/Extensions/ApiExplorerIgnores.cs b/src/Web/Grand.Web.Common/Extensions/ApiExplorerIgnores.cs
deleted file mode 100644
index 3b0ee8d8e..000000000
--- a/src/Web/Grand.Web.Common/Extensions/ApiExplorerIgnores.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using Microsoft.AspNetCore.Mvc.ApplicationModels;
-
-namespace Grand.Web.Common.Extensions
-{
- public class ApiExplorerIgnores : IActionModelConvention
- {
- public void Apply(ActionModel action)
- {
- if (action.Controller.ControllerName.Equals("Pwa"))
- action.ApiExplorer.IsVisible = false;
- }
- }
-}
diff --git a/src/Web/Grand.Web.Common/Grand.Web.Common.csproj b/src/Web/Grand.Web.Common/Grand.Web.Common.csproj
index aa35f837c..f955d8932 100644
--- a/src/Web/Grand.Web.Common/Grand.Web.Common.csproj
+++ b/src/Web/Grand.Web.Common/Grand.Web.Common.csproj
@@ -9,7 +9,6 @@
<PackageReference Include="NetEscapades.AspNetCore.SecurityHeaders" Version="0.16.1" />
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="5.0.0" />
<PackageReference Include="Wangkanai.Detection" Version="4.0.0" />
- <PackageReference Include="WebEssentials.AspNetCore.PWA" Version="1.0.65" />
<PackageReference Include="WebMarkupMin.AspNetCore6" Version="2.11.0" />
<PackageReference Include="WebMarkupMin.Core" Version="2.9.0" />
<PackageReference Include="WebMarkupMin.NUglify" Version="2.11.0" />
diff --git a/src/Web/Grand.Web.Common/Infrastructure/ServiceCollectionExtensions.cs b/src/Web/Grand.Web.Common/Infrastructure/ServiceCollectionExtensions.cs
index cb49b967a..f9dfaccb0 100644
--- a/src/Web/Grand.Web.Common/Infrastructure/ServiceCollectionExtensions.cs
+++ b/src/Web/Grand.Web.Common/Infrastructure/ServiceCollectionExtensions.cs
@@ -180,11 +180,7 @@ namespace Grand.Web.Common.Infrastructure
public static IMvcBuilder AddGrandMvc(this IServiceCollection services, IConfiguration configuration)
{
//add basic MVC feature
- var mvcBuilder = services.AddMvc(options =>
- {
- //for API - ignore for PWA
- options.Conventions.Add(new ApiExplorerIgnores());
- });
+ var mvcBuilder = services.AddMvc();
//add view localization
mvcBuilder.AddViewLocalization();
@@ -365,27 +361,5 @@ namespace Grand.Web.Common.Infrastructure
{
services.AddDetection();
}
-
-
- /// <summary>
- /// Add Progressive Web App
- /// </summary>
- /// <param name="services">Collection of service descriptors</param>
- public static void AddPWA(this IServiceCollection services, IConfiguration configuration)
- {
- if (!DataSettingsManager.DatabaseIsInstalled())
- return;
-
- var config = new AppConfig();
- configuration.GetSection("Application").Bind(config);
- if (config.EnableProgressiveWebApp)
- {
- var options = new WebEssentials.AspNetCore.Pwa.PwaOptions {
- Strategy = (WebEssentials.AspNetCore.Pwa.ServiceWorkerStrategy)config.ServiceWorkerStrategy,
- RoutesToIgnore = "/admin/*"
- };
- services.AddProgressiveWebApp(options);
- }
- }
}
}
\ No newline at end of file
diff --git a/src/Web/Grand.Web.Common/Startup/GrandMvcStartup.cs b/src/Web/Grand.Web.Common/Startup/GrandMvcStartup.cs
index d41baf5e7..fc49d042d 100644
--- a/src/Web/Grand.Web.Common/Startup/GrandMvcStartup.cs
+++ b/src/Web/Grand.Web.Common/Startup/GrandMvcStartup.cs
@@ -31,9 +31,6 @@ namespace Grand.Web.Common.Startup
//add and configure MVC feature
services.AddGrandMvc(configuration);
- //add pwa
- services.AddPWA(configuration);
-
}
/// <summary>
diff --git a/src/Web/Grand.Web/App_Data/appsettings.json b/src/Web/Grand.Web/App_Data/appsettings.json
index 92e8cf06f..387cb1604 100644
--- a/src/Web/Grand.Web/App_Data/appsettings.json
+++ b/src/Web/Grand.Web/App_Data/appsettings.json
@@ -133,15 +133,6 @@
//A value indicating whether to ignore "limit per store" rules
"IgnoreStoreLimitations": false,
- ///Enable minimal Progressive Web App.
- "EnableProgressiveWebApp": false,
- //CacheFirst = 0,
- //CacheFirstSafe = 1,
- //CacheFingerprinted = 2,
- //Minimal = 3,
- //NetworkFirst = 4
- "ServiceWorkerStrategy": 3,
-
//Use my request localization culture
"UseRequestLocalization": false,
"DefaultRequestCulture": "en-US",
diff --git a/src/Web/Grand.Web/Program.cs b/src/Web/Grand.Web/Program.cs
index ee08fe016..afff8048f 100644
--- a/src/Web/Grand.Web/Program.cs
+++ b/src/Web/Grand.Web/Program.cs
@@ -15,7 +15,6 @@ builder.Host.UseDefaultServiceProvider((context, options) =>
options.ValidateOnBuild = false;
});
-
//use serilog
builder.Host.UseSerilog();
@@ -46,7 +45,7 @@ Grand.Infrastructure.StartupBase.ConfigureServices(builder.Services, builder.Con
//Allow non ASCII chars in headers
var config = new HostingConfig();
builder.Configuration.GetSection("Application").Bind(config);
-if(config.AllowNonAsciiCharInHeaders)
+if (config.AllowNonAsciiCharInHeaders)
{
builder.WebHost.ConfigureKestrel(options =>
{