Browse Source

Merge branch 'dev' into AbpDynamicClaimsMiddleware

pull/20596/head
maliming 2 years ago
parent
commit
7e189996d4
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 4
      abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en-GB.json
  2. 9
      abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json
  3. 9
      docs/en/cli/index.md
  4. 4
      docs/en/framework/ui/angular/quick-start.md
  5. 4
      docs/en/get-started/layered-web-application.md
  6. 4
      docs/en/get-started/single-layer-web-application.md
  7. 19
      docs/en/guides/migrating-from-open-source.md
  8. 4
      docs/en/release-info/migration-guides/abp-8-3.md
  9. 2
      docs/en/studio/installation.md
  10. 2
      docs/en/tutorials/todo/layered/index.md
  11. 2
      docs/en/tutorials/todo/single-layer/index.md
  12. 11
      framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/AbpAspNetCoreMvcUiBundlingModule.cs
  13. 7
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs
  14. 16
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpExceptionFilter.cs
  15. 15
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpExceptionPageFilter.cs
  16. 6
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Libs/AbpMvcLibsOptions.cs
  17. 88
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Libs/AbpMvcLibsService.cs
  18. 6
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Libs/IAbpMvcLibsService.cs
  19. 6
      framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcTestModule.cs
  20. 2
      latest-versions.json
  21. 3
      modules/docs/src/Volo.Docs.Web/Bundling/PrismjsScriptBundleContributorDocsExtension.cs
  22. 9
      modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml.cs

4
abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en-GB.json

@ -15,6 +15,7 @@
"Permission:Maintain": "Maintain", "Permission:Maintain": "Maintain",
"Permission:ClearCaches": "Clear caches", "Permission:ClearCaches": "Clear caches",
"Permission:Modules": "Modules", "Permission:Modules": "Modules",
"Permission:UserDownloads": "User Downloads",
"Permission:Packages": "Packages", "Permission:Packages": "Packages",
"Permission:Edit": "Edit", "Permission:Edit": "Edit",
"Permission:Delete": "Delete", "Permission:Delete": "Delete",
@ -102,6 +103,9 @@
"DoYouWantToCreateNewUser": "Do you want to create new user?", "DoYouWantToCreateNewUser": "Do you want to create new user?",
"MasterModules": "Master Modules", "MasterModules": "Master Modules",
"OrganizationName": "Organisation name", "OrganizationName": "Organisation name",
"DownloadType": "Download type",
"UserDownloads": "User Downloads",
"AcceptNewsletter": "Accept newsletter",
"CreationDate": "Creation date", "CreationDate": "Creation date",
"LicenseStartDate": "License start date", "LicenseStartDate": "License start date",
"LicenseEndDate": "License end date", "LicenseEndDate": "License end date",

9
abp_io/AbpIoLocalization/AbpIoLocalization/Admin/Localization/Resources/en.json

@ -120,8 +120,15 @@
"PurchaseOrderNo": "Purchase order no", "PurchaseOrderNo": "Purchase order no",
"QuotationDate": "Quotation date", "QuotationDate": "Quotation date",
"CompanyName": "Company name", "CompanyName": "Company name",
"DownloadType": "Download type",
"UserDownloads": "User Downloads",
"AcceptNewsletter": "Accept newsletter",
"CompanyAddress": "Company address", "CompanyAddress": "Company address",
"Price": "Price", "Price": "Price",
"Unknown": "Unknown",
"DddEBook": "Ddd EBook",
"MasteringAbpFrameworkEBook": "Mastering AbpFramework EBook",
"MicroserviceEBook": "Microservice EBook",
"DiscountText": "Discount text", "DiscountText": "Discount text",
"DiscountQuantity": "Discount quantity", "DiscountQuantity": "Discount quantity",
"DiscountPrice": "Discount price", "DiscountPrice": "Discount price",
@ -284,6 +291,7 @@
"Menu:Quotation": "Quotation", "Menu:Quotation": "Quotation",
"Menu:Invoice": "Invoice", "Menu:Invoice": "Invoice",
"Menu:Quotation/Invoice": "Quotation/Invoice", "Menu:Quotation/Invoice": "Quotation/Invoice",
"Menu:UserDownloads": "User Downloads",
"Menu:PaymentRequests": "Payment Requests", "Menu:PaymentRequests": "Payment Requests",
"Permission:PaymentRequests": "Payment Requests", "Permission:PaymentRequests": "Payment Requests",
"PaymentRequests": "Payment Requests", "PaymentRequests": "Payment Requests",
@ -566,6 +574,7 @@
"AllowAbpStudioBetaAccess": "Allow ABP Studio Beta Access", "AllowAbpStudioBetaAccess": "Allow ABP Studio Beta Access",
"TotalQuestionCanNotBeNullMessage": "Total Question can not be null", "TotalQuestionCanNotBeNullMessage": "Total Question can not be null",
"Permission:OrganizationAutoRenewalPayments": "Organization Auto Renewal Payments", "Permission:OrganizationAutoRenewalPayments": "Organization Auto Renewal Payments",
"Permission:UserDownloads": "User Downloads",
"Permission:RetryFailedPayments": "Retry Failed Payments", "Permission:RetryFailedPayments": "Retry Failed Payments",
"AutoRenewalIsNotEnabled": "Auto Renewal is not enabled!", "AutoRenewalIsNotEnabled": "Auto Renewal is not enabled!",
"LicenseIsNotExpired": "License is not expired!", "LicenseIsNotExpired": "License is not expired!",

