Update release notes and deploy workspace
CI - Build & Verify / Build, Typecheck & Hygiene (push) Successful in 59s
CI - Build & Verify / Deploy to award.noveria.net (push) Failing after 53s

This commit is contained in:
AzuTear
2026-06-29 17:49:54 +02:00
parent c466348d18
commit 441ef2b850
196 changed files with 9279 additions and 39292 deletions
+31 -1
View File
@@ -1,11 +1,19 @@
using System.Text.Json;
using System.Text.RegularExpressions;
using Backend.Contracts;
using Backend.Domain;
using System.Net;
namespace Backend.Common;
public static class SeasonMappings
{
private static readonly Regex HtmlBreakRegex = new(@"<\s*br\s*/?>", RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex HtmlListItemOpenRegex = new(@"<\s*li\b[^>]*>", RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex HtmlBlockCloseRegex = new(@"</\s*(p|div|li|ul|ol|h1|h2|h3|h4|h5|h6)\s*>", RegexOptions.IgnoreCase | RegexOptions.Compiled);
private static readonly Regex HtmlTagRegex = new(@"<[^>]*>", RegexOptions.Compiled);
private static readonly Regex MultiNewlineRegex = new(@"\n{3,}", RegexOptions.Compiled);
public static bool IsSeasonScheduleValid(
DateOnly nominationStartsAt,
DateOnly nominationEndsAt,
@@ -90,6 +98,28 @@ public static class SeasonMappings
return string.IsNullOrWhiteSpace(trimmed) ? "https://twitch.tv/jayuhime" : trimmed;
}
public static string NormalizePlainTextContent(string? value)
{
var trimmed = value?.Trim() ?? string.Empty;
if (string.IsNullOrWhiteSpace(trimmed))
{
return string.Empty;
}
var withBreakHints = HtmlBreakRegex.Replace(trimmed, "\n");
withBreakHints = HtmlListItemOpenRegex.Replace(withBreakHints, "- ");
withBreakHints = HtmlBlockCloseRegex.Replace(withBreakHints, "\n");
withBreakHints = HtmlTagRegex.Replace(withBreakHints, " ");
withBreakHints = WebUtility.HtmlDecode(withBreakHints).Replace("\r\n", "\n").Replace('\r', '\n');
var normalizedLines = withBreakHints
.Split('\n')
.Select(line => line.Trim())
.ToArray();
return MultiNewlineRegex.Replace(string.Join('\n', normalizedLines), "\n\n").Trim();
}
public static string NormalizePhaseKey(string? currentPhase)
{
var value = currentPhase?.Trim().ToLowerInvariant() ?? string.Empty;
@@ -183,7 +213,7 @@ public static class SeasonMappings
[
new FooterLinkDto("imprint", "Impressum", settings.ImprintUrl, settings.ImprintContent),
new FooterLinkDto("contact", "Kontakt", settings.ContactUrl, settings.ContactContent),
new FooterLinkDto("sponsors", "Sponsoren & Partner", settings.SponsorsUrl, settings.SponsorsContent),
new FooterLinkDto("sponsors", "Sponsoren & Partner", string.Empty, settings.SponsorsContent),
new FooterLinkDto("showacts", "Showacts", settings.ShowactsUrl, settings.ShowactsContent),
];
}