diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 18cfe87..4d96388 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,13 +37,16 @@ jobs: shell: pwsh run: node build-cookie-engine.mjs + # -OpenSource: Sieve Pro lives in a private repository CI cannot see + # (pro/README.md), so CI packages with its empty stand-ins. Every + # protection is in this repository and is built and checked here. - name: Package Chrome build shell: pwsh - run: powershell -ExecutionPolicy Bypass -File .\build-chrome.ps1 -Zip + run: powershell -ExecutionPolicy Bypass -File .\build-chrome.ps1 -Zip -OpenSource - name: Package Firefox build shell: pwsh - run: powershell -ExecutionPolicy Bypass -File .\build-firefox.ps1 -Zip + run: powershell -ExecutionPolicy Bypass -File .\build-firefox.ps1 -Zip -OpenSource - name: Validate expected outputs shell: pwsh @@ -84,12 +87,16 @@ jobs: } # Dev-only trees must never be shipped. - $forbidden = @("node_modules", "src", "vendor", "test", "_metadata") + $forbidden = @("node_modules", "src", "vendor", "test", "_metadata", "pro-private") foreach ($browser in @("chrome", "firefox")) { foreach ($dir in $forbidden) { $p = "dist\$browser\$dir" if (Test-Path $p) { throw "Dev-only path leaked into build: $p" } } + # An open-source build carries Sieve Pro's stand-ins, never Pro. + if (-not (Select-String -Path "dist\$browser\pro\features.js" -SimpleMatch "SieveProFeatures = null" -Quiet)) { + throw "The open-source $browser build carries Sieve Pro, or lost its stand-in" + } } # Each build must carry the correct manifest. diff --git a/.gitignore b/.gitignore index a3d22b8..8878ce5 100644 --- a/.gitignore +++ b/.gitignore @@ -28,6 +28,11 @@ store-assets/ # Packaged extension builds produced by build-chrome.ps1 / build-firefox.ps1 dist/ +# Sieve Pro: a separate private repository, checked out here and copied over +# the stand-ins in pro/ by the build (pro/README.md). Never part of this one; +# test/pro-standins-test.mjs fails if anything under it is ever tracked. +/pro-private/ + # Packaged extension artifacts / signing keys — never commit these *.zip *.crx diff --git a/PRIVACY.md b/PRIVACY.md index 72d50fa..a8ee650 100644 --- a/PRIVACY.md +++ b/PRIVACY.md @@ -1,6 +1,6 @@ # Privacy Policy for Sieve -**Last updated: October 8, 2026** +**Last updated: October 29, 2026** ## The short version @@ -21,8 +21,20 @@ today", so it can compare them on your next visit. It is described [below](#what-the-dark-pattern-blocker-remembers), stays on your device, and can be erased with one button. +There is one exception to "nothing is sent": **Sieve Pro**, the optional one-time +purchase. If you buy it and type in your licence key, that key is sent to Polar, +the company that sells Sieve Pro for us, to check that it is valid, along with a +plain name for the browser ("Sieve · Edge on Windows") so you can tell your +browsers apart on your purchases page. That happens when you enter or remove the +key and about once a week in between, and only from Sieve's settings page. It is +described [below](#sieve-pro-licence-check). Without Pro, nothing changes. + Sieve is open source, so anyone can verify these claims: - +. The one exception is Sieve Pro's +features (the urge screen, plans, streaks and Your progress), which are not open source. +They make no network requests and keep everything on your device, and the +licence check, the only request Pro makes, is part of the open-source code +(`common/pro.js`), so what it sends can be checked by anyone. --- @@ -43,6 +55,18 @@ third party. | Screen-time tally, **only if you turn Usage Insights on** | Show you where your time goes | Yes | | What a page claimed, while the Dark Pattern Blocker is on | Tell a fake countdown or stock number from a real one on your next visit — see [below](#what-the-dark-pattern-blocker-remembers) | Yes | | Free-trial reminders, **only the ones you ask for** | Remind you before a free trial starts charging — see [below](#free-trial-reminders) | Yes | +| When the block page last stopped each kind of site | One date and time per kind (gambling, dating, games, AI tools, trading, your own blocked sites) and your longest gap, for Sieve Pro's streaks — never the site or its address | Yes | +| When the block page stopped you, for the kinds of site you block for yourself | The time and the kind (gambling, dating, games, AI tools, trading, your own blocked sites) of each stop, kept for a year, so Sieve Pro can show when it tends to get hard and write your month — never the site or its address, and never threats such as scam or malware sites. Kept for everyone, Pro or not | Yes | +| Monthly block totals | The Protection Dashboard keeps its daily counts for 30 days; as a day leaves, its counts are added to its month, for about two years — counts only, never a site | Yes | +| Urges waited out, **only if you press "I'm OK now"** | When, how long it took, and the kind of site, to draw Sieve Pro's Proof it passes dial | Yes | +| A message in your own voice, **only if you record or choose one** | The recording or sound file, stored in the extension's own database in your browser, and played on the urge screen. The microphone is used only while you record | Yes | +| Plans for the hard moments, **only if you write one** | Your two lines in your own words, the kind of site and the time each is for, to show on Sieve Pro's urge screen when that moment comes | Yes | +| What you picked to try instead, **only if you pick one** | Your list of things to try, and for each pick on the urge screen when it was, the kind of site and which one, kept for a year, so Sieve Pro can tell you how long you tended to stay away after each | Yes | +| A heads-up before your hardest hours, **only if you turn it on** | The times to give it and the words it says, worked out from the record above, for Sieve Pro's heads-up notification | Yes | +| Sieve Pro licence key, **only if you enter one** | Turn on the Pro features | Kept on your device; checked with Polar — see [below](#sieve-pro-licence-check) | +| Seal, **only if you start one** | When it ends, and its way out: either the key your witness's authenticator app shares with Sieve (needed to check their codes) and their recovery codes as **hashes**, or the emergency key as a **hash**. A witness's app works offline; nothing is sent to them, us or anyone | Yes | +| Urge screen, **only what you fill in** | Your reason, an optional photo (shrunk to fit 800 pixels), and a contact's name and number or email address, shown on the block page | Yes | +| Streak settings, **only for what you track** | The day you stopped, what it used to cost you, and what you are saving for, to count streaks, money kept and how close the goal is | Yes | Sieve also reads the content of web pages you visit **in the page itself** — for example, to mask profanity, hide toxic comments, remove dark patterns, or count @@ -107,12 +131,42 @@ what was already measured; **Clear history** is what erases it. This data is never transmitted anywhere, is not used for any purpose other than drawing your own report back to you, and is deleted with the extension. +### Sieve Pro licence check + +Sieve Pro is sold by Polar (polar.sh), who handle the payment, the receipt and +the licence key. Sieve itself never sees your payment details or your email +address. + +When you type a licence key into Sieve's settings, Sieve sends **that key and +Sieve's own shop ID** to Polar's licence service (`api.polar.sh`) to ask whether +it is valid. A key works in a few browsers at once, so entering it also takes +one of its places for this browser, under a plain name for the browser and +operating system ("Sieve · Edge on Windows"), never anything that identifies you +or the machine. Sieve asks again about once a week, only when you open its +settings page, so a refunded key stops working; that check carries the key, the +shop ID and this browser's place on the key. **Remove from this browser** gives +the place back (the same three things) and then deletes the key here. + +Nothing else is sent: not your browsing, not your settings, not anything the +Pro features keep. Polar knows which purchase the key belongs to, because they +sold it, and may see your IP address, as with any web request. + +**In Firefox**, Sieve asks your permission before it sends the key, the first +time you press Activate, through Firefox's own question about data an +extension sends. If you say no, nothing is sent and Pro stays off. Nobody who +does not activate Pro is ever asked. + +The key is kept on your device so it can be checked again. The Pro features +themselves (the urge screen, plans, the heads-up, streaks and Your progress) run +entirely on your device, like the rest of Sieve. + --- ## What Sieve does NOT do - It does **not** create an account or ask you to log in. -- It does **not** collect your name, email, location, or any identifier. +- It does **not** collect your name, email, location, or any identifier. (A Sieve + Pro licence key you type in is sent to Polar to check it, as described above.) - It does **not** upload your browsing history, the URLs you visit, page content, keystrokes, or activity — to us or to anyone else. (If you switch on Usage Insights, a site-name-and-duration tally is kept **on your device**, as @@ -126,7 +180,8 @@ drawing your own report back to you, and is deleted with the extension. ## Network activity (full transparency) Sieve makes outbound network requests only to **download files to your device** — -never to upload anything about you. Specifically: +never to upload anything about you — with the one exception of the Sieve Pro +licence check. Specifically: - **Blocklists** — publicly available lists (for example, known gambling, scam, malware, and phishing domains) are downloaded so protection stays current. @@ -141,8 +196,12 @@ never to upload anything about you. Specifically: optional in-app notice to show (for example, a new feature). It sends no information about you, and if the file is unreachable nothing is shown. You can dismiss any notice permanently. +- **Sieve Pro licence check, only if you enter a licence key** — the key, + Sieve's shop ID and a plain browser name are sent to Polar's licence service + (`api.polar.sh`) when you enter or remove it, then about once a week when you + open the settings page. See [above](#sieve-pro-licence-check). -These are all **downloads to your device**. They do not include your identity, your +Apart from that licence check, these are all **downloads to your device**. They do not include your identity, your browsing history, page content, or any personal information beyond the normal network request needed to fetch a file. As with any web request, the host serving a file (a blocklist provider, the model host, GitHub for the announcement, or the @@ -162,6 +221,7 @@ Sieve requests only the permissions needed to filter content locally: - **tabs** — open the local "blocked"/settings pages and close popup/hijack tabs. It does not read your browser history. If you switch Usage Insights on, it also reads the site name of the tab you are looking at, in order to time it. - **idle** — used only by Usage Insights, to stop the clock when you step away or lock the screen. It reports how long it has been since you touched the keyboard or mouse; it cannot see what you typed. - **offscreen** — run the optional toxicity model locally, off the main page. +- **notifications** (optional, never asked for at install) — asked for only if you turn on Sieve Pro's heads-up before your hardest hours, and used only to show it. The notification's words are worked out on your device; nothing is sent. - **scripting** — run Sieve's own filters in pages. For example, the Dark Pattern Blocker's on-page notes are added only to a page where it has found something to show, rather than to every page. - **host access (all sites)** — required because harmful content can appear on any site; used only to run the local filters. No browsing data is collected. @@ -170,17 +230,21 @@ Sieve requests only the permissions needed to filter content locally: ## Chrome Web Store data disclosure In the Chrome Web Store's terms, "collect" means transferring data off the -user's device. Sieve transfers nothing, so it declares that it does **not** -collect any of the following: personally identifiable information, health -information, financial and payment information, authentication information, -personal communications, location, web history, user activity, or website -content. - -To be plain about the three cases where that wording could mislead: if you switch +user's device. The only thing Sieve transfers is a Sieve Pro licence key, if you +enter one, to Polar to check it. Sieve declares that as **authentication +information**, used only to check the licence, never sold, and never used for +anything else. It declares that it does **not** collect any of the following: +personally identifiable information, health information, financial and payment +information, personal communications, location, web history, user activity, or +website content. + +To be plain about the cases where that wording could mislead: if you switch on Usage Insights, a tally of site names and durations is written **to your own browser storage**; the Dark Pattern Blocker writes the numbers described -above under scrambled codes; and a free-trial reminder you ask for keeps that -site's name and dates. You can erase any of them at any time. Nothing about +above under scrambled codes; a free-trial reminder you ask for keeps that +site's name and dates; the block page keeps when it stopped you, by kind of +site; and Sieve Pro's streaks, urge screen and voice message keep what is +listed in the table above. You can erase any of them at any time. Nothing about them is ever sent to us or to a third party, which is why the declaration above is still accurate. diff --git a/README.md b/README.md index 7d933e9..44bd005 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ tracking, nothing leaves your browser. - **Doomscroll Stopper** — a daily time limit on endless feeds, with a gentle pause overlay. - **Guardian self-lock** — an optional PIN that gates *weakening* your protection (turning things off, allowlisting) while strengthening it stays free. - **Cool-off** — an optional wait (1 hour to 7 days) before anything that weakens your protection unlocks. The change is asked for first and unlocks only once the wait is over, for that one change, once, for a day; nothing turns off by itself, and a request can be called off at any time. Works with or without a PIN. +- **Seal** — lock your protection until a date (a week, 30 or 90 days, a year). Until then nothing that weakens it can be changed, not with the PIN and not after a cool-off. The only way out early is held by a **witness** — someone you trust scans a QR code into their authenticator app, and you ask them for the six digits it shows (standard TOTP, no server; eight hashed recovery codes for a lost phone; five wrong codes lock entry for a while) — or, for someone with nobody to ask, by an emergency key shown once and stored only as a hash. Extending is always allowed, shortening never. Like BlockNSFW's Pact. - **Protection Dashboard** — a today/this-week breakdown of everything Sieve blocked for you, including an **Ads** section counting ad-network requests, the YouTube and Facebook ads removed, the ad-blocker walls cleared and the empty ad slots hidden. Only running totals are stored — never which site or which ad network. The request counter reads back which of Sieve's own block rules fired, which Chrome allows and Firefox does not, so they stay at zero on Firefox while the blocking itself is unaffected. - **Usage Insights** — an opt-in screen-time report: total time, a per-day and per-hour curve, and which sites took it. Only the tab you are looking at counts, the clock stops when you step away, and the record never leaves your device (7/30/90-day retention, clearable at any time). @@ -187,3 +188,11 @@ licensed under [CC BY-SA 3.0](https://creativecommons.org/licenses/by-sa/3.0/), Sieve elects the CC arm of EasyList's GPLv3 / CC BY-SA 3.0 dual licence; BY-SA's "Collection" clause is what keeps the rest of the project MIT. Editing that one file means editing a BY-SA file — see [`data/ATTRIBUTION-easylist.md`](data/ATTRIBUTION-easylist.md). + +**Sieve Pro** (the urge screen with its designs and voice message, streaks with a +savings goal, and Your progress: hardest hours, proof it passes, the month and +year letters) is not open source and is not in +this repository: [`pro/`](pro/README.md) holds empty stand-ins, and the store versions +of Sieve carry the real files. Every protection is here, so a build from this +repository blocks exactly what the store version does. Build one with +`build-chrome.ps1 -OpenSource` (or `build-firefox.ps1 -OpenSource`). diff --git a/background/heads-up.js b/background/heads-up.js new file mode 100644 index 0000000..46b94e4 --- /dev/null +++ b/background/heads-up.js @@ -0,0 +1,154 @@ +// background/heads-up.js +// Sieve — the heads-up before someone's hardest hours: a notification at a +// time this device already worked out, and nothing else. +// +// Sieve Pro (pro/coach.js) reads when the block page has tended to stop +// someone and, once they switch the heads-up on, writes to proHeadsUp the +// moments to give it and the words to say. This file is the open-source half: +// it keeps one alarm set for the next of those moments, shows the notification +// when it comes, and sets the next. Without Pro nothing writes proHeadsUp, so +// nothing here ever fires; and it only ever shows the words stored there. +// +// Notifications need a permission Sieve does not ask for when it is installed. +// It is an optional one, asked for in Settings only when someone switches the +// heads-up on. Until it is given, chrome.notifications does not exist here and +// nothing is shown. +// +// A heads-up that comes late, because the computer was asleep through it, is +// dropped rather than shown at the wrong time: it is a warning for a moment +// that has already passed. + +const KEY = "proHeadsUp"; +const LICENCE_KEY = "proLicence"; +const ALARM = "sieve-heads-up"; +const NOTIFICATION = "sieve-heads-up"; +const LATE_MS = 30 * 60 * 1000; +const TITLE_MAX = 80; +const BODY_MAX = 400; + +// The stored schedule, read defensively: { enabled, at: [{ day, minute }], +// title, body }. day is Date#getDay's (0 is Sunday), minute of the day local. +export function normalize(raw) { + const src = raw && typeof raw === "object" ? raw : {}; + const at = (Array.isArray(src.at) ? src.at : []).filter( + (s) => + s && + Number.isInteger(s.day) && + s.day >= 0 && + s.day < 7 && + Number.isInteger(s.minute) && + s.minute >= 0 && + s.minute < 1440, + ); + return { + enabled: src.enabled === true, + at: at.map((s) => ({ day: s.day, minute: s.minute })), + title: typeof src.title === "string" ? src.title.slice(0, TITLE_MAX) : "", + body: typeof src.body === "string" ? src.body.slice(0, BODY_MAX) : "", + }; +} + +// The first of those moments after `now`, in local time, or null. Built from +// the date parts, so a daylight-saving change cannot move it by an hour. +export function nextAt(at, now) { + const base = new Date(now); + let best = null; + for (const slot of at) { + for (let add = 0; add <= 7; add++) { + const d = new Date( + base.getFullYear(), + base.getMonth(), + base.getDate() + add, + Math.floor(slot.minute / 60), + slot.minute % 60, + ); + if (d.getDay() !== slot.day || d.getTime() <= now) continue; + if (best === null || d.getTime() < best) best = d.getTime(); + break; + } + } + return best; +} + +// Is Pro on? The same test as common/pro.js isProState, which is written for +// pages and cannot load in a service worker: a stored key Polar granted, not +// past its expiry. A key that lapses stops the heads-up with it. +export function licensed(raw, now) { + if (!raw || typeof raw !== "object") return false; + if (typeof raw.key !== "string" || !raw.key.trim() || raw.status !== "granted") return false; + return !Number.isFinite(raw.expiresAt) || now < raw.expiresAt; +} + +// Keeps the one alarm on the next heads-up, or clears it when there is none. +export async function arm(now = Date.now()) { + const stored = await chrome.storage.local.get([KEY, LICENCE_KEY]); + const headsUp = normalize(stored[KEY]); + const when = headsUp.enabled && licensed(stored[LICENCE_KEY], now) ? nextAt(headsUp.at, now) : null; + if (when === null) { + await chrome.alarms.clear(ALARM); + return null; + } + const set = await chrome.alarms.get(ALARM); + if (!set || set.scheduledTime !== when) await chrome.alarms.create(ALARM, { when }); + return when; +} + +// The alarm went off: show the heads-up if it is still wanted, still allowed +// and on time, then set the next one. Returns whether it was shown. +export async function fire(alarm, now = Date.now()) { + if (!alarm || alarm.name !== ALARM) return false; + const stored = await chrome.storage.local.get([KEY, LICENCE_KEY]); + const headsUp = normalize(stored[KEY]); + let shown = false; + if ( + headsUp.enabled && + headsUp.title && + headsUp.body && + licensed(stored[LICENCE_KEY], now) && + now - alarm.scheduledTime < LATE_MS && + chrome.notifications + ) { + try { + // Only the options Firefox knows as well: it rejects ones it doesn't. + await chrome.notifications.create(NOTIFICATION, { + type: "basic", + iconUrl: chrome.runtime.getURL("icons/icon-128.png"), + title: headsUp.title, + message: headsUp.body, + }); + shown = true; + } catch (err) { + console.warn("[Sieve] could not show the heads-up:", err); + } + } + // The next one, never this one again. + await arm(Math.max(now, alarm.scheduledTime) + 1000); + return shown; +} + +// Tapping it opens Your progress at the plans. Registered once the permission +// exists, which may be after this worker started. +let clicksHeard = false; +function listenForClicks() { + if (clicksHeard || !chrome.notifications || !chrome.notifications.onClicked) return; + chrome.notifications.onClicked.addListener((id) => { + if (id !== NOTIFICATION) return; + chrome.notifications.clear(id); + chrome.tabs.create({ url: chrome.runtime.getURL("pages/progress.html#plans") }); + }); + clicksHeard = true; +} + +chrome.alarms.onAlarm.addListener((alarm) => { + if (alarm.name !== ALARM) return; + fire(alarm).catch((err) => console.warn("[Sieve] heads-up:", err)); +}); + +chrome.storage.onChanged.addListener((changes, area) => { + if (area !== "local" || (!changes[KEY] && !changes[LICENCE_KEY])) return; + arm().catch((err) => console.warn("[Sieve] heads-up:", err)); +}); + +if (chrome.permissions && chrome.permissions.onAdded) chrome.permissions.onAdded.addListener(listenForClicks); +listenForClicks(); +arm().catch((err) => console.warn("[Sieve] heads-up:", err)); diff --git a/background/service-worker.js b/background/service-worker.js index 1762cc8..002cbc3 100644 --- a/background/service-worker.js +++ b/background/service-worker.js @@ -24,15 +24,20 @@ import "./google-web-only.js"; // Site Cleanup — sends Google searches to the import "./search-filter-subscriptions.js"; // Search Result Filter — subscribed lists, fetched and refreshed import "./tells.js"; // Dark Pattern Blocker — the Claim Ledger's storage, and the toolbar badge import "./trial-reminders.js"; // Dark Pattern Blocker — the free-trial reminders you ask for +import "./heads-up.js"; // Sieve Pro — the heads-up before the hardest hours (shows only what Pro stored) // A plain script, not an ES module: importing it for its side effect is what // puts KeywordPattern on `self`, which is where the blocked-sites entry parser // lives. The settings page and the content script load the same file, so all // three agree on what an entry means. import "../common/keyword-pattern.js"; +// Also a plain script: the attempt record (when the block page stopped a habit), +// which this worker alone writes so two block pages cannot lose an entry. +import "../common/attempts.js"; import { buildCustomBlockRules } from "./custom-block-rules.js"; // blocked-sites list -> dynamic rules import { installStatsListener, installStatsAlarmHandler, scheduleStatsMidnightAlarm } from "../common/stats.js"; // Shared Protection Dashboard stats store installStatsListener(); +self.SieveAttempts.installListener(); installStatsAlarmHandler(); scheduleStatsMidnightAlarm(); @@ -553,6 +558,8 @@ const DOOMSCROLL_CS_FILES = [ "common/doomscroll-sites.js", "common/access-code.js", "common/cooloff.js", + "common/totp.js", + "common/seal.js", "common/theme.js", "common/guardian-prompt.js", "content/pause-overlay.js", diff --git a/build-chrome.ps1 b/build-chrome.ps1 index e930f84..6f9824f 100644 --- a/build-chrome.ps1 +++ b/build-chrome.ps1 @@ -9,11 +9,23 @@ # engine) so the copied artifacts are guaranteed fresh. Requires # `npm install` to have been run. # -Zip Also produce dist/sieve-chrome.zip. +# -OpenSource +# Build without Sieve Pro, on purpose: pro\ keeps its empty +# stand-ins. What CI builds, and what anyone can build from GitHub. +# -Sandbox A test build whose Pro uses Polar's sandbox store (with -Zip, a +# test package). Never upload one. +# +# Sieve Pro comes from a private repository checked out at pro-private\ (see +# pro\README.md and build-pro.mjs). A plain build includes it when that +# checkout is there; a store package (-Zip) refuses to build without it, or +# while common\pro.js cannot sell through Polar's live store yet. [CmdletBinding()] param( [switch]$Bundle, - [switch]$Zip + [switch]$Zip, + [switch]$OpenSource, + [switch]$Sandbox ) $ErrorActionPreference = "Stop" @@ -24,6 +36,8 @@ $OutDir = Join-Path $ScriptDir "dist\chrome" $ManifestSrc = Join-Path $SrcDir "manifest.json" $ManifestDst = Join-Path $OutDir "manifest.json" +$ProKind = if ($OpenSource) { "open-source" } elseif ($Sandbox) { "sandbox" } elseif ($Zip) { "store" } else { "dev" } + # Whole folders copied verbatim into the build. Anything not listed here # (node_modules, src, vendor, cookie-rules-extra, test, _metadata, docs) is # dev-only and never shipped. @@ -37,6 +51,7 @@ $RuntimeFolders = @( "options", "pages", "popup", + "pro", "rules" ) $RuntimeFiles = @( @@ -49,6 +64,7 @@ $RequiredAssets = @( "background\service-worker.js", "background\ad-tracker-stats.js", "background\retired-tracker-blocker.js", + "pro\features.js", "content\cookie-engine.bundle.js", "content\toxic-model.bundle.js", "content\youtube-ads.js", @@ -85,6 +101,11 @@ if ($Bundle) { if ($LASTEXITCODE -ne 0) { throw "build-cookie-engine.mjs failed" } } +# Checked before anything is cleaned, so a refused package leaves dist\ as it was. +Write-Host "==> Checking Sieve Pro ($ProKind build)" -ForegroundColor Cyan +& node (Join-Path $SrcDir "build-pro.mjs") --check $ProKind +if ($LASTEXITCODE -ne 0) { throw "This build cannot be made (see above)." } + Write-Host "==> Cleaning $OutDir" -ForegroundColor Cyan if (Test-Path $OutDir) { Remove-Item -Path $OutDir -Recurse -Force @@ -110,6 +131,10 @@ foreach ($file in $RuntimeFiles) { } } +Write-Host "==> Sieve Pro" -ForegroundColor Cyan +& node (Join-Path $SrcDir "build-pro.mjs") $OutDir $ProKind +if ($LASTEXITCODE -ne 0) { throw "build-pro.mjs failed" } + Write-Host "==> Stripping comments from the packaged JavaScript" -ForegroundColor Cyan # The source is heavily commented on purpose; the package does not need any of # it. This removes comments ONLY - every statement keeps its own line and its @@ -152,4 +177,11 @@ if ($Zip) { } Write-Host "==> Chrome build complete: $OutDir" -ForegroundColor Green +# The stand-in's statement survives comment stripping; the real file's does not exist. +if (Select-String -Path (Join-Path $OutDir "pro\features.js") -SimpleMatch "SieveProFeatures = null" -Quiet) { + Write-Host "==> Sieve Pro: not included" -ForegroundColor Yellow +} else { + Write-Host "==> Sieve Pro: included" -ForegroundColor Green +} +if ($ProKind -eq "sandbox") { Write-Host "==> TEST PACKAGE: Sieve Pro may use Polar's sandbox. Never upload it to a store." -ForegroundColor Yellow } if ($Zip) { Write-Host "==> Zip: $ZipPath" -ForegroundColor Green } diff --git a/build-firefox.ps1 b/build-firefox.ps1 index 51d165f..48b724f 100644 --- a/build-firefox.ps1 +++ b/build-firefox.ps1 @@ -10,11 +10,23 @@ # `npm install` to have been run. # -Zip Also produce dist/sieve-firefox.zip (forward-slash entry paths, # which Firefox / AMO require). +# -OpenSource +# Build without Sieve Pro, on purpose: pro\ keeps its empty +# stand-ins. What CI builds, and what anyone can build from GitHub. +# -Sandbox A test build whose Pro uses Polar's sandbox store (with -Zip, a +# test package). Never upload one. +# +# Sieve Pro comes from a private repository checked out at pro-private\ (see +# pro\README.md and build-pro.mjs). A plain build includes it when that +# checkout is there; a store package (-Zip) refuses to build without it, or +# while common\pro.js cannot sell through Polar's live store yet. [CmdletBinding()] param( [switch]$Bundle, - [switch]$Zip + [switch]$Zip, + [switch]$OpenSource, + [switch]$Sandbox ) $ErrorActionPreference = "Stop" @@ -25,6 +37,8 @@ $OutDir = Join-Path $ScriptDir "dist\firefox" $ManifestSrc = Join-Path $SrcDir "manifest.firefox.json" $ManifestDst = Join-Path $OutDir "manifest.json" +$ProKind = if ($OpenSource) { "open-source" } elseif ($Sandbox) { "sandbox" } elseif ($Zip) { "store" } else { "dev" } + # Whole folders copied verbatim into the build. Anything not listed here # (node_modules, src, vendor, cookie-rules-extra, test, _metadata, docs) is # dev-only and never shipped. @@ -37,6 +51,7 @@ $RuntimeFolders = @( "options", "pages", "popup", + "pro", "rules" ) $RuntimeFiles = @( @@ -49,6 +64,7 @@ $RequiredAssets = @( "background\service-worker.js", "background\ad-tracker-stats.js", "background\retired-tracker-blocker.js", + "pro\features.js", "content\cookie-engine.bundle.js", "content\youtube-ads.js", "content\youtube-ads-bridge.js", @@ -84,6 +100,11 @@ if ($Bundle) { if ($LASTEXITCODE -ne 0) { throw "build-cookie-engine.mjs failed" } } +# Checked before anything is cleaned, so a refused package leaves dist\ as it was. +Write-Host "==> Checking Sieve Pro ($ProKind build)" -ForegroundColor Cyan +& node (Join-Path $SrcDir "build-pro.mjs") --check $ProKind +if ($LASTEXITCODE -ne 0) { throw "This build cannot be made (see above)." } + Write-Host "==> Cleaning $OutDir" -ForegroundColor Cyan if (Test-Path $OutDir) { Remove-Item -Path $OutDir -Recurse -Force @@ -109,6 +130,10 @@ foreach ($file in $RuntimeFiles) { } } +Write-Host "==> Sieve Pro" -ForegroundColor Cyan +& node (Join-Path $SrcDir "build-pro.mjs") $OutDir $ProKind +if ($LASTEXITCODE -ne 0) { throw "build-pro.mjs failed" } + Write-Host "==> Removing Chrome-only payload" -ForegroundColor Cyan # content\toxic-model.bundle.js is 638 KB of TensorFlow.js, and its ONLY consumer # is offscreen\toxic-offscreen.html. Firefox has no chrome.offscreen, so that @@ -160,4 +185,11 @@ if ($Zip) { } Write-Host "==> Firefox build complete: $OutDir" -ForegroundColor Green +# The stand-in's statement survives comment stripping; the real file's does not exist. +if (Select-String -Path (Join-Path $OutDir "pro\features.js") -SimpleMatch "SieveProFeatures = null" -Quiet) { + Write-Host "==> Sieve Pro: not included" -ForegroundColor Yellow +} else { + Write-Host "==> Sieve Pro: included" -ForegroundColor Green +} +if ($ProKind -eq "sandbox") { Write-Host "==> TEST PACKAGE: Sieve Pro may use Polar's sandbox. Never upload it to a store." -ForegroundColor Yellow } if ($Zip) { Write-Host "==> Zip: $ZipPath" -ForegroundColor Green } diff --git a/build-pro.mjs b/build-pro.mjs new file mode 100644 index 0000000..5809ae4 --- /dev/null +++ b/build-pro.mjs @@ -0,0 +1,142 @@ +// build-pro.mjs +// Puts Sieve Pro into a build, or deliberately leaves it out. Called twice by +// build-chrome.ps1 and build-firefox.ps1: +// +// node build-pro.mjs --check before dist\ is cleaned, so a +// refused package leaves it as it was +// node build-pro.mjs after the runtime folders are copied +// +// is one of: +// store a package for the stores (-Zip): Pro must be included, from a +// clean pro-private checkout, selling through Polar's live store +// sandbox a test build (-Sandbox, with or without -Zip): Pro included, +// and this build's own copy of common/pro.js switched to Polar's +// sandbox store; never upload one +// dev a plain build: Pro included when pro-private is checked out +// open-source without Pro on purpose (-OpenSource): the stand-ins stay +// +// Sieve Pro is not open source. Its files live in a private repository checked +// out at pro-private\ (ignored by this one); pro\ here holds an empty stand-in +// of the same name for each (pro/README.md). Only those names are copied, so +// nothing else in the private repository (its tests, its notes) can reach a +// package. + +import { readFileSync, readdirSync, existsSync, copyFileSync, rmSync, statSync, writeFileSync } from "node:fs"; +import { join, dirname } from "node:path"; +import { fileURLToPath } from "node:url"; +import { execFileSync } from "node:child_process"; +import vm from "node:vm"; + +const ROOT = dirname(fileURLToPath(import.meta.url)); +const STANDINS = join(ROOT, "pro"); +const PRIVATE = join(ROOT, "pro-private"); +const REAL = join(PRIVATE, "pro"); +const KINDS = ["store", "sandbox", "dev", "open-source"]; +// Every real file starts by saying it is Sieve Pro; that line is how a real +// file is told from a stand-in. +const MARK = "(Sieve Pro; pro-private/, not open source)"; + +function fail(message) { + console.error(`build-pro: ${message}`); + process.exit(1); +} + +function standInNames() { + return readdirSync(STANDINS).filter((f) => f.endsWith(".js")).sort(); +} + +// The licence settings, read the way the extension reads them. +function proConfig() { + const sandbox = { window: {} }; + vm.runInNewContext(readFileSync(join(ROOT, "common", "pro.js"), "utf8"), sandbox); + return sandbox.window.SievePro.CONFIG; +} + +function checkPrivate(kind) { + if (!existsSync(REAL)) { + if (kind === "store" || kind === "sandbox") { + fail("a store package needs Sieve Pro. Check out the private repository at pro-private\\, or pass -OpenSource to package without it."); + } + return false; + } + const names = standInNames(); + for (const name of readdirSync(REAL).filter((f) => f.endsWith(".js"))) { + if (!names.includes(name)) fail(`pro-private\\pro\\${name} has no stand-in in pro\\, so it would never ship. Add one.`); + } + for (const name of names) { + const real = join(REAL, name); + if (!existsSync(real)) fail(`pro-private\\pro is missing ${name}`); + if (statSync(real).size === 0) fail(`pro-private\\pro\\${name} is empty`); + const text = readFileSync(real, "utf8"); + if (!text.split("\n", 1)[0].includes(MARK)) fail(`pro-private\\pro\\${name} does not start by saying it is Sieve Pro (${MARK})`); + if (text === readFileSync(join(STANDINS, name), "utf8")) fail(`pro-private\\pro\\${name} is only the stand-in`); + } + return true; +} + +// What a store in common/pro.js still lacks before it can sell Sieve Pro. +function storeGaps(name) { + const s = (proConfig().stores || {})[name] || {}; + const missing = []; + if (!s.organizationId) missing.push("no organizationId"); + if (!Array.isArray(s.benefitIds) || s.benefitIds.length === 0) missing.push("no benefitIds"); + if (!s.checkoutUrl) missing.push("no checkoutUrl"); + return missing; +} + +function checkSandbox() { + const missing = storeGaps("sandbox"); + if (missing.length) fail(`common/pro.js has no complete sandbox store: ${missing.join(", ")}.`); +} + +function checkStore() { + const c = proConfig(); + const missing = storeGaps("live"); + if (c.mode !== "live") missing.unshift(`mode is "${c.mode}", not "live"`); + if (missing.length) fail(`common/pro.js cannot sell Sieve Pro yet: ${missing.join(", ")}. Fill in stores.live from the Polar dashboard, or pass -Sandbox for a test package.`); + + let dirty = ""; + try { + dirty = execFileSync("git", ["status", "--porcelain", "--", "pro"], { cwd: PRIVATE, encoding: "utf8" }); + } catch { + fail("pro-private\\ is not a git checkout, so this package could not be traced to a commit."); + } + if (dirty.trim()) fail(`pro-private\\pro has changes that are not committed:\n${dirty}`); +} + +const args = process.argv.slice(2); + +if (args[0] === "--check") { + const kind = args[1]; + if (!KINDS.includes(kind)) fail(`unknown kind "${kind}"`); + if (kind === "open-source") process.exit(0); + checkPrivate(kind); + if (kind === "store") checkStore(); + if (kind === "sandbox") checkSandbox(); + process.exit(0); +} + +const [outDir, kind] = args; +if (!outDir || !KINDS.includes(kind)) fail("usage: node build-pro.mjs "); +const outPro = join(outDir, "pro"); +if (!existsSync(outPro)) fail(`${outPro} is missing: is "pro" in the build's runtime folders?`); +rmSync(join(outPro, "README.md"), { force: true }); + +if (kind === "open-source" || !checkPrivate(kind)) { + console.log("Sieve Pro: not included (the stand-ins stay)"); + process.exit(0); +} +for (const name of standInNames()) copyFileSync(join(REAL, name), join(outPro, name)); +console.log(`Sieve Pro: included (${standInNames().join(", ")})`); + +// A sandbox build switches its own copy of the licence check to Polar's test +// store. The source, and every other build, stays live. +if (kind === "sandbox") { + const file = join(outDir, "common", "pro.js"); + const text = readFileSync(file, "utf8"); + // \r? because a Windows checkout may have CRLF line endings. + const live = /^([ \t]*)mode: "live",(\r?)$/m; + if ((text.match(new RegExp(live.source, "gm")) || []).length !== 1) fail(`${file}: expected exactly one mode: "live", line`); + writeFileSync(file, text.replace(live, '$1mode: "sandbox",$2')); + console.log("Sieve Pro: this build uses Polar's sandbox store"); +} diff --git a/common/attempts.js b/common/attempts.js new file mode 100644 index 0000000..a0f71b1 --- /dev/null +++ b/common/attempts.js @@ -0,0 +1,163 @@ +// common/attempts.js +// Sieve — the attempt record: when the block page stopped a site from a list +// someone chose to block for themselves. +// +// The block page already counts blocks per day for the dashboard +// (common/stats.js). This keeps the moments themselves, a time and the kind of +// site, because "when" is the one thing a daily count throws away and the one +// someone trying to stop most wants to know: Friday nights after eleven, the +// evening after payday. Sieve Pro reads it (when it's hardest, your month and +// your year); nothing that blocks does. +// +// Only habits are recorded: the kinds of site a person turns on to stop +// themselves (gambling, dating, their own blocked sites, games, AI tools, +// trading). Threats, such as scam sites, malware and phishing, are not urges +// and never appear here. +// +// It is written for everyone, Pro or not, on this device, next to the daily +// counts, so someone who buys Pro later sees the months before. Nothing is +// sent anywhere. +// +// Storage, chrome.storage.local: +// sieveAttempts { v: 1, since: , a: [[, ], ...] } oldest first +// +// One urge often reaches the block page more than once: a reload, a second +// try, a site that hops through two of its own domains. A repeat of the same +// category within MERGE_MS of the last one is the same attempt, not a new one. +// The record keeps KEEP_DAYS (a year and a little, so a whole year can be +// told) and at most MAX entries. +// +// The service worker writes it (installListener), so two block pages opening +// at once cannot lose one another's entry; pages only read it. + +(() => { + "use strict"; + + const root = typeof self !== "undefined" ? self : globalThis; + if (root.SieveAttempts) return; + + const KEY = "sieveAttempts"; + const MESSAGE = "SIEVE_RECORD_ATTEMPT"; + const DAY = 24 * 60 * 60 * 1000; + const MERGE_MS = 5 * 60 * 1000; + const KEEP_DAYS = 400; + const MAX = 6000; + + // The block page's ?category= values that are habits. pro/streaks.js groups + // them into the habits a person tracks. + const CATEGORIES = [ + "gambling", + "prediction-markets", + "dating", + "custom-blocked", + "games-portals", + "games-stores", + "games-platforms", + "games-streaming", + "ai-chatbots", + "ai-writing", + "ai-companions", + "trading", + ]; + + function normalize(raw) { + const src = raw && typeof raw === "object" ? raw : {}; + const list = Array.isArray(src.a) ? src.a : []; + const a = list + .filter( + (e) => + Array.isArray(e) && + Number.isFinite(e[0]) && + e[0] > 0 && + typeof e[1] === "string" && + CATEGORIES.includes(e[1]), + ) + .map((e) => [Math.floor(e[0]), e[1]]) + .sort((x, y) => x[0] - y[0]); + let since = Number.isFinite(src.since) && src.since > 0 ? Math.floor(src.since) : null; + if (a.length && (since === null || a[0][0] < since)) since = a[0][0]; + return { v: 1, since, a }; + } + + // The record with this attempt in it, pruned to the window. `added` is false + // for a category that is not a habit and for a repeat inside MERGE_MS. + function add(raw, category, now = Date.now()) { + const record = normalize(raw); + const cutoff = now - KEEP_DAYS * DAY; + record.a = record.a.filter((e) => e[0] >= cutoff && e[0] <= now); + if (record.since === null) record.since = now; + if (!CATEGORIES.includes(category)) return { record, added: false }; + for (let i = record.a.length - 1; i >= 0; i--) { + if (now - record.a[i][0] >= MERGE_MS) break; + if (record.a[i][1] === category) return { record, added: false }; + } + record.a.push([now, category]); + if (record.a.length > MAX) record.a = record.a.slice(record.a.length - MAX); + return { record, added: true }; + } + + // The attempts between two moments, optionally only some categories. + function between(record, from, to, categories) { + const want = Array.isArray(categories) ? categories : null; + return normalize(record).a.filter( + (e) => e[0] >= from && e[0] < to && (!want || want.includes(e[1])), + ); + } + + async function get() { + const stored = await chrome.storage.local.get(KEY); + return normalize(stored[KEY]); + } + + // Writes queue behind one another in the one context that writes. + let writing = Promise.resolve(); + + function record(category, now = Date.now()) { + const run = writing.then(async () => { + const stored = await chrome.storage.local.get(KEY); + const before = normalize(stored[KEY]); + const { record: next, added } = add(before, category, now); + // The worker wakes often; a wake that changes nothing writes nothing. + if (added || next.since !== before.since || next.a.length !== before.a.length) { + await chrome.storage.local.set({ [KEY]: next }); + } + return added; + }); + writing = run.catch(() => {}); + return run; + } + + // Called once by the service worker. Only the block page sends the message. + // The record starts counting now if it has never started, so a month that + // passes without one attempt can still be told as a clear month. + function installListener() { + chrome.runtime.onMessage.addListener((message, sender, sendResponse) => { + if (!message || message.type !== MESSAGE) return false; + const page = chrome.runtime.getURL("pages/blocked.html"); + if (!sender || typeof sender.url !== "string" || !sender.url.startsWith(page)) return false; + record(message.category) + .then((added) => sendResponse({ ok: true, added })) + .catch((err) => { + console.warn("[Sieve] could not record the attempt:", err); + sendResponse({ ok: false }); + }); + return true; + }); + record(null).catch(() => {}); + } + + root.SieveAttempts = { + KEY, + MESSAGE, + MERGE_MS, + KEEP_DAYS, + MAX, + CATEGORIES, + normalize, + add, + between, + get, + record, + installListener, + }; +})(); diff --git a/common/changelog.js b/common/changelog.js index f576fb0..43e51b5 100644 --- a/common/changelog.js +++ b/common/changelog.js @@ -13,6 +13,31 @@ // =========================================================================== const SIEVE_CHANGELOG = [ + { + version: "1.6.0", + date: "November 2026", + items: [ + "New, and free: the Seal, in Settings › Lock. It locks your protection until a date you choose: a week, 30 days, 90 days or a year. Until then nothing that weakens it can be changed, not with your PIN and not by waiting out a cool-off. Extending a seal is always allowed; shortening one is not.", + "The way out early is held by a witness: someone you trust scans a QR code into the authenticator app they already use, and you ask them for the six digits it shows. They also keep eight recovery codes in case their phone is lost. Nothing is sent anywhere, and five wrong codes lock entry for a while. The seal only starts once their app has shown a code that works. If there is nobody to ask, choose a printed emergency key instead.", + "A running seal shows in the toolbar popup, with the day it ends.", + "New: Sieve Pro, a one-time purchase with no subscription. Every protection stays free, the Seal included, and always will. Pro adds help for the hard moments and a way to see how far you have come, running on your device like the rest of Sieve.", + "The urge screen changes what you see when Sieve stops you at a blocked site. Instead of a notice, the page leads with something to do while the urge passes, then your own reason in your own words, a photo if you chose one, a message in your own voice, and one tap to text, call or email someone you trust. Go back and Allow stay underneath, exactly as before.", + "At its centre, choose a breathing ring, an ensō (hold to breathe in, let go to breathe out, and a brush draws one circle a breath), or a river to lead from the spring to the sea, a small puzzle with no clock and no score for the minutes an urge takes.", + "Proof it passes: press “I'm OK now” when an urge has passed, and it becomes a dot on a dial at the minute it passed. The next time, the dial's hand runs through them while you wait: “Your urges pass. Usually by minute 6.” In your hardest hours, the urge screen says so.", + "Record a message for yourself in Settings, or choose a song or a voice note from someone you love. The urge screen plays it with a tap, or by itself if you ask. It stays on your device; the microphone is on only while you record.", + "Streaks count the days since you last tried to open a gambling site, a dating site, or any other kind you track, and what it would have cost: “23 days · about $1,140 kept”. Give the money a goal, such as a trip or a debt paid off, and see how close it is. They show in the toolbar popup and in settings, with your best run and the next milestone.", + "Your progress, a page of its own: when it tends to get hard, by weekday and hour; the dial of every urge you have waited out; a letter after every month, with clear days, money kept and the month before beside it, ready to print for a counsellor or sponsor; and your year on one calendar. The toolbar popup says when a new month's letter is waiting.", + "Plans for the hard moments: decide while it's calm, in your own words. “If it's late and I'm in bed scrolling, then I put my phone on the kitchen charger.” Give a plan a kind of site and a time, such as your hardest hours or around 11 pm, and the urge screen shows it before anything else when that moment comes.", + "After “I'm OK now”, if there was no plan for that moment, the urge screen asks two questions while it's fresh: what was going on, and what you could do first next time. Your answers become a plan for that kind of site and that hour. “Not now” skips it, and Settings can turn the questions off.", + "A heads-up before your hardest hours, if you turn it on: a notification fifteen minutes before they usually start, on the days they have come, with your plan for them. Sieve asks your browser for permission to show notifications only when you switch this on. It is worked out on your device, and a heads-up the computer slept through is dropped rather than shown late.", + "What works for you: while you wait on the urge screen, pick one of your own things to try instead, such as a walk or a call. Sieve keeps which one you picked and how long until a blocked site stopped you again, and once you have tried something twice it says so: “After a walk, you usually stayed away about 3 hours.” Your progress lists them all. A pattern from your own days, never a promise.", + "The top of the toolbar popup, redone, on a pine band like BlockNSFW's. Whether Sieve is on is now a stamp beside its name, and a running seal shows its days as a row of holes, filling one a day.", + "With Sieve Pro the popup knows what time it is: “Your hard hours start in 20 minutes”, the day drawn hour by hour with your hardest ones marked, your plan for them, and what tends to help you, with your streaks underneath. On a day they don't come, it says when they next do.", + "To make that possible, the block page now keeps when it stopped you, as well as how many times, for the kinds of site you block for yourself (never threats such as scam sites, and never the site's address). It is kept on your device for a year, for everyone, so Pro can show the months before you bought it.", + "Sieve Pro is sold by Polar, who send the licence key with your receipt. One key works in up to three browsers at once, and “Remove from this browser” frees a place for another. Entering it sends that key and a plain name for the browser to Polar to check it, and again about once a week when you open the settings. Firefox asks your permission first. The privacy policy explains exactly what is sent.", + "A fix for the Protection Dashboard: blocks from the gambling list built into Sieve were not being counted, only those from the downloaded list.", + ], + }, { version: "1.5.2", date: "November 2026", diff --git a/common/guardian-prompt.js b/common/guardian-prompt.js index d6c17ea..1376135 100644 --- a/common/guardian-prompt.js +++ b/common/guardian-prompt.js @@ -12,6 +12,9 @@ // With a cool-off set (common/cooloff.js) the change must first wait it // out: until then the dialog only offers to start or call off the wait, and // resolves false. Once the wait is over, the PIN is asked for as before. +// While a Seal runs (common/seal.js) the change is refused before +// any of that, and only the seal's emergency key — which ends the seal — +// gets through to the cool-off and the PIN. // // SieveGuardian.gateToggleOff(checkbox, actionName) -> Promise // Helper for on/off switches. Returns true if the change may proceed. @@ -271,6 +274,7 @@ cancelBtn.textContent = "Cancel"; codeExpected = ""; cool = null; + seal = null; stage = "pin"; } @@ -356,10 +360,104 @@ } } + // --- seal stage --------------------------------------------------------- + // + // Shown INSTEAD of everything else while a Seal runs. The change is refused; + // the one thing on offer is the seal's way out — a code from its witness, + // or its printed key — which ends the seal and hands over to the cool-off + // and the PIN exactly as if there had been no seal. + let seal = null; // SieveSeal.check()'s answer while it is showing + + const byWitness = () => !!seal && seal.exit === "witness"; + + function lockedLine(retryAt) { + const minutes = Math.max(1, Math.ceil((retryAt - Date.now()) / 60000)); + return `Too many wrong codes. Try again in ${minutes} min${minutes === 1 ? "" : "s"}.`; + } + + function showSealed(actionName, info) { + const S = window.SieveSeal; + const { title } = codeElements(); + stage = "sealed"; + seal = info; + title.textContent = `Sealed until ${S.formatDay(info.until)}`; + subEl.textContent = actionName || "This change is protected."; + input.hidden = true; + errorEl.hidden = true; + coolEl.hidden = false; + setCoolText([ + "You sealed your protection until ", + { strong: S.formatWhen(info.until) }, + byWitness() + ? ". Until then nothing that weakens it can be changed — not with your PIN, and not after a cool-off. Only a code from your witness ends it early." + : ". Until then nothing that weakens it can be changed — not with your PIN, and not after a cool-off. Only the emergency key ends it early.", + ]); + cancelBtn.textContent = byWitness() ? "Ask your witness" : "Use emergency key"; + confirmBtn.textContent = "Close"; + confirmBtn.focus(); + } + + function askForSealKey() { + const { title } = codeElements(); + stage = "sealkey"; + title.textContent = "End the seal early"; + setCoolText([ + byWitness() + ? "Ask your witness for the six digits their authenticator app shows for Sieve, or for one of their recovery codes. It ends the whole seal; your PIN and cool-off still apply after it." + : "Type the emergency key you were given when the seal started. It ends the whole seal; your PIN and cool-off still apply after it.", + ]); + input.hidden = false; + input.type = "text"; + input.classList.add("code-input"); + input.placeholder = byWitness() ? "123456 or XXXX-XXXX" : "XXXX-XXXX-XXXX-XXXX-XXXX"; + input.value = ""; + errorEl.hidden = false; + errorEl.textContent = seal && seal.lockedUntil ? lockedLine(seal.lockedUntil) : ""; + errorEl.dataset.tone = ""; + cancelBtn.textContent = "Back"; + confirmBtn.textContent = "End the seal"; + input.focus(); + } + + async function sealKeySubmit() { + // One code at a time (common/seal.js counts the wrong ones). + if (confirmBtn.disabled) return; + confirmBtn.disabled = true; + let result = { ok: false }; + try { + result = await window.SieveSeal.breakWith(input.value); + } catch (err) { + console.warn("[Sieve] could not check the seal's code:", err); + } finally { + confirmBtn.disabled = false; + } + if (result.ok) { + finish(true); + return; + } + if (result.locked) { + errorEl.textContent = lockedLine(result.retryAt); + } else { + errorEl.textContent = byWitness() ? "That code doesn't match. Ask for the newest one." : "That key doesn't match."; + } + errorEl.dataset.tone = ""; + input.value = ""; + input.focus(); + } + // The left-hand button: Cancel / Never mind, or — while a request is // waiting — Cancel request, which calls the change off. Always free, since - // it can only keep protection where it is. + // it can only keep protection where it is. On the seal it leads to the + // emergency key and back. async function dismiss() { + if (stage === "sealed") { + askForSealKey(); + return; + } + if (stage === "sealkey") { + showSealed(pending && pending.actionName, seal); + return; + } if (stage === "cooloff" && cool && cool.info.state !== "none") { try { await window.SieveCooloff.cancel(cool.info.key); @@ -371,6 +469,14 @@ } async function submit() { + if (stage === "sealed") { + finish(false); + return; + } + if (stage === "sealkey") { + await sealKeySubmit(); + return; + } if (stage === "cooloff") { await cooloffSubmit(); return; @@ -468,6 +574,33 @@ } } + // The running seal, or null when there is none (or this page did not load + // common/seal.js). A failed read goes on without it, as the cool-off does. + async function sealFor() { + const S = window.SieveSeal; + if (!S) return null; + try { + const info = await S.check(); + return info.sealed ? info : null; + } catch (err) { + console.warn("[Sieve] seal check failed, going on without it:", err); + return null; + } + } + + // Resolves true only when the emergency key ended the seal. + function askSealed(actionName, info, critical) { + build(); + if (pending) finish(false); + return new Promise((resolve) => { + pending = { resolve, actionName, critical, cooloffKey: null }; + resetToPinStage(); + raise(); + overlay.hidden = false; + showSealed(actionName, info); + }); + } + function askToWait(actionName, info, critical) { build(); if (pending) finish(false); @@ -487,6 +620,12 @@ async function confirmUnlock(actionName, opts) { const critical = !!(opts && opts.critical); + // A seal comes before everything else: while it runs, nothing that weakens + // protection goes through. Its emergency key ends it, and then the rest of + // the gate runs as usual. + const running = await sealFor(); + if (running && !(await askSealed(actionName, running, critical))) return false; + // The cool-off comes first and does not depend on a PIN: it is the lock // that still works for someone on their own. const cooloff = await cooloffFor(actionName); @@ -536,6 +675,8 @@ // Resolves true when no cool-off applies or the wait is over (using up the // request), false otherwise — so a caller can await it after its PIN check. async function requireCooloff(actionName) { + const running = await sealFor(); + if (running && !(await askSealed(actionName, running, true))) return false; const cooloff = await cooloffFor(actionName); if (!cooloff) return true; if (cooloff.state === "ready") { diff --git a/common/pro.js b/common/pro.js new file mode 100644 index 0000000..464b0cc --- /dev/null +++ b/common/pro.js @@ -0,0 +1,428 @@ +// common/pro.js +// Sieve — Sieve Pro, the one-time purchase that unlocks the Pro features. +// +// Every protection stays free, the Seal included. Pro adds comfort and insight +// on top (the urge screen, streaks), and this module answers one question for +// both: has this browser got a valid Pro licence? +// +// This file is open source on purpose, like BlockNSFW's shared/supporter.js: +// it is the one part of Pro that talks to the network, so anyone can read +// exactly what it sends. The features themselves are not open source; store +// builds copy them over the stand-ins in pro/ (pro/README.md). +// +// The licence is a key sold through Polar (polar.sh), which emails it to the +// buyer. It is checked against Polar's public licence endpoints, which need no +// secret and are made for apps that run on the buyer's own machine. A key +// works on a few browsers at once: Polar's activation limit on the licence-key +// benefit, set in Polar, as BlockNSFW's is. Entering the key takes one of its +// places, named for the browser ("Sieve · Edge on Windows"); "Remove from this +// browser" gives the place back, so the key can move. With no limit set in +// Polar, a key simply works wherever it is entered. Decisions that hold it up: +// +// - The only things ever sent are the key, Sieve's organisation id, that +// browser name, and this browser's place on the key; only from the +// settings page: when a key is entered or removed, then at most once a +// week. Never from a website, never from the popup. +// - Firefox asks before an extension sends anything off the device. The key +// is declared as optional "authenticationInfo" (manifest.firefox.json), so +// the question is asked of someone who presses Activate, and nobody else. +// Without that yes, nothing is sent. +// - Being offline is not being refunded. A network error, a timeout or a +// server error keeps whatever was last known; only a clear answer from +// Polar (revoked, disabled, unknown key, this browser's place given back) +// turns Pro off. +// - Losing Pro never weakens a protection. Nothing that protects asks this +// module anything, and nothing here clears or changes their state. +// +// Like the PIN, this lives in this browser's storage. It is not copy +// protection: anyone can edit an extension's code. The people who pay are the +// honest ones, and this is built for them. + +(() => { + "use strict"; + + if (window.SievePro) return; + + const LICENCE_KEY = "proLicence"; + + // From the Polar dashboard: Monolab's store, the one BlockNSFW's Supporter + // sells through too. `mode` is "live" for real purchases and "sandbox" for + // Polar's test store, which is a separate copy with its own organisation, + // product and benefit; a key from one does not open the other. Shipped + // builds are live; `build-chrome.ps1 -Sandbox` makes a test build that + // switches this one word in its own copy (build-pro.mjs). + const CONFIG = { + mode: "live", + stores: { + live: { + organizationId: "354a2f6c-8ea7-46a7-87c5-f97645c12e29", + // The benefit(s) that grant Sieve Pro. Required: every product in the + // store shares the organisation id, so this is what tells a Sieve Pro + // key from a BlockNSFW one. Until it is set, Pro cannot be activated. + benefitIds: [], + // Without it the settings page hides the Buy button. + checkoutUrl: "", + api: "https://api.polar.sh", + // Where buyers find their key and see the browsers it is on. + portal: "https://polar.sh/monolab/portal", + }, + sandbox: { + organizationId: "35c82b93-77a2-4b87-8478-39fc5dd4e666", + benefitIds: ["128feed7-d174-4ea4-a623-8bb26140935a"], + checkoutUrl: "https://sandbox-api.polar.sh/v1/checkout-links/polar_cl_nMckDrg0py2tVxqLjBPTm96ZqBomNzo7lS5nV2amxgc/redirect", + api: "https://sandbox-api.polar.sh", + portal: "https://sandbox.polar.sh/monolab/portal", + }, + }, + priceLabel: "$24.99", + }; + + function store() { + return CONFIG.stores[CONFIG.mode] || CONFIG.stores.live; + } + + const DAY = 24 * 60 * 60 * 1000; + const REFRESH_EVERY_MS = 7 * DAY; + const TIMEOUT_MS = 15000; + + // "granted" is the only status that unlocks anything. "invalid" is ours: a + // key Polar does not know, or one for a different product. "removed" is + // ours too: the key still works, but this browser's place on it was given + // back (on the purchases page, or every place was taken by the time a limit + // was set). + const STATUSES = ["granted", "revoked", "disabled", "invalid", "removed"]; + + const CONSENT = { data_collection: ["authenticationInfo"] }; + + function normalizeLicence(raw) { + if (!raw || typeof raw !== "object") return null; + const key = typeof raw.key === "string" ? raw.key.trim() : ""; + if (!key) return null; + const limit = Math.floor(Number(raw.limit)); + return { + key, + displayKey: typeof raw.displayKey === "string" && raw.displayKey ? raw.displayKey : maskKey(key), + status: STATUSES.includes(raw.status) ? raw.status : "invalid", + benefitId: typeof raw.benefitId === "string" ? raw.benefitId : "", + expiresAt: Number.isFinite(raw.expiresAt) ? raw.expiresAt : null, + checkedAt: Number.isFinite(raw.checkedAt) ? raw.checkedAt : 0, + activationId: typeof raw.activationId === "string" ? raw.activationId : "", + limit: limit > 0 ? limit : 0, + }; + } + + // "****-E304DA": enough to tell two keys apart, not enough to use one. + function maskKey(key) { + const tail = String(key).replace(/[^A-Za-z0-9]/g, "").slice(-6).toUpperCase(); + return tail ? `****-${tail}` : "****"; + } + + // A pure decision, so it can be tested without storage. + function isProState(licence, now = Date.now()) { + const l = normalizeLicence(licence); + if (!l || l.status !== "granted") return false; + return l.expiresAt === null || now < l.expiresAt; + } + + function isConfigured() { + const s = store(); + return !!s.organizationId && s.benefitIds.length > 0; + } + + function apiBase() { + return store().api; + } + + function portalUrl() { + return store().portal; + } + + function checkoutUrl() { + return store().checkoutUrl; + } + + // What this browser is called on the purchases page, so a buyer can tell + // their browsers apart: "Sieve · Edge on Windows". Nothing more. + function deviceLabel() { + const ua = typeof navigator !== "undefined" && navigator.userAgent ? navigator.userAgent : ""; + const browser = /Edg\//.test(ua) ? "Edge" : /Firefox\//.test(ua) ? "Firefox" : /OPR\//.test(ua) ? "Opera" : "Chrome"; + const os = /Android/.test(ua) ? "Android" : /Windows/.test(ua) ? "Windows" : /CrOS/.test(ua) ? "ChromeOS" + : /Mac OS X|Macintosh/.test(ua) ? "Mac" : /Linux/.test(ua) ? "Linux" : ""; + return `Sieve · ${browser}${os ? ` on ${os}` : ""}`; + } + + // --- Firefox's consent ------------------------------------------------------ + + // True only in the Firefox build, which declares the key as optional data. + function needsConsent() { + try { + const gecko = chrome.runtime.getManifest().browser_specific_settings; + const optional = gecko && gecko.gecko && gecko.gecko.data_collection_permissions + ? gecko.gecko.data_collection_permissions.optional + : null; + return Array.isArray(optional) && optional.includes("authenticationInfo"); + } catch { + return false; + } + } + + async function hasConsent() { + if (!needsConsent()) return true; + try { + return await chrome.permissions.contains(CONSENT); + } catch { + return true; // a Firefox older than its consent framework has nothing to ask + } + } + + // Must be called straight from a click, before anything is awaited: Firefox + // only shows its question in answer to the person's own action. + function askConsent() { + if (!needsConsent()) return Promise.resolve(true); + const older = (err) => !/user input|handler/i.test(String(err && err.message)); + try { + return Promise.resolve(chrome.permissions.request(CONSENT)).catch(older); + } catch (err) { + return Promise.resolve(older(err)); + } + } + + // --- Asking Polar ----------------------------------------------------------- + + // One request. { status, body } when Polar answered (body null when there was + // none to read), or { offline: true } when it did not. + async function call(path, payload) { + const controller = typeof AbortController === "function" ? new AbortController() : null; + const timer = controller ? setTimeout(() => controller.abort(), TIMEOUT_MS) : null; + let res; + try { + res = await fetch(`${apiBase()}${path}`, { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify(payload), + credentials: "omit", + cache: "no-store", + signal: controller ? controller.signal : undefined, + }); + } catch { + return { offline: true }; + } finally { + if (timer) clearTimeout(timer); + } + if (!res.ok || res.status === 204) return { status: res.status, body: null }; + try { + return { status: res.status, body: await res.json() }; + } catch { + return { offline: true }; // an answer that could not be read is no answer + } + } + + // A 4xx is Polar saying no: an unknown key (404), a malformed one (422), a + // key it will not validate (403). Rate limits and timeouts are not answers. + function saysNo(status) { + return status >= 400 && status < 500 && status !== 408 && status !== 429; + } + + const NO = { ok: true, status: "invalid", benefitId: "", displayKey: "", expiresAt: null, limit: 0 }; + + // Polar's answer, read into our own shape. + // { ok: true, status, benefitId, displayKey, expiresAt, limit } a clear answer + // { ok: false, offline: true, reason? } no clear answer + function readAnswer(body) { + const status = STATUSES.includes(body && body.status) ? body.status : "invalid"; + const benefitId = body && typeof body.benefit_id === "string" ? body.benefit_id : ""; + const wrongProduct = !store().benefitIds.includes(benefitId); + const expires = body && body.expires_at ? Date.parse(body.expires_at) : NaN; + const limit = Math.floor(Number(body && body.limit_activations)); + return { + ok: true, + status: wrongProduct ? "invalid" : status, + benefitId, + displayKey: body && typeof body.display_key === "string" ? body.display_key : "", + expiresAt: Number.isFinite(expires) ? expires : null, + limit: limit > 0 ? limit : 0, + }; + } + + async function validate(key, activationId) { + if (!isConfigured()) return { ok: false, offline: true, reason: "not-configured" }; + if (!(await hasConsent())) return { ok: false, offline: true, reason: "no-consent" }; + const payload = { key, organization_id: store().organizationId }; + if (activationId) payload.activation_id = activationId; + const r = await call("/v1/customer-portal/license-keys/validate", payload); + if (r.offline) return { ok: false, offline: true }; + if (r.status >= 200 && r.status < 300 && r.body) return readAnswer(r.body); + if (saysNo(r.status)) return NO; + return { ok: false, offline: true }; + } + + // Takes one of the key's places for this browser. + // { ok: true, activationId } | { ok: false, status: "full" | "invalid", limit? } | { ok: false, offline: true } + async function takePlace(key, limit) { + const r = await call("/v1/customer-portal/license-keys/activate", { + key, + organization_id: store().organizationId, + label: deviceLabel(), + }); + if (r.offline) return { ok: false, offline: true }; + if (r.status === 403) return { ok: false, status: "full", limit }; + if (r.status >= 200 && r.status < 300 && r.body && r.body.id) return { ok: true, activationId: String(r.body.id) }; + if (saysNo(r.status)) return { ok: false, status: "invalid" }; + return { ok: false, offline: true }; + } + + // Granted, but run out, reads as revoked: either way the key no longer opens Pro. + function statusOf(answer, now) { + if (answer.status === "granted" && answer.expiresAt !== null && now >= answer.expiresAt) return "revoked"; + return answer.status; + } + + function licenceFrom(key, answer, now, activationId, status = statusOf(answer, now)) { + return normalizeLicence({ + key, + displayKey: answer.displayKey || maskKey(key), + status, + benefitId: answer.benefitId, + expiresAt: answer.expiresAt, + checkedAt: now, + activationId, + limit: answer.limit, + }); + } + + async function getLicence() { + const stored = await chrome.storage.local.get(LICENCE_KEY); + return normalizeLicence(stored[LICENCE_KEY]); + } + + async function isPro(now = Date.now()) { + try { + return isProState(await getLicence(), now); + } catch { + return false; + } + } + + async function keep(licence) { + await chrome.storage.local.set({ [LICENCE_KEY]: licence }); + return licence; + } + + // Enter a key from the settings page (after askConsent, in Firefox). Only a + // granted key is kept: a mistyped one should not replace a good licence. + // { ok: true } Pro is on + // { ok: false, status } Polar said no ("full": every place taken) + // { ok: false, offline: true, reason? } could not ask; try again later + async function activate(rawKey, now = Date.now()) { + const key = String(rawKey == null ? "" : rawKey).trim(); + if (!key) return { ok: false, status: "invalid" }; + + // The same key entered again here keeps its place rather than taking a second. + const held = await getLicence(); + if (held && held.key === key && held.activationId && held.status !== "removed") { + const again = await validate(key, held.activationId); + if (!again.ok) return again; + if (statusOf(again, now) === "granted") { + await keep(licenceFrom(key, again, now, held.activationId)); + return { ok: true }; + } + } + + const answer = await validate(key); + if (!answer.ok) return answer; + const status = statusOf(answer, now); + if (status !== "granted") return { ok: false, status }; + + let activationId = ""; + if (answer.limit > 0) { + const place = await takePlace(key, answer.limit); + if (!place.ok) return place; + activationId = place.activationId; + } + await keep(licenceFrom(key, answer, now, activationId)); + return { ok: true }; + } + + // Re-check a granted licence once it is a week old. A refund shows up as + // "revoked" and a place given back as "removed"; both are kept (so the + // settings page can say what happened) rather than deleted. + async function refreshIfDue(now = Date.now()) { + const licence = await getLicence(); + if (!licence || licence.status !== "granted") return { checked: false }; + // A clock moved backwards would otherwise postpone the check for as long + // as it was moved; checking early costs nothing. + const age = now - licence.checkedAt; + if (age >= 0 && age < REFRESH_EVERY_MS) return { checked: false }; + + const { key, activationId } = licence; + const done = async (next) => ({ checked: true, status: (await keep(next)).status }); + const answer = await validate(key, activationId); + if (!answer.ok) return { checked: false, offline: true }; + + if (statusOf(answer, now) === "granted") { + if (answer.limit > 0 && !activationId) { + // Polar's limit came in after this key was entered here. + const place = await takePlace(key, answer.limit); + if (place.ok) return done(licenceFrom(key, answer, now, place.activationId)); + if (place.status) return done(licenceFrom(key, answer, now, "", place.status === "full" ? "removed" : "invalid")); + return { checked: false, offline: true }; + } + return done(licenceFrom(key, answer, now, activationId)); + } + + if (activationId) { + // A no, asked with this browser's place: either the key is over, or only + // the place was given back. Asked again without it to tell which. + const plain = await validate(key); + if (!plain.ok) return { checked: false, offline: true }; + if (statusOf(plain, now) === "granted") return done(licenceFrom(key, plain, now, "", "removed")); + return done(licenceFrom(key, plain, now, "")); + } + return done(licenceFrom(key, answer, now, "")); + } + + // "Remove from this browser": gives this browser's place on the key back, + // then forgets the key here. Offline, nothing changes: forgetting the key + // without telling Polar would leave the place taken. Needs no gate: Pro + // going away never weakens a protection that is already running. + // { ok: true } | { ok: false, offline: true } + async function release() { + const licence = await getLicence(); + if (licence && licence.activationId && licence.status === "granted") { + if (!(await hasConsent())) return { ok: false, offline: true, reason: "no-consent" }; + const r = await call("/v1/customer-portal/license-keys/deactivate", { + key: licence.key, + organization_id: store().organizationId, + activation_id: licence.activationId, + }); + // 404: Polar has no such place any more, which is what was asked for. + const given = !r.offline && ((r.status >= 200 && r.status < 300) || r.status === 404); + if (!given) return { ok: false, offline: true }; + } + await chrome.storage.local.remove(LICENCE_KEY); + return { ok: true }; + } + + window.SievePro = { + LICENCE_KEY, + CONFIG, + REFRESH_EVERY_MS, + normalizeLicence, + maskKey, + isProState, + isConfigured, + apiBase, + portalUrl, + checkoutUrl, + deviceLabel, + needsConsent, + hasConsent, + askConsent, + getLicence, + isPro, + validate, + activate, + refreshIfDue, + release, + }; +})(); diff --git a/common/qr.js b/common/qr.js new file mode 100644 index 0000000..5ecefb7 --- /dev/null +++ b/common/qr.js @@ -0,0 +1,408 @@ +// common/qr.js +// A small QR Code encoder, so a Seal's witness can scan its key into their +// authenticator app. Sieve loads nothing from a CDN, so this is written here +// instead of vendored. +// +// Scope is deliberately narrow: byte mode, error correction level M, +// versions 1 to 10 (up to 213 bytes; an otpauth:// key is about 90). The +// structure follows ISO/IEC 18004 and the layout of Project Nayuki's QR Code +// generator (MIT), re-implemented for this one use. It returns a matrix of +// booleans (true = dark); the page draws it. +// +// Ported from BlockNSFW's shared/qr.js, kept as it is there. Loaded as a +// classic + + + + + + + + + + + + diff --git a/options/options.js b/options/options.js index 218af32..71aac67 100644 --- a/options/options.js +++ b/options/options.js @@ -592,6 +592,21 @@ function optionsDefaults() { seenWhatsNewVersion: "", // Warden band on the Overview — folded to its one-line bar by the × wardenFolded: false, + // The Seal (common/seal.js), and Sieve Pro: the licence (common/pro.js), + // the urge screen and streaks (pro/streaks.js), and the note about a + // voice message (pro/voice.js). The urge screen's photo has its own key, + // read separately, and the sound lives in IndexedDB, so this batch never + // carries an image or a recording. + proLicence: null, + proSeal: null, + proUrge: {}, + proHabits: {}, + habitAttempts: {}, + proVoice: null, + // Plans, things to do instead, and the heads-up (pro/coach.js). + proPlans: null, + proInstead: null, + proHeadsUp: null, }; for (const t of DARK_PATTERN_TYPES) { d[t.key] = t.default !== undefined ? t.default : true; @@ -725,6 +740,8 @@ async function applyStoredSettings(store) { setupGuardian(store); // self-lock PIN status panel setupAccessCode(); // optional second layer over that PIN setupCooloff(store); // a wait before any weakening change unlocks + setupSeal(store); // lock protection until a date (free) + setupPro(store); // Sieve Pro: licence, urge screen, streaks setupDarkPatterns(store); // Module 3A — relocated from the popup setupToxicSites(store); // per-site toggles — relocated from the popup @@ -2157,6 +2174,448 @@ function setupCooloff(store) { renderRequests(); } +// =========================================================================== +// The Seal — lock protection until a date (common/seal.js). Free, like every +// other protection. Starting or extending a seal strengthens protection, so +// neither goes through the Guardian gate; there is no control that shortens +// one. Refusing weakening changes while it runs happens in the gate itself +// (common/guardian-prompt.js), so this group only starts, shows and extends. +// =========================================================================== + +const SEAL_DAY_MS = 24 * 60 * 60 * 1000; +const SVG_NS = "http://www.w3.org/2000/svg"; + +// The witness's QR code, drawn as one SVG path (common/qr.js). Always dark +// on white, whatever the page's theme: that is what a camera reads. +function drawSealQr(container, text) { + const qr = window.SieveQr.encode(text); + const span = qr.size + 8; // the four-module quiet zone on each side + const svg = document.createElementNS(SVG_NS, "svg"); + svg.setAttribute("viewBox", `0 0 ${span} ${span}`); + svg.setAttribute("shape-rendering", "crispEdges"); + svg.setAttribute("aria-hidden", "true"); + const paper = document.createElementNS(SVG_NS, "rect"); + paper.setAttribute("width", String(span)); + paper.setAttribute("height", String(span)); + paper.setAttribute("fill", "#ffffff"); + const ink = document.createElementNS(SVG_NS, "path"); + ink.setAttribute("d", window.SieveQr.toPath(qr)); + ink.setAttribute("fill", "#000000"); + svg.append(paper, ink); + container.replaceChildren(svg); +} + +// Print one part of the seal (its key, or the witness's sheet) and nothing +// else on the page (options.css, html.print-seal). +function printSealPart(el) { + const root = document.documentElement; + el.classList.add("is-printing"); + root.classList.add("print-seal"); + window.addEventListener( + "afterprint", + () => { + root.classList.remove("print-seal"); + el.classList.remove("is-printing"); + }, + { once: true }, + ); + window.print(); +} + +function setupSeal(store) { + const S = window.SieveSeal; + const badge = document.getElementById("seal-badge"); + const boxes = { + start: document.getElementById("seal-start"), + confirm: document.getElementById("seal-confirm"), + key: document.getElementById("seal-key-box"), + running: document.getElementById("seal-running"), + }; + const lengthEl = document.getElementById("seal-length"); + const beginBtn = document.getElementById("seal-begin"); + const confirmText = document.getElementById("seal-confirm-text"); + const cancelBtn = document.getElementById("seal-cancel"); + const goBtn = document.getElementById("seal-go"); + const witnessBox = document.getElementById("seal-witness"); + const witnessHead = document.getElementById("seal-witness-print-head"); + const qrBox = document.getElementById("seal-qr"); + const secretEl = document.getElementById("seal-secret"); + const recoveryList = document.getElementById("seal-recovery"); + const codeInput = document.getElementById("seal-witness-code"); + const codeError = document.getElementById("seal-witness-error"); + const printWitnessBtn = document.getElementById("seal-print-witness"); + const keyBox = boxes.key; + const keyEl = document.getElementById("seal-key"); + const printHead = document.getElementById("seal-print-head"); + const printBtn = document.getElementById("seal-print"); + const doneBtn = document.getElementById("seal-key-done"); + const runningText = document.getElementById("seal-running-text"); + const runningHint = document.getElementById("seal-running-hint"); + const extendLength = document.getElementById("seal-extend-length"); + const extendBtn = document.getElementById("seal-extend"); + + let current = S.stateOf(store.proSeal) === "sealed" ? S.normalizeSeal(store.proSeal) : null; + // "start" | "confirm" | "key". The key stays on screen until it is put away, + // even though the seal is already running underneath it. + let mode = "start"; + // The witness's key and recovery codes while pairing, and only then: never + // stored until their app shows a code that works, and wiped from the page + // once the seal starts or the pairing is called off. + let pairing = null; + + const exitChosen = () => { + const picked = document.querySelector('input[name="sealExit"]:checked'); + return picked ? picked.value : "witness"; + }; + + function show(name) { + for (const [k, box] of Object.entries(boxes)) box.hidden = k !== name; + } + + function clearPairing() { + pairing = null; + qrBox.replaceChildren(); + secretEl.textContent = ""; + recoveryList.replaceChildren(); + witnessHead.textContent = ""; + codeInput.value = ""; + codeError.textContent = ""; + witnessBox.hidden = true; + printWitnessBtn.hidden = true; + } + + function render() { + const now = Date.now(); + const sealed = !!current && now < current.until; + // A running seal is a protection switched on, so it is the green badge. + badge.textContent = sealed ? "On" : "Off"; + badge.classList.toggle("on", sealed); + if (mode === "key") return show("key"); + if (sealed) { + mode = "start"; + const days = Math.ceil((current.until - now) / SEAL_DAY_MS); + runningText.textContent = + `Sealed until ${S.formatWhen(current.until)} — ${days === 1 ? "1 day" : `${days} days`} to go.`; + if (current.exit === "witness") { + const left = current.witness.recovery.filter((r) => !r.used).length; + runningHint.textContent = + "Your witness holds the way out. To end it early, try any protected change, choose " + + `“Ask your witness” and type the code their app shows (or one of their ${left} recovery codes). ` + + "Your PIN and cool-off apply again after it."; + } else { + runningHint.textContent = + "Your printed key is the way out. To end it early, try any protected change and choose " + + "“Use emergency key”. Your PIN and cool-off apply again after it."; + } + return show("running"); + } + show(mode === "confirm" ? "confirm" : "start"); + } + + beginBtn.addEventListener("click", () => { + const until = Date.now() + Number(lengthEl.value) * SEAL_DAY_MS; + const exit = exitChosen(); + confirmText.textContent = + `Seal your protection until ${S.formatWhen(until)}? Until then you will not be able to ` + + "switch a blocker off, allow a site, remove your PIN or shorten your cool-off. " + + (exit === "witness" ? "Only a code from your witness will end it early." : "Only the emergency key will end it early."); + clearPairing(); + if (exit === "witness") { + pairing = S.pairWitness(); + drawSealQr(qrBox, pairing.uri); + secretEl.textContent = window.SieveTotp.formatSecret(pairing.secret); + for (const code of pairing.recoveryCodes) { + const li = document.createElement("li"); + li.textContent = code; + recoveryList.appendChild(li); + } + witnessHead.textContent = + `Sieve · you are the witness for a seal that ends ${S.formatWhen(until)}. When they ask, ` + + "read them the six digits your authenticator app shows for “Sieve: Seal”, or one of these codes."; + witnessBox.hidden = false; + printWitnessBtn.hidden = false; + } + mode = "confirm"; + render(); + (exit === "witness" ? codeInput : goBtn).focus(); + }); + + cancelBtn.addEventListener("click", () => { + clearPairing(); + mode = "start"; + render(); + beginBtn.focus(); + }); + + goBtn.addEventListener("click", async () => { + const days = Number(lengthEl.value); + goBtn.disabled = true; + let result; + try { + result = pairing ? await S.startWithWitness(days, pairing, codeInput.value) : await S.start(days); + } catch (err) { + console.warn("[Sieve] could not start the seal:", err); + result = { ok: false }; + } + goBtn.disabled = false; + if (result.reason === "wrong-code") { + codeError.textContent = "That code doesn't match. Check the app shows “Sieve: Seal”, and type the newest code."; + codeInput.select(); + return; + } + if (!result.ok) { + clearPairing(); + mode = "start"; + render(); + return; + } + if (pairing) { + // Running now; the witness's key and codes leave the page. + clearPairing(); + mode = "start"; + render(); + return; + } + keyEl.textContent = result.key; + printHead.textContent = + `Sieve · emergency key for the seal that ends ${S.formatWhen(result.until)}. ` + + "Typing it into Sieve ends the seal early."; + mode = "key"; + render(); + doneBtn.focus(); + }); + + codeInput.addEventListener("keydown", (e) => { + if (e.key === "Enter") goBtn.click(); + }); + + // Print one part of the seal alone, not the settings page around it. + printBtn.addEventListener("click", () => printSealPart(keyBox)); + printWitnessBtn.addEventListener("click", () => printSealPart(witnessBox)); + + doneBtn.addEventListener("click", () => { + // Gone from the page as well as from storage: it was shown once. + keyEl.textContent = ""; + printHead.textContent = ""; + mode = "start"; + render(); + }); + + extendBtn.addEventListener("click", async () => { + try { + await S.extend(Number(extendLength.value)); + } catch (err) { + console.warn("[Sieve] could not extend the seal:", err); + } + }); + + chrome.storage.onChanged.addListener((changes, area) => { + if (area !== "local" || !changes[S.SEAL_KEY]) return; + const next = changes[S.SEAL_KEY].newValue; + current = S.stateOf(next) === "sealed" ? S.normalizeSeal(next) : null; + render(); + }); + + // Days to go, and the moment a seal ends. + setInterval(render, 60 * 1000); + + return { render }; +} + +// =========================================================================== +// Sieve Pro — the licence box, and the section the Pro features live in. +// Everything that protects stays free and open source, the Seal included. The +// Pro features (the urge screen, streaks) are not: a store build copies them +// from a private repository over the empty stand-ins in pro/ (see +// pro/README.md). An open-source build keeps the stand-ins, so this section is +// taken out of the page, and every protection works exactly the same. +// +// In a store build the groups are shown to everyone and work only with a +// licence. +// =========================================================================== + +function proShortDate(ms) { + try { + return new Date(ms).toLocaleDateString(undefined, { day: "numeric", month: "short", year: "numeric" }); + } catch { + return new Date(ms).toDateString(); + } +} + +function setupPro(store) { + const P = window.SievePro; + // pro/features.js names the features this build carries: null in an + // open-source build, where pro/settings.js is an empty stand-in as well. + const carried = Array.isArray(window.SieveProFeatures) && window.SieveProFeatures.length > 0; + if (!P || !carried || !window.SieveProSettings) { + // Gone before setupNav and setupFinder run, so no link, search or deep + // link can open a section with nothing in it. + const section = document.getElementById("section-pro"); + if (section) section.remove(); + return; + } + + let pro = P.isProState(store.proLicence); + + for (const el of document.querySelectorAll(".pro-price")) el.textContent = P.CONFIG.priceLabel; + + // The section's link appears once Pro is on sale, or once a key is stored, + // so a build shipped before the shop opens shows nobody a dead end. + const navShown = P.isConfigured() || !!P.normalizeLicence(store.proLicence); + document.getElementById("nav-pro-group").hidden = !navShown; + document.getElementById("nav-pro").hidden = !navShown; + + // Each Pro group returns its render(pro); this page needs no list of them. + const groups = Object.values(window.SieveProSettings.setup(store) || {}); + enhanceSwitchRows(document.getElementById("section-pro")); + + function applyPro() { + for (const card of document.querySelectorAll(".pro-feature")) { + card.classList.toggle("is-locked", !pro); + const note = card.querySelector(".pro-note"); + if (note) note.hidden = pro; + for (const control of card.querySelectorAll(".pro-control")) control.disabled = !pro; + } + for (const group of groups) if (group && typeof group.render === "function") group.render(pro); + } + + setupLicence(store, (next) => { + pro = next; + applyPro(); + }); + applyPro(); +} + +function setupLicence(store, onChange) { + const P = window.SievePro; + const badge = document.getElementById("pro-badge"); + const buyActions = document.getElementById("pro-buy-actions"); + const buyLink = document.getElementById("pro-buy"); + const buyField = document.getElementById("pro-buy-field"); + const ownedField = document.getElementById("pro-owned-field"); + const ownedText = document.getElementById("pro-owned-text"); + const checkedEl = document.getElementById("pro-checked"); + const keyInput = document.getElementById("pro-key"); + const activateBtn = document.getElementById("pro-activate"); + const errorEl = document.getElementById("pro-error"); + const forgetBtn = document.getElementById("pro-forget"); + const forgetError = document.getElementById("pro-forget-error"); + const forgetHint = document.getElementById("pro-forget-hint"); + const portalLink = document.getElementById("pro-portal"); + + if (P.checkoutUrl()) { + buyLink.href = P.checkoutUrl(); + buyActions.hidden = false; + } + portalLink.href = P.portalUrl(); + + const CONSENT_MSG = "Firefox asks before Sieve sends the key to Polar to check it. Press Activate again and choose Allow."; + + function render(raw) { + const licence = P.normalizeLicence(raw); + const on = P.isProState(licence); + badge.textContent = on ? "Pro" : "Free"; + badge.classList.toggle("badge-new", on); + buyField.hidden = on; + ownedField.hidden = !licence; + if (!licence) return; + const key = licence.displayKey; + if (on) { + const places = licence.limit + ? ` It works in up to ${licence.limit} browsers at once; this one is “${P.deviceLabel()}”.` + : ""; + ownedText.textContent = `Pro is on, with key ${key}.${places} Thank you for supporting Sieve.`; + } else if (licence.status === "removed") { + ownedText.textContent = + `This browser's place on key ${key} was given back, so Pro is off here. ` + + "Enter the key again to take a place back, if one is free."; + } else if (licence.status === "revoked" || licence.status === "disabled") { + ownedText.textContent = + `Key ${key} was refunded or turned off, so Pro is off. ` + + "A seal you already started still runs to its date."; + } else { + ownedText.textContent = `Key ${key} is not a Sieve Pro key, so Pro is off.`; + } + forgetHint.hidden = !(on && licence.activationId); + checkedEl.textContent = licence.checkedAt ? `Last checked ${proShortDate(licence.checkedAt)}` : ""; + } + + async function activate() { + const key = keyInput.value.trim(); + errorEl.textContent = ""; + if (!key) { + errorEl.textContent = "Paste the licence key from your receipt email."; + return; + } + // Firefox's question has to come straight from this click, before + // anything else is awaited. Everywhere else it is a yes at once. + const consent = P.askConsent(); + activateBtn.disabled = true; + activateBtn.textContent = "Checking…"; + let result; + try { + result = (await consent) ? await P.activate(key) : { ok: false, offline: true, reason: "no-consent" }; + } catch { + result = { ok: false, offline: true }; + } + activateBtn.disabled = false; + activateBtn.textContent = "Activate"; + if (result.ok) { + keyInput.value = ""; // the storage listener below shows the rest + } else if (result.reason === "not-configured") { + errorEl.textContent = "Sieve Pro is not on sale yet."; + } else if (result.reason === "no-consent") { + errorEl.textContent = CONSENT_MSG; + } else if (result.offline) { + errorEl.textContent = "Could not reach the licence check. Check your connection and try again."; + } else if (result.status === "full") { + const where = result.limit === 1 ? "one browser" : `${result.limit || "as many"} browsers`; + errorEl.textContent = + `That key is already in ${where}, as many as it allows. Remove it from one of them first: ` + + "in Sieve's settings there, or on your purchases page."; + } else if (result.status === "revoked" || result.status === "disabled") { + errorEl.textContent = "That key was refunded or turned off."; + } else { + errorEl.textContent = "That key was not recognised. Check it against your receipt email."; + } + } + + activateBtn.addEventListener("click", activate); + keyInput.addEventListener("keydown", (e) => { + if (e.key === "Enter") activate(); + }); + + // Pro going away weakens no protection, so taking the key out is not gated. + forgetBtn.addEventListener("click", async () => { + forgetError.textContent = ""; + forgetBtn.disabled = true; + let result; + try { + result = await P.release(); + } catch { + result = { ok: false, offline: true }; + } + forgetBtn.disabled = false; + if (!result.ok) { + forgetError.textContent = + result.reason === "no-consent" + ? "Firefox no longer lets Sieve send the key, so this browser keeps its place. Allow it in Firefox's add-on settings, or free the place on your purchases page." + : "Could not reach the licence check, so this browser keeps its place. Try again when you're online."; + } + }); + + chrome.storage.onChanged.addListener((changes, area) => { + if (area !== "local" || !changes[P.LICENCE_KEY]) return; + const next = changes[P.LICENCE_KEY].newValue; + render(next); + onChange(P.isProState(next)); + }); + + render(store.proLicence); + // The weekly re-check: a no-op on most loads, and never in the page's way. + P.refreshIfDue().catch((err) => console.warn("[Sieve] licence check failed:", err)); +} + // =========================================================================== // Doomscroll Stopper (Module 2A) — per-site tracking, limits, today's stats. // =========================================================================== diff --git a/package.json b/package.json index f089ea3..b6b0edb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sieve", - "version": "1.5.1", + "version": "1.6.0", "private": true, "description": "Build tooling for Sieve's optional TensorFlow.js toxicity model (Module 4A, Layer 2). The extension itself is plain JS loaded directly by the manifest; only the optional Layer-2 bundle is produced by esbuild.", "scripts": { @@ -9,7 +9,8 @@ "build:chrome": "powershell -ExecutionPolicy Bypass -File ./build-chrome.ps1 -Bundle -Zip", "build:firefox": "powershell -ExecutionPolicy Bypass -File ./build-firefox.ps1 -Bundle -Zip", "build:all": "npm run build:chrome && npm run build:firefox", - "test": "node --test test/*-test.mjs" + "test": "node --test test/*-test.mjs", + "test:pro": "node --test pro-private/tests/*-test.mjs" }, "devDependencies": { "esbuild": "^0.25.0" diff --git a/pages/blocked.html b/pages/blocked.html index 23b4d4c..3a6d606 100644 --- a/pages/blocked.html +++ b/pages/blocked.html @@ -309,6 +309,7 @@ background: transparent; border: 1px solid var(--rule-strong); border-radius: 3px; + text-decoration: none; cursor: pointer; transition: background-color 120ms var(--ease), border-color 120ms var(--ease), color 120ms var(--ease), transform 80ms var(--ease); @@ -373,6 +374,1462 @@ color: var(--ink-3); } + /* ---- Urge screen (Sieve Pro, pro/urge.js) ---------------------------------- + Leads the page instead of the notice's headline when it is on: a + breathing ring, a count, the reader's own reason and photo, and one + tap to someone they trust. Ink only — nothing here is "on". */ + + .urge { + display: flex; + flex-direction: column; + margin-bottom: 36px; + } + + /* The markup holds two pages, the words and the instrument, for the + spread below. In one column they step aside and the order puts the + ring back under the headline, where it has always been. */ + .urge-words, + .urge-instrument { + display: contents; + } + + .urge-stage, + .urge-design, + .urge-count, + .urge-proof { + order: 1; + } + + .urge-instead, + .urge-debrief, + .urge-debrief-done, + .urge-why { + order: 2; + } + + .urge-streak { + order: 3; + } + + .urge-actions { + order: 4; + } + + .urge-hour { + margin: 12px 0 0; + max-width: 46ch; + font-size: 14px; + line-height: 1.5; + color: var(--ink-2); + } + + .urge-stage { + position: relative; + width: 168px; + margin-top: 32px; + } + + .breath { + position: relative; + display: grid; + place-items: center; + width: 168px; + height: 168px; + } + + /* Proof it passes: the breathing ring sits inside the dial of the urges + already waited out, each a dot at the minute it passed. The ring at + its fullest stays inside the innermost dots. */ + .urge-stage.has-dial { + display: grid; + place-items: center; + width: min(320px, 100%); + aspect-ratio: 1; + } + + .urge-stage.has-dial .breath { + width: 41%; + height: 41%; + } + + .urge-stage.has-dial .breath-word { + max-width: 78%; + font-size: 15px; + line-height: 1.2; + text-align: center; + } + + .urge-stage.has-dial + .urge-design + .urge-count { + width: min(320px, 100%); + } + + .dial { + position: absolute; + inset: 0; + width: 100%; + height: 100%; + overflow: visible; + } + + .dial-ring { + fill: none; + stroke: var(--rule-strong); + stroke-width: 1; + } + + .dial-tick { + stroke: var(--ink-3); + stroke-width: 1; + } + + .dial-label { + font-family: var(--font-mono); + font-size: 11px; + fill: var(--ink-3); + } + + .dial-arc { + fill: none; + stroke: var(--ink); + stroke-width: 2; + } + + .dial-hand { + stroke: var(--ink); + stroke-width: 1.5; + stroke-linecap: round; + } + + .dial-usual { + stroke: var(--ink-2); + stroke-width: 3; + } + + .dial-dot { + fill: var(--ink-3); + } + + .dial-dot.is-ahead { + fill: none; + stroke: var(--ink-3); + stroke-width: 1; + } + + .dial-dot.is-passed, + .dial-new { + fill: var(--ink); + } + + .urge-proof { + margin: 14px 0 0; + max-width: 46ch; + font-size: 15px; + line-height: 1.5; + color: var(--ink-2); + } + + .urge-voice { + margin-top: 14px; + } + + /* ---- Urge screen designs (pro/designs.js) ---------------------------- + The ensō: the Zen circle drawn one breath at a time; ink on paper, and + the page signed in ink after the fifth breath. The river: tiles turned + until the ink runs from the spring to the sea. */ + + .urge-design { + margin-top: 28px; + } + + .btn-link { + margin-top: 8px; + padding: 0; + border: 0; + background: none; + color: var(--ink); + font: inherit; + font-size: 14px; + text-decoration: underline; + text-underline-offset: 3px; + cursor: pointer; + } + + .enso-stage { + display: flex; + align-items: flex-end; + gap: 14px; + } + + .enso-frame { + position: relative; + width: min(calc(100% - 3rem), 22rem); + aspect-ratio: 1; + } + + .enso { + display: block; + width: 100%; + height: 100%; + overflow: visible; + } + + .enso-path { + fill: none; + stroke: var(--rule-strong); + stroke-width: 1.2; + } + + .enso-stroke { + fill: none; + stroke: var(--ink); + stroke-linecap: round; + } + + .enso-bristle { + opacity: 0.4; + } + + .enso-dry circle { + fill: none; + stroke: var(--paper); + } + + .enso-pool, + .enso-drops circle { + fill: var(--ink); + } + + /* The breath drives the brush: the in-breath takes it halfway round, the + longer out-breath closes it, and between breaths the ink fades. */ + .enso-ink { + opacity: 0; + } + + .enso-stage[data-phase="in"] .enso-ink, + .enso-stage[data-phase="out"] .enso-ink, + .enso-stage[data-phase="done"] .enso-ink { + opacity: 1; + } + + .enso-stage[data-phase="rest"] .enso-ink { + transition: opacity 0.9s var(--ease); + } + + .enso-stage[data-phase="in"] .enso-stroke { + transition: stroke-dashoffset 4s cubic-bezier(0.35, 0, 0.6, 1); + } + + .enso-stage[data-phase="out"] .enso-stroke { + transition: stroke-dashoffset 6s cubic-bezier(0.25, 0, 0.35, 1); + } + + .enso-hold { + position: absolute; + inset: 8%; + padding: 0; + border: 0; + border-radius: 50%; + background: transparent; + cursor: pointer; + touch-action: none; + user-select: none; + -webkit-user-select: none; + -webkit-touch-callout: none; + -webkit-tap-highlight-color: transparent; + } + + .enso-hold:focus-visible { + outline: 2px solid var(--ink); + outline-offset: 6px; + } + + .enso-cue { + position: absolute; + inset: 0; + display: grid; + place-items: center; + font-family: var(--font-serif); + font-size: 17px; + color: var(--ink-2); + pointer-events: none; + } + + .enso-stage[data-phase="done"] .enso-cue { + opacity: 0; + } + + /* On a wide screen the breath is named under the circle once it has + begun; on a phone it stays inside, where the thumb and eyes are. */ + @media (min-width: 561px) { + .enso-stage:not([data-phase="idle"]) .enso-cue { + opacity: 0; + } + } + + .enso-signature { + display: flex; + flex-direction: column; + align-items: center; + gap: 10px; + padding-bottom: 6%; + } + + .enso-inscription { + margin: 0; + writing-mode: vertical-rl; + font-family: var(--font-mono); + font-size: 10px; + letter-spacing: 0.15em; + text-transform: uppercase; + color: var(--ink-3); + } + + .enso-seal { + flex: none; + width: 2rem; + height: 2rem; + opacity: 0; + transform: scale(1.1); + transition: + opacity 0.3s var(--ease), + transform 0.3s var(--ease); + } + + .enso-stage[data-phase="done"] .enso-seal { + opacity: 1; + transform: none; + } + + .enso-stage.is-still .enso-seal { + transform: none; + } + + .enso-seal-stone { + fill: var(--ink); + } + + .enso-seal-cut { + fill: none; + stroke: var(--paper); + stroke-width: 2.4; + stroke-linecap: round; + } + + .enso-seal-border { + stroke-width: 1.1; + } + + /* Where the seal will go, marked until it lands. */ + .enso-seal-place { + display: grid; + border-radius: 2px; + outline: 1px dashed var(--rule-strong); + transition: outline-color 0.3s var(--ease); + } + + .enso-stage[data-phase="done"] .enso-seal-place { + outline-color: transparent; + } + + /* How far through the breath (pro/designs.js): in for four seconds, + out for six, filled from the stage's phase, as the brush is. */ + .enso-timing { + display: flex; + align-items: center; + gap: 10px; + margin-top: 8px; + } + + .enso-time-label { + font-family: var(--font-mono); + font-size: 10px; + letter-spacing: 0.1em; + text-transform: uppercase; + color: var(--ink-3); + } + + .enso-time-in, + .enso-time-out { + position: relative; + display: block; + height: 2px; + background: var(--rule); + overflow: hidden; + } + + .enso-time-in { + width: 64px; + } + + .enso-time-out { + width: 96px; + } + + .enso-time-in > span, + .enso-time-out > span { + position: absolute; + top: 0; + bottom: 0; + left: 0; + width: 0; + background: var(--ink); + } + + .enso-stage[data-phase="in"] ~ .enso-timing .enso-time-in > span { + width: 100%; + transition: width 4s linear; + } + + .enso-stage[data-phase="out"] ~ .enso-timing .enso-time-in > span, + .enso-stage[data-phase="rest"] ~ .enso-timing .enso-time-in > span, + .enso-stage[data-phase="rest"] ~ .enso-timing .enso-time-out > span { + width: 100%; + } + + .enso-stage[data-phase="out"] ~ .enso-timing .enso-time-out > span { + width: 100%; + transition: width 6s linear; + } + + .enso-stage[data-phase="done"] ~ .enso-timing { + display: none; + } + + .enso-phase { + margin: 16px 0 0; + min-height: 1.3em; + font-family: var(--font-serif); + font-size: 19px; + } + + .enso-tally { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 8px 12px; + margin-top: 10px; + } + + .enso-slots { + display: flex; + gap: 8px; + } + + .enso-slot { + width: 2rem; + height: 2rem; + overflow: visible; + } + + .enso-slot-guide { + fill: none; + stroke: var(--ink-3); + stroke-width: 1.2; + stroke-dasharray: 1.4 3.2; + } + + .enso-slot.is-drawn .enso-slot-guide { + display: none; + } + + .enso-slot-ink { + fill: none; + stroke: var(--ink); + stroke-linecap: round; + } + + .enso-count, + .river-moves { + font-family: var(--font-mono); + font-size: 12px; + letter-spacing: 0.04em; + font-variant-numeric: tabular-nums; + color: var(--ink-3); + } + + .enso-done { + margin-top: 14px; + } + + .enso-done-line, + .river-status { + margin: 0; + font-size: 15px; + line-height: 1.5; + } + + /* The river as a map (pro/designs.js): the tiles lie on an inked map, + 100 units to a tile, with the spring and its hills in the margin on + the left and the coast and the sea on the right. designs.js sets the + board's proportions and where the tiles sit, as the board is 6 by 6 + on a small screen and 10 by 5 on a wide one. */ + .river-play { + position: relative; + width: min(100%, 30rem); + aspect-ratio: 750 / 620; + } + + .river-ends { + position: absolute; + inset: 0; + width: 100%; + height: 100%; + overflow: visible; + pointer-events: none; + } + + .river-grid { + position: absolute; + display: grid; + } + + .river-tile { + position: relative; + min-width: 0; + min-height: 0; + padding: 0; + border: 0; + border-radius: 0; + background: transparent; + color: inherit; + cursor: pointer; + overflow: hidden; + touch-action: manipulation; + -webkit-tap-highlight-color: transparent; + transition: box-shadow 0.2s var(--ease); + } + + .river-tile:focus-visible { + z-index: 1; + outline: 2px solid var(--ink); + outline-offset: -3px; + } + + .river-piece { + display: block; + width: 100%; + height: 100%; + transition: transform 0.24s var(--ease); + } + + /* A channel is its banks with the map's paper between them, until the + ink fills it. */ + .river-bank { + fill: none; + stroke: var(--ink-2); + stroke-width: 22; + } + + .river-water { + fill: none; + stroke: var(--raised); + stroke-width: 18.5; + transition: stroke 0.2s var(--ease); + } + + @media (hover: hover) { + .river-play:not(.is-solved) .river-tile:hover { + box-shadow: inset 0 0 0 1px var(--rule-strong); + } + } + + .river-tile.is-wet .river-water, + .river-source { + stroke: var(--ink); + } + + .river-pool { + fill: var(--ink); + } + + /* The map itself. Its thin lines keep one width at any size. */ + .river-paper { + fill: var(--raised); + } + + .river-sea { + fill: var(--wash); + } + + .river-hatch, + .river-contour, + .river-ticks, + .river-coast, + .river-hills, + .river-frame, + .river-frame-in { + fill: none; + vector-effect: non-scaling-stroke; + } + + .river-hatch { + stroke: var(--rule); + stroke-width: 1px; + transition: stroke 0.6s var(--ease) 0.3s; + } + + .river-contour { + stroke: var(--rule); + stroke-width: 1px; + } + + .river-ticks { + stroke: var(--rule-strong); + stroke-width: 1px; + } + + .river-coast { + stroke: var(--ink-2); + stroke-width: 1.2px; + } + + .river-hills { + stroke: var(--ink-3); + stroke-width: 1.3px; + stroke-linecap: round; + stroke-linejoin: round; + } + + .river-frame { + stroke: var(--ink); + stroke-width: 1.5px; + } + + .river-frame-in { + stroke: var(--rule-strong); + stroke-width: 0.8px; + } + + .river-label { + fill: var(--ink-2); + font-family: var(--font-mono); + letter-spacing: 0.14em; + } + + .river-sea-label { + font-family: var(--font-serif); + font-style: italic; + letter-spacing: 0.3em; + } + + .river-north path { + fill: var(--ink); + } + + .river-waves { + fill: none; + stroke: var(--ink-2); + stroke-width: 1.5px; + stroke-linecap: round; + vector-effect: non-scaling-stroke; + } + + .river-seal { + fill: var(--ink); + opacity: 0; + transition: opacity 0.2s var(--ease) 0.2s; + } + + .river-play.is-solved .river-tile { + cursor: default; + } + + /* When the river reaches the sea, the sea darkens with it. */ + .river-play.is-solved .river-mouth, + .river-play.is-solved .river-waves { + stroke: var(--ink); + } + + .river-play.is-solved .river-hatch { + stroke: var(--ink-3); + } + + .river-play.is-solved .river-seal { + opacity: 1; + } + + .river-play.is-still .river-piece, + .river-play.is-still .river-water, + .river-play.is-still .river-hatch, + .river-play.is-still .river-seal { + transition: none; + } + + @media (prefers-reduced-motion: no-preference) { + .river-play:not(.is-still) .river-pool { + transform-box: fill-box; + transform-origin: center; + animation: river-pool 2.6s ease-in-out infinite; + } + @keyframes river-pool { + 50% { + transform: scale(1.18); + } + } + } + + /* Under the map: where the river stands, with the map's key. */ + .river-foot { + margin-top: 14px; + } + + .river-status { + font-family: var(--font-serif); + font-size: 19px; + line-height: 1.3; + } + + .river-tally { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 6px 10px; + margin: 8px 0 4px; + } + + .river-swatch { + width: 26px; + height: 10px; + } + + .river-key { + display: inline-flex; + align-items: center; + gap: 8px; + white-space: nowrap; + } + + .river-key + .river-key { + margin-left: 8px; + } + + .river-swatch .river-bank { + stroke-width: 9; + } + + .river-swatch .river-water { + stroke-width: 7; + } + + .river-swatch.is-wet .river-water { + stroke: var(--ink); + } + + .breath-ring { + position: absolute; + inset: 0; + border: 1.5px solid var(--ink); + border-radius: 50%; + background: var(--wash); + transform: scale(0.62); + } + + .breath-word { + position: relative; + font-family: var(--font-serif); + font-size: 19px; + letter-spacing: -0.005em; + } + + .urge-count { + width: 168px; + margin: 12px 0 0; + text-align: center; + font-family: var(--font-mono); + font-size: 12px; + letter-spacing: 0.1em; + font-variant-numeric: tabular-nums; + color: var(--ink-3); + } + + .urge-why { + display: flex; + align-items: flex-start; + gap: 18px; + margin: 28px 0 0; + padding: 14px 0; + border-top: 1px solid var(--rule); + border-bottom: 1px solid var(--rule); + } + + .urge-photo { + flex: none; + width: 120px; + height: 120px; + object-fit: cover; + border-radius: 3px; + } + + .urge-reason { + margin: 0; + font-family: var(--font-serif); + font-size: 19px; + line-height: 1.45; + white-space: pre-wrap; + overflow-wrap: anywhere; + } + + .urge-streak { + margin: 18px 0 0; + font-size: 14px; + color: var(--ink-2); + } + + /* Plans, things to do instead, and the questions after it passes + (pro/coach.js). The plan is written in the person's own words, so it + gets the reason's serif; the rest stays in the page's sans. */ + .urge-plan { + margin: 24px 0 0; + padding: 14px 0; + border-top: 1px solid var(--rule); + border-bottom: 1px solid var(--rule); + } + + .urge-plan-text { + display: grid; + grid-template-columns: auto 1fr; + gap: 6px 14px; + margin: 6px 0 0; + } + + .urge-plan-text dt { + padding-top: 5px; + font-family: var(--font-mono); + font-size: 10.5px; + letter-spacing: 0.1em; + text-transform: uppercase; + color: var(--ink-3); + } + + .urge-plan-text dd { + margin: 0; + font-family: var(--font-serif); + font-size: 18px; + line-height: 1.45; + overflow-wrap: anywhere; + } + + .urge-instead, + .urge-debrief { + margin: 28px 0 0; + } + + .urge-tries { + display: flex; + flex-wrap: wrap; + gap: 8px; + margin-top: 8px; + } + + .urge-try { + min-height: 36px; + padding: 0 14px; + } + + .urge-try[aria-pressed="true"] { + border-color: var(--ink); + background: var(--wash); + box-shadow: inset 0 0 0 1px var(--ink); + } + + .urge-works, + .urge-debrief-lede, + .urge-debrief-done { + margin: 12px 0 0; + max-width: 54ch; + font-size: 14px; + line-height: 1.5; + color: var(--ink-2); + } + + .urge-field { + display: block; + margin-top: 14px; + max-width: 54ch; + } + + .urge-field-label { + display: block; + margin-bottom: 6px; + font-size: 13px; + color: var(--ink-2); + } + + .urge-input { + box-sizing: border-box; + width: 100%; + min-height: 40px; + padding: 8px 12px; + font-family: var(--font-sans); + font-size: 15px; + color: var(--ink); + background: transparent; + border: 1px solid var(--rule-strong); + border-radius: 3px; + } + + .urge-input:focus-visible { + outline: 2px solid var(--ink); + outline-offset: 1px; + } + + .urge-debrief .actions { + margin-top: 16px; + } + + /* With the urge screen leading, its own buttons are the primary ones; + Go back below steps down to an outline, and the settings note goes. */ + html[data-urge="on"] #back-btn { + color: var(--ink); + background: transparent; + border-color: var(--rule-strong); + } + + html[data-urge="on"] #back-btn:hover { + background: var(--wash); + border-color: var(--ink); + } + + html[data-urge="on"] .note { + display: none; + } + + @media (prefers-reduced-motion: no-preference) { + .urge:not([hidden]) .breath-ring { + animation: breath 10s linear infinite; + } + /* In for four seconds, out for six — the same split urge.js counts. */ + @keyframes breath { + 0% { + transform: scale(0.62); + animation-timing-function: cubic-bezier(0.37, 0, 0.63, 1); + } + 40% { + transform: scale(1); + animation-timing-function: cubic-bezier(0.37, 0, 0.63, 1); + } + 100% { + transform: scale(0.62); + } + } + } + + @media (max-width: 560px) { + .urge-why { + flex-direction: column; + } + .urge-photo { + width: 100%; + height: auto; + max-height: 240px; + } + } + + /* ---- The spread (Sieve Pro, the breathing ring and the ensō) ------------ + With the breathing ring or the ensō leading on a wide screen (urge.js + sets data-urge-layout), the urge screen is two facing pages: the words + on the left, the dial or the circle on the right with the two things + to do now under it. The address, Go back, Close and Allow step down to + one quiet row beneath both (shared with the map, below). Narrower than + this, the page stays the one column above. */ + @media (min-width: 1024px) { + html:is([data-urge-layout="spread"], [data-urge-layout="map"]) .letterhead, + html:is([data-urge-layout="spread"], [data-urge-layout="map"]) .notice, + html:is([data-urge-layout="spread"], [data-urge-layout="map"]) .foot { + width: min(1280px, 100%); + padding-left: 48px; + padding-right: 48px; + } + + html:is([data-urge-layout="spread"], [data-urge-layout="map"]) .notice { + padding-top: 32px; + padding-bottom: 32px; + } + + html:is([data-urge-layout="spread"], [data-urge-layout="map"]) .notice-body { + flex: 1; + display: grid; + grid-template-columns: minmax(0, 1fr) auto; + align-items: center; + column-gap: 24px; + max-width: none; + padding-left: 0; + border-left: 0; + } + + /* The plate beside the headline gives way to one round the dial. */ + html:is([data-urge-layout="spread"], [data-urge-layout="map"]) .notice-body::before { + content: none; + } + + html[data-urge-layout="spread"] .urge { + grid-column: 1 / -1; + display: grid; + grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); + margin-bottom: 0; + padding-bottom: 28px; + border-bottom: 1px solid var(--rule); + } + + html[data-urge-layout="spread"] .urge-words, + html[data-urge-layout="spread"] .urge-instrument { + display: flex; + flex-direction: column; + justify-content: center; + min-width: 0; + } + + html[data-urge-layout="spread"] .urge-words > *, + html[data-urge-layout="spread"] .urge-instrument > * { + order: 0; + } + + html[data-urge-layout="spread"] .urge-words { + padding-right: 56px; + } + + html[data-urge-layout="spread"] .urge-instrument { + position: relative; + isolation: isolate; + align-items: center; + padding-left: 56px; + border-left: 1px solid var(--rule); + text-align: center; + } + + html[data-urge-layout="spread"] .urge h1 { + font-size: clamp(56px, 5.4vw, 76px); + letter-spacing: -0.03em; + } + + html[data-urge-layout="spread"] .urge-stage.has-dial { + width: min(430px, 100%); + margin-top: 0; + } + + html[data-urge-layout="spread"] .urge-stage.has-dial .breath-word { + font-size: 18px; + } + + /* The ensō as the instrument page: the circle at 420px with its + inscription and seal beside it, the breath named under it. */ + html[data-urge-layout="spread"] .urge-design { + width: min(480px, 100%); + margin-top: 0; + } + + html[data-urge-layout="spread"] .enso-stage { + justify-content: center; + } + + html[data-urge-layout="spread"] .enso-frame { + width: min(calc(100% - 3rem), 400px); + } + + /* Tucked into the paper under the circle, which its box leaves + empty, so the whole spread still fits one screen. */ + html[data-urge-layout="spread"] .enso-phase { + margin-top: -10px; + font-size: 24px; + line-height: 1.2; + } + + html[data-urge-layout="spread"] .enso-timing, + html[data-urge-layout="spread"] .enso-tally, + html[data-urge-layout="spread"] .enso-done { + justify-content: center; + } + + html[data-urge-layout="spread"] .enso-tally { + margin-top: 16px; + } + + html[data-urge-layout="spread"] .enso-done:not([hidden]) { + display: flex; + flex-wrap: wrap; + align-items: baseline; + gap: 0 12px; + margin-top: 10px; + } + + html[data-urge-layout="spread"] .enso-done .btn-link { + margin-top: 0; + } + + /* A ring of sieve holes just outside the dial's numbers, fading out + both ways so no edge of it shows, and gone by the dial's foot so the + count and the line under it sit on plain paper. */ + html[data-urge-layout="spread"] .urge-stage.has-dial::before { + content: ""; + position: absolute; + z-index: -1; + inset: -16%; + pointer-events: none; + background-image: + radial-gradient(circle, var(--holes) 1.7px, transparent 2.2px), + radial-gradient(circle, var(--holes) 1.7px, transparent 2.2px); + background-size: 16px 14px; + background-position: 0 0, 8px 7px; + -webkit-mask-image: + radial-gradient(closest-side, transparent 72%, #000 84%, transparent 100%), + linear-gradient(to bottom, #000 55%, transparent 78%); + -webkit-mask-composite: source-in; + mask-image: + radial-gradient(closest-side, transparent 72%, #000 84%, transparent 100%), + linear-gradient(to bottom, #000 55%, transparent 78%); + mask-composite: intersect; + } + + html[data-urge-layout="spread"] .urge-stage.has-dial + .urge-design + .urge-count { + width: auto; + } + + html[data-urge-layout="spread"] .urge-count { + margin-top: 14px; + font-size: 26px; + letter-spacing: 0.02em; + color: var(--ink); + } + + html[data-urge-layout="spread"] .urge-proof { + margin-top: 6px; + max-width: 40ch; + } + + html[data-urge-layout="spread"] .urge-actions { + justify-content: center; + margin-top: 22px; + } + + html[data-urge-layout="spread"] .urge-actions .btn { + min-height: 46px; + padding: 0 20px; + font-size: 15px; + } + + html[data-urge-layout="spread"] .urge-streak { + margin-top: 16px; + font-size: 13.5px; + color: var(--ink-3); + } + + html[data-urge-layout="spread"] .urge-plan { + margin-top: 30px; + } + + html[data-urge-layout="spread"] .urge-instead, + html[data-urge-layout="spread"] .urge-debrief { + margin-top: 26px; + } + + html[data-urge-layout="spread"] .urge-why { + margin-top: 26px; + padding-bottom: 0; + border-bottom: 0; + } + + /* The quiet row: where you were going, and the ways out. */ + html:is([data-urge-layout="spread"], [data-urge-layout="map"]) .origin { + display: flex; + flex-wrap: wrap; + align-items: baseline; + gap: 4px 12px; + min-width: 0; + margin: 0; + padding: 14px 0 0; + border: 0; + } + + html:is([data-urge-layout="spread"], [data-urge-layout="map"]) .origin-label { + margin: 0; + } + + html:is([data-urge-layout="spread"], [data-urge-layout="map"]) .notice-body > .actions { + grid-column: 2; + justify-content: flex-end; + gap: 8px; + margin-top: 0; + padding-top: 14px; + } + + html:is([data-urge-layout="spread"], [data-urge-layout="map"]) .notice-body > .actions .btn { + min-height: 36px; + padding: 0 12px; + font-size: 13.5px; + } + + html:is([data-urge-layout="spread"], [data-urge-layout="map"]) #allow-btn { + padding: 0 6px; + border: 0; + background: none; + color: var(--ink-2); + font-weight: 400; + text-decoration: underline; + text-underline-offset: 3px; + } + + html:is([data-urge-layout="spread"], [data-urge-layout="map"]) #allow-btn:hover { + color: var(--ink); + background: none; + } + + html:is([data-urge-layout="spread"], [data-urge-layout="map"]) .allow-result { + text-align: right; + } + } + + /* ---- The map (Sieve Pro, the river) --------------------------------------- + With the river on a wide screen, its board is a map across the whole + page (pro/designs.js deals it 10 by 5): the headline and the plan + above it; where the river stands, with the map's key, 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. */ + @media (min-width: 1024px) { + html[data-urge-layout="map"] .letterhead, + html[data-urge-layout="map"] .notice, + html[data-urge-layout="map"] .foot { + width: min(1344px, 100%); + } + + html[data-urge-layout="map"] .notice { + padding-top: 8px; + padding-bottom: 8px; + } + + /* Where the river stands and the two things to do share the row + under the map: the river's on the left, the buttons laid over its + right end. */ + html[data-urge-layout="map"] .urge { + grid-column: 1 / -1; + display: grid; + grid-template-columns: minmax(0, 1fr) minmax(0, 470px); + grid-template-areas: + "kicker plan" + "title plan" + "lede why" + "hour why" + "map map" + "bottom bottom" + "proof instead" + "streak instead" + "debrief debrief"; + column-gap: 56px; + margin-bottom: 0; + padding-bottom: 12px; + border-bottom: 1px solid var(--rule); + } + + html[data-urge-layout="map"] .urge-design { + display: contents; + } + + html[data-urge-layout="map"] .urge-words > .kicker { + grid-area: kicker; + margin-bottom: 10px; + } + + html[data-urge-layout="map"] .urge h1 { + grid-area: title; + font-size: 56px; + letter-spacing: -0.03em; + } + + html[data-urge-layout="map"] #urge-lede { + grid-area: lede; + max-width: none; + margin-top: 12px; + } + + html[data-urge-layout="map"] .urge-hour { + grid-area: hour; + } + + /* The plan and the reason, as one block beside the headline. */ + html[data-urge-layout="map"] .urge-plan, + html[data-urge-layout="map"] .urge-why { + margin: 0; + padding: 0 0 0 24px; + border: 0; + border-left: 1px solid var(--rule); + } + + html[data-urge-layout="map"] .urge-plan { + grid-area: plan; + align-self: end; + padding-bottom: 6px; + } + + html[data-urge-layout="map"] .urge-why { + grid-area: why; + align-self: start; + gap: 14px; + } + + /* If, Then and Why down one column, as a key; the two headings the + block has elsewhere would make it taller than the headline. */ + html[data-urge-layout="map"] .urge-plan > .origin-label, + html[data-urge-layout="map"] .urge-why .origin-label { + display: none; + } + + html[data-urge-layout="map"] .urge-plan-text { + grid-template-columns: 36px minmax(0, 1fr); + gap: 2px 12px; + margin: 0; + } + + html[data-urge-layout="map"] .urge-why figcaption { + position: relative; + padding-left: 48px; + } + + html[data-urge-layout="map"] .urge-reason { + display: inline; + } + + html[data-urge-layout="map"] .urge-why figcaption::before { + content: "Why"; + position: absolute; + top: 5px; + left: 0; + font-family: var(--font-mono); + font-size: 10.5px; + letter-spacing: 0.1em; + text-transform: uppercase; + color: var(--ink-3); + } + + html[data-urge-layout="map"] .urge-plan-text dd, + html[data-urge-layout="map"] .urge-reason { + font-size: 18px; + line-height: 1.45; + } + + html[data-urge-layout="map"] .urge-photo { + width: 64px; + height: 64px; + } + + html[data-urge-layout="map"] .urge-voice, + html[data-urge-layout="map"] .urge-try { + min-height: 30px; + padding: 0; + border: 0; + background: none; + font-weight: 400; + text-decoration: underline; + text-underline-offset: 3px; + } + + html[data-urge-layout="map"] .urge-voice { + display: inline-flex; + min-height: 0; + margin: 0 0 0 10px; + font-weight: 500; + vertical-align: baseline; + } + + html[data-urge-layout="map"] .urge-voice:hover, + html[data-urge-layout="map"] .urge-try:hover { + background: none; + } + + html[data-urge-layout="map"] .river-play { + grid-area: map; + justify-self: center; + width: min(100%, 1000px); + margin-top: 14px; + } + + html[data-urge-layout="map"] .river-foot { + grid-area: bottom; + display: flex; + flex-wrap: wrap; + align-items: center; + gap: 6px 24px; + min-width: 0; + margin-top: 12px; + padding-right: 290px; + } + + html[data-urge-layout="map"] .river-status { + font-size: 23px; + line-height: 1.2; + } + + html[data-urge-layout="map"] .river-tally { + margin: 0; + } + + html[data-urge-layout="map"] .river-again { + margin-top: 0; + } + + html[data-urge-layout="map"] .urge-actions { + grid-area: bottom; + justify-self: end; + align-self: center; + margin-top: 12px; + } + + html[data-urge-layout="map"] .urge-actions .btn { + min-height: 46px; + padding: 0 20px; + font-size: 15px; + } + + html[data-urge-layout="map"] .urge-proof { + grid-area: proof; + margin-top: 8px; + font-size: 14px; + } + + html[data-urge-layout="map"] .urge-streak { + grid-area: streak; + margin-top: 2px; + font-size: 13.5px; + color: var(--ink-3); + } + + /* Things to try, as a line of links in the corner. */ + html[data-urge-layout="map"] .urge-instead { + grid-area: instead; + justify-self: end; + display: flex; + flex-wrap: wrap; + align-items: baseline; + justify-content: flex-end; + gap: 2px 16px; + margin: 8px 0 0; + } + + html[data-urge-layout="map"] .urge-tries { + display: contents; + } + + html[data-urge-layout="map"] .urge-try { + min-height: 26px; + } + + html[data-urge-layout="map"] .urge-try[aria-pressed="true"] { + box-shadow: none; + font-weight: 600; + text-decoration: none; + } + + html[data-urge-layout="map"] .urge-works { + flex-basis: 100%; + margin: 0; + font-size: 13.5px; + text-align: right; + } + + html[data-urge-layout="map"] .urge-debrief, + html[data-urge-layout="map"] .urge-debrief-done { + grid-area: debrief; + } + } + /* ---- Foot --------------------------------------------------------------- */ .foot { @@ -440,11 +1897,106 @@ Sieve - Block notice + Block notice
+ + + @@ -486,7 +2038,17 @@