9
docs/en/cli/index.md

@ -105,6 +105,8 @@ abp cli update
abp cli update --preview abp cli update --preview
abp cli update --version 1.0.0 abp cli update --version 1.0.0
abp cli remove abp cli remove
abp cli check-version
abp cli clear-cache
```` ````
### new ### new
@ -794,12 +796,19 @@ Examples:
````bash ````bash
abp upgrade -t app abp upgrade -t app
abp upgrade -t app --language-management --gdpr --audit-logging-ui --text-template-management --openiddict-pro
abp upgrade -t app-nolayers --audit-logging-ui
abp upgrade -t app-nolayers -p D:\MyProjects\MyProject abp upgrade -t app-nolayers -p D:\MyProjects\MyProject
```` ````
#### Options #### Options
* `--path` or `-p`: Specifies the module path. The module should be in that directory. If not specified, the default is the current directory. * `--path` or `-p`: Specifies the module path. The module should be in that directory. If not specified, the default is the current directory.
* `--gdpr`: Installs GDPR module too.
* `--language-management`: Installs Language Management module too.
* `--audit-logging-ui`: Installs Audit Logging Pro (UI) module too.
* `--text-template-management`: Installs Text Template Management module too.
* `--openiddict-pro`: Installs OpenIddict Pro (UI) module too.
### translate ### translate

4
docs/en/framework/ui/angular/quick-start.md

