Add canonical domain support (#37)

- Update deps
This commit is contained in:
Daniel J. Summers 2023-07-08 20:36:49 -04:00
parent 7b325dc19e
commit 5b27ea5cd2
5 changed files with 25 additions and 12 deletions

1
.gitignore vendored
View File

@ -261,6 +261,7 @@ src/MyWebLog/wwwroot/img/daniel-j-summers
src/MyWebLog/wwwroot/img/bit-badger
.ionide
.vscode
src/MyWebLog/appsettings.Production.json
# SQLite database files

View File

@ -5,18 +5,22 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="BitBadger.Npgsql.FSharp.Documents" Version="1.0.0-beta2" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="7.0.3" />
<PackageReference Include="BitBadger.Npgsql.FSharp.Documents" Version="1.0.0-beta3" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="7.0.8" />
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.FSharpLu.Json" Version="0.11.7" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NodaTime.Serialization.JsonNet" Version="3.0.1" />
<PackageReference Include="Npgsql.NodaTime" Version="7.0.2" />
<PackageReference Include="Npgsql.NodaTime" Version="7.0.4" />
<PackageReference Include="RethinkDb.Driver" Version="2.3.150" />
<PackageReference Include="RethinkDb.Driver.FSharp" Version="0.9.0-beta-07" />
</ItemGroup>
<ItemGroup>
<PackageReference Update="FSharp.Core" Version="7.0.300" />
</ItemGroup>
<ItemGroup>
<Compile Include="Converters.fs" />
<Compile Include="Interfaces.fs" />

View File

@ -7,9 +7,9 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Markdig" Version="0.30.4" />
<PackageReference Include="Markdown.ColorCode" Version="1.0.2" />
<PackageReference Include="NodaTime" Version="3.1.6" />
<PackageReference Include="Markdig" Version="0.31.0" />
<PackageReference Include="Markdown.ColorCode" Version="1.0.4" />
<PackageReference Include="NodaTime" Version="3.1.9" />
</ItemGroup>
</Project>

View File

@ -23,13 +23,15 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="DotLiquid" Version="2.2.682" />
<PackageReference Include="Giraffe" Version="6.0.0" />
<PackageReference Include="Giraffe.Htmx" Version="1.8.5" />
<PackageReference Include="Giraffe.ViewEngine.Htmx" Version="1.8.5" />
<PackageReference Include="NeoSmart.Caching.Sqlite" Version="6.0.1" />
<PackageReference Include="BitBadger.AspNetCore.CanonicalDomains" Version="1.0.0" />
<PackageReference Include="DotLiquid" Version="2.2.692" />
<PackageReference Include="Giraffe" Version="6.2.0" />
<PackageReference Include="Giraffe.Htmx" Version="1.9.2" />
<PackageReference Include="Giraffe.ViewEngine.Htmx" Version="1.9.2" />
<PackageReference Include="NeoSmart.Caching.Sqlite" Version="6.1.0" />
<PackageReference Include="RethinkDB.DistributedCache" Version="1.0.0-rc1" />
<PackageReference Include="System.ServiceModel.Syndication" Version="7.0.0" />
<PackageReference Update="FSharp.Core" Version="7.0.300" />
</ItemGroup>
<ItemGroup>

View File

@ -99,6 +99,8 @@ let showHelp () =
open System.IO
open System.Linq
open BitBadger.AspNetCore.CanonicalDomains
open Giraffe
open Giraffe.EndpointRouting
open Microsoft.AspNetCore.Authentication.Cookies
@ -200,6 +202,10 @@ let rec main args =
do! Maintenance.loadTheme [| ""; themeFile |] app.Services
let _ = app.UseForwardedHeaders ()
let domainCfg = app.Services.GetRequiredService<IConfiguration>().GetSection "CanonicalDomains"
if domainCfg.AsEnumerable().Count () > 0 then app.UseCanonicalDomains () |> ignore
let _ = app.UseCookiePolicy (CookiePolicyOptions (MinimumSameSitePolicy = SameSiteMode.Strict))
let _ = app.UseMiddleware<WebLogMiddleware> ()
let _ = app.UseAuthentication ()