Skip to content

Commit

Permalink
Merge branch 'dev' into AbpDynamicClaimsMiddleware
Browse files Browse the repository at this point in the history
  • Loading branch information
maliming committed Aug 23, 2024
2 parents 321918e + af472dd commit 7e18999
Show file tree
Hide file tree
Showing 22 changed files with 200 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"Permission:Maintain": "Maintain",
"Permission:ClearCaches": "Clear caches",
"Permission:Modules": "Modules",
"Permission:UserDownloads": "User Downloads",
"Permission:Packages": "Packages",
"Permission:Edit": "Edit",
"Permission:Delete": "Delete",
Expand Down Expand Up @@ -102,6 +103,9 @@
"DoYouWantToCreateNewUser": "Do you want to create new user?",
"MasterModules": "Master Modules",
"OrganizationName": "Organisation name",
"DownloadType": "Download type",
"UserDownloads": "User Downloads",
"AcceptNewsletter": "Accept newsletter",
"CreationDate": "Creation date",
"LicenseStartDate": "License start date",
"LicenseEndDate": "License end date",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,15 @@
"PurchaseOrderNo": "Purchase order no",
"QuotationDate": "Quotation date",
"CompanyName": "Company name",
"DownloadType": "Download type",
"UserDownloads": "User Downloads",
"AcceptNewsletter": "Accept newsletter",
"CompanyAddress": "Company address",
"Price": "Price",
"Unknown": "Unknown",
"DddEBook": "Ddd EBook",
"MasteringAbpFrameworkEBook": "Mastering AbpFramework EBook",
"MicroserviceEBook": "Microservice EBook",
"DiscountText": "Discount text",
"DiscountQuantity": "Discount quantity",
"DiscountPrice": "Discount price",
Expand Down Expand Up @@ -284,6 +291,7 @@
"Menu:Quotation": "Quotation",
"Menu:Invoice": "Invoice",
"Menu:Quotation/Invoice": "Quotation/Invoice",
"Menu:UserDownloads": "User Downloads",
"Menu:PaymentRequests": "Payment Requests",
"Permission:PaymentRequests": "Payment Requests",
"PaymentRequests": "Payment Requests",
Expand Down Expand Up @@ -566,6 +574,7 @@
"AllowAbpStudioBetaAccess": "Allow ABP Studio Beta Access",
"TotalQuestionCanNotBeNullMessage": "Total Question can not be null",
"Permission:OrganizationAutoRenewalPayments": "Organization Auto Renewal Payments",
"Permission:UserDownloads": "User Downloads",
"Permission:RetryFailedPayments": "Retry Failed Payments",
"AutoRenewalIsNotEnabled": "Auto Renewal is not enabled!",
"LicenseIsNotExpired": "License is not expired!",
Expand Down
9 changes: 9 additions & 0 deletions docs/en/cli/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ abp cli update
abp cli update --preview
abp cli update --version 1.0.0
abp cli remove
abp cli check-version
abp cli clear-cache
````

### new
Expand Down Expand Up @@ -794,12 +796,19 @@ Examples:

````bash
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
````

#### Options

* `--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

Expand Down
4 changes: 2 additions & 2 deletions docs/en/framework/ui/angular/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

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.
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.
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.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:
- [Angular Language Service](https://marketplace.visualstudio.com/items?itemName=angular.ng-template)
- [Prettier - Code formatter](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
Expand Down
4 changes: 2 additions & 2 deletions docs/en/get-started/layered-web-application.md
Original file line number Diff line number Diff line change
Expand Up @@ -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>
* [.NET 8.0+](https://dotnet.microsoft.com/en-us/download/dotnet)
{{ if UI != "Blazor" }}
* [Node v16 or v18](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)
* [Node v18.19+](https://nodejs.org/)
* [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 }}
{{ if Tiered == "Yes" }}
* [Redis](https://redis.io/) (as the [distributed cache](Caching.md)).
Expand Down
4 changes: 2 additions & 2 deletions docs/en/get-started/single-layer-web-application.md
Original file line number Diff line number Diff line change
Expand Up @@ -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>
* [.NET 8.0+](https://dotnet.microsoft.com/en-us/download/dotnet)
{{ if UI != "Blazor" }}
* [Node v16 or v18](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)
* [Node v18.19+](https://nodejs.org/)
* [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 }}
{{ if Tiered == "Yes" }}
* [Redis](https://redis.io/) (as the [distributed cache](Caching.md)).
Expand Down
19 changes: 10 additions & 9 deletions docs/en/guides/migrating-from-open-source.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

```bash
abp upgrade [-t <template-name>]
abp upgrade [-t <template-name>] [options]

