Skip to content

Commit fad06c7

Browse files
committed
improve demo project
1 parent 3f37549 commit fad06c7

67 files changed

Lines changed: 59730 additions & 850 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

BlazorCaptcha.WebAssembly/BlazorCaptcha.WebAssembly.csproj

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,27 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
4+
<TargetFrameworks>net9.0;net10.0</TargetFrameworks>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77

88
<!-- Package metadata -->
99
<PackageId>BlazorCaptcha.WebAssembly</PackageId>
10-
<Version>2.1.1</Version>
10+
<Version>3.0.0</Version>
1111
<Authors>Christophe Peugnet</Authors>
1212
<Copyright>Copyright 2020-2026</Copyright>
13-
<Description>Generates a captcha image for a Blazor WebAssembly application. For use with .NET 8.0 or higher Blazor WebAssembly applications</Description>
13+
<Description>Generates a captcha image for a Blazor WebAssembly application. For use with .NET 9.0 or higher Blazor WebAssembly applications</Description>
1414
<PackageTags>Blazor, captcha</PackageTags>
1515
<PackageProjectUrl>https://github.com/tossnet/Blazor-Captcha</PackageProjectUrl>
1616
<RepositoryUrl>https://github.com/tossnet/Blazor-Captcha</RepositoryUrl>
1717
<RepositoryType>git</RepositoryType>
1818
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1919
<PackageReadmeFile>README.md</PackageReadmeFile>
20-
<PackageReleaseNotes>https://github.com/tossnet/Blazor-Captcha#release-notes</PackageReleaseNotes>
2120
<PackageIcon>icon.png</PackageIcon>
22-
21+
<PackageReleaseNotes>
22+
v3.0.0 Remove .NET 8.0 support, update dependencies to .NET 9.0 and .NET 10.0 versions
23+
</PackageReleaseNotes>
24+
2325
<!-- Build and symbols -->
2426
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
2527
<GenerateDocumentationFile>true</GenerateDocumentationFile>
@@ -39,25 +41,18 @@
3941
<None Include="icon.png" Pack="true" PackagePath="" />
4042
</ItemGroup>
4143

42-
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
43-
<PackageReference Include="Microsoft.AspNetCore.Components" Version="8.0.23" />
44-
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.23" />
45-
<PackageReference Include="SkiaSharp" Version="3.119.1" />
46-
<PackageReference Include="SkiaSharp.Views.Blazor" Version="3.119.1" />
47-
</ItemGroup>
48-
4944
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
50-
<PackageReference Include="Microsoft.AspNetCore.Components" Version="9.0.12" />
51-
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.0.12" />
52-
<PackageReference Include="SkiaSharp" Version="3.119.1" />
53-
<PackageReference Include="SkiaSharp.Views.Blazor" Version="3.119.1" />
45+
<PackageReference Include="Microsoft.AspNetCore.Components" Version="9.0.13" />
46+
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.0.13" />
47+
<PackageReference Include="SkiaSharp" Version="3.119.2" />
48+
<PackageReference Include="SkiaSharp.Views.Blazor" Version="3.119.2" />
5449
</ItemGroup>
5550

5651
<ItemGroup Condition="'$(TargetFramework)' == 'net10.0'">
57-
<PackageReference Include="Microsoft.AspNetCore.Components" Version="10.0.2" />
58-
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="10.0.2" />
59-
<PackageReference Include="SkiaSharp" Version="3.119.1" />
60-
<PackageReference Include="SkiaSharp.Views.Blazor" Version="3.119.1" />
52+
<PackageReference Include="Microsoft.AspNetCore.Components" Version="10.0.3" />
53+
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="10.0.3" />
54+
<PackageReference Include="SkiaSharp" Version="3.119.2" />
55+
<PackageReference Include="SkiaSharp.Views.Blazor" Version="3.119.2" />
6156
</ItemGroup>
6257

6358
<ItemGroup>

BlazorCaptcha.sln

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 17
4-
VisualStudioVersion = 17.0.31710.8
3+
# Visual Studio Version 18
4+
VisualStudioVersion = 18.4.11506.43 insiders
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorCaptcha", "BlazorCaptcha\BlazorCaptcha.csproj", "{C7C98B4F-68A4-40B4-A1BA-A095AB20DB07}"
77
EndProject

