feat(settings): topic ntfy par site, SMTP/ntfy/S3 globaux, DSN GlitchTip fixe + toggle (Fixes #105 #106 #107 #108)
#105 — Topic ntfy cible par site : - Site.NtfyTopic (migration AddSiteNtfyTopic), UI création/édition SitesPage - NotificationService.ResolveNtfyTopicAsync : topic du site sinon heimdall_{userId} #106 — Paramètres SMTP/ntfy/S3 GLOBAUX : - Seed + sections UI : agentScoped=false pour ntfy.*/email.*/storage.*/sentry.* - Migration douce au démarrage : UPDATE des clés existantes en base #107 — GlitchTip : DSN fixes (central projet 6, agent projet 7) dans appsettings, - plus de champ DSN éditable en UI → switch sentry.enabled (nécessite redémarrage) - Init Sentry déplacé après AddInfrastructure, lit sentry.enabled en base (fallback true) #108 — Composants typés : MudNumericField borné (port SMTP, rétention, heartbeat), - switch pour booléens, select pour log.level — pas de saisie libre
This commit is contained in:
1 parent
85bfdac7ee
commit
dc8a24918d
25 files changed
+2485
-153
No files matched your search
+2217
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,28 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Heimdall.Infrastructure.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddSiteNtfyTopic : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "NtfyTopic",
|
||||
table: "sites",
|
||||
type: "text",
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "NtfyTopic",
|
||||
table: "sites");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1453,6 +1453,9 @@ namespace Heimdall.Infrastructure.Migrations
|
||||
.HasMaxLength(200)
|
||||
.HasColumnType("character varying(200)");
|
||||
|
||||
b.Property<string>("NtfyTopic")
|
||||
.HasColumnType("text");
|
||||
|
||||
b.Property<string>("RegistrationTokenHash")
|
||||
.HasMaxLength(128)
|
||||
.IsUnicode(false)
|
||||
|
||||
@@ -111,7 +111,7 @@ public class NotificationService : INotificationService
|
||||
|
||||
if (config.NtfyEnabled)
|
||||
{
|
||||
var topic = $"heimdall_{userId}";
|
||||
var topic = await ResolveNtfyTopicAsync(notification, userId, ct);
|
||||
await _ntfyService.SendNotificationAsync(
|
||||
topic,
|
||||
notification.Title,
|
||||
@@ -125,6 +125,26 @@ public class NotificationService : INotificationService
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Résout le topic ntfy cible d'une notification (ticket #105) :
|
||||
/// topic du site si défini, sinon topic personnel <c>heimdall_{userId}</c>.
|
||||
/// </summary>
|
||||
private async Task<string> ResolveNtfyTopicAsync(Notification notification, Guid userId, CancellationToken ct)
|
||||
{
|
||||
if (notification.SiteId is { } siteId)
|
||||
{
|
||||
var siteTopic = await _context.Sites
|
||||
.AsNoTracking()
|
||||
.Where(s => s.Id == siteId)
|
||||
.Select(s => s.NtfyTopic)
|
||||
.FirstOrDefaultAsync(ct);
|
||||
if (!string.IsNullOrWhiteSpace(siteTopic))
|
||||
return siteTopic;
|
||||
}
|
||||
|
||||
return $"heimdall_{userId}";
|
||||
}
|
||||
|
||||
public async Task<int> GetUnreadCountAsync(Guid userId, CancellationToken ct = default)
|
||||
{
|
||||
return await _context.Notifications
|
||||
|
||||
Reference in new issue
Block a user