-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate to .net9 #40
base: main
Are you sure you want to change the base?
Migrate to .net9 #40
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,13 +5,13 @@ This repository contains a set of packages which allows you to add Google reCapt | |
## KITT.Web.ReCaptcha.Blazor | ||
|
||
This project add Google reCaptcha to your Blazor apps.<br/> | ||
This project targets **.NET 8** as supported Framework version. | ||
This project targets **.NET 9** as supported Framework version. | ||
|
||
### Installation | ||
|
||
This project is available on NuGet. | ||
|
||
It can be installed using the ```dotnet add package``` command or the NuGet wizard on your favourite IDE. | ||
It can be installed using the `dotnet add package` command or the NuGet wizard on your favourite IDE. | ||
|
||
```bash | ||
dotnet add package KITT.Web.ReCaptcha.Blazor | ||
|
@@ -22,13 +22,13 @@ More informations are available on the project [README](https://github.com/albx/ | |
## KITT.Web.ReCaptcha.Http | ||
|
||
This project add Google reCaptcha to your ASP.NET Core apps giving the service to validate your reCaptcha client response.<br/> | ||
This project targets **.NET 6** and **.NET 8** as supported Framework versions. | ||
This project targets **.NET 6** and **.NET 9** as supported Framework versions. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In this case maybe it's better keep .NET 8 and removing .NET 6, since it's not supported anymore. This will be a breaking change IMHO. What do you think? |
||
|
||
### Installation | ||
|
||
This project is available on NuGet. | ||
|
||
It can be installed using the ```dotnet add package``` command or the NuGet wizard on your favourite IDE. | ||
It can be installed using the `dotnet add package` command or the NuGet wizard on your favourite IDE. | ||
|
||
```bash | ||
dotnet add package KITT.Web.ReCaptcha.Http | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<TargetFramework>net9.0</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\..\..\src\KITT.Web.ReCaptcha.Http\KITT.Web.ReCaptcha.Http.csproj" /> | ||
<ProjectReference Include="..\KITT.Web.ReCaptcha.Samples.v2.Blazor.Client\KITT.Web.ReCaptcha.Samples.v2.Blazor.Client.csproj" /> | ||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.10" /> | ||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="9.0.0" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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>net9.0</TargetFramework> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As told before. In this case I'd keep .NET 8 and add support to .NET 9 |
||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Authors>Alberto Mori</Authors> | ||
|
@@ -22,8 +22,8 @@ | |
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.10" /> | ||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.10" /> | ||
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.0.0" /> | ||
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,27 @@ | ||
# KITT.Web.ReCaptcha.Blazor | ||
|
||
This project add Google reCaptcha to your Blazor apps.<br/> | ||
This project targets **.NET 8** as supported Framework version. | ||
This project targets **.NET 9** as supported Framework version. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As told before in the general readme. I'd support both .NET 8 and .NET 9 |
||
|
||
## Installation | ||
|
||
This project is available on [NuGet](https://www.nuget.org/packages/KITT.Web.ReCaptcha.Blazor). | ||
|
||
It can be installed using the ```dotnet add package``` command or the NuGet wizard on your favourite IDE. | ||
It can be installed using the `dotnet add package` command or the NuGet wizard on your favourite IDE. | ||
|
||
```bash | ||
dotnet add package KITT.Web.ReCaptcha.Blazor | ||
``` | ||
|
||
## reCaptcha v2 | ||
|
||
### Usage | ||
|
||
The project gives you a Razor component which add the reCaptcha v2 widget. | ||
|
||
Add the namespace ```KITT.Web.ReCaptcha.Blazor.v2``` to your Razor Components or in the ```_Imports.razor``` file. | ||
Add the namespace `KITT.Web.ReCaptcha.Blazor.v2` to your Razor Components or in the `_Imports.razor` file. | ||
|
||
After that you can use the ```<ReCaptcha />``` component in your ```EditForm``` like in this sample: | ||
After that you can use the `<ReCaptcha />` component in your `EditForm` like in this sample: | ||
|
||
```csharp | ||
<ReCaptcha SiteKey="<your reCaptcha v2 client key>" | ||
|
@@ -36,50 +37,61 @@ After that you can use the ```<ReCaptcha />``` component in your ```EditForm``` | |
|
||
### Parameters | ||
|
||
The component needs to be used inside an ```EditForm```. It exposes the following properties: | ||
The component needs to be used inside an `EditForm`. It exposes the following properties: | ||
|
||
|Property|Description| | ||
|---|---| | ||
|**SiteKey** (Required)|*string*: the value of the v2 client site key| | ||
|**@bind-Value**|*string*: the property to bind| | ||
|**Theme**|*Theme* enum: the theme to use (default: *Theme.Light*)| | ||
|**Size**|*Size* enum: the size of the widget (default: *Size.Normal*)| | ||
|**TabIndex**|*int*: the tabIndex value (default: *0*)| | ||
|**Id**|*string*: the id of the HTML element used to render the reCaptcha widget (*default*: "recaptcha")| | ||
| Property | Description | | ||
| ---------------------- | ------------------------------------------------------------------------------------------------- | | ||
| **SiteKey** (Required) | _string_: the value of the v2 client site key | | ||
| **@bind-Value** | _string_: the property to bind | | ||
| **Theme** | _Theme_ enum: the theme to use (default: _Theme.Light_) | | ||
| **Size** | _Size_ enum: the size of the widget (default: _Size.Normal_) | | ||
| **TabIndex** | _int_: the tabIndex value (default: _0_) | | ||
| **Id** | _string_: the id of the HTML element used to render the reCaptcha widget (_default_: "recaptcha") | | ||
|
||
## reCaptcha v3 | ||
|
||
### Usage | ||
|
||
You can register reCaptcha using the ```AddReCaptchaV3``` extension method: | ||
You can register reCaptcha using the `AddReCaptchaV3` extension method: | ||
|
||
```csharp | ||
using KITT.Web.ReCaptcha.Blazor.v3; | ||
//... | ||
builder.Services.AddReCaptchaV3(options => options.SiteKey = "<YOUR CLIENT SITE KEY VALUE>"); | ||
``` | ||
After that you have to add the *ReCaptchaScript* component. | ||
|
||
After that you have to add the _ReCaptchaScript_ component. | ||
|
||
#### Blazor Web App | ||
With the new Blazor Web App you can add the *ReCaptchaScript* component to your App.razor: | ||
|
||
With the new Blazor Web App you can add the _ReCaptchaScript_ component to your App.razor: | ||
|
||
```razor | ||
.... | ||
<ReCaptchaScript /> | ||
<script src="_framework/blazor.web.js"></script> | ||
``` | ||
|
||
#### Blazor WebAssembly | ||
|
||
If you're using Blazor WebAssembly, simply register it to the RootComponents calling the extension method: | ||
|
||
```csharp | ||
builder.RootComponents.RegisterReCaptchaScript(); | ||
``` | ||
|
||
#### Blazor Server | ||
If you're using Blazor Server, edit the *_Host.cshtml* page in this way: | ||
|
||
If you're using Blazor Server, edit the _\_Host.cshtml_ page in this way: | ||
|
||
```razor | ||
.... | ||
<script src="_framework/blazor.server.js"></script> | ||
<component type="typeof(ReCaptchaScript)" render-mode="ServerPrerendered" /> | ||
``` | ||
|
||
After that you can inject the ReCaptchaService to your component and call the VerifyAsync method: | ||
|
||
```razor | ||
@inject ReCaptchaService ReCaptcha | ||
... | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFrameworks>net6.0;net8.0</TargetFrameworks> | ||
<TargetFrameworks>net6.0;net9.0</TargetFrameworks> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As told before. I'd remove .NET 6 since it's not supported anymore and keep .NET 8, adding the support to .NET 9. This will be a breaking change |
||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<GenerateDocumentationFile>True</GenerateDocumentationFile> | ||
|
@@ -18,7 +18,7 @@ | |
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.1" /> | ||
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure to remove support for .NET 8 since it's the current LTS. Maybe better support both .NET 8 and .NET 9. What do you think?