BlazorCaptcha/BlazorCaptcha.csproj

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
4+
<TargetFrameworks>net9.0;net10.0</TargetFrameworks>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77

88
<!-- Package metadata -->
99
<PackageId>BlazorCaptcha</PackageId>
10-
<Version>2.1.2</Version>
10+
<Version>3.0.0</Version>
1111
<Authors>Christophe Peugnet</Authors>
1212
<Copyright>Copyright 2020-2026</Copyright>
13-
<Description>Generates a captcha image for a Blazor Server application. For use with .NET 8.0 or higher Blazor applications</Description>
13+
<Description>Generates a captcha image for a Blazor Server application. For use with .NET 9.0 or higher Blazor applications</Description>
1414
<PackageTags>Blazor, captcha</PackageTags>
1515
<PackageProjectUrl>https://github.com/tossnet/Blazor-Captcha</PackageProjectUrl>
1616
<RepositoryUrl>https://github.com/tossnet/Blazor-Captcha</RepositoryUrl>
1717
<RepositoryType>git</RepositoryType>
1818
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1919
<PackageReadmeFile>README.md</PackageReadmeFile>
20-
<PackageReleaseNotes>https://github.com/tossnet/Blazor-Captcha#release-notes</PackageReleaseNotes>
20+
<PackageReleaseNotes>
21+
v3.0.0 Remove .NET 8.0 support, update dependencies to .NET 9.0 and .NET 10.0 versions
22+
</PackageReleaseNotes>
2123
<PackageIcon>icon.png</PackageIcon>
2224

2325
<!-- Build and symbols -->
@@ -35,17 +37,9 @@
3537
<None Include="icon.png" Pack="true" PackagePath="" />
3638
</ItemGroup>
3739

38-
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
39-
<PackageReference Include="Microsoft.AspNetCore.Components" Version="8.0.24" />
40-
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="8.0.24" />
41-
<PackageReference Include="SkiaSharp" Version="3.119.2" />
42-
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="3.119.2" />
43-
<PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="3.119.2" />
44-
</ItemGroup>
45-
4640
<ItemGroup Condition="'$(TargetFramework)' == 'net9.0'">
47-
<PackageReference Include="Microsoft.AspNetCore.Components" Version="9.0.4" />
48-
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.0.4" />
41+
<PackageReference Include="Microsoft.AspNetCore.Components" Version="9.0.13" />
42+
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="9.0.13" />
4943
<PackageReference Include="SkiaSharp" Version="3.119.2" />
5044
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="3.119.2" />
5145
<PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="3.119.2" />

