Update to .NET 8/9; minor tweaks
This commit is contained in:
parent
870f87cb17
commit
88841fd3f8
2
build.fs
2
build.fs
@ -33,7 +33,7 @@ let zipTheme (name : string) (_ : TargetParameter) =
|
|||||||
|> Zip.zipSpec $"{releasePath}/{name}-theme.zip"
|
|> Zip.zipSpec $"{releasePath}/{name}-theme.zip"
|
||||||
|
|
||||||
/// Frameworks supported by this build
|
/// Frameworks supported by this build
|
||||||
let frameworks = [ "net6.0"; "net8.0" ]
|
let frameworks = [ "net8.0"; "net9.0" ]
|
||||||
|
|
||||||
/// Publish the project for the given runtime ID
|
/// Publish the project for the given runtime ID
|
||||||
let publishFor rid (_ : TargetParameter) =
|
let publishFor rid (_ : TargetParameter) =
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>net6.0;net8.0</TargetFrameworks>
|
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
|
||||||
<DebugType>embedded</DebugType>
|
<DebugType>embedded</DebugType>
|
||||||
<AssemblyVersion>2.2.0.0</AssemblyVersion>
|
<AssemblyVersion>3.0.0.0</AssemblyVersion>
|
||||||
<FileVersion>2.2.0.0</FileVersion>
|
<FileVersion>3.0.0.0</FileVersion>
|
||||||
<Version>2.2.0</Version>
|
<Version>3.0.0</Version>
|
||||||
|
<VersionSuffix>beta1</VersionSuffix>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -5,17 +5,17 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="BitBadger.Documents.Postgres" Version="4.0.0-rc5" />
|
<PackageReference Include="BitBadger.Documents.Postgres" Version="4.0.0" />
|
||||||
<PackageReference Include="BitBadger.Documents.Sqlite" Version="4.0.0-rc5" />
|
<PackageReference Include="BitBadger.Documents.Sqlite" Version="4.0.0" />
|
||||||
<PackageReference Include="Microsoft.Data.Sqlite" Version="8.0.8" />
|
<PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="9.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
|
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.0" />
|
||||||
<PackageReference Include="Microsoft.FSharpLu.Json" Version="0.11.7" />
|
<PackageReference Include="Microsoft.FSharpLu.Json" Version="0.11.7" />
|
||||||
<PackageReference Include="NodaTime.Serialization.JsonNet" Version="3.1.0" />
|
<PackageReference Include="NodaTime.Serialization.JsonNet" Version="3.1.0" />
|
||||||
<PackageReference Include="Npgsql.NodaTime" Version="8.0.4" />
|
<PackageReference Include="Npgsql.NodaTime" Version="9.0.2" />
|
||||||
<PackageReference Include="RethinkDb.Driver" Version="2.3.150" />
|
<PackageReference Include="RethinkDb.Driver" Version="2.3.150" />
|
||||||
<PackageReference Include="RethinkDb.Driver.FSharp" Version="0.9.0-beta-07" />
|
<PackageReference Include="RethinkDb.Driver.FSharp" Version="0.9.0-beta-07" />
|
||||||
<PackageReference Update="FSharp.Core" Version="8.0.400" />
|
<PackageReference Update="FSharp.Core" Version="9.0.100" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -205,22 +205,20 @@ let webLogField (webLogId: WebLogId) =
|
|||||||
|
|
||||||
|
|
||||||
open BitBadger.Documents.Sqlite
|
open BitBadger.Documents.Sqlite
|
||||||
open BitBadger.Documents.Sqlite.WithConn
|
|
||||||
|
|
||||||
/// Functions to support revisions
|
/// Functions to support revisions
|
||||||
module Revisions =
|
module Revisions =
|
||||||
|
|
||||||
/// Find all revisions for the given entity
|
/// Find all revisions for the given entity
|
||||||
let findByEntityId<'TKey> revTable entityTable (key: 'TKey) conn =
|
let findByEntityId<'TKey> revTable entityTable (key: 'TKey) (conn: SqliteConnection) =
|
||||||
Custom.list
|
conn.customList
|
||||||
$"SELECT as_of, revision_text FROM %s{revTable} WHERE %s{entityTable}_id = @id ORDER BY as_of DESC"
|
$"SELECT as_of, revision_text FROM %s{revTable} WHERE %s{entityTable}_id = @id ORDER BY as_of DESC"
|
||||||
[ idParam key ]
|
[ idParam key ]
|
||||||
Map.toRevision
|
Map.toRevision
|
||||||
conn
|
|
||||||
|
|
||||||
/// Find all revisions for all posts for the given web log
|
/// Find all revisions for all posts for the given web log
|
||||||
let findByWebLog<'TKey> revTable entityTable (keyFunc: string -> 'TKey) webLogId conn =
|
let findByWebLog<'TKey> revTable entityTable (keyFunc: string -> 'TKey) webLogId (conn: SqliteConnection) =
|
||||||
Custom.list
|
conn.customList
|
||||||
$"SELECT pr.*
|
$"SELECT pr.*
|
||||||
FROM %s{revTable} pr
|
FROM %s{revTable} pr
|
||||||
INNER JOIN %s{entityTable} p ON p.data->>'Id' = pr.{entityTable}_id
|
INNER JOIN %s{entityTable} p ON p.data->>'Id' = pr.{entityTable}_id
|
||||||
@ -228,19 +226,16 @@ module Revisions =
|
|||||||
ORDER BY as_of DESC"
|
ORDER BY as_of DESC"
|
||||||
[ webLogParam webLogId ]
|
[ webLogParam webLogId ]
|
||||||
(fun rdr -> keyFunc (Map.getString $"{entityTable}_id" rdr), Map.toRevision rdr)
|
(fun rdr -> keyFunc (Map.getString $"{entityTable}_id" rdr), Map.toRevision rdr)
|
||||||
conn
|
|
||||||
|
|
||||||
/// Update a page or post's revisions
|
/// Update a page or post's revisions
|
||||||
let update<'TKey> revTable entityTable (key: 'TKey) oldRevs newRevs conn = backgroundTask {
|
let update<'TKey> revTable entityTable (key: 'TKey) oldRevs newRevs (conn: SqliteConnection) = backgroundTask {
|
||||||
let toDelete, toAdd = Utils.diffRevisions oldRevs newRevs
|
let toDelete, toAdd = Utils.diffRevisions oldRevs newRevs
|
||||||
for delRev in toDelete do
|
for delRev in toDelete do
|
||||||
do! Custom.nonQuery
|
do! conn.customNonQuery
|
||||||
$"DELETE FROM %s{revTable} WHERE %s{entityTable}_id = @id AND as_of = @asOf"
|
$"DELETE FROM %s{revTable} WHERE %s{entityTable}_id = @id AND as_of = @asOf"
|
||||||
[ idParam key; sqlParam "@asOf" (instantParam delRev.AsOf) ]
|
[ idParam key; sqlParam "@asOf" (instantParam delRev.AsOf) ]
|
||||||
conn
|
|
||||||
for addRev in toAdd do
|
for addRev in toAdd do
|
||||||
do! Custom.nonQuery
|
do! conn.customNonQuery
|
||||||
$"INSERT INTO {revTable} VALUES (@id, @asOf, @text)"
|
$"INSERT INTO {revTable} VALUES (@id, @asOf, @text)"
|
||||||
[ idParam key; sqlParam "asOf" (instantParam addRev.AsOf); sqlParam "@text" (string addRev.Text) ]
|
[ idParam key; sqlParam "asOf" (instantParam addRev.AsOf); sqlParam "@text" (string addRev.Text) ]
|
||||||
conn
|
|
||||||
}
|
}
|
||||||
|
@ -7,11 +7,11 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Markdig" Version="0.37.0" />
|
<PackageReference Include="Markdig" Version="0.39.1" />
|
||||||
<PackageReference Include="Markdown.ColorCode" Version="2.2.2" />
|
<PackageReference Include="Markdown.ColorCode" Version="2.3.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
<PackageReference Include="NodaTime" Version="3.1.12" />
|
<PackageReference Include="NodaTime" Version="3.2.0" />
|
||||||
<PackageReference Update="FSharp.Core" Version="8.0.400" />
|
<PackageReference Update="FSharp.Core" Version="9.0.100" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Expecto" Version="10.2.1" />
|
<PackageReference Include="Expecto" Version="10.2.1" />
|
||||||
<PackageReference Include="ThrowawayDb.Postgres" Version="1.4.0" />
|
<PackageReference Include="ThrowawayDb.Postgres" Version="1.4.0" />
|
||||||
<PackageReference Update="FSharp.Core" Version="8.0.400" />
|
<PackageReference Update="FSharp.Core" Version="9.0.100" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -75,10 +75,10 @@ module WebLogCache =
|
|||||||
| RegEx of Regex * string
|
| RegEx of Regex * string
|
||||||
|
|
||||||
/// The cache of web log details
|
/// The cache of web log details
|
||||||
let mutable private _cache : WebLog list = []
|
let mutable private _cache: WebLog list = []
|
||||||
|
|
||||||
/// Redirect rules with compiled regular expressions
|
/// Redirect rules with compiled regular expressions
|
||||||
let mutable private _redirectCache = ConcurrentDictionary<WebLogId, CachedRedirectRule list> ()
|
let mutable private _redirectCache = ConcurrentDictionary<WebLogId, CachedRedirectRule list>()
|
||||||
|
|
||||||
/// Try to get the web log for the current request (longest matching URL base wins)
|
/// Try to get the web log for the current request (longest matching URL base wins)
|
||||||
let tryGet (path : string) =
|
let tryGet (path : string) =
|
||||||
@ -126,7 +126,7 @@ module PageListCache =
|
|||||||
open MyWebLog.ViewModels
|
open MyWebLog.ViewModels
|
||||||
|
|
||||||
/// Cache of displayed pages
|
/// Cache of displayed pages
|
||||||
let private _cache = ConcurrentDictionary<WebLogId, DisplayPage array> ()
|
let private _cache = ConcurrentDictionary<WebLogId, DisplayPage array>()
|
||||||
|
|
||||||
let private fillPages (webLog: WebLog) pages =
|
let private fillPages (webLog: WebLog) pages =
|
||||||
_cache[webLog.Id] <-
|
_cache[webLog.Id] <-
|
||||||
@ -159,7 +159,7 @@ module CategoryCache =
|
|||||||
open MyWebLog.ViewModels
|
open MyWebLog.ViewModels
|
||||||
|
|
||||||
/// The cache itself
|
/// The cache itself
|
||||||
let private _cache = ConcurrentDictionary<WebLogId, DisplayCategory array> ()
|
let private _cache = ConcurrentDictionary<WebLogId, DisplayCategory array>()
|
||||||
|
|
||||||
/// Are there categories cached for this web log?
|
/// Are there categories cached for this web log?
|
||||||
let exists (ctx: HttpContext) = _cache.ContainsKey ctx.WebLog.Id
|
let exists (ctx: HttpContext) = _cache.ContainsKey ctx.WebLog.Id
|
||||||
@ -184,7 +184,7 @@ module CategoryCache =
|
|||||||
module ThemeAssetCache =
|
module ThemeAssetCache =
|
||||||
|
|
||||||
/// A list of asset names for each theme
|
/// A list of asset names for each theme
|
||||||
let private _cache = ConcurrentDictionary<ThemeId, string list> ()
|
let private _cache = ConcurrentDictionary<ThemeId, string list>()
|
||||||
|
|
||||||
/// Retrieve the assets for the given theme ID
|
/// Retrieve the assets for the given theme ID
|
||||||
let get themeId = _cache[themeId]
|
let get themeId = _cache[themeId]
|
||||||
|
@ -31,16 +31,16 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="BitBadger.AspNetCore.CanonicalDomains" Version="1.0.0" />
|
<PackageReference Include="BitBadger.AspNetCore.CanonicalDomains" Version="1.1.0" />
|
||||||
<PackageReference Include="DotLiquid" Version="2.2.692" />
|
<PackageReference Include="DotLiquid" Version="2.2.692" />
|
||||||
<PackageReference Include="Fluid.Core" Version="2.11.1" />
|
<PackageReference Include="Fluid.Core" Version="2.16.0" />
|
||||||
<PackageReference Include="Giraffe" Version="6.4.0" />
|
<PackageReference Include="Giraffe" Version="7.0.2" />
|
||||||
<PackageReference Include="Giraffe.Htmx" Version="2.0.2" />
|
<PackageReference Include="Giraffe.Htmx" Version="2.0.4" />
|
||||||
<PackageReference Include="Giraffe.ViewEngine.Htmx" Version="2.0.2" />
|
<PackageReference Include="Giraffe.ViewEngine.Htmx" Version="2.0.4" />
|
||||||
<PackageReference Include="NeoSmart.Caching.Sqlite.AspNetCore" Version="8.0.0" />
|
<PackageReference Include="NeoSmart.Caching.Sqlite.AspNetCore" Version="9.0.0" />
|
||||||
<PackageReference Include="RethinkDB.DistributedCache" Version="1.0.0-rc1" />
|
<PackageReference Include="RethinkDB.DistributedCache" Version="1.0.0-rc1" />
|
||||||
<PackageReference Include="System.ServiceModel.Syndication" Version="8.0.0" />
|
<PackageReference Include="System.ServiceModel.Syndication" Version="9.0.0" />
|
||||||
<PackageReference Update="FSharp.Core" Version="8.0.400" />
|
<PackageReference Update="FSharp.Core" Version="9.0.100" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -131,7 +131,7 @@ open Microsoft.AspNetCore.Authentication.Cookies
|
|||||||
open Microsoft.AspNetCore.Builder
|
open Microsoft.AspNetCore.Builder
|
||||||
open Microsoft.AspNetCore.HttpOverrides
|
open Microsoft.AspNetCore.HttpOverrides
|
||||||
open Microsoft.Extensions.Caching.Distributed
|
open Microsoft.Extensions.Caching.Distributed
|
||||||
open NeoSmart.Caching.Sqlite.AspNetCore
|
open NeoSmart.Caching.Sqlite
|
||||||
open RethinkDB.DistributedCache
|
open RethinkDB.DistributedCache
|
||||||
|
|
||||||
[<EntryPoint>]
|
[<EntryPoint>]
|
||||||
@ -191,7 +191,7 @@ let main args =
|
|||||||
| _ -> ()
|
| _ -> ()
|
||||||
|
|
||||||
let _ = builder.Services.AddSession(fun opts ->
|
let _ = builder.Services.AddSession(fun opts ->
|
||||||
opts.IdleTimeout <- TimeSpan.FromMinutes 60
|
opts.IdleTimeout <- TimeSpan.FromMinutes 60.
|
||||||
opts.Cookie.HttpOnly <- true
|
opts.Cookie.HttpOnly <- true
|
||||||
opts.Cookie.IsEssential <- true)
|
opts.Cookie.IsEssential <- true)
|
||||||
let _ = builder.Services.AddGiraffe()
|
let _ = builder.Services.AddGiraffe()
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"Generator": "myWebLog 3",
|
"Generator": "myWebLog 3",
|
||||||
"Logging": {
|
"Logging": {
|
||||||
"LogLevel": {
|
"LogLevel": {
|
||||||
@ -8,7 +8,7 @@
|
|||||||
"Kestrel": {
|
"Kestrel": {
|
||||||
"Endpoints": {
|
"Endpoints": {
|
||||||
"Http": {
|
"Http": {
|
||||||
"Url": "http://0.0.0.0:80"
|
"Url": "http://0.0.0.0:5000"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user