Rewrite: Next.js → ASP.NET Core 10 Razor Pages
deploy / deploy (push) Failing after 1m21s

Full rewrite of the portfolio site from Next.js 14 to .NET 10:

- ASP.NET Core 10 Razor Pages, no Node.js dependency
- EF Core 10 + SQLite (same schema as before — data survives upgrade)
- Cookie authentication (same single-password model)
- Resend contact form via HttpClient
- Bilingual FA/EN via locale cookie + BasePageModel
- All UI ported to Razor Pages with Tailwind CDN + custom CSS
- Vanilla JS: particles, typewriter, cursor, animations, portfolio modal
- Dockerfile: SDK 10.0-alpine → aspnet 10.0-alpine (no npm/Node needed)
- CI/CD: dropped NPM_TOKEN, ADMIN_SESSION_SECRET — pure dotnet publish

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-06-01 07:46:56 +03:30
parent bcea9dc2f6
commit 1b3a8b493e
111 changed files with 2409 additions and 14062 deletions
+35
View File
@@ -0,0 +1,35 @@
@page "/Admin/Posts/{slug}"
@model SoroushAsadi.Pages.Admin.Posts.PostEditModel
@{
Layout = "_AdminLayout";
ViewData["Title"] = "Edit post: " + Model.Slug;
}
<div class="mb-6 flex items-center gap-4">
<a href="/Admin/Posts" class="text-slate-400 hover:text-white transition-colors text-sm">← Posts</a>
<h1 class="font-display text-xl font-bold text-white">@Model.Slug</h1>
<a href="/blog/@Model.Slug" target="_blank" class="text-xs text-slate-400 hover:text-white transition-colors">View ↗</a>
</div>
@if (!string.IsNullOrEmpty(Model.Message))
{
<div class="mb-4 rounded-lg border border-emerald/30 bg-emerald/10 px-4 py-3 text-sm text-emerald">@Model.Message</div>
}
<form method="post" class="space-y-4">
<div>
<label class="label-mono mb-2 block">Body (Markdown)</label>
<p class="text-xs text-slate-500 mb-2">Supports: ## headings, **bold**, `code`, - list items, paragraphs</p>
<textarea name="body" rows="30"
class="w-full rounded-xl border border-white/10 bg-white/[.03] px-4 py-3 font-mono text-xs text-slate-200 outline-none focus:border-electric/60 transition-colors resize-y"
spellcheck="false">@Model.CurrentBody</textarea>
</div>
<div class="flex gap-3">
<button type="submit" class="btn-primary">Save</button>
@if (Model.HasOverride)
{
<button type="submit" name="reset" value="1" class="rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-2 text-sm text-red-400 hover:bg-red-500/20 transition-colors">Reset to default</button>
}
<a href="/Admin/Posts" class="btn-ghost">Cancel</a>
</div>
</form>
+71
View File
@@ -0,0 +1,71 @@
using System.Text.Json.Nodes;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using SoroushAsadi.Services;
namespace SoroushAsadi.Pages.Admin.Posts;
[Authorize]
public class PostEditModel(ContentService content) : PageModel
{
[BindProperty(SupportsGet = true)]
public string Slug { get; set; } = "";
public string CurrentBody { get; private set; } = "";
public string Message { get; private set; } = "";
public bool HasOverride { get; private set; }
// Known default bodies live in Blog/Post.cshtml.cs (DefaultBodies)
private static readonly Dictionary<string, string> _defaults = new()
{
["rag-eval-framework"] = SoroushAsadi.Pages.Blog.DefaultBodies.RagEval,
["agentic-n8n-patterns"] = SoroushAsadi.Pages.Blog.DefaultBodies.N8nPatterns,
["vertex-cost-control"] = SoroushAsadi.Pages.Blog.DefaultBodies.VertexCost,
["k8s-llm-inference"] = SoroushAsadi.Pages.Blog.DefaultBodies.K8sInference,
["flutter-on-device-ai"] = SoroushAsadi.Pages.Blog.DefaultBodies.FlutterAI,
["enterprise-ai-roadmap"] = SoroushAsadi.Pages.Blog.DefaultBodies.EnterpriseRoadmap,
};
public void OnGet()
{
var overrides = content.GetPostOverrides();
if (overrides.TryGetValue(Slug, out var node) && node["body"]?.GetValue<string>() is { } body)
{
CurrentBody = body;
HasOverride = true;
}
else
{
CurrentBody = _defaults.GetValueOrDefault(Slug, "");
}
}
public IActionResult OnPost(string body, string? reset)
{
if (reset == "1")
{
// Remove override — default body shows through
var existing = content.GetPostOverrides();
existing.Remove(Slug);
// Rebuild the posts JSON without this slug
var obj = new JsonObject();
foreach (var kv in existing) obj[kv.Key] = kv.Value.DeepClone();
content.SaveSection(ContentService.PostsKey, obj.ToJsonString());
Message = "Reset to default.";
HasOverride = false;
CurrentBody = _defaults.GetValueOrDefault(Slug, "");
return Page();
}
content.SavePost(Slug, new JsonObject { ["body"] = body });
HasOverride = true;
CurrentBody = body;
Message = "Saved.";
return Page();
}
}
// Re-export DefaultBodies from the Blog page so this page can use them
+29
View File
@@ -0,0 +1,29 @@
@page "/Admin/Posts"
@model SoroushAsadi.Pages.Admin.Posts.PostsIndexModel
@{
Layout = "_AdminLayout";
ViewData["Title"] = "Blog posts";
var slugs = new[]{ "rag-eval-framework","agentic-n8n-patterns","vertex-cost-control","k8s-llm-inference","flutter-on-device-ai","enterprise-ai-roadmap" };
}
<h1 class="font-display text-2xl font-bold text-white mb-8">Blog posts</h1>
<div class="space-y-2">
@foreach (var slug in slugs)
{
var hasOverride = Model.OverrideSlugs.Contains(slug);
<div class="glass flex items-center justify-between p-4">
<div class="flex items-center gap-3">
<span class="font-mono text-sm text-white">@slug</span>
@if (hasOverride)
{
<span class="rounded-full bg-violet/10 px-2 py-0.5 font-mono text-[.65rem] text-violet">customized</span>
}
</div>
<div class="flex gap-2">
<a href="/Admin/Posts/@slug" class="btn-ghost text-xs py-1.5 px-3">Edit</a>
<a href="/blog/@slug" target="_blank" class="text-xs text-slate-400 hover:text-white transition-colors self-center">View ↗</a>
</div>
</div>
}
</div>
+13
View File
@@ -0,0 +1,13 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc.RazorPages;
using SoroushAsadi.Services;
namespace SoroushAsadi.Pages.Admin.Posts;
[Authorize]
public class PostsIndexModel(ContentService content) : PageModel
{
public IReadOnlySet<string> OverrideSlugs { get; private set; } = new HashSet<string>();
public void OnGet() => OverrideSlugs = content.GetPostOverrides().Keys.ToHashSet();
}