Skip to content

Feature/pro coach - #39

Merged
codepurse merged 13 commits into
mainfrom
feature/pro-coach
Oct 30, 2026
Merged

codepurse merged 13 commits into
mainfrom
feature/pro-coach

Conversation

@codepurse

Copy link
Copy Markdown
Owner

No description provided.

codepurse and others added 13 commits October 29, 2026 11:29
Sieve Pro is a one-time purchase ($24, sold through Polar) that adds new
features on top of Sieve; everything Sieve did before stays free. Like
BlockNSFW's Supporter extras, the features are not open source: they live in
a private repository checked out at pro-private/ (ignored here), and pro/
holds an empty stand-in for each. Every protection stays in this repository,
so a build from it blocks exactly what the store version does.

- common/pro.js: the licence check, open source on purpose since it is the
  one network request Pro makes. It sends the key and the store's
  organisation id to Polar's public validate endpoint, on entry and about
  weekly from Settings only. Offline keeps the last answer; only a clear no
  turns Pro off. The Sieve Pro benefit id is required before anything is
  sent, because the store is shared with BlockNSFW.
- pro/: stand-ins for seal.js, urge.js, streaks.js, settings.js and
  features.js (which says null). pro/README.md explains.
- build-pro.mjs, called by build-chrome.ps1 and build-firefox.ps1: copies
  pro-private/pro over the stand-ins. A plain build includes Pro when it is
  checked out; -Zip refuses without it, with uncommitted Pro changes, or
  while common/pro.js cannot sell yet; -OpenSource leaves it out, and CI
  now builds that way and asserts the stand-ins shipped.
