From ba5e27e01189bb018c06c8368e11deec06437da0 Mon Sep 17 00:00:00 2001 From: "Daniel J. Summers" Date: Sat, 5 Jul 2025 13:40:06 -0400 Subject: [PATCH] Simplify catch-all route; bump admin theme version --- src/MyWebLog/Handlers/Routes.fs | 11 +++-------- src/admin-theme/version.txt | 2 +- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/MyWebLog/Handlers/Routes.fs b/src/MyWebLog/Handlers/Routes.fs index f6d25ae..d677ed6 100644 --- a/src/MyWebLog/Handlers/Routes.fs +++ b/src/MyWebLog/Handlers/Routes.fs @@ -28,15 +28,13 @@ module CatchAll = "wwwroot" if textLink.Length > 1 then textLink[1..] else textLink ] |> String.concat (string Path.DirectorySeparatorChar) - match File.Exists staticFileName with - | true -> + if File.Exists staticFileName then debug (fun () -> $"File {textLink} is a static file") yield File.GetLastWriteTimeUtc staticFileName |> System.DateTimeOffset |> Some |> streamFile true staticFileName None - | false -> () // Home page directory without the directory slash if textLink = "" then yield redirectTo true (webLog.RelativeUrl Permalink.Empty) let permalink = Permalink textLink[1..] @@ -99,11 +97,8 @@ module CatchAll = } // GET {all-of-the-above} - let route : HttpHandler = fun next ctx -> task { - match deriveAction ctx |> Seq.tryHead with - | Some handler -> return! handler next ctx - | None -> return None // Error.notFound next ctx - } + let route : HttpHandler = fun next ctx -> + match deriveAction ctx |> Seq.tryHead with Some handler -> handler next ctx | None -> Error.notFound next ctx /// Serve theme assets module Asset = diff --git a/src/admin-theme/version.txt b/src/admin-theme/version.txt index f3f14b6..987617d 100644 --- a/src/admin-theme/version.txt +++ b/src/admin-theme/version.txt @@ -1,2 +1,2 @@ myWebLog Admin -2.2 \ No newline at end of file +3 \ No newline at end of file