support PWA notification.
ci-cd-vm / ci-cd (push) Failing after 1m34s

This commit is contained in:
Chris Chen
2026-06-29 22:20:15 -07:00
parent 45d910b554
commit b9210f2501
32 changed files with 1054 additions and 12 deletions
+14
View File
@@ -474,6 +474,20 @@ public static class DbSeeder
});
await db.SaveChangesAsync();
}
// Generate the VAPID key pair once so Web Push works out of the box. Persisted on the
// singleton row; the public key is handed to browsers, the private key signs each push.
var row = await db.NotificationSettings.OrderBy(s => s.Id).FirstAsync();
if (string.IsNullOrWhiteSpace(row.VapidPublicKey))
{
var keys = WebPush.VapidHelper.GenerateVapidKeys();
row.VapidPublicKey = keys.PublicKey;
row.VapidPrivateKey = keys.PrivateKey;
if (string.IsNullOrWhiteSpace(row.VapidSubject))
row.VapidSubject = "mailto:admin@rolac.local";
row.EnableWebPush = true;
await db.SaveChangesAsync();
}
}
/// <summary>