Eliminate warnings; serve local htmx
- Pin non-vulnerable dependency
This commit is contained in:
1 parent
fe165af596
commit
f7b479a759
3 files changed
+46
-38
No files matched your search
@@ -1,25 +1,27 @@
|
|||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
|
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
|
||||||
|
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageVersion Include="BitBadger.AspNetCore.CanonicalDomains" Version="1.0.0" />
|
<PackageVersion Include="BitBadger.AspNetCore.CanonicalDomains" Version="1.1.0" />
|
||||||
<PackageVersion Include="BitBadger.Documents.Postgres" Version="3.1.0" />
|
<PackageVersion Include="BitBadger.Documents.Postgres" Version="4.3.0" />
|
||||||
<PackageVersion Include="Expecto" Version="10.2.1" />
|
<PackageVersion Include="Expecto" Version="11.1.1" />
|
||||||
<PackageVersion Include="Giraffe" Version="6.4.0" />
|
<PackageVersion Include="Giraffe" Version="8.3.0" />
|
||||||
<PackageVersion Include="Giraffe.Htmx" Version="2.0.0" />
|
<PackageVersion Include="Giraffe.Htmx" Version="2.0.11" />
|
||||||
<PackageVersion Include="Giraffe.ViewEngine" Version="1.4.0" />
|
<PackageVersion Include="Giraffe.ViewEngine" Version="1.4.0" />
|
||||||
<PackageVersion Include="Giraffe.ViewEngine.Htmx" Version="2.0.0" />
|
<PackageVersion Include="Giraffe.ViewEngine.Htmx" Version="2.0.11" />
|
||||||
<PackageVersion Include="MailKit" Version="4.6.0" />
|
<PackageVersion Include="MailKit" Version="4.18.2" />
|
||||||
<PackageVersion Include="Microsoft.AspNetCore.Html.Abstractions" Version="2.2.0" />
|
<PackageVersion Include="Microsoft.AspNetCore.Html.Abstractions" Version="2.3.14" />
|
||||||
<PackageVersion Include="Microsoft.AspNetCore.Http" Version="2.2.2" />
|
<PackageVersion Include="Microsoft.AspNetCore.Http" Version="2.3.14" />
|
||||||
<PackageVersion Include="Microsoft.AspNetCore.Http.Extensions" Version="2.2.0" />
|
<PackageVersion Include="Microsoft.AspNetCore.Http.Extensions" Version="2.3.14" />
|
||||||
<PackageVersion Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
|
<PackageVersion Include="Microsoft.AspNetCore.Mvc" Version="2.3.14" />
|
||||||
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageVersion Include="Microsoft.AspNetCore.WebUtilities" Version="2.3.14" />
|
||||||
<PackageVersion Include="NodaTime" Version="3.1.11" />
|
<PackageVersion Include="Newtonsoft.Json" Version="13.0.4" />
|
||||||
<PackageVersion Include="NodaTime.Serialization.JsonNet" Version="3.1.0" />
|
<PackageVersion Include="NodaTime" Version="3.3.7" />
|
||||||
<PackageVersion Include="NodaTime.Testing" Version="3.1.11" />
|
<PackageVersion Include="NodaTime.Serialization.JsonNet" Version="3.3.0" />
|
||||||
<PackageVersion Include="Npgsql.FSharp" Version="5.7.0" />
|
<PackageVersion Include="NodaTime.Testing" Version="3.3.7" />
|
||||||
<PackageVersion Include="Npgsql.NodaTime" Version="8.0.3" />
|
<PackageVersion Include="Npgsql.FSharp" Version="8.0.0" />
|
||||||
|
<PackageVersion Include="Npgsql.NodaTime" Version="10.0.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -278,7 +278,7 @@ let private pageLayout viewInfo pgTitle content =
|
|||||||
(contentSection viewInfo pgTitle content)
|
(contentSection viewInfo pgTitle content)
|
||||||
match viewInfo.Layout with
|
match viewInfo.Layout with
|
||||||
| FullPage ->
|
| FullPage ->
|
||||||
Script.minified
|
Script.local
|
||||||
script [ _src "/js/ckeditor/ckeditor.js" ] []
|
script [ _src "/js/ckeditor/ckeditor.js" ] []
|
||||||
script [ _src "/js/app.js" ] []
|
script [ _src "/js/app.js" ] []
|
||||||
| _ -> () ]
|
| _ -> () ]
|
||||||
|
|||||||
+25
-19
@@ -15,13 +15,14 @@ open System
|
|||||||
open Microsoft.AspNetCore.Builder
|
open Microsoft.AspNetCore.Builder
|
||||||
open Microsoft.AspNetCore.Hosting
|
open Microsoft.AspNetCore.Hosting
|
||||||
open Microsoft.Extensions.Configuration
|
open Microsoft.Extensions.Configuration
|
||||||
|
open Microsoft.Extensions.Hosting
|
||||||
|
|
||||||
/// Module to hold configuration for the web app
|
/// Module to hold configuration for the web app
|
||||||
[<RequireQualifiedAccess>]
|
[<RequireQualifiedAccess>]
|
||||||
module Configure =
|
module Configure =
|
||||||
|
|
||||||
/// Set up the configuration for the app
|
/// Set up the configuration for the app
|
||||||
let configuration (ctx: WebHostBuilderContext) (cfg: IConfigurationBuilder) =
|
let configuration (ctx: HostBuilderContext) (cfg: IConfigurationBuilder) =
|
||||||
cfg.SetBasePath(ctx.HostingEnvironment.ContentRootPath)
|
cfg.SetBasePath(ctx.HostingEnvironment.ContentRootPath)
|
||||||
.AddJsonFile("appsettings.json", optional = true, reloadOnChange = true)
|
.AddJsonFile("appsettings.json", optional = true, reloadOnChange = true)
|
||||||
.AddJsonFile($"appsettings.{ctx.HostingEnvironment.EnvironmentName}.json", optional = true)
|
.AddJsonFile($"appsettings.{ctx.HostingEnvironment.EnvironmentName}.json", optional = true)
|
||||||
@@ -37,6 +38,7 @@ module Configure =
|
|||||||
open System.Globalization
|
open System.Globalization
|
||||||
open BitBadger.Documents.Postgres
|
open BitBadger.Documents.Postgres
|
||||||
open Microsoft.AspNetCore.Authentication.Cookies
|
open Microsoft.AspNetCore.Authentication.Cookies
|
||||||
|
open Microsoft.AspNetCore.HttpOverrides
|
||||||
open Microsoft.AspNetCore.Localization
|
open Microsoft.AspNetCore.Localization
|
||||||
open Microsoft.Extensions.Caching.Distributed
|
open Microsoft.Extensions.Caching.Distributed
|
||||||
open Microsoft.Extensions.DependencyInjection
|
open Microsoft.Extensions.DependencyInjection
|
||||||
@@ -56,6 +58,10 @@ module Configure =
|
|||||||
opts.DefaultRequestCulture <- RequestCulture("en-US", "en-US")
|
opts.DefaultRequestCulture <- RequestCulture("en-US", "en-US")
|
||||||
opts.SupportedCultures <- supportedCultures
|
opts.SupportedCultures <- supportedCultures
|
||||||
opts.SupportedUICultures <- supportedCultures)
|
opts.SupportedUICultures <- supportedCultures)
|
||||||
|
let _ =
|
||||||
|
svc.Configure<ForwardedHeadersOptions>(
|
||||||
|
fun (opts: ForwardedHeadersOptions) ->
|
||||||
|
opts.ForwardedHeaders <- ForwardedHeaders.XForwardedFor ||| ForwardedHeaders.XForwardedProto)
|
||||||
let _ =
|
let _ =
|
||||||
svc.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
|
svc.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
|
||||||
.AddCookie(fun opts ->
|
.AddCookie(fun opts ->
|
||||||
@@ -176,8 +182,6 @@ module Configure =
|
|||||||
logger.LogError(EventId(), ex, "An unhandled exception has occurred while executing the request.")
|
logger.LogError(EventId(), ex, "An unhandled exception has occurred while executing the request.")
|
||||||
clearResponse >=> setStatusCode 500 >=> text ex.Message
|
clearResponse >=> setStatusCode 500 >=> text ex.Message
|
||||||
|
|
||||||
open Microsoft.Extensions.Hosting
|
|
||||||
|
|
||||||
/// Configure logging
|
/// Configure logging
|
||||||
let logging (log: ILoggingBuilder) =
|
let logging (log: ILoggingBuilder) =
|
||||||
let env = log.Services.BuildServiceProvider().GetService<IWebHostEnvironment>()
|
let env = log.Services.BuildServiceProvider().GetService<IWebHostEnvironment>()
|
||||||
@@ -190,9 +194,8 @@ module Configure =
|
|||||||
open Microsoft.Extensions.Options
|
open Microsoft.Extensions.Options
|
||||||
|
|
||||||
/// Configure the application
|
/// Configure the application
|
||||||
let app (app : IApplicationBuilder) =
|
let app (app : WebApplication) =
|
||||||
let env = app.ApplicationServices.GetRequiredService<IWebHostEnvironment>()
|
if app.Environment.IsDevelopment() then
|
||||||
if env.IsDevelopment() then
|
|
||||||
app.UseDeveloperExceptionPage()
|
app.UseDeveloperExceptionPage()
|
||||||
else
|
else
|
||||||
app.UseGiraffeErrorHandler errorHandler
|
app.UseGiraffeErrorHandler errorHandler
|
||||||
@@ -206,12 +209,11 @@ module Configure =
|
|||||||
let _ = app.UseMiddleware<RequestStartMiddleware>()
|
let _ = app.UseMiddleware<RequestStartMiddleware>()
|
||||||
let _ = app.UseRouting()
|
let _ = app.UseRouting()
|
||||||
let _ = app.UseSession()
|
let _ = app.UseSession()
|
||||||
let _ = app.UseRequestLocalization(
|
let _ = app.UseRequestLocalization(app.Services.GetService<IOptions<RequestLocalizationOptions>>().Value)
|
||||||
app.ApplicationServices.GetService<IOptions<RequestLocalizationOptions>>().Value)
|
|
||||||
let _ = app.UseAuthentication()
|
let _ = app.UseAuthentication()
|
||||||
let _ = app.UseAuthorization()
|
let _ = app.UseAuthorization()
|
||||||
let _ = app.UseEndpoints(fun e -> e.MapGiraffeEndpoints routes)
|
let _ = app.UseEndpoints(fun e -> e.MapGiraffeEndpoints routes)
|
||||||
app.ApplicationServices.GetRequiredService<IStringLocalizerFactory>() |> Views.I18N.setUpFactories
|
app.Services.GetRequiredService<IStringLocalizerFactory>() |> Views.I18N.setUpFactories
|
||||||
|
|
||||||
|
|
||||||
/// The web application
|
/// The web application
|
||||||
@@ -222,15 +224,19 @@ module App =
|
|||||||
[<EntryPoint>]
|
[<EntryPoint>]
|
||||||
let main args =
|
let main args =
|
||||||
let contentRoot = Directory.GetCurrentDirectory()
|
let contentRoot = Directory.GetCurrentDirectory()
|
||||||
let app =
|
let builder = WebApplication.CreateBuilder(
|
||||||
WebHostBuilder()
|
WebApplicationOptions(
|
||||||
.UseContentRoot(contentRoot)
|
ContentRootPath = contentRoot,
|
||||||
.ConfigureAppConfiguration(Configure.configuration)
|
WebRootPath = Path.Combine(contentRoot, "wwwroot"),
|
||||||
.UseKestrel(Configure.kestrel)
|
Args = args))
|
||||||
.UseWebRoot(Path.Combine(contentRoot, "wwwroot"))
|
let _ = builder.Host.ConfigureAppConfiguration Configure.configuration
|
||||||
.ConfigureServices(Configure.services)
|
let _ = builder.WebHost.UseStaticWebAssets()
|
||||||
.ConfigureLogging(Configure.logging)
|
let _ = builder.WebHost.UseKestrel Configure.kestrel
|
||||||
.Configure(System.Action<IApplicationBuilder> Configure.app)
|
let _ = Configure.services builder.Services
|
||||||
.Build()
|
let _ = builder.WebHost.ConfigureLogging Configure.logging
|
||||||
|
|
||||||
|
let app = builder.Build()
|
||||||
|
Configure.app app
|
||||||
|
|
||||||
if args.Length > 0 then printfn $"Unrecognized option {args[0]}" else app.Run()
|
if args.Length > 0 then printfn $"Unrecognized option {args[0]}" else app.Run()
|
||||||
0
|
0
|
||||||
Reference in new issue
Block a user