This page is blocked

+ + + + + + + + + + diff --git a/pages/blocked.js b/pages/blocked.js index 6507d93..87ecbdf 100644 --- a/pages/blocked.js +++ b/pages/blocked.js @@ -21,9 +21,9 @@ // gambling → the Phase-1 gambling blocker (original wording) // prediction-markets → a prediction market / betting platform (2nd Gambling // Blocker toggle; opt-in self-control tone) -// If the param is missing (the gambling rules don't send one) we fall back to -// the gambling wording — which is also the static HTML default, so the page -// still reads correctly even if this script somehow never runs. +// If the param is missing (the bundled gambling rule did not send one before +// 1.6.0) we fall back to the gambling wording — which is also the static HTML +// default, so the page still reads correctly even if this script never runs. // // The page also shows WHICH url was blocked (a DNR redirect drops it, so the // background captures it from webNavigation and we ask for it here) and offers a @@ -266,6 +266,31 @@ } recordBlockView(); + // The attempt record (common/attempts.js): when, as well as how many, for + // the habits someone blocks for themselves. The service worker decides + // whether this category is one, and keeps it on this device. + function recordAttempt() { + if (new URLSearchParams(location.search).get("resolved")) return; + try { + chrome.runtime + .sendMessage({ type: "SIEVE_RECORD_ATTEMPT", category }) + .catch(() => {}); + } catch (err) { + // Extension context may be unavailable in unusual conditions. + } + } + recordAttempt(); + + // Streaks and the urge screen (Sieve Pro): records this attempt for the + // habit the category belongs to, and with Pro and the urge screen on, leads + // the page with it. See pro/urge.js (an empty stand-in in an open-source + // build, where SieveUrge does not exist and the page stays the plain notice). + if (window.SieveUrge) { + window.SieveUrge.onBlocked(category).catch((err) => { + console.warn("[Sieve] urge screen failed:", err); + }); + } + // Severity sets the tone: ⚠️ categories are known threats and take the // caution colour on the kicker and margin rule; everything else is ink. // Read by blocked.html's CSS. diff --git a/pages/progress.css b/pages/progress.css new file mode 100644 index 0000000..6631c4a --- /dev/null +++ b/pages/progress.css @@ -0,0 +1,650 @@ +/* ========================================================================== + Sieve — Your progress (Sieve Pro) + Layout only; tokens come from common/sieve-ui.css. Ink on paper, and + nothing green: green means a protection is on, and nothing here is one. + A clear day is a filled ink dot, a day a blocked site stopped you is a + ring, and days before the record began are a hairline. + ========================================================================== */ + +.pg { + width: min(860px, 100%); + margin: 0 auto; + padding: 0 32px 80px; +} + +.pg-letterhead { + display: flex; + align-items: center; + justify-content: space-between; + padding: 28px 0 20px; + border-bottom: 1px solid var(--rule); +} + +.pg-back { + display: inline-flex; + align-items: center; + gap: 8px; + margin-left: -6px; + padding: 4px 6px; + font-size: 13px; + color: var(--ink-2); + text-decoration: none; + border-radius: var(--r-1); + transition: color var(--t-press) var(--ease), background-color var(--t-press) var(--ease); +} + +.pg-back:hover { + color: var(--ink); + background: var(--wash); +} + +.pg-back svg { + width: 15px; + height: 15px; +} + +.brand { + display: inline-flex; + align-items: center; + gap: 8px; +} + +.brand .mark { + width: 22px; + height: 22px; +} + +.pg-head { + padding: 48px 0 8px; +} + +.pg-title { + margin: 8px 0 0; + font-family: var(--font-serif); + font-size: clamp(34px, 6vw, 46px); + font-weight: 400; + line-height: 1.08; + letter-spacing: -0.02em; +} + +.pg-sub { + max-width: 56ch; + margin: 14px 0 0; + font-size: 15px; + line-height: 1.6; + color: var(--ink-2); +} + +.pg-note { + margin-top: 36px; + padding: 24px 0; + border-top: 1px solid var(--rule); +} + +.pg-note p { + max-width: 58ch; + font-size: 15px; + line-height: 1.6; + color: var(--ink-2); +} + +.pg-actions { + display: flex; + flex-wrap: wrap; + gap: var(--s-2); + margin-top: 18px; +} + +/* ---- Which habits -------------------------------------------------------- */ + +.pg-habits { + display: flex; + flex-wrap: wrap; + gap: 8px; + margin-top: 28px; +} + +.pg-habits:empty { + display: none; +} + +.pg-chip { + padding: 6px 12px; + border: 1px solid var(--rule-strong); + border-radius: 999px; + background: transparent; + color: var(--ink-2); + font: inherit; + font-size: 13px; + cursor: pointer; + transition: color var(--t-press) var(--ease), border-color var(--t-press) var(--ease); +} + +.pg-chip:hover { + color: var(--ink); + border-color: var(--ink); +} + +.pg-chip[aria-pressed="true"] { + color: var(--paper); + background: var(--ink); + border-color: var(--ink); +} + +.pg-chip:focus-visible { + outline: 2px solid var(--ink); + outline-offset: 2px; +} + +/* ---- Parts --------------------------------------------------------------- */ + +.pg-part { + margin-top: 40px; + padding-top: 24px; + border-top: 1px solid var(--rule); +} + +.pg-part-head { + display: flex; + flex-wrap: wrap; + align-items: center; + justify-content: space-between; + gap: 8px 16px; +} + +.pg-h { + margin: 10px 0 0; + font-family: var(--font-serif); + font-size: 26px; + font-weight: 400; + line-height: 1.2; + letter-spacing: -0.01em; +} + +.pg-lede { + max-width: 58ch; + margin: 10px 0 0; + font-size: 15px; + line-height: 1.6; + color: var(--ink-2); +} + +.pg-meta { + margin: 12px 0 0; + font-family: var(--font-mono); + font-size: 12px; + letter-spacing: 0.04em; + color: var(--ink-3); +} + +.pg-try { + max-width: 58ch; + margin: 14px 0 0; + padding-left: 14px; + border-left: 2px solid var(--ink); + font-size: 15px; + line-height: 1.55; +} + +.pg-empty { + max-width: 58ch; + margin: 12px 0 0; + font-size: 15px; + line-height: 1.6; + color: var(--ink-2); +} + +.pg-empty a, +.pg-note a { + color: var(--ink); +} + +.pg-nav { + display: inline-flex; + align-items: center; + gap: 4px; +} + +.pg-nav .btn { + min-width: 34px; + padding: 4px 10px; + font-size: 18px; + line-height: 1; +} + +.pg-nav-label { + min-width: 9.5em; + font-family: var(--font-mono); + font-size: 12px; + letter-spacing: 0.06em; + text-align: center; + text-transform: uppercase; + color: var(--ink-2); +} + +/* ---- Streaks ------------------------------------------------------------- */ + +.pg-streak-list, +.pg-works-list, +.pg-plan-list { + margin: 14px 0 0; + padding: 0; + list-style: none; +} + +/* What works for you: the thing tried, and what came after it. */ +.pg-work { + display: grid; + grid-template-columns: minmax(0, 14rem) minmax(0, 1fr); + gap: 4px 24px; + padding: 12px 0; +} + +.pg-work + .pg-work, +.pg-plan + .pg-plan { + border-top: 1px solid var(--rule); +} + +.pg-work-name { + font-family: var(--font-serif); + font-size: 19px; + line-height: 1.3; + overflow-wrap: anywhere; +} + +.pg-work-what { + font-size: 14px; + line-height: 1.5; + color: var(--ink-2); +} + +.pg-work.is-early .pg-work-name { + color: var(--ink-2); +} + +/* Your plans: If and Then apart, in their own words. */ +.pg-plan { + padding: 12px 0; +} + +.pg-plan-text { + display: grid; + grid-template-columns: auto 1fr; + gap: 4px 14px; + margin: 0; +} + +.pg-plan-text dt { + padding-top: 5px; + font-family: var(--font-mono); + font-size: 10.5px; + letter-spacing: 0.1em; + text-transform: uppercase; + color: var(--ink-3); +} + +.pg-plan-text dd { + margin: 0; + font-family: var(--font-serif); + font-size: 19px; + line-height: 1.4; + overflow-wrap: anywhere; +} + +.pg-plan-when { + margin: 6px 0 0; + font-size: 13px; + color: var(--ink-3); +} + +@media (max-width: 560px) { + .pg-work { + grid-template-columns: minmax(0, 1fr); + } +} + +.pg-streak { + display: grid; + grid-template-columns: minmax(0, 1fr) auto; + gap: 4px 24px; + padding: 14px 0; +} + +.pg-streak + .pg-streak { + border-top: 1px solid var(--rule); +} + +.pg-streak-name { + font-size: 14px; + color: var(--ink-2); +} + +.pg-streak-days { + font-family: var(--font-serif); + font-size: 34px; + line-height: 1.1; + letter-spacing: -0.015em; +} + +.pg-streak-side { + align-self: end; + font-size: 14px; + line-height: 1.5; + text-align: right; + color: var(--ink-2); +} + +.pg-goal { + grid-column: 1 / -1; + max-width: 30rem; + margin-top: 6px; +} + +.pg-goal-text { + margin: 0 0 6px; + font-size: 14px; + color: var(--ink-2); +} + +.pg-goal-track { + height: 6px; + background: var(--rule); + border-radius: 3px; + overflow: hidden; +} + +.pg-goal-fill { + display: block; + height: 100%; + background: var(--ink); + border-radius: 3px; +} + +/* ---- When it's hardest: seven weekdays by twenty-four hours --------------- */ + +.heat { + display: grid; + grid-template-columns: 2.6em repeat(24, minmax(0, 1fr)); + gap: 2px; + margin-top: 18px; + max-width: 44rem; +} + +.heat-day, +.heat-hour { + font-family: var(--font-mono); + font-size: 10px; + letter-spacing: 0.04em; + color: var(--ink-3); +} + +.heat-hour { + white-space: nowrap; + overflow: visible; +} + +.heat-day { + align-self: center; +} + +.heat-cell { + aspect-ratio: 1; + border-radius: 2px; + background: var(--wash); +} + +.heat-cell.l1 { background: color-mix(in srgb, var(--ink) 18%, transparent); } +.heat-cell.l2 { background: color-mix(in srgb, var(--ink) 38%, transparent); } +.heat-cell.l3 { background: color-mix(in srgb, var(--ink) 62%, transparent); } +.heat-cell.l4 { background: var(--ink); } + +.heat-cell.is-hard { + box-shadow: 0 0 0 1.5px var(--paper), 0 0 0 3px var(--ink); +} + +/* ---- Proof it passes ----------------------------------------------------- */ + +.pg-proof { + display: grid; + grid-template-columns: minmax(0, 240px) minmax(0, 1fr); + align-items: center; + gap: 28px; + margin-top: 10px; +} + +.pg-proof .dial { + width: 100%; + height: auto; + overflow: visible; +} + +.dial-ring { fill: none; stroke: var(--rule-strong); stroke-width: 1; } +.dial-tick { stroke: var(--ink-3); stroke-width: 1; } +.dial-label { font-family: var(--font-mono); font-size: 11px; fill: var(--ink-3); } +.dial-arc { fill: none; stroke: var(--ink); stroke-width: 2; } +.dial-hand { stroke: var(--ink); stroke-width: 1.5; stroke-linecap: round; } +.dial-usual { stroke: var(--ink-2); stroke-width: 3; } +.dial-dot { fill: var(--ink); } +.dial-new { fill: var(--ink); } + +/* ---- Your month: a letter, and the month on one calendar ------------------ */ + +.pg-figures { + display: flex; + flex-wrap: wrap; + gap: 18px 36px; + margin-top: 20px; +} + +.pg-figure { + display: grid; + gap: 2px; +} + +.pg-figure-n { + font-family: var(--font-serif); + font-size: 30px; + line-height: 1.1; +} + +.pg-figure-what { + font-size: 13px; + color: var(--ink-2); +} + +.cal { + display: grid; + grid-template-columns: repeat(7, minmax(0, 1fr)); + gap: 4px; + max-width: 26rem; + margin-top: 22px; +} + +.cal-weekday { + font-family: var(--font-mono); + font-size: 10px; + letter-spacing: 0.06em; + text-align: center; + text-transform: uppercase; + color: var(--ink-3); +} + +.cal-day { + position: relative; + display: grid; + place-items: center; + aspect-ratio: 1; + font-family: var(--font-mono); + font-size: 11px; + color: var(--ink-3); +} + +.cal-day .day-mark { + position: absolute; + inset: 14%; + width: auto; + height: auto; +} + +.cal-day span { + position: relative; +} + +.cal-day.is-clear span { + color: var(--paper); +} + +.cal-day.is-urge span, +.cal-day.is-today span { + color: var(--ink); +} + +.cal-day.is-today { + outline: 1px solid var(--ink); + outline-offset: -1px; + border-radius: var(--r-1); +} + +.day-mark { + display: inline-block; + width: 10px; + height: 10px; + border-radius: 50%; + vertical-align: -1px; +} + +.day-mark.is-clear { + background: var(--ink); +} + +.day-mark.is-urge { + box-shadow: inset 0 0 0 1.5px var(--ink); +} + +.day-mark.is-before { + box-shadow: inset 0 0 0 1px var(--rule-strong); + border-radius: 2px; +} + +.pg-key { + display: flex; + flex-wrap: wrap; + gap: 6px 18px; + margin-top: 12px; + font-size: 12px; + color: var(--ink-3); +} + +.pg-closing { + margin: 20px 0 0; + font-family: var(--font-serif); + font-size: 19px; + font-style: italic; +} + +.pg-closing:empty { + display: none; +} + +/* ---- Your year: every day on one calendar --------------------------------- */ + +.year { + display: grid; + grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); + gap: 18px 22px; + margin-top: 20px; +} + +.year-month-name { + margin: 0 0 6px; + font-family: var(--font-mono); + font-size: 11px; + letter-spacing: 0.06em; + text-transform: uppercase; + color: var(--ink-2); +} + +.year-month-count { + color: var(--ink-3); +} + +.year-days { + display: grid; + grid-template-columns: repeat(7, minmax(0, 1fr)); + gap: 3px; + max-width: 8.5rem; +} + +.year-day { + aspect-ratio: 1; + border-radius: 50%; +} + +.year-day.is-clear { background: var(--ink); } +.year-day.is-urge { box-shadow: inset 0 0 0 1.5px var(--ink); } +.year-day.is-today { box-shadow: inset 0 0 0 1.5px var(--ink-3); border-radius: 2px; } +.year-day.is-before, +.year-day.is-ahead { box-shadow: inset 0 0 0 1px var(--rule); border-radius: 2px; } + +/* ---- Foot ------------------------------------------------------------------ */ + +.pg-foot { + margin-top: 64px; +} + +.pg-foot .kicker { + margin-top: 12px; +} + +/* ---- Small screens --------------------------------------------------------- */ + +@media (max-width: 560px) { + .pg { + padding: 0 16px 64px; + } + .pg-head { + padding-top: 32px; + } + .pg-proof { + grid-template-columns: minmax(0, 1fr); + } + .pg-proof .dial { + max-width: 240px; + } + .heat { + grid-template-columns: 2.2em repeat(24, minmax(0, 1fr)); + gap: 1px; + } + .heat-hour { + font-size: 8px; + } + .pg-streak { + grid-template-columns: minmax(0, 1fr); + } + .pg-streak-side { + text-align: left; + } +} + +/* ---- Print: the month's letter, on its own -------------------------------- */ + +@media print { + body { + background: #fff; + } + .pg-letterhead .pg-back, + .pg-head, + .pg-habits, + .pg-no-print, + .pg-nav .btn, + .pg-foot { + display: none !important; + } + .pg-part:not(.pg-letter) { + display: none !important; + } + .pg-letter { + margin-top: 24px; + border-top: 0; + } +} diff --git a/pages/progress.html b/pages/progress.html new file mode 100644 index 0000000..f955c2c --- /dev/null +++ b/pages/progress.html @@ -0,0 +1,179 @@ + + + + + + + Sieve — Your progress + + + + + + +
+
+ + + Settings + + + + Sieve + +
+ +
+