@ -4,8 +4,8 @@
Please follow the steps below to prepare your development environment for Angular. Please follow the steps below to prepare your development environment for Angular.
1. **Install Node.js:** Please visit [Node.js downloads page](https://nodejs.org/en/download/) and download proper Node.js v16 or v18 installer for your OS. An alternative is to install [NVM](https://github.com/nvm-sh/nvm) and use it to have multiple versions of Node.js in your operating system. 1. **Install Node.js:** Please visit [Node.js downloads page](https://nodejs.org/en/download/) and download proper Node.js `v18.19+` installer for your OS. An alternative is to install [NVM](https://github.com/nvm-sh/nvm) and use it to have multiple versions of Node.js in your operating system.
2. **[Optional] Install Yarn:** You may install Yarn v1 (not v2) following the instructions on [the installation page](https://classic.yarnpkg.com/en/docs/install). Yarn v1 delivers an arguably better developer experience compared to npm v6 and below. You may skip this step and work with npm, which is built-in in Node.js, instead. 2. **[Optional] Install Yarn:** You may install Yarn v1.22+ (not v2) following the instructions on [the installation page](https://classic.yarnpkg.com/en/docs/install). Yarn v1 delivers an arguably better developer experience compared to npm v10 and below. You may skip this step and work with npm, which is built-in in Node.js, instead.
3. **[Optional] Install VS Code:** [VS Code](https://code.visualstudio.com/) is a free, open-source IDE which works seamlessly with TypeScript. Although you can use any IDE including Visual Studio or Rider, VS Code will most likely deliver the best developer experience when it comes to Angular projects. ABP project templates even contain plugin recommendations for VS Code users, which VS Code will ask you to install when you open the Angular project folder. Here is a list of recommended extensions: 3. **[Optional] Install VS Code:** [VS Code](https://code.visualstudio.com/) is a free, open-source IDE which works seamlessly with TypeScript. Although you can use any IDE including Visual Studio or Rider, VS Code will most likely deliver the best developer experience when it comes to Angular projects. ABP project templates even contain plugin recommendations for VS Code users, which VS Code will ask you to install when you open the Angular project folder. Here is a list of recommended extensions:
- [Angular Language Service](https://marketplace.visualstudio.com/items?itemName=angular.ng-template) - [Angular Language Service](https://marketplace.visualstudio.com/items?itemName=angular.ng-template)
- [Prettier - Code formatter](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) - [Prettier - Code formatter](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)

4
docs/en/get-started/layered-web-application.md

@ -22,8 +22,8 @@ The following tools should be installed on your development machine:
* [Visual Studio 2022](https://visualstudio.microsoft.com/vs/) (v17.3+) for Windows / [Visual Studio for Mac](https://visualstudio.microsoft.com/vs/mac/). <sup id="a-editor">[1](#f-editor)</sup> * [Visual Studio 2022](https://visualstudio.microsoft.com/vs/) (v17.3+) for Windows / [Visual Studio for Mac](https://visualstudio.microsoft.com/vs/mac/). <sup id="a-editor">[1](#f-editor)</sup>
* [.NET 8.0+](https://dotnet.microsoft.com/en-us/download/dotnet) * [.NET 8.0+](https://dotnet.microsoft.com/en-us/download/dotnet)
{{ if UI != "Blazor" }} {{ if UI != "Blazor" }}
* [Node v16 or v18](https://nodejs.org/) * [Node v18.19+](https://nodejs.org/)
* [Yarn v1.20+ (not v2)](https://classic.yarnpkg.com/en/docs/install) <sup id="a-yarn">[2](#f-yarn)</sup> or npm v6+ (already installed with Node) * [Yarn v1.22+ (not v2)](https://classic.yarnpkg.com/en/docs/install) <sup id="a-yarn">[2](#f-yarn)</sup> or npm v10+ (already installed with Node)
{{ end }} {{ end }}
{{ if Tiered == "Yes" }} {{ if Tiered == "Yes" }}
* [Redis](https://redis.io/) (as the [distributed cache](Caching.md)). * [Redis](https://redis.io/) (as the [distributed cache](Caching.md)).

4
docs/en/get-started/single-layer-web-application.md

@ -21,8 +21,8 @@ The following tools should be installed on your development machine:
* [Visual Studio 2022](https://visualstudio.microsoft.com/vs/) (v17.3+) for Windows / [Visual Studio for Mac](https://visualstudio.microsoft.com/vs/mac/). <sup id="a-editor">[1](#f-editor)</sup> * [Visual Studio 2022](https://visualstudio.microsoft.com/vs/) (v17.3+) for Windows / [Visual Studio for Mac](https://visualstudio.microsoft.com/vs/mac/). <sup id="a-editor">[1](#f-editor)</sup>
* [.NET 8.0+](https://dotnet.microsoft.com/en-us/download/dotnet) * [.NET 8.0+](https://dotnet.microsoft.com/en-us/download/dotnet)
{{ if UI != "Blazor" }} {{ if UI != "Blazor" }}
* [Node v16 or v18](https://nodejs.org/) * [Node v18.19+](https://nodejs.org/)
* [Yarn v1.20+ (not v2)](https://classic.yarnpkg.com/en/docs/install) <sup id="a-yarn">[2](#f-yarn)</sup> or npm v6+ (already installed with Node) * [Yarn v1.22+ (not v2)](https://classic.yarnpkg.com/en/docs/install) <sup id="a-yarn">[2](#f-yarn)</sup> or npm v10+ (already installed with Node)
{{ end }} {{ end }}
{{ if Tiered == "Yes" }} {{ if Tiered == "Yes" }}
* [Redis](https://redis.io/) (as the [distributed cache](Caching.md)). * [Redis](https://redis.io/) (as the [distributed cache](Caching.md)).

19
docs/en/guides/migrating-from-open-source.md

@ -9,12 +9,14 @@ ABP Studio provides a way for users, who already started the development before
* Alternatively, you can use the following ABP Studio CLI command to achieve the same functionality: * Alternatively, you can use the following ABP Studio CLI command to achieve the same functionality:
```bash ```bash
abp upgrade [-t <template-name>] abp upgrade [-t <template-name>] [options]
Examples: Examples:
abp upgrade -t app abp upgrade -t app
abp upgrade -t app-nolayers abp upgrade -t app --language-management --gdpr --audit-logging-ui --text-template-management --openiddict-pro
abp upgrade -t app-nolayers --audit-logging-ui
abp upgrade -t app-nolayers -p D:\MyProjects\MyProject
``` ```
## Changes in the solution ## Changes in the solution
@ -31,15 +33,14 @@ This command will remove the following modules from your solution:
And install the following modules to your solution: And install the following modules to your solution:
- Volo.Abp.Account.Pro - Volo.Abp.Account.Pro
- Volo.Abp.AuditLogging.Pro
- Volo.Abp.Identity.Pro - Volo.Abp.Identity.Pro
- Volo.Abp.OpenIddict.Pro
- Volo.Saas
- Volo.Abp.LanguageManagement
- Volo.Abp.TextTemplateManagement
- Volo.FileManagement
- Volo.Abp.Gdpr
- Volo.Abp.LeptonXTheme - Volo.Abp.LeptonXTheme
- Volo.Saas
- Volo.Abp.OpenIddict.Pro (*Optional*)
- Volo.Abp.AuditLogging.Pro (*Optional*)
- Volo.Abp.LanguageManagement (*Optional*)
- Volo.Abp.TextTemplateManagement (*Optional*)
- Volo.Abp.Gdpr (*Optional*)
### Other changes ### Other changes

4
docs/en/release-info/migration-guides/abp-8-3.md

@ -49,6 +49,10 @@ However, notice this package is used by the `@abp/aspnetcore.mvc.ui.theme.shared
See the PR for more info: https://github.com/abpframework/abp/pull/19340 See the PR for more info: https://github.com/abpframework/abp/pull/19340
### Angular UI
We wish to formally inform you that ABP version 8.3 has been upgraded to incorporate Angular version 18. Consequently, we recommend migrating your application to [Angular v18](https://angular.dev/update-guide) to ensure compatibility.
## PRO ## PRO
> Please check the **Open-Source (Framework)** section before reading this section. The listed topics might affect your application and you might need to take care of them. > Please check the **Open-Source (Framework)** section before reading this section. The listed topics might affect your application and you might need to take care of them.

2
docs/en/studio/installation.md

@ -8,7 +8,7 @@
Before you begin the installation process for ABP Studio, ensure that your system meets the following pre-requirements: Before you begin the installation process for ABP Studio, ensure that your system meets the following pre-requirements:
### Node ### Node
Make sure [Node.js](https://nodejs.org/en) is installed on your system. If you have not installed Node.js, you can download the `v16` or `v18` version from the official [Node.js website](https://nodejs.org/en/download/prebuilt-installer). Make sure [Node.js](https://nodejs.org/en) is installed on your system. If you have not installed Node.js, you can download the `v18.19+` version from the official [Node.js website](https://nodejs.org/en/download/prebuilt-installer).
### WireGuard (Optional) ### WireGuard (Optional)
ABP Studio needs [WireGuard](https://www.wireguard.com/) for Kubernetes operations. You can find the installation instructions for your specific operating system below: ABP Studio needs [WireGuard](https://www.wireguard.com/) for Kubernetes operations. You can find the installation instructions for your specific operating system below:

2
docs/en/tutorials/todo/layered/index.md

@ -53,7 +53,7 @@ This documentation has a video tutorial on **YouTube**!! You can watch it here:
## Pre-Requirements ## Pre-Requirements
* An IDE (e.g. [Visual Studio](https://visualstudio.microsoft.com/vs/)) that supports [.NET 8.0+](https://dotnet.microsoft.com/download/dotnet) development. * An IDE (e.g. [Visual Studio](https://visualstudio.microsoft.com/vs/)) that supports [.NET 8.0+](https://dotnet.microsoft.com/download/dotnet) development.
* [Node v16.x](https://nodejs.org/) * [Node v18.19+](https://nodejs.org/)
{{if DB=="Mongo"}} {{if DB=="Mongo"}}

2
docs/en/tutorials/todo/single-layer/index.md

@ -49,7 +49,7 @@ This documentation has a video tutorial on **YouTube**!! You can watch it here:
## Pre-Requirements ## Pre-Requirements
* An IDE (e.g. [Visual Studio](https://visualstudio.microsoft.com/vs/)) that supports [.NET 8.0+](https://dotnet.microsoft.com/download/dotnet) development. * An IDE (e.g. [Visual Studio](https://visualstudio.microsoft.com/vs/)) that supports [.NET 8.0+](https://dotnet.microsoft.com/download/dotnet) development.
* [Node v16.x](https://nodejs.org/) * [Node v18.19+](https://nodejs.org/)
{{if DB=="Mongo"}} {{if DB=="Mongo"}}

11
framework/src/Volo.Abp.AspNetCore.Mvc.UI.Bundling/Volo/Abp/AspNetCore/Mvc/UI/Bundling/AbpAspNetCoreMvcUiBundlingModule.cs

@ -1,4 +1,5 @@
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap; using Volo.Abp.AspNetCore.Mvc.Libs;
using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap;
using Volo.Abp.Minify; using Volo.Abp.Minify;
using Volo.Abp.Modularity; using Volo.Abp.Modularity;
@ -11,5 +12,11 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling;
)] )]
public class AbpAspNetCoreMvcUiBundlingModule : AbpModule public class AbpAspNetCoreMvcUiBundlingModule : AbpModule
{ {
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpMvcLibsOptions>(options =>
{
options.CheckLibs = true;
});
}
} }

7
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcModule.cs

@ -32,6 +32,7 @@ using Volo.Abp.AspNetCore.Mvc.DataAnnotations;
using Volo.Abp.AspNetCore.Mvc.DependencyInjection; using Volo.Abp.AspNetCore.Mvc.DependencyInjection;
using Volo.Abp.AspNetCore.Mvc.Infrastructure; using Volo.Abp.AspNetCore.Mvc.Infrastructure;
using Volo.Abp.AspNetCore.Mvc.Json; using Volo.Abp.AspNetCore.Mvc.Json;
using Volo.Abp.AspNetCore.Mvc.Libs;
using Volo.Abp.AspNetCore.Mvc.Localization; using Volo.Abp.AspNetCore.Mvc.Localization;
using Volo.Abp.AspNetCore.VirtualFileSystem; using Volo.Abp.AspNetCore.VirtualFileSystem;
using Volo.Abp.DependencyInjection; using Volo.Abp.DependencyInjection;
@ -231,6 +232,7 @@ public class AbpAspNetCoreMvcModule : AbpModule
public override void OnApplicationInitialization(ApplicationInitializationContext context) public override void OnApplicationInitialization(ApplicationInitializationContext context)
{ {
AddApplicationParts(context); AddApplicationParts(context);
CheckLibs(context);
} }
private static void AddApplicationParts(ApplicationInitializationContext context) private static void AddApplicationParts(ApplicationInitializationContext context)
@ -277,4 +279,9 @@ public class AbpAspNetCoreMvcModule : AbpModule
partManager.ApplicationParts.AddIfNotContains(moduleAssembly); partManager.ApplicationParts.AddIfNotContains(moduleAssembly);
} }
} }
private static void CheckLibs(ApplicationInitializationContext context)
{
context.ServiceProvider.GetRequiredService<IAbpMvcLibsService>().CheckLibs(context);
}
} }

16
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpExceptionFilter.cs

@ -75,10 +75,18 @@ public class AbpExceptionFilter : IAsyncExceptionFilter, IAbpFilter, ITransientD
} }
else else
{ {
context.HttpContext.Response.Headers.Add(AbpHttpConsts.AbpErrorFormat, "true"); if (!context.HttpContext.Response.HasStarted)
context.HttpContext.Response.StatusCode = (int)context {
.GetRequiredService<IHttpExceptionStatusCodeFinder>() context.HttpContext.Response.Headers.Add(AbpHttpConsts.AbpErrorFormat, "true");
.GetStatusCode(context.HttpContext, context.Exception); context.HttpContext.Response.StatusCode = (int)context
.GetRequiredService<IHttpExceptionStatusCodeFinder>()
.GetStatusCode(context.HttpContext, context.Exception);
}
else
{
var logger = context.GetService<ILogger<AbpExceptionFilter>>(NullLogger<AbpExceptionFilter>.Instance)!;
logger.LogWarning("HTTP response has already started, cannot set headers and status code!");
}
context.Result = new ObjectResult(new RemoteServiceErrorResponse(remoteServiceErrorInfo)); context.Result = new ObjectResult(new RemoteServiceErrorResponse(remoteServiceErrorInfo));
} }

15
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ExceptionHandling/AbpExceptionPageFilter.cs

@ -103,10 +103,17 @@ public class AbpExceptionPageFilter : IAsyncPageFilter, IAbpFilter, ITransientDe
} }
else else
{ {
context.HttpContext.Response.Headers.Add(AbpHttpConsts.AbpErrorFormat, "true"); if (!context.HttpContext.Response.HasStarted)
context.HttpContext.Response.StatusCode = (int)context {
.GetRequiredService<IHttpExceptionStatusCodeFinder>() context.HttpContext.Response.Headers.Add(AbpHttpConsts.AbpErrorFormat, "true");
.GetStatusCode(context.HttpContext, context.Exception!); context.HttpContext.Response.StatusCode = (int)context
.GetRequiredService<IHttpExceptionStatusCodeFinder>()
.GetStatusCode(context.HttpContext, context.Exception!);
}
else
{
logger.LogWarning("HTTP response has already started, cannot set headers and status code!");
}
context.Result = new ObjectResult(new RemoteServiceErrorResponse(remoteServiceErrorInfo)); context.Result = new ObjectResult(new RemoteServiceErrorResponse(remoteServiceErrorInfo));
} }

6
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Libs/AbpMvcLibsOptions.cs

@ -0,0 +1,6 @@
namespace Volo.Abp.AspNetCore.Mvc.Libs;
public class AbpMvcLibsOptions
{
public bool CheckLibs { get; set; }
}

88
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Libs/AbpMvcLibsService.cs

@ -0,0 +1,88 @@
using System;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Microsoft.Extensions.FileProviders;
using Volo.Abp.DependencyInjection;
namespace Volo.Abp.AspNetCore.Mvc.Libs;
public class AbpMvcLibsService : IAbpMvcLibsService, ITransientDependency
{
private Task<bool>? _checkLibsTask;
public virtual void CheckLibs(ApplicationInitializationContext context)
{
var options = context.ServiceProvider.GetRequiredService<IOptions<AbpMvcLibsOptions>>().Value;
if (options.CheckLibs)
{
var app = context.GetApplicationBuilder();
app.Use(async (httpContext, next) =>
{
if (!await CheckLibsAsyncOnceAsync(httpContext))
{
httpContext.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
httpContext.Response.ContentType = "text/html";
await httpContext.Response.WriteAsync(
"<html>" +
" <head>" +
" <title>Error - The Libs folder is missing!</title>" +
" </head>" +
" <body>" +
" <h1> &#9888;&#65039; The Libs folder under the <code style='background-color: #e7e7e7;'>wwwroot/libs</code> directory is empty!</h1>" +
" <p>The Libs folder contains mandatory NPM Packages for running the project.</p>" +
" <p>Make sure you run the <code style='background-color: #e7e7e7;'>abp install-libs</code> CLI tool command.</p>" +
" <p>For more information, check out the <a href='https://abp.io/docs/latest/CLI#install-libs'>ABP CLI documentation</a></p>" +
" </body>" +
"</html>",
Encoding.UTF8
);
return;
}
await next(httpContext);
});
}
}
protected virtual Task<bool> CheckLibsAsyncOnceAsync(HttpContext httpContext)
{
if (_checkLibsTask == null)
{
_checkLibsTask = CheckLibsAsync(httpContext);
}
return _checkLibsTask;
}
protected virtual Task<bool> CheckLibsAsync(HttpContext httpContext)
{
var logger = httpContext.RequestServices.GetRequiredService<ILogger<AbpMvcLibsService>>();
try
{
var fileProvider = new PhysicalFileProvider(httpContext.RequestServices.GetRequiredService<IWebHostEnvironment>().WebRootPath);
var libsFolder = fileProvider.GetDirectoryContents("/libs");
if (!libsFolder.Exists || !libsFolder.Any())
{
logger.LogError("The 'wwwroot/libs' folder does not exist or empty!");
return Task.FromResult(false);
}
}
catch (Exception e)
{
// In case of any exception, log it and return true to prevent crashing the application.
logger.LogError(e, "An error occurred while checking the libs folder!");
}
return Task.FromResult(true);
}
}

6
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Libs/IAbpMvcLibsService.cs

@ -0,0 +1,6 @@
namespace Volo.Abp.AspNetCore.Mvc.Libs;
public interface IAbpMvcLibsService
{
void CheckLibs(ApplicationInitializationContext context);
}

6
framework/test/Volo.Abp.AspNetCore.Mvc.Tests/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcTestModule.cs

@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations; using Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations;
using Volo.Abp.AspNetCore.Mvc.GlobalFeatures; using Volo.Abp.AspNetCore.Mvc.GlobalFeatures;
using Volo.Abp.AspNetCore.Mvc.Libs;
using Volo.Abp.AspNetCore.Mvc.Localization; using Volo.Abp.AspNetCore.Mvc.Localization;
using Volo.Abp.AspNetCore.Mvc.Localization.Resource; using Volo.Abp.AspNetCore.Mvc.Localization.Resource;
using Volo.Abp.AspNetCore.Security.Claims; using Volo.Abp.AspNetCore.Security.Claims;
@ -140,6 +141,11 @@ public class AbpAspNetCoreMvcTestModule : AbpModule
}); });
context.Services.TransformAbpClaims(); context.Services.TransformAbpClaims();
Configure<AbpMvcLibsOptions>(options =>
{
options.CheckLibs = false;
});
} }
public override void OnApplicationInitialization(ApplicationInitializationContext context) public override void OnApplicationInitialization(ApplicationInitializationContext context)

2
latest-versions.json

@ -1,6 +1,6 @@
[ [
{ {
"version": "8.2.1", "version": "8.2.2",
"releaseDate": "", "releaseDate": "",
"type": "stable", "type": "stable",
"message": "" "message": ""

3
modules/docs/src/Volo.Docs.Web/Bundling/PrismjsScriptBundleContributorDocsExtension.cs

@ -23,7 +23,8 @@ namespace Volo.Docs.Bundling
"scss", "scss",
"sql", "sql",
"typescript", "typescript",
"diff" "diff",
"yaml"
}; };
public override void ConfigureBundle(BundleConfigurationContext context) public override void ConfigureBundle(BundleConfigurationContext context)

9
modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml.cs

@ -197,7 +197,6 @@ namespace Volo.Docs.Pages.Documents.Project
await SetNavigationAsync(); await SetNavigationAsync();
SetLanguageSelectListItems(); SetLanguageSelectListItems();
SetDocumentPageTitle();
return Page(); return Page();
} }
@ -472,7 +471,12 @@ namespace Volo.Docs.Pages.Documents.Project
private void SetDocumentPageTitle() private void SetDocumentPageTitle()
{ {
DocumentPageTitle = Navigation.FindNavigation(DocumentNameWithExtension)?.Text ?? DocumentName?.Replace("-", " "); DocumentPageTitle = DocumentName?.Replace("-", " ");
var match = Regex.Match(Document.Content, @"#(?<PageTitle>.+)");
if (match.Success && match.Groups.TryGetValue("PageTitle", out var group))
{
DocumentPageTitle = Regex.Replace(group.Value, "<.*?>", string.Empty).Trim();
}
} }
public string CreateVersionLink(VersionInfoViewModel latestVersion, string version, string documentName = null) public string CreateVersionLink(VersionInfoViewModel latestVersion, string version, string documentName = null)
@ -508,6 +512,7 @@ namespace Volo.Docs.Pages.Documents.Project
Document = await GetSpecificDocumentOrDefaultAsync(language); Document = await GetSpecificDocumentOrDefaultAsync(language);
DocumentLanguageCode = language; DocumentLanguageCode = language;
DocumentNameWithExtension = Document.Name; DocumentNameWithExtension = Document.Name;
SetDocumentPageTitle();
await ConvertDocumentContentToHtmlAsync(); await ConvertDocumentContentToHtmlAsync();
return true; return true;
} }

Loading…
Cancel
Save