R9 Web Push in decePub: one subscription per persona, each with its own token and registration
Build / Build (push) Successful in 56s

Settings gets "Notifications on this device" (PushEditor): personas, alerts in four groups, policy, a test
notification, after a one-time notice of what the push service learns. Each persona ticked gets its own service
worker registration (push-worker.js at push/{slot}/), so its own endpoint and keys, subscribed with its own token
(IHttpService's *As); nothing PrivaPub stores ties two personas together and the worker never reads the payload's
token. PushService follows the tokens (re-subscribing after a renewal), reconciles at every session start, turns
off before sign-out and drops deleted or suspended personas. A click opens that persona's notifications; the app
badge counts the unread ones. Exchanges now ask for the push scope.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WpVCoDeM1qUTRp4fXQdfof
This commit is contained in:
thepraandClaude Opus 5.5 committed 2026-10-18 09:50:46 +02:00
1 parent d33697e3fc
commit ab17959ed4
29 files changed
+2047 -67

No files matched your search

+26 -9
View File
@@ -1,17 +1,13 @@
@inherits LocalizableComponentBase
@implements IDisposable
@* The one-time notice before a persona's first reaction or poll vote, and before it first joins an event
(PublicNoticeService), in MainLayout. *@
@* The one-time notice before a persona's first reaction or poll vote, before it first joins an event, and before this
device's first Web Push subscription (PublicNoticeService), in MainLayout. data-public-notice names which. *@
<DModal Placement="DModalPlacement.ResponsiveBottom" IsOpen="Notices.IsAsking" IsOpenChanged="Closed" CloseOnBackdrop="false" CloseText="@Localizer["Close"]"
data-public-notice>
<Heading>@(Notices.Act == PublicAct.Participation ? Localizer["Joining an event is public"] : Localizer["Reactions and votes are public"])</Heading>
data-public-notice="@ActName">
<Heading>@HeadingText</Heading>
<ChildContent>
<p class="text-sm">
@(Notices.Act == PublicAct.Participation
? Localizer["The event's server shows who takes part, {0} included. Your other personas are never named.", CascadingState.Persona?.Name ?? ""]
: Localizer["Anyone who can see the post can see that {0} reacted to it or voted in it. Your other personas are never named.", CascadingState.Persona?.Name ?? ""])
</p>
<p class="text-sm">@NoticeText</p>
</ChildContent>
<Actions>
<DButton Size="DSize.Sm" OnClick="() => Notices.Answer(false)">@Localizer["Cancel"]</DButton>
@@ -22,6 +18,27 @@
@code {
[Inject] PublicNoticeService Notices { get; set; }
string ActName => Notices.Act switch
{
PublicAct.Participation => "participation",
PublicAct.Push => "push",
_ => "reaction"
};
string HeadingText => Notices.Act switch
{
PublicAct.Participation => Localizer["Joining an event is public"],
PublicAct.Push => Localizer["Notifications go through your browser's push service"],
_ => Localizer["Reactions and votes are public"]
};
string NoticeText => Notices.Act switch
{
PublicAct.Participation => Localizer["The event's server shows who takes part, {0} included. Your other personas are never named.", CascadingState.Persona?.Name ?? ""],
PublicAct.Push => Localizer["To reach this device while decePub is closed, PrivaPub hands each notification to the push service your browser uses (Google's, Mozilla's, Apple's…). It is encrypted for this browser alone: the push service learns when a notification arrives and how big it is, never what it says, who sent it or which persona it is for. Each persona has a subscription of its own, so PrivaPub keeps nothing that ties your personas together."],
_ => Localizer["Anyone who can see the post can see that {0} reacted to it or voted in it. Your other personas are never named.", CascadingState.Persona?.Name ?? ""]
};
protected override void OnInitialized()
{
Notices.Changed += Refresh;