diff --git a/.github/workflows/build + test.yml b/.github/workflows/build + test.yml index 69b7068..5b2fd6e 100644 --- a/.github/workflows/build + test.yml +++ b/.github/workflows/build + test.yml @@ -12,11 +12,11 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Setup .NET - uses: actions/setup-dotnet@v1 + uses: actions/setup-dotnet@v4 with: - dotnet-version: 6.0.x + dotnet-version: 8.0.x - name: Restore dependencies run: dotnet restore - name: Build diff --git a/ClubSite/Areas/Manager/Pages/Login.cshtml b/ClubSite/Areas/Manager/Pages/Login.cshtml index aa920e2..29fae5c 100644 --- a/ClubSite/Areas/Manager/Pages/Login.cshtml +++ b/ClubSite/Areas/Manager/Pages/Login.cshtml @@ -69,8 +69,8 @@ (function () { 'use strict'; window.addEventListener('load', function () { - var forms = document.getElementsByClassName('needs-validation'); - var validation = Array.prototype.filter.call(forms, function (form) { + const forms = document.getElementsByClassName('needs-validation'); + const validation = Array.prototype.filter.call(forms, function (form) { form.addEventListener('submit', function (event) { if (form.checkValidity() === false) { event.preventDefault(); diff --git a/ClubSite/ClubSite.csproj b/ClubSite/ClubSite.csproj index 07db541..d7702bb 100644 --- a/ClubSite/ClubSite.csproj +++ b/ClubSite/ClubSite.csproj @@ -1,75 +1,65 @@  - - - net6.0 - enable - latest - 3.6.0 - axuno gGmbH - The source code for https://www.volleyballclub.de/ - $([System.DateTime]::Now.ToString(yyyy)) - Copyright 2020-$(CurrentYear) axuno gGmbH and Contributors - MIT - - en;de - - - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - - - - - - - - - - - - - - - - - True - True - StatusCodes.resx - - - True - True - StatusDescriptions.resx - - - - - - PublicResXFileCodeGenerator - StatusCodes.Designer.cs - - - PublicResXFileCodeGenerator - StatusDescriptions.Designer.cs - - - - - - Always - - - + + net8.0 + enable + latest + 4.0.0 + axuno gGmbH + The source code for https://www.volleyballclub.de/ + $([System.DateTime]::Now.ToString(yyyy)) + Copyright 2020-$(CurrentYear) axuno gGmbH and Contributors + MIT + + en;de + + + + + + + + + + + + + + + + + + + + + + + + + + + True + True + StatusCodes.resx + + + True + True + StatusDescriptions.resx + + + + + PublicResXFileCodeGenerator + StatusCodes.Designer.cs + + + PublicResXFileCodeGenerator + StatusDescriptions.Designer.cs + + + + + Always + + \ No newline at end of file diff --git a/ClubSite/Controllers/Captcha.cs b/ClubSite/Controllers/Captcha.cs index 1054a54..3300901 100644 --- a/ClubSite/Controllers/Captcha.cs +++ b/ClubSite/Controllers/Captcha.cs @@ -17,7 +17,7 @@ namespace ClubSite.Controllers; [Route("captcha")] public class Captcha : Controller { - async public Task Index() + public async Task Index() { return await GetSvgContent(); } @@ -32,13 +32,14 @@ private Task GetSvgContent() // Change the response headers to output an un-cached image. HttpContext.Response.Clear(); - HttpContext.Response.Headers.Add("Expires", DateTime.UtcNow.Date.AddDays(-1).ToString("R")); - HttpContext.Response.Headers.Add("Cache-Control", "no-store, no-cache, must-revalidate"); - HttpContext.Response.Headers.Add("Pragma", "no-cache"); + // Don't use Headers.Add() here, as it will add multiple headers of the same type. + HttpContext.Response.Headers.Append("Expires", DateTime.UtcNow.Date.AddDays(-1).ToString("R")); + HttpContext.Response.Headers.Append("Cache-Control", "no-store, no-cache, must-revalidate"); + HttpContext.Response.Headers.Append("Pragma", "no-cache"); HttpContext.Response.ContentType = "image/svg+xml"; return Task.FromResult(Content(ci.Image)); } - private string CaptchaSessionKeyName => Library.CaptchaSvgGenerator.CaptchaSessionKeyName; + private static string CaptchaSessionKeyName => Library.CaptchaSvgGenerator.CaptchaSessionKeyName; } \ No newline at end of file diff --git a/ClubSite/Pages/TournamentRegistration.cshtml.cs b/ClubSite/Pages/TournamentRegistration.cshtml.cs index a709b41..9ca13d4 100644 --- a/ClubSite/Pages/TournamentRegistration.cshtml.cs +++ b/ClubSite/Pages/TournamentRegistration.cshtml.cs @@ -279,7 +279,7 @@ Vielen Dank! Volleyballclub Neusäß e.V. -Browser: {(Request.Headers.ContainsKey(HeaderNames.UserAgent) ? Request.Headers[HeaderNames.UserAgent].ToString() : "unbekannt")} +Browser: {(Request.Headers.TryGetValue(HeaderNames.UserAgent, out var value) ? value.ToString() : "unbekannt")} IP-Adresse: {HttpContext.Connection.RemoteIpAddress} "; } diff --git a/ClubSite/Pages/_Layout.cshtml b/ClubSite/Pages/_Layout.cshtml index 2262e7e..9fbc61a 100644 --- a/ClubSite/Pages/_Layout.cshtml +++ b/ClubSite/Pages/_Layout.cshtml @@ -38,9 +38,7 @@ @if (!Env.IsDevelopment()) { } -@* SRI Hash Generator: https://www.srihash.org/ *@ - - + @await RenderSectionAsync("script", false) diff --git a/ClubSite/Pages/_ValidationScriptsPartial.cshtml b/ClubSite/Pages/_ValidationScriptsPartial.cshtml deleted file mode 100644 index d8a48e3..0000000 --- a/ClubSite/Pages/_ValidationScriptsPartial.cshtml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/ClubSite/Program.cs b/ClubSite/Program.cs index f2ff1b5..2d0629e 100644 --- a/ClubSite/Program.cs +++ b/ClubSite/Program.cs @@ -53,14 +53,10 @@ public static async Task Main(string[] args) .LoadConfigurationFromFile(Path.Combine(builder.Environment.ContentRootPath, ConfigurationFolder, $"NLog.{builder.Environment.EnvironmentName}.config")); - builder.WebHost.ConfigureServices(WebAppStartup.ConfigureServices); + WebAppStartup.ConfigureServices(builder.Environment, builder.Configuration, builder.Services); var app = builder.Build(); - - builder.WebHost.ConfigureAppConfiguration((context, confBuilder) => - { - WebAppStartup.Configure(app, app.Services.GetRequiredService()); - }); + WebAppStartup.Configure(app, app.Services.GetRequiredService()); await app.RunAsync(); } diff --git a/ClubSite/WebAppStartup.cs b/ClubSite/WebAppStartup.cs index ef99c77..383210e 100644 --- a/ClubSite/WebAppStartup.cs +++ b/ClubSite/WebAppStartup.cs @@ -25,26 +25,25 @@ using Piranha.AttributeBuilder; using Piranha.Manager.Editor; using Piranha; -using Piranha.AspNetCore.Models; namespace ClubSite; /// -/// The demo startup class to setup and configure the league. +/// The startup class to set up and configure the ClubSite. /// public static class WebAppStartup { /// /// The method gets called by at startup, BEFORE building the app is completed. /// - public static void ConfigureServices(WebHostBuilderContext context, IServiceCollection services) + public static void ConfigureServices(IWebHostEnvironment context, IConfigurationManager configuration, IServiceCollection services) { // required for cookies and session cookies (will throw CryptographicException without) services.AddDataProtection() - .SetApplicationName(context.HostingEnvironment.ApplicationName) + .SetApplicationName(context.ApplicationName) .SetDefaultKeyLifetime(TimeSpan.FromDays(360)) .PersistKeysToFileSystem( - new DirectoryInfo(Path.Combine(context.HostingEnvironment.ContentRootPath, "DataProtectionKeys"))) + new DirectoryInfo(Path.Combine(context.ContentRootPath, "DataProtectionKeys"))) .UseCryptographicAlgorithms(new AuthenticatedEncryptorConfiguration() { EncryptionAlgorithm = EncryptionAlgorithm.AES_256_CBC, ValidationAlgorithm = ValidationAlgorithm.HMACSHA256 @@ -54,12 +53,12 @@ public static void ConfigureServices(WebHostBuilderContext context, IServiceColl // Custom ClubSite db context services.AddDbContext((sp, options) => - options.UseSqlServer(context.Configuration.GetConnectionString("VolleyballClub"))); + options.UseSqlServer(configuration.GetConnectionString("VolleyballClub"))); // Piranha service setup services.AddPiranha(svcBuilder => { - svcBuilder.AddRazorRuntimeCompilation = context.HostingEnvironment.IsDevelopment(); + svcBuilder.AddRazorRuntimeCompilation = context.IsDevelopment(); svcBuilder.UseCms(); svcBuilder.UseFileStorage(naming: Piranha.Local.FileStorageNaming.UniqueFolderNames); @@ -68,9 +67,9 @@ public static void ConfigureServices(WebHostBuilderContext context, IServiceColl svcBuilder.UseTinyMCE(); svcBuilder.UseMemoryCache(); svcBuilder.UseEF(db => - db.UseSqlServer(context.Configuration.GetConnectionString("VolleyballClub"))); + db.UseSqlServer(configuration.GetConnectionString("VolleyballClub"))); svcBuilder.UseIdentityWithSeed(db => - db.UseSqlServer(context.Configuration.GetConnectionString("VolleyballClub"))); + db.UseSqlServer(configuration.GetConnectionString("VolleyballClub"))); }); // MUST be before AddMvc! @@ -102,7 +101,7 @@ public static void ConfigureServices(WebHostBuilderContext context, IServiceColl }); services.Configure( - context.Configuration.GetSection(nameof(ConfigurationPoco.MailSettings)) ?? + configuration.GetSection(nameof(ConfigurationPoco.MailSettings)) ?? throw new InvalidOperationException( $"Configuration section '{nameof(ConfigurationPoco.MailSettings)}' not found.")); diff --git a/ClubSite/app_offline_.htm b/ClubSite/app_offline_.htm index 326a2d4..b0447af 100644 --- a/ClubSite/app_offline_.htm +++ b/ClubSite/app_offline_.htm @@ -5,55 +5,56 @@ Volleyballclub Neusäß - Maintenance - + -
-
-

Volleyballclub Neusäß e.V.

- - Logo -
-
-
-
-
-
- Maintenance -
-

The application is undergoing some maintenance.

-

- - Please try again in a few minutes.
- Sorry for any inconvenience. -
-

-
+
+
+

Volleyballclub Neusäß e.V.

+ + Logo
-
-
-
- Wartungsarbeiten -
-

Es laufen derzeit einige Wartungsarbeiten.

-

- - Bitte versuchen Sie es in ein paar Minuten nochmals.
- Entschuldigen Sie die Unannehmlichkeiten. -
-

+
+
+
+
+
+ Maintenance +
+

The application is undergoing some maintenance.

+

+ + Please try again in a few minutes.
+ Sorry for any inconvenience. +
+

+
+
+
+
+
+
+
+ Wartungsarbeiten +
+

Es laufen derzeit einige Wartungsarbeiten.

+

+ + Bitte versuchen Sie es in ein paar Minuten nochmals.
+ Entschuldigen Sie die Unannehmlichkeiten. +
+

+
+
-
- -
- - - + \ No newline at end of file diff --git a/ClubSite/gulpfile.js b/ClubSite/gulpfile.js index 4888212..a1f4159 100644 --- a/ClubSite/gulpfile.js +++ b/ClubSite/gulpfile.js @@ -36,6 +36,8 @@ gulp.task("min", .pipe(gulp.dest("wwwroot/assets/fonts/lato/")); gulp.src("assets/fonts/raleway/*.woff2") .pipe(gulp.dest("wwwroot/assets/fonts/raleway/")); + gulp.src("node_modules/bootstrap/dist/js/bootstrap.bundle.min.js") + .pipe(gulp.dest("wwwroot/assets/js/bootstrap/")); done(); });