Examples:

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
Expand All @@ -31,15 +33,14 @@ This command will remove the following modules from your solution:
And install the following modules to your solution:

- Volo.Abp.Account.Pro
- Volo.Abp.AuditLogging.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.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

Expand Down
4 changes: 4 additions & 0 deletions docs/en/release-info/migration-guides/abp-8-3.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

### 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

> 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.
Expand Down
2 changes: 1 addition & 1 deletion docs/en/studio/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Before you begin the installation process for ABP Studio, ensure that your system meets the following pre-requirements:

### 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)
ABP Studio needs [WireGuard](https://www.wireguard.com/) for Kubernetes operations. You can find the installation instructions for your specific operating system below:
Expand Down
2 changes: 1 addition & 1 deletion docs/en/tutorials/todo/layered/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ This documentation has a video tutorial on **YouTube**!! You can watch it here:
## 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.
* [Node v16.x](https://nodejs.org/)
* [Node v18.19+](https://nodejs.org/)

{{if DB=="Mongo"}}

Expand Down
2 changes: 1 addition & 1 deletion docs/en/tutorials/todo/single-layer/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ This documentation has a video tutorial on **YouTube**!! You can watch it here:
## 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.
* [Node v16.x](https://nodejs.org/)
* [Node v18.19+](https://nodejs.org/)

{{if DB=="Mongo"}}

Expand Down
Original file line number Diff line number Diff line change
@@ -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.Modularity;

Expand All @@ -11,5 +12,11 @@ namespace Volo.Abp.AspNetCore.Mvc.UI.Bundling;
)]
public class AbpAspNetCoreMvcUiBundlingModule : AbpModule
{

public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpMvcLibsOptions>(options =>
{
options.CheckLibs = true;
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
using Volo.Abp.AspNetCore.Mvc.DependencyInjection;
using Volo.Abp.AspNetCore.Mvc.Infrastructure;
using Volo.Abp.AspNetCore.Mvc.Json;
using Volo.Abp.AspNetCore.Mvc.Libs;
using Volo.Abp.AspNetCore.Mvc.Localization;
using Volo.Abp.AspNetCore.VirtualFileSystem;
using Volo.Abp.DependencyInjection;
Expand Down Expand Up @@ -231,6 +232,7 @@ public override void PostConfigureServices(ServiceConfigurationContext context)
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
AddApplicationParts(context);
CheckLibs(context);
}

private static void AddApplicationParts(ApplicationInitializationContext context)
Expand Down Expand Up @@ -277,4 +279,9 @@ private static void AddToApplicationParts(ApplicationPartManager partManager, IE
partManager.ApplicationParts.AddIfNotContains(moduleAssembly);
}
}

private static void CheckLibs(ApplicationInitializationContext context)
{
context.ServiceProvider.GetRequiredService<IAbpMvcLibsService>().CheckLibs(context);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,18 @@ await context.HttpContext.RequestServices.GetRequiredService<IAbpAuthorizationEx
}
else
{
context.HttpContext.Response.Headers.Add(AbpHttpConsts.AbpErrorFormat, "true");
context.HttpContext.Response.StatusCode = (int)context
.GetRequiredService<IHttpExceptionStatusCodeFinder>()
.GetStatusCode(context.HttpContext, context.Exception);
if (!context.HttpContext.Response.HasStarted)
{
context.HttpContext.Response.Headers.Add(AbpHttpConsts.AbpErrorFormat, "true");
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));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,17 @@ await context.HttpContext.RequestServices.GetRequiredService<IAbpAuthorizationEx
}
else
{
context.HttpContext.Response.Headers.Add(AbpHttpConsts.AbpErrorFormat, "true");
context.HttpContext.Response.StatusCode = (int)context
.GetRequiredService<IHttpExceptionStatusCodeFinder>()
.GetStatusCode(context.HttpContext, context.Exception!);
if (!context.HttpContext.Response.HasStarted)
{
context.HttpContext.Response.Headers.Add(AbpHttpConsts.AbpErrorFormat, "true");
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));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Volo.Abp.AspNetCore.Mvc.Libs;

public class AbpMvcLibsOptions
{
public bool CheckLibs { get; set; }
}
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Volo.Abp.AspNetCore.Mvc.Libs;

public interface IAbpMvcLibsService
{
void CheckLibs(ApplicationInitializationContext context);
}
Loading

0 comments on commit 7e18999

Please sign in to comment.