- Hooks that do nothing without Pro: the Guardian gate checks for a running
  seal first (sealed dialog and emergency key in guardian-prompt.js); the
  block page hands its category to the urge screen; the popup shows a
  running seal and tracked streaks; Settings gains a Sieve Pro section
  (licence box plus the feature groups' markup) that is removed when the
  build carries no Pro features.
- rules/gambling-rules.json now redirects with ?category=gambling, so blocks
  from the bundled gambling list are counted on the dashboard at last.
- PRIVACY.md describes the licence check and declares it; README.md and the
  1.6.0 release notes say what Pro is and what stays free.

Tests: test/pro-test.mjs (licence, 16) and test/pro-standins-test.mjs (the
stand-ins stay empty, pro-private is never tracked, every hook checks Pro is
there). Verified in headless Edge from dist/chrome: 38 checks with Pro, and
the open-source build with none of it. Firefox lint: 0 errors, 15 warnings
(baseline 17) both ways.

Not done yet: Sieve Pro's benefit id and checkout link in common/pro.js, and
Firefox's data_collection_permissions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A Sieve Pro key now takes one of a limited number of places, as BlockNSFW's
Supporter codes do (Polar's activation limit, set to 3 on the benefit).
Ported from BlockNSFW's shared/supporter.js:

- Activate validates the key, then takes a place named for the browser
  ("Sieve · Edge on Windows"). Every place taken is a 403, and Settings
  says so and where to free one. The same key entered again keeps its
  place. With no limit set in Polar, a key works anywhere, as before.
- The weekly check asks with this browser's place. A no is asked again
  without it, to tell a refund ("revoked") from a place given back on the
  purchases page ("removed", re-entering the key takes one back). A limit
  set after the key was entered takes a place at the next check.
- "Remove from this browser" calls deactivate first and forgets the key
  only once Polar has the place back (404 counts as back). Offline, the key
  is kept, so the place is never left taken. Settings links the purchases
  page.

Firefox: manifest.firefox.json declares authenticationInfo as optional
data, and Activate asks Firefox's consent straight from the click, before
anything is sent. Without it nothing is sent; consent withdrawn later stops
the weekly check without turning Pro off. Chrome and Edge never ask. Older
Firefox without the consent framework goes on as before.

PRIVACY.md and the 1.6.0 notes now say a plain browser name goes with the
key, when it is sent (entered, removed, weekly), and that Firefox asks.

Tests: test/pro-test.mjs (28). Verified in headless Edge from dist/chrome:
the 38 Pro checks again, plus the licence box with places, a place given
back, every place taken, and Remove offline and online (fetch replaced in
the page, so nothing reached Polar). Firefox lint unchanged: 0 errors, 15
warnings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
common/pro.js now holds both of Monolab's Polar stores side by side, since
the sandbox is a separate copy with its own ids:

- stores.sandbox: organisation 35c82b93-…, the "Sieve Pro" product's
  licence-key benefit 128feed7-… ("Sieve Lifetime Code"), and its checkout
  link. All read back from the sandbox checkout itself.
- stores.live: Monolab's live organisation, as before; its benefit id and
  checkout link are still to come, so store packages keep refusing.
- The price label follows the product: $24.99.

`build-chrome.ps1 -Sandbox` (or build-firefox.ps1), with or without -Zip,
now makes a test build whose own copy of common/pro.js says mode "sandbox";
the source and every other build stay live. build-pro.mjs checks the
sandbox store is complete for such a build, and the live one for a store
package.

Checked against Polar's real sandbox from a -Sandbox build in headless Edge:
the Buy button opens the sandbox checkout at $24.99, and a made-up key goes
to the sandbox validate endpoint with only the key and the organisation,
comes back 404, and Settings says it was not recognised, storing nothing.
The full yes path waits on a real sandbox key. Tests: 829 public, 30 private.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Seal is a protection, so it leaves Sieve Pro: everything that protects
stays free and open source, as in BlockNSFW, and Pro is now the urge
screen and streaks. common/seal.js and its tests come back to this
repository, its settings move from Settings › Sieve Pro to Settings › Lock
(after Cool-off), and the popup shows a running seal with or without Pro.

The way out early is now held by a witness by default, as for the Pact:

- common/totp.js and common/qr.js are ported from BlockNSFW's shared/
  (standard TOTP, RFC 6238; its own QR encoder, no CDN), with their tests
  (the RFC 4226/6238 vectors, Reed-Solomon worked examples, a Seal key
  read back block by block).
- Starting a seal with a witness shows a QR code to scan into their
  authenticator app, the key to type if they can't, and eight recovery
  codes, with a "Print for your witness" sheet. The seal starts only once
  their app shows a code that works, so a bad scan cannot leave a seal with
  no way out, and that code is spent so it cannot end the seal. The key and
  codes leave the page as it starts; recovery codes are kept only as hashes.
- The Sealed dialog asks for the witness's six digits or a recovery code.
  Five wrong codes lock entry for 5 minutes, doubling to an hour. Codes are
  checked one at a time and the button waits, so a burst of guesses cannot
  slip past the count (found in the browser check; test added).
- A printed key stays as the choice for someone with nobody to ask. Seals
  stored before today read as key seals.

Tests: 876 public (seal 23, totp 11, qr 12), 18 private. Headless Edge,
open-source build: 20 checks covering pairing, a wrong and a right code,
the dialog, the spent code, the lockout, recovery and fresh codes, the
printed key, the popup without Pro, and 390px. Pro build: 26 checks.
Firefox lint unchanged: 0 errors, 15 warnings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The additions chosen on 2026-10-29, ported from BlockNSFW's extras:

- The urge screen's centre can be a breathing ring, an enso or a river.
- Proof it passes: "I'm OK now" puts the minute an urge passed on a
  dial, and the dial runs through them the next time.
- A message in your own voice (or a song), recorded in Settings and
  played on the urge screen; kept in IndexedDB on the device.
- Streaks gain a savings goal.
- Your progress (pages/progress.html): when it tends to get hard, by
  weekday and hour; the dial; a letter for every month and year.

Free foundation they read: common/attempts.js keeps WHEN the block page
stopped you (habits only, never threats or addresses; 5-minute merge,
400 days), written by the service worker on SIEVE_RECORD_ATTEMPT; and
monthly stats are folded in the stats prune. The pro/ files here are
the public stand-ins; the features live in the private repo.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hours

The public half of three Pro features (the logic is pro/coach.js in the
private repo; pro/coach.js here is its empty stand-in):

- The urge screen gains markup for the plan that fits the moment, the
  person's own things to try instead, and two questions after "I'm OK
  now" that turn what happened into a plan.
- Settings gains a "Plans for the hard moments" group and a things-to-try
  list in the urge screen group; Your progress gains "What works for you"
  and "Your plans" (the month and year become parts 06 and 07).
- background/heads-up.js (open source) shows the heads-up: one alarm on
  the next moment Pro stored in proHeadsUp, a notification with only the
  stored words, dropped if more than 30 minutes late, and stopped when
  the switch is off or the licence lapses.
- "notifications" is an optional permission, asked for only when the
  heads-up is switched on in Settings; never at install.

Changelog (1.6.0) and the privacy policy describe the new records and
the permission. test/heads-up-test.mjs (7); npm test 892 pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The top of the toolbar popup, redone (option C from the mockups):

- Whether Sieve is on is a stamp in the top bar (green with the count,
  danger colour and a line in words when everything is off); the
  version moves to the footer beside All settings.
- A running seal (free) shows its days as holes, one filled a day, or a
  thin bar for seals longer than a month.
- With Pro: tonight from pro/coach.js (the hard hours against the
  clock, a rolling strip of the hours round now, the plan, what tends
  to help), then the seal and streaks as stamps, money kept, and Your
  progress.
- Without Pro, where Pro is on sale: one line about what Pro would show
  here, dismissed for good with the x.

Checked in a real browser: free, Pro an hour before hard hours that
start at midnight, and everything off (21 checks). npm test 892.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The name, the status stamp and the top sit on pine (#0d3b31, the
Warden band's colour; #1f3a32 in dark), with the page's tokens set again
inside it for paper on pine. On pine, "on" is a light mint, still the
only green that means something is running. Dark palette written twice;
theme test passes. 21 popup checks pass in a real browser.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The urge screen is set out as two pages (option A from the mockups):
the words on the left (headline, plan, things to try, your reason), the
dial on the right, at 430px with a ring of sieve holes round it, the
count, the proof line, and Text Sam / I'm OK now under it. Go back,
Close this tab and Allow (now a quiet link) share one row beneath both.

Only with the breathing ring, and only from 1024px wide; pro/urge.js
sets data-urge-layout. The markup holds the two pages, and in one
column the CSS order puts every part back where it was, so the ensō, the
river and phones look as before.

Checked in headless Edge with the private Pro files: 1440, 1280, 1024,
900 and 390 wide, light and dark, a sparse setup, the ensō, and the
questions after I'm OK now. npm test 892, test:pro 58.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… place

The ensō now takes the instrument page of the spread, as the breathing
ring does (option E1 from the mockups): the circle at 400px with its
inscription and seal beside it, the breath named under it, then the
tally, the proof line and Text Sam / I'm OK now. Every state fits a
1440 x 900 screen, after the fifth breath too.

Two new parts of the ensō, in one column as well: a line that fills in
for four seconds and out for six, driven by the stage's data-phase like
the brush, and a dashed place where the seal will land. The river keeps
the one column.

Checked in headless Edge with real presses: idle, half an in-breath,
mid out-breath, five breaths to the seal, dark, 1024 and 390 wide, and
the river and breathing ring unchanged. npm test 892, test:pro 58.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The river design is now an inked map (option R2 from the mockups). On a
wide screen its board is 10 by 5 and runs across the whole page, with
the headline and the plan above it, where the river stands and the two
things to do now below it, then the proof, the streak and the things to
try. The quiet row beneath is the spread's, which the map shares.

The map, drawn by pro/designs.js and styled here: contours and hill
marks, a corner tick for each tile instead of a ruled grid, the spring's
pool, a ragged coast with a hatched sea that darkens when the river
reaches it, the sea's name, a north arrow and a double frame. Tiles lie
on it with darker banks; a hover marks the tile. Under the board, a key
shows how far the ink has run along the course, and the turns.

On a small screen the board stays 6 by 6 in the one column, so its
tiles stay 44px for a thumb.

Checked in headless Edge with the private Pro files: a fresh deal, tile
turns, the solved look, dark, sparse, 1440, 1280, 1024 and 390 wide,
forty rivers dealt for overlaps between the map's labels, and the
breathing ring and the ensō unchanged. npm test 892, test:pro 59.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Brings in the Google Search cleanup (#36), Brave, Yahoo and Swisscows in
the Search Result Filter (#38) and the 1.5.1 release merges.

One conflict, in common/changelog.js: both sides added a new entry at
the top. Both are kept, 1.6.0 above 1.5.2, so neither release loses its
notes. npm test 892, test:pro 59.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codepurse
codepurse merged commit d5357e3 into main Oct 30, 2026
1 check 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