README.md

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,7 @@ Generates a captcha image for a Blazor Server or Webassembly application.
66
## Live demo
77
Blazor webassembly : <a href="https://tossnet.github.io/Blazor-Captcha/" target="_blank">[https://tossnet.github.io/Blazor-Captcha/](https://tossnet.github.io/Blazor-Captcha/)</a>
88

9-
> [!WARNING]
10-
> **⚠️ WebAssembly Demo Currently Broken ⚠️**
11-
>
12-
> The live demo on GitHub Pages is currently not working due to a SkiaSharp initialization error:
13-
> ```
14-
> Uncaught ManagedError: TypeInitialization_Type, SkiaSharp.SKImageInfo
15-
> ```
16-
>
17-
> **The component works correctly locally** (both debug and release), but fails when deployed to GitHub Pages. This issue appeared after version 2.0.2 and persists despite rollback attempts.
18-
>
19-
> **🙏 Help Wanted:** If you have experience with SkiaSharp + Blazor WebAssembly deployment issues and find a solution, please [open an issue using our template](https://github.com/tossnet/Blazor-Captcha/issues/new?template=skiasharp-wasm-fix.yml) or submit a PR - it would be greatly appreciated!
20-
>
21-
> Related discussion: https://github.com/mono/SkiaSharp/discussions/3185
22-
9+
2310
![Blazor Captcha](https://github.com/tossnet/Blazor-Captcha/blob/master/blazor-captcha.png)
2411

2512

@@ -46,9 +33,6 @@ For client-side and server-side Blazor - add script section to _Host.cshtml (hea
4633
@page "/"
4734
@using BlazorCaptcha
4835

49-
<h3>Hello, world!</h3>
50-
51-
5236
<Captcha @bind-CaptchaWord="@Captcha" CharNumber="@CaptchaLetters" />
5337

5438
<p>@Captcha</p>
@@ -68,8 +52,14 @@ For client-side and server-side Blazor - add script section to _Host.cshtml (hea
6852

6953
## <a name="ReleaseNotes"></a>Release Notes
7054

55+
<details open="open"><summary>Version 3.0.0</summary>
56+
57+
>-Remove .NET 8.0 support
58+
>- Update dependencies to .NET 9.0 and .NET 10.0 versions
59+
>- Update dependencies to latest SkiaSharp versions 3.119.2
60+
</details>
7161
72-
<details open="open"><summary>Version 2.1.2</summary>
62+
<details><summary>Version 2.1.2</summary>
7363

7464
>- Fix NuGet packaging: `BlazorCaptcha.Commun` is now embedded directly (no separate package dependency)
7565
>- Resolves error `NU1101: Unable to find package BlazorCaptcha.Commun`

Samples/BlazorWebAssembly/Blazor-Wasm-Captcha-Test/Blazor-Wasm-Captcha-Test.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11+
<PackageReference Include="Brism" Version="1.0.1" />
1112
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="10.0.3" />
1213
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="10.0.3" PrivateAssets="all" />
1314
</ItemGroup>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
@page "/install"
2+
3+
<PageTitle>Installation</PageTitle>
4+
5+
<h1>Installation</h1>
6+
7+
<CodeBlock Language="CodeLanguage.Bash"
8+
Code=@(@"
9+
dotnet add package BlazorCaptcha
10+
") />
11+
12+
<p>For client-side (<b>index.html</b>) and server-side Blazor (<b>App.razor</b>) - add script section (head section)</p>
13+
14+
<CodeBlock Language="CodeLanguage.Html"
15+
Code=@(@"
16+
<link href=""_content/BlazorCaptcha/captcha.css"" rel=""stylesheet"" />
17+
") />
18+
19+
<h3>Basic use</h3>
20+
21+
22+
23+
<CodeBlock Language="CodeLanguage.Razor"
24+
Code=@(@"
25+
@using BlazorCaptcha
26+
27+
<Captcha @bind-CaptchaWord=""@Captcha"" CharNumber=""@CaptchaLetters"" />
28+
29+
<p>@Captcha</p>
30+
") />
31+
32+
33+
<CodeBlock Language="CodeLanguage.CSharp"
34+
Code=@(@"
35+
private string Captcha = """";
36+
private int CaptchaLetters = 5;
37+
38+
protected override Task OnInitializedAsync()
39+
{
40+
Captcha = BlazorCaptcha.Commun.Tools.GetCaptchaWord(CaptchaLetters);
41+
42+
return base.OnInitializedAsync();
43+
}
44+
") />

Samples/BlazorWebAssembly/Blazor-Wasm-Captcha-Test/Program.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Blazor_Wasm_Captcha_Test;
2+
using Brism;
23
using Microsoft.AspNetCore.Components.Web;
34
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
45

@@ -8,4 +9,6 @@
89

910
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
1011

12+
builder.Services.AddBrism();
13+
1114
await builder.Build().RunAsync();

Samples/BlazorWebAssembly/Blazor-Wasm-Captcha-Test/Shared/NavMenu.razor

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,13 @@
1111
<nav class="flex-column">
1212
<div class="nav-item px-3">
1313
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
14-
<span class="oi oi-home" aria-hidden="true"></span> Home
14+
<span class="bi bi-house-door-fill-nav-menu" aria-hidden="true"></span> Home
15+
</NavLink>
16+
</div>
17+
18+
<div class="nav-item px-3">
19+
<NavLink class="nav-link" href="install">
20+
<span class="bi bi-custom bi bi-floppy" aria-hidden="true"></span> Installation
1521
</NavLink>
1622
</div>
1723
</nav>

Samples/BlazorWebAssembly/Blazor-Wasm-Captcha-Test/Shared/NavMenu.razor.css

Lines changed: 42 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,44 @@
33
}
44

55
.top-row {
6-
height: 3.5rem;
6+
min-height: 3.5rem;
77
background-color: rgba(0,0,0,0.4);
88
}
99

1010
.navbar-brand {
1111
font-size: 1.1rem;
1212
}
1313

14-
.oi {
15-
width: 2rem;
16-
font-size: 1.1rem;
17-
vertical-align: text-top;
18-
top: -2px;
14+
.bi {
15+
display: inline-block;
16+
position: relative;
17+
width: 1.25rem;
18+
height: 1.25rem;
19+
margin-right: 0.75rem;
20+
top: -1px;
21+
background-size: cover;
22+
}
23+
24+
.bi-house-door-fill-nav-menu {
25+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-house-door-fill' viewBox='0 0 16 16'%3E%3Cpath d='M6.5 14.5v-3.505c0-.245.25-.495.5-.495h2c.25 0 .5.25.5.5v3.5a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5v-7a.5.5 0 0 0-.146-.354L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293L8.354 1.146a.5.5 0 0 0-.708 0l-6 6A.5.5 0 0 0 1.5 7.5v7a.5.5 0 0 0 .5.5h4a.5.5 0 0 0 .5-.5Z'/%3E%3C/svg%3E");
26+
}
27+
28+
.bi-plus-square-fill-nav-menu {
29+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-plus-square-fill' viewBox='0 0 16 16'%3E%3Cpath d='M2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2zm6.5 4.5v3h3a.5.5 0 0 1 0 1h-3v3a.5.5 0 0 1-1 0v-3h-3a.5.5 0 0 1 0-1h3v-3a.5.5 0 0 1 1 0z'/%3E%3C/svg%3E");
30+
}
31+
32+
.bi-list-nested-nav-menu {
33+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='white' class='bi bi-list-nested' viewBox='0 0 16 16'%3E%3Cpath fill-rule='evenodd' d='M4.5 11.5A.5.5 0 0 1 5 11h10a.5.5 0 0 1 0 1H5a.5.5 0 0 1-.5-.5zm-2-4A.5.5 0 0 1 3 7h10a.5.5 0 0 1 0 1H3a.5.5 0 0 1-.5-.5zm-2-4A.5.5 0 0 1 1 3h10a.5.5 0 0 1 0 1H1a.5.5 0 0 1-.5-.5z'/%3E%3C/svg%3E");
34+
}
35+
36+
.bi-custom {
37+
font-size: 1.3rem;
38+
margin-top: -1.5rem;
39+
margin-left: -0.2rem;
1940
}
2041

2142
.nav-item {
2243
font-size: 0.9rem;
23-
padding-bottom: 0.5rem;
2444
}
2545

2646
.nav-item:first-of-type {
@@ -34,21 +54,21 @@
3454
.nav-item ::deep a {
3555
color: #d7d7d7;
3656
border-radius: 4px;
37-
height: 3rem;
57+
height: 3.5rem;
3858
display: flex;
3959
align-items: center;
4060
line-height: 3rem;
4161
}
4262

43-
.nav-item ::deep a.active {
44-
background-color: rgba(255,255,255,0.25);
45-
color: white;
46-
}
63+
.nav-item ::deep a.active {
64+
background-color: rgba(255,255,255,0.37);
65+
color: white;
66+
}
4767

48-
.nav-item ::deep a:hover {
49-
background-color: rgba(255,255,255,0.1);
50-
color: white;
51-
}
68+
.nav-item ::deep a:hover {
69+
background-color: rgba(255,255,255,0.1);
70+
color: white;
71+
}
5272

5373
@media (min-width: 641px) {
5474
.navbar-toggler {
@@ -59,4 +79,10 @@
5979
/* Never collapse the sidebar for wide screens */
6080
display: block;
6181
}
82+
83+
.nav-scrollable {
84+
/* Allow sidebar to scroll for tall menus */
85+
height: calc(100vh - 3.5rem);
86+
overflow-y: auto;
87+
}
6288
}

Samples/BlazorWebAssembly/Blazor-Wasm-Captcha-Test/_Imports.razor

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@
88
@using Microsoft.JSInterop
99
@using Blazor_Wasm_Captcha_Test
1010
@using Blazor_Wasm_Captcha_Test.Shared
11+
@using Brism

0 commit comments

Comments
 (0)