Email tracking on every surface: API, CLI, TUI - #268
Merged
Merged
Conversation
Until now a project's email tracking could only be seen or changed on the dashboard's Tracking tab. Now the same thing is reachable with a crp_ token: - API: GET /api/v1/email-tracking (every reachable project, role, on/off, tracking id, last day's human opens/clicks/unsubscribes, no secrets); GET /api/v1/email-tracking/<id|hostname>[?secret=1] (the secret only on request and never to a viewer); POST .../<enable|disable|rotate> (owners and members only). Roles follow requireProjectAccess. - CLI, in-repo and the published @profullstack/crawlproof (0.3.0): crawlproof email-tracking list | show [--secret] | enable | disable | rotate. show --secret piped prints the secret alone, so it pipes into myna newsletter track set. - TUI: a sixth tab, Email, with its own loader; e turns the highlighted project on or off. Closes #267. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
ThreatCrush Security Scan48 finding(s) HIGH/CRITICAL: 2 | MEDIUM: 31 | LOW: 15
Snippets are redacted; ThreatCrush never prints matched credential material. |
| const c = capture(); | ||
| expect(await runEmailTracking([], {}, call, c.out)).toBe(0); | ||
| expect(c.lines[0]).toMatch(/^on\s+moshcode\.sh\s+e960e0a69972a7f34ea197bb\s+12 opens, 3 clicks, 1 unsubs \(24h\)$/); | ||
| expect(c.lines[1]).toMatch(/^off\s+profullstack\.com/); |
| state.email.loading = true; | ||
| invalidate(); | ||
| try { | ||
| const res = await fetcher(`${base}/api/v1/email-tracking`, { headers }); |
| const toggle = async (row: EmailTrackingRow): Promise<void> => { | ||
| const action = row.enabled ? "disable" : "enable"; | ||
| try { | ||
| const res = await fetcher(`${base}/api/v1/email-tracking/${encodeURIComponent(row.project_id)}/${action}`, { method: "POST", headers }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #267. Anthony: email tracking "needs to support all surfaces, cli/tui/web/pwa/desktop/mobile". Until now it was only reachable on the dashboard's Tracking tab.
GET /api/v1/email-tracking: every reachable project with role, on/off, tracking id and URLs, and the last day's human opens/clicks/unsubscribes. No secrets.GET /api/v1/email-tracking/<id or hostname>[?secret=1]: the secret only on request, never to a viewer (403).POST .../<enable or disable or rotate>: owners and members only; rotate answers with the new secret.@profullstack/crawlproof0.3.0)crawlproof email-tracking list, show <site> [--secret], enable, disable, rotate, with--json. Piped,show --secretprints only the secret, socrawlproof email-tracking show moshcode.sh --secret | myna newsletter track set <id>works. One implementation inlib/emailTracking/cli.ts; both CLIs hand it their token-authed call.crawlproof dashboard)eturns the highlighted project on or off.manifest.webmanifest; there are no native apps.Access follows
requireProjectAccess:vieweronly looks.Tests
tests/email-tracking-api.test.ts(6): roles, secret gating, ambiguous refs, 401 before any read.tests/email-tracking-surfaces.test.ts(5): the CLI's output, errors and piped secret; the TUI tab rendered through hqtui, the loader and theetoggle.tsc --noEmitclean.packages/clibuilds, andhelplists the new command. Against production it currently 404s cleanly, because the route isn't deployed yet.After merge and deploy: publish
@profullstack/crawlproof0.3.0. Then myna can addmyna newsletter track connect <site>, which reads this API with the crawlproof token myna already holds.🤖 Generated with Claude Code