Skip to content

User notifications, step 4: the Telegram block on the subscription page - #99

Merged
limeflash merged 2 commits into
mainfrom
feat/user-notify-subpage
Dec 3, 2026
Merged

limeflash merged 2 commits into
mainfrom
feat/user-notify-subpage

Conversation

@limeflash

Copy link
Copy Markdown
Collaborator

Step 4 of user notifications (spec §3, §10.3, §15): the "Telegram notifications" block on the subscription page, per the owner's mockup.

  • Endpoints under the subscription link, behind the page password, the cross-origin check and the self-service switch: POST <link>/telegram, /telegram/link, /telegram/cancel, /telegram/<chat>/unlink, /telegram/<chat>/mute. Reading is free; changes spend the page's write budget.
  • A person sees and changes only their own chats: row id, language, date, announcements on/off. Never the Telegram chat id, its ciphertext or MAC, or the token.
  • States off / wait (one-time link with a countdown, the page notices the link by itself) / expired / on ("N of M", announcements switch, disconnect, "link another" off at the limit).
  • The link code, its hash and the chat limit moved from telegram to the store, so the public Worker does not link the bot.
  • Texts en/ru/zh/tr/fa (tr/fa need a native review). Docs en/ru/zh in the user page guide, with the privacy warning.

Checks: go vet, go test (subs, access, store, telegram, httpserver, app), pnpm -C web typecheck and the whole pnpm -C web test, test-edge-store.ps1, check-edge-sizes.sh (public headroom 141 KiB, jobs 251 KiB).

🤖 Generated with Claude Code

limeflash and others added 2 commits December 3, 2026 19:25
… subscription page

A person links their own chats to the people's bot from the subscription page (spec notifications-panel-spec, PR 4).

Server: POST <link>/telegram, /telegram/link, /telegram/cancel, /telegram/unlink, /telegram/mute, under the page password and in
the self-service write budget like the device removal. Only the person's own chats; the answer carries the language, the date,
the mute flag and an opaque row id, never the chat id, chat_enc, chat_mac or the token. The page data gets tg_notify only when
the people's bot is set, the owner allows self-service and the page is not a preview.

Shared code: the link code (generation, hash, 15 minutes) and the chat limit moved from the telegram package to the store, so the
public Worker does not import telegram; the owner's bot uses the same functions. Public edge Worker grows by about 54 KiB and
keeps 148 KiB of headroom.

Frontend: the block on the devices tab (off, wait, exp, on), a poll while the code waits, a countdown, the Announcements switch
(mute), unlink, a new link; en/ru/zh/tr/fa (tr and fa wait for proofreading). Docs: a section in en/ru/zh with the privacy warning.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@limeflash
limeflash merged commit 846c832 into main Dec 3, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant