From a68b52c813ad120885d583dc2468dee396ba09b3 Mon Sep 17 00:00:00 2001 From: Drew Kennedy Date: Tue, 28 Oct 2025 12:50:12 +1000 Subject: [PATCH 1/5] Enhance dependency review workflow and update project references - Added support for allowing dependencies with specific licenses in the dependency review action. - Included a new package reference for BlazorWasmPreRendering.Build. - Updated BuildInfo format in MainLayout.razor to include GitHub release style versioning. - Refactored service registration in Program.cs for better organization and prerendering support. --- .github/workflows/dependency-review.yml | 4 ++++ Albatross.csproj | 1 + Layout/MainLayout.razor | 7 +++---- Program.cs | 21 ++++++++++++--------- 4 files changed, 20 insertions(+), 13 deletions(-) diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index 1bc1c38..3e377f8 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -17,5 +17,9 @@ jobs: fail-on-severity: moderate # Allow licenses (add/remove as needed for your project) allow-licenses: MIT, Apache-2.0, BSD-2-Clause, BSD-3-Clause, ISC, GPL-3.0 + # Allow dependencies even if license detection fails + # System.Net.Http and System.Text.RegularExpressions are Microsoft packages with MIT licenses + # but GitHub may flag them as "OTHER" due to license metadata format + allow-dependencies-licenses: pkg:nuget/System.Net.Http, pkg:nuget/System.Text.RegularExpressions # Comment on PR with summary comment-summary-in-pr: always diff --git a/Albatross.csproj b/Albatross.csproj index ebb4fb2..ad38a8b 100644 --- a/Albatross.csproj +++ b/Albatross.csproj @@ -62,6 +62,7 @@ + diff --git a/Layout/MainLayout.razor b/Layout/MainLayout.razor index 9a7a0e4..8d298eb 100644 --- a/Layout/MainLayout.razor +++ b/Layout/MainLayout.razor @@ -1,5 +1,6 @@ @inherits LayoutComponentBase @using System.Reflection +@using Generated
@@ -57,11 +58,9 @@ protected override void OnInitialized() { Assembly assembly = typeof(Program).Assembly; - var version = assembly.GetName().Version; var title = assembly.GetCustomAttribute()?.Title ?? "Albatross"; - var buildDate = DateTime.Now.ToString("yyyy-MM-dd"); - @* BuildInfo = $"{title} v{version}"; *@ - BuildInfo = $"{title}"; + // Use the same version format as GitHub releases: BuildTimestamp-BuildId + BuildInfo = $"{title} v{BuildConstants.BuildTimestamp}-{BuildConstants.BuildId}"; } } diff --git a/Program.cs b/Program.cs index c2eb9f5..fd2d872 100644 --- a/Program.cs +++ b/Program.cs @@ -7,14 +7,17 @@ builder.RootComponents.Add("#app"); builder.RootComponents.Add("head::after"); -builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); -builder.Services.AddScoped(sp => - new AbuseIPDBService( - sp.GetRequiredService() - ) -); - -// API access tokens are now hardcoded in the service for security purposes -// This makes them less discoverable than storing them in appsettings.json +ConfigureServices(builder.Services, builder.HostEnvironment.BaseAddress); await builder.Build().RunAsync(); + +// Extract service registration to static local function for prerendering support +static void ConfigureServices(IServiceCollection services, string baseAddress) +{ + services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(baseAddress) }); + services.AddScoped(sp => + new AbuseIPDBService( + sp.GetRequiredService() + ) + ); +} From 77b6fcf81057f6c8cecfdd59b9c5f38dfcb2d4d4 Mon Sep 17 00:00:00 2001 From: Drew Kennedy Date: Tue, 28 Oct 2025 13:16:39 +1000 Subject: [PATCH 2/5] Refactor build info formatting to match GitHub release versioning --- Layout/MainLayout.razor | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Layout/MainLayout.razor b/Layout/MainLayout.razor index 8d298eb..b5b4aff 100644 --- a/Layout/MainLayout.razor +++ b/Layout/MainLayout.razor @@ -60,7 +60,14 @@ Assembly assembly = typeof(Program).Assembly; var title = assembly.GetCustomAttribute()?.Title ?? "Albatross"; - // Use the same version format as GitHub releases: BuildTimestamp-BuildId - BuildInfo = $"{title} v{BuildConstants.BuildTimestamp}-{BuildConstants.BuildId}"; + // Extract date (YYYYMMDD) from timestamp (YYYYMMDD-HHMM) and use short build ID + var buildDate = BuildConstants.BuildTimestamp.Length >= 8 + ? BuildConstants.BuildTimestamp.Substring(0, 8) + : BuildConstants.BuildTimestamp; + var shortId = BuildConstants.BuildId.Length >= 8 + ? BuildConstants.BuildId.Substring(0, 8) + : BuildConstants.BuildId; + + BuildInfo = $"{title} v{buildDate}-{shortId}"; } } From 0a9dab51f7fa132de5020d0a1c67bd4484946acb Mon Sep 17 00:00:00 2001 From: Drew Kennedy Date: Tue, 28 Oct 2025 13:25:17 +1000 Subject: [PATCH 3/5] Remove versioning from build info display in MainLayout --- Layout/MainLayout.razor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Layout/MainLayout.razor b/Layout/MainLayout.razor index b5b4aff..c945227 100644 --- a/Layout/MainLayout.razor +++ b/Layout/MainLayout.razor @@ -68,6 +68,6 @@ ? BuildConstants.BuildId.Substring(0, 8) : BuildConstants.BuildId; - BuildInfo = $"{title} v{buildDate}-{shortId}"; + BuildInfo = $"{title}"; } } From fdc00a911cc16846155f46eba7ba9f79f1dbe62b Mon Sep 17 00:00:00 2001 From: Drew Kennedy Date: Tue, 28 Oct 2025 13:33:13 +1000 Subject: [PATCH 4/5] Update allowed licenses in dependency review workflow --- .github/workflows/dependency-review.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index 3e377f8..f9e854e 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -16,7 +16,7 @@ jobs: # Fail the action if any vulnerabilities are found fail-on-severity: moderate # Allow licenses (add/remove as needed for your project) - allow-licenses: MIT, Apache-2.0, BSD-2-Clause, BSD-3-Clause, ISC, GPL-3.0 + allow-licenses: MIT, Apache-2.0, BSD-2-Clause, BSD-3-Clause, ISC, GPL-3.0, MPL-1.1, MPL-2.0 # Allow dependencies even if license detection fails # System.Net.Http and System.Text.RegularExpressions are Microsoft packages with MIT licenses # but GitHub may flag them as "OTHER" due to license metadata format From 4f577b608d9a34b2b02a7154bb4251224a5629ed Mon Sep 17 00:00:00 2001 From: Drew Kennedy Date: Tue, 28 Oct 2025 13:59:46 +1000 Subject: [PATCH 5/5] Add sitemap generation target and update README for SEO optimization --- Albatross.csproj | 12 ++++++++++- README.md | 36 +++++++++++++++++++++++++++++++ wwwroot/sitemap.xml | 52 --------------------------------------------- 3 files changed, 47 insertions(+), 53 deletions(-) diff --git a/Albatross.csproj b/Albatross.csproj index ad38a8b..ea610aa 100644 --- a/Albatross.csproj +++ b/Albatross.csproj @@ -58,11 +58,21 @@ + + + + + + + - + diff --git a/README.md b/README.md index ae60ccd..b3b95e8 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ A modern Blazor WebAssembly application that provides comprehensive IP address a - **Combined Data Sources**: Integrated AbuseIPDB and Cloudflare Radar API data for comprehensive IP analysis - **Secure Authentication**: Build-time generated HMAC authentication with timestamp validation for enhanced security - **CORS Protection**: Cloudflare Worker proxy handles CORS and protects API keys from client exposure +- **SEO-Optimized**: Static HTML prerendering for improved search engine indexing and web crawler accessibility - **Modern UI**: Clean, responsive Blazor WebAssembly interface with real-time JSON formatting - **Cross-Platform**: Runs on Windows, macOS, and Linux @@ -53,6 +54,41 @@ The project uses MSBuild targets for automated key generation and code injection - `Generated/build-manifest.json` - Build metadata and timestamps - `cloudflare-worker.js` - Final worker with injected authentication +## Prerendering + +Albatross uses **[BlazorWasmPreRendering.Build](https://github.com/jsakamoto/BlazorWasmPreRendering.Build)** to generate static HTML during the publish process, improving SEO and web crawler accessibility. + +### How It Works +- **Build-Time Rendering**: During `dotnet publish`, the app is rendered to static HTML +- **SEO Benefits**: Search engines can index content without executing JavaScript +- **Hidden Content**: Prerendered HTML is hidden (opacity: 0, z-index: -1) to prevent visual flash +- **Blazor Hydration**: The app seamlessly takes over after loading, providing full interactivity +- **Zero Runtime Overhead**: Prerendering happens at build time, not on the server + +### Implementation +For prerendering to work, service registration must be extracted into a static local function in `Program.cs`: +```csharp +static void ConfigureServices(IServiceCollection services, string baseAddress) +{ + services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(baseAddress) }); + services.AddScoped(/* ... */); +} +``` + +See the [BlazorWasmPreRendering.Build documentation](https://github.com/jsakamoto/BlazorWasmPreRendering.Build#services-registration) for more details. + +### Verification +To verify prerendering is working after deployment: +```bash +# Check for prerendering markers in the HTML +curl -s https://albatross.devnomadic.com | grep "PRERENDERING-BEGIN" + +# Or view page source in browser and search for: + +``` + +If prerendering is working, you'll see the full app structure in the HTML source, not just "Loading..." + ## Setup and Development ### Prerequisites diff --git a/wwwroot/sitemap.xml b/wwwroot/sitemap.xml index ae93054..e69de29 100644 --- a/wwwroot/sitemap.xml +++ b/wwwroot/sitemap.xml @@ -1,52 +0,0 @@ - - - - - - https://albatross.devnomadic.com/ - 2025-07-12 - weekly - 1.0 - - - - - https://albatross.devnomadic.com/ip-manifests/AWS.json - 2025-07-12 - daily - 0.8 - - - https://albatross.devnomadic.com/ip-manifests/Azure.json - 2025-07-12 - daily - 0.8 - - - https://albatross.devnomadic.com/ip-manifests/GCP.json - 2025-07-12 - daily - 0.8 - - - https://albatross.devnomadic.com/ip-manifests/Oracle.json - 2025-07-12 - daily - 0.8 - - - - - https://albatross.devnomadic.com/robots.txt - 2025-07-12 - monthly - 0.3 - - - - - -