Sieve Pro

+

Your progress

+

+ Read from what Sieve keeps in this browser: when a blocked site stopped you, the urges + you waited out, and the streaks you count. Nothing here was sent anywhere. +

+
+ + + + + + + + + +
+ +

Sieve · on this device · patterns, never causes

+
+
+ + + + + + + + + + + diff --git a/pages/progress.js b/pages/progress.js new file mode 100644 index 0000000..bc463ba --- /dev/null +++ b/pages/progress.js @@ -0,0 +1,16 @@ +// pages/progress.js +// Sieve — starts the Your progress page. What fills it is Sieve Pro +// (pro/progress.js, not open source); in a build without it, that file is an +// empty stand-in and the page says Sieve Pro is not part of this build. + +(() => { + "use strict"; + + if (!window.SieveProgress) { + document.getElementById("pg-absent").hidden = false; + return; + } + window.SieveProgress.start().catch((err) => { + console.warn("[Sieve] Your progress could not be read:", err); + }); +})(); diff --git a/popup/popup.css b/popup/popup.css index 2cc5954..058c3ef 100644 --- a/popup/popup.css +++ b/popup/popup.css @@ -56,66 +56,404 @@ body { font-variant-numeric: tabular-nums; } -/* ---- Status light --------------------------------------------------------- */ +/* ---- The masthead: a pine band ------------------------------------------------- + The name, the status and the top sit on pine, as BlockNSFW's popup does, so + the two read as one family. Pine is the band's colour, not Sieve's "on" + green (the same exception as the Warden band in Settings): inside it the + page's own tokens are set again for paper on pine, and "on" becomes a light + mint, still the only green that means something is running. */ + +.masthead { + --paper: #0d3b31; + --ink: #fbf9f4; + --ink-2: #cdd9d3; + --ink-3: #9db3aa; + --rule: rgba(255, 255, 255, 0.14); + --rule-strong: rgba(255, 255, 255, 0.28); + --wash: rgba(255, 255, 255, 0.06); + --wash-strong: rgba(255, 255, 255, 0.12); + --on: #a3dbbd; + --on-ink: #0d3b31; + --danger: #f2a58e; + background: var(--paper); + color: var(--ink); + padding-bottom: 4px; + margin-bottom: 10px; +} + +/* Dark: written twice, as every dark palette is (see sieve-ui.css). */ +@media (prefers-color-scheme: dark) { + :root:not([data-theme="light"]) .masthead { + --paper: #1f3a32; + --ink: #f1ede3; + --ink-2: #c9d4ce; + --ink-3: #9db3aa; + --rule: rgba(241, 237, 227, 0.13); + --rule-strong: rgba(241, 237, 227, 0.26); + --on: #a3dbbd; + --on-ink: #1f3a32; + } +} -.status { - display: flex; - align-items: flex-start; - gap: 12px; - margin-top: 8px; - padding: 10px 18px 12px; +:root[data-theme="dark"] .masthead { + --paper: #1f3a32; + --ink: #f1ede3; + --ink-2: #c9d4ce; + --ink-3: #9db3aa; + --rule: rgba(241, 237, 227, 0.13); + --rule-strong: rgba(241, 237, 227, 0.26); + --on: #a3dbbd; + --on-ink: #1f3a32; +} + +.masthead .mark, +.masthead .wordmark { + color: var(--ink); +} + +/* ---- Status: a stamp in the top bar ------------------------------------------ + Green when anything is on (rule 1), in the danger colour when nothing is. */ + +.status-stamp { + display: inline-flex; + align-items: center; + gap: 6px; + height: 22px; + padding: 0 7px; + font-family: var(--font-mono); + font-size: 10.5px; + font-weight: 600; + letter-spacing: 0.08em; + text-transform: uppercase; + white-space: nowrap; + color: var(--ink-3); + border: 1px solid var(--rule-strong); + border-radius: 2px; + font-variant-numeric: tabular-nums; } -/* A lamp: lit green when anything is on, an empty ring when nothing is. */ .status-light { flex-shrink: 0; - width: 10px; - height: 10px; - margin-top: 5px; + width: 7px; + height: 7px; border-radius: 50%; - border: 1.5px solid var(--ink-3); - transition: background-color var(--t-state) var(--ease), border-color var(--t-state) var(--ease), - box-shadow var(--t-state) var(--ease); + border: 1.5px solid currentColor; + box-sizing: border-box; } -.status.enabled .status-light { - background: var(--on); +.status-stamp.enabled { + color: var(--on); border-color: var(--on); - box-shadow: 0 0 0 3px var(--on-wash); } -.status.disabled .status-light { +.status-stamp.enabled .status-light { + background: var(--on); +} + +.status-stamp.disabled { + color: var(--danger); border-color: var(--danger); } -.status-text { +.status-off { + margin: 14px 18px 0; + font-family: var(--font-serif); + font-size: 18px; + line-height: 1.3; + color: var(--danger); +} + +/* ---- The top: the seal, tonight, or the hint -------------------------------- */ + +.top { + padding: 16px 18px 14px; +} + +/* A rule between two parts, never above the first one showing. */ +.top > :not([hidden]) ~ :not([hidden]) { + margin-top: 14px; + padding-top: 12px; + border-top: 1px solid var(--rule-strong); +} + +.seal-head, +.pro-hint-head { display: flex; - flex-direction: column; - gap: 2px; - min-width: 0; + justify-content: space-between; + align-items: center; } -.status-title { +.seal-figure { + display: flex; + align-items: baseline; + gap: 10px; + margin: 6px 0 0; +} + +.seal-days { font-family: var(--font-serif); - font-size: 18px; + font-size: 26px; + line-height: 1.1; + letter-spacing: -0.015em; + color: var(--ink); +} + +.seal-sub { + font-size: 12.5px; + color: var(--ink-2); +} + +/* The seal's days as holes: filled once gone, a ring round today. A seal + longer than a month is a thin bar instead. */ +.holes { + display: flex; + flex-wrap: wrap; + gap: 5px; + margin-top: 9px; +} + +.hole { + width: 9px; + height: 9px; + border-radius: 50%; + border: 1.5px solid var(--rule-strong); + box-sizing: border-box; +} + +.hole.is-done { + background: var(--ink); + border-color: var(--ink); +} + +.hole.is-now { + border-color: var(--ink); + box-shadow: 0 0 0 2px var(--paper), 0 0 0 3.5px var(--ink-3); +} + +.holes .bar { + flex: 1; + height: 5px; + border-radius: 3px; + background: var(--rule); + overflow: hidden; +} + +.holes .bar span { + display: block; + height: 100%; + background: var(--ink); +} + +.tonight-title { + margin: 6px 0 0; + font-family: var(--font-serif); + font-size: 21px; line-height: 1.2; + letter-spacing: -0.01em; color: var(--ink); + text-wrap: balance; } -.status.disabled .status-title { - color: var(--danger); +/* Hours round now: gone, now, and the hardest two hatched where they come + (outlined only on days they don't). */ +.day { + position: relative; + margin-top: 14px; +} + +.day-hours { + display: grid; + grid-template-columns: repeat(24, 1fr); + gap: 2px; +} + +.day-h { + height: 16px; + border-radius: 2px; + background: var(--wash-strong); +} + +.day-h.is-past { + background: var(--rule); +} + +.day-h.is-now { + background: var(--ink); +} + +.day-h.is-hard { + box-shadow: inset 0 0 0 1px var(--ink); +} + +.day-h.is-hard.is-due { + background: repeating-linear-gradient(135deg, var(--ink) 0 2px, transparent 2px 5px); } -.status-meta { +/* Clock labels where 12a, 6a, 12p and 6p fall in the strip. */ +.day-scale { + position: relative; + height: 12px; + margin-top: 5px; font-family: var(--font-mono); - font-size: 11px; + font-size: 9.5px; color: var(--ink-3); } -.status-meta:empty { +.day-scale span { + position: absolute; + top: 0; +} + +.day-now { + position: absolute; + top: -15px; + transform: translateX(-50%); + font-family: var(--font-mono); + font-size: 9.5px; + letter-spacing: 0.06em; + text-transform: uppercase; + color: var(--ink); +} + +.day-hard { + display: block; + margin-top: 3px; + text-align: right; + font-family: var(--font-mono); + font-size: 9.5px; + letter-spacing: 0.06em; + text-transform: uppercase; + color: var(--ink); +} + +.day.is-empty { + margin-top: 10px; +} + +.day.is-empty .day-h { + height: 12px; +} + +.tonight-plan { + margin-top: 14px; + padding: 12px 0 10px; + border-top: 1px solid var(--rule-strong); + border-bottom: 1px solid var(--rule); +} + +.plan-text { + display: grid; + grid-template-columns: auto 1fr; + gap: 4px 12px; + margin: 8px 0 0; +} + +.plan-text dt { + padding-top: 3px; + font-family: var(--font-mono); + font-size: 10px; + letter-spacing: 0.1em; + text-transform: uppercase; + color: var(--ink-3); +} + +.plan-text dd { + margin: 0; + font-family: var(--font-serif); + font-size: 16px; + line-height: 1.35; + color: var(--ink); + overflow-wrap: anywhere; +} + +.tonight-works, +.tonight-kept, +.pro-hint-text { + margin: 9px 0 0; + font-size: 12.5px; + line-height: 1.45; + color: var(--ink-2); +} + +.stamps { + display: flex; + flex-wrap: wrap; + gap: 6px; + margin-top: 12px; +} + +.stamps:empty { display: none; } +.stamp { + display: inline-flex; + align-items: center; + height: 22px; + padding: 0 7px; + font-family: var(--font-mono); + font-size: 10.5px; + font-weight: 600; + letter-spacing: 0.08em; + text-transform: uppercase; + white-space: nowrap; + color: var(--ink); + border: 1px solid var(--rule-strong); + border-radius: 2px; +} + +.tonight .status-pro-link, +.pro-hint .status-pro-link { + display: block; + margin-top: 10px; + font-size: 12.5px; +} + +.pro-hint-close { + display: grid; + place-items: center; + width: 22px; + height: 22px; + margin-right: -4px; + padding: 0; + font-size: 15px; + line-height: 1; + color: var(--ink-3); + background: none; + border: 0; + border-radius: var(--r-1); + cursor: pointer; +} + +.pro-hint-close:hover { + color: var(--ink); + background: var(--wash); +} + +.status-pro-link { + align-self: flex-start; + margin-top: 2px; + padding: 0; + border: 0; + background: none; + color: var(--ink); + font: inherit; + text-decoration: underline; + text-decoration-color: var(--rule-strong); + text-underline-offset: 3px; + cursor: pointer; +} + +.status-pro-link:hover { + text-decoration-color: var(--ink); +} + +.status-pro-link:focus-visible { + outline: 2px solid var(--ink); + outline-offset: 2px; + border-radius: 2px; +} + /* ---- Blocks of switches --------------------------------------------------- */ .block { @@ -527,6 +865,12 @@ body { outline-offset: -3px; } +.settings-end { + display: inline-flex; + align-items: center; + gap: 10px; +} + .settings-link svg { width: 16px; height: 16px; diff --git a/popup/popup.html b/popup/popup.html index dbcc051..4b364e3 100644 --- a/popup/popup.html +++ b/popup/popup.html @@ -10,6 +10,9 @@ + +
Sieve - v— + + + + Checking… +
- -
- - - Checking… - - + + + + +