Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 49 additions & 2 deletions Website/lib/loader.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// The one inline script every page ends with. It starts the page's scripts. The Content Security Policy in
// public/_headers runs this script alone, by its hash, and what it starts ('strict-dynamic'), so it is the same on
// every page and starts only the site's own files and Plausible. astro.config.mjs checks every page carries it
// every page and starts only the site's own files, Plausible and PostHog. astro.config.mjs checks every page carries it
// unchanged and writes its hash into the built _headers.
//
// Each script's address carries a hash of the file, so a changed script is never served from a stale cache.
Expand Down Expand Up @@ -37,21 +37,68 @@ export function loader(publicDir) {
plausible.init();
}
if (missing) plausible("404");
// PostHog, on the live site only: page views, clicks, heatmaps, web vitals, errors and recordings of visits, in
// the edbn project ui.edbn.me uses, through /ingest on this site (worker/index.js). Calls wait in its queue until
// its script arrives. It keeps its random id in this site's local storage, never a cookie, so nothing joins a
// visit here to ui.edbn.me. Recordings never hold what is typed, and leave out anything marked ph-no-capture: the
// key and the buyer's email. Privacy section 6 says exactly this, so change both together.
var reports = location.hostname === "outbound.edbn.me";
if (reports) {
var posthog = window.posthog = [];
posthog.people = [];
posthog.capture = function () { posthog.push(["capture"].concat([].slice.call(arguments))); };
posthog._i = [["phc_Ckkg6Qm4MnyqPUe27H93ZjigjBJxh3booYsszWpsN8Yi", {
api_host: "/ingest",
ui_host: "https://us.posthog.com",
defaults: "2026-08-30",
persistence: "localStorage",
person_profiles: "identified_only",
capture_exceptions: true,
capture_heatmaps: true,
capture_dead_clicks: true,
capture_performance: { web_vitals: true, network_timing: true },
enable_recording_console_log: true,
session_recording: { maskAllInputs: true, recordHeaders: false, recordBody: false },
// Polar's checkout address, which a buyer arrives on the thank-you page from, is cut to its host.
before_send: function (event) {
[event && event.properties, event && event.$set_once, event && event.$set].forEach(function (props) {
for (var key in props || {}) {
if (/referr?er$/.test(key) && typeof props[key] === "string" && /polar\\.sh/.test(props[key])) {
props[key] = props[key].replace(/^(https?:\\/\\/[^\\/?#]+).*$/, "$1");
}
}
});
return event;
}
}]];
}
// Addresses go through a Trusted Types policy where the browser has them, which takes these and nothing else.
var urls = ${JSON.stringify({ plausible: "https://plausible.io/js/pa-UjwzQoq8qX6tVKev_Xvxo.js", ...urls })};
var urls = ${JSON.stringify({ plausible: "https://plausible.io/js/pa-UjwzQoq8qX6tVKev_Xvxo.js", posthog: "/ingest/static/array.js", ...urls })};
var policy = window.trustedTypes && trustedTypes.createPolicy("outbound", {
createScriptURL: function (url) {
for (var name in urls) if (urls[name] === url) return url;
throw new TypeError("Not one of Outbound's scripts: " + url);
}
});
// PostHog fetches the rest of itself (recordings, web vitals and so on) by setting addresses of its own, which
// the default policy lets through when they are on this site under /ingest/static/ or /ingest/array/.
if (reports && window.trustedTypes) {
trustedTypes.createPolicy("default", {
createScriptURL: function (url) {
var address = new URL(url, location.href);
if (address.origin === location.origin && /^\\/ingest\\/(static|array)\\//.test(address.pathname)) return url;
throw new TypeError("Not one of Outbound's scripts: " + url);
}
});
}
function start(name, async) {
var script = document.createElement("script");
script.src = policy ? policy.createScriptURL(urls[name]) : urls[name];
script.async = async;
document.body.appendChild(script);
}
start("plausible", true);
if (reports) start("posthog", true);
// The page's own scripts run in this order, as they would from tags here.
start("app", false);
if (page) start(page, false);
Expand Down
7 changes: 5 additions & 2 deletions Website/public/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@
return WORDS[key] || english;
}

// Counts a moment with Plausible. Blocked, missing or failing, it does nothing, and nothing waits for it.
// Counts a moment with Plausible and PostHog. Blocked, missing or failing, each does nothing, and nothing waits.
function track(name, props) {
try {
if (typeof window.plausible === "function") window.plausible(name, { props: props });
} catch (error) {}
try {
if (window.posthog && typeof window.posthog.capture === "function") window.posthog.capture(name, props);
} catch (error) {}
}

// Which part of the page a link sits in, so the counts can tell the top bar's Buy from the price box's.
Expand Down Expand Up @@ -115,7 +118,7 @@
var small = buy.classList.contains("btn-sm");
var button = document.createElement("button");
button.type = "button";
button.className = "btn btn-light key-button" + (small ? " btn-sm" : "");
button.className = "btn btn-light key-button ph-no-capture" + (small ? " btn-sm" : "");
button.title = word("js.copyKeyTitle", "Copy your key");
if (!small) {
var code = document.createElement("code");
Expand Down
3 changes: 3 additions & 0 deletions Website/public/feedback.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
try {
if (typeof window.plausible === "function") window.plausible(name, { props: props });
} catch (error) {}
try {
if (window.posthog && typeof window.posthog.capture === "function") window.posthog.capture(name, props);
} catch (error) {}
}

var form = document.getElementById("feedback");
Expand Down
9 changes: 8 additions & 1 deletion Website/public/thanks.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,20 @@
return WORDS[key] || english;
}

// Counts a moment with Plausible. Blocked, missing or failing, it does nothing, and nothing waits for it.
// Counts a moment with Plausible and PostHog. Blocked, missing or failing, each does nothing, and nothing waits.
function track(name, props, revenue) {
try {
if (typeof window.plausible === "function") {
window.plausible(name, revenue ? { props: props, revenue: revenue } : { props: props });
}
} catch (error) {}
try {
if (window.posthog && typeof window.posthog.capture === "function") {
var extra = revenue ? { revenue: revenue.amount, currency: revenue.currency } : {};
for (var prop in props) extra[prop] = props[prop];
window.posthog.capture(name, extra);
}
} catch (error) {}
}

var id = window.OUTBOUND_CHECKOUT;
Expand Down
3 changes: 3 additions & 0 deletions Website/public/waitlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
try {
if (typeof window.plausible === "function") window.plausible(name, { props: props });
} catch (error) {}
try {
if (window.posthog && typeof window.posthog.capture === "function") window.posthog.capture(name, props);
} catch (error) {}
}

var form = document.getElementById("waitlist");
Expand Down
2 changes: 1 addition & 1 deletion Website/src/pages/[...lang]/thanks.astro
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const href = (path: string) => localHref(lang, path);
<strong data-i18n="thanks.step2" set:html={t("thanks.step2")}></strong> <span data-i18n="thanks.step2Detail" set:html={t("thanks.step2Detail")}></span>
<div class="cta-row"><a class="btn btn-light" id="activate" href="#" aria-disabled="true" set:html={t("thanks.activate")}></a></div>
{/* The key, under Activate and before the menu bar, once thanks.js has it. */}
<div class="license" id="license" hidden>
<div class="license ph-no-capture" id="license" hidden>
<h2 set:html={t("thanks.key")}></h2>
<div class="key-row">
<code id="key"></code>
Expand Down
16 changes: 14 additions & 2 deletions Website/src/pages/privacy.astro
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Topbar from "../components/Topbar.astro";
<div class="wrap-narrow prose legal">
<h1>Privacy.</h1>
<p class="lede">The app has no account and no analytics. The painting happens on your Mac. This policy says exactly what Outbound and this website do with personal data, who handles it, and what you can ask of us.</p>
<p class="updated">Last updated 21 November 2026</p>
<p class="updated">Last updated 24 November 2026</p>

<nav class="contents" aria-label="On this page">
<a href="#who">1. Who we are</a>
Expand Down Expand Up @@ -47,6 +47,7 @@ import Topbar from "../components/Topbar.astro";
<li>The copy from the Mac App Store makes no network requests at all.</li>
<li>The copy from this website goes online only to check its license and to look for updates.</li>
<li>This website counts visits with Plausible, which sets no cookies and keeps nothing that identifies you.</li>
<li>It also uses PostHog to see how its pages are used and where they break, with recordings of visits that never hold what you type or your key.</li>
<li>Payments are taken by Polar on this website, and by Apple on the App Store. We never see your card.</li>
<li>We don't sell personal data or share it for advertising, and there are no ad pixels, advertising cookies or cross-site tracking on this website.</li>
</ul>
Expand Down Expand Up @@ -92,8 +93,17 @@ import Topbar from "../components/Topbar.astro";
<li>Visits are counted with Plausible: which pages are seen, where visitors came from, and their country, browser and kind of device. It sets no cookies and keeps nothing that identifies you. On the thank-you page it gets only the page, not the checkout in its address. See <a href="https://plausible.io/data-policy">Plausible's data policy</a>.</li>
<li>It also counts clicks on Buy and Download, which questions in the FAQ are opened, and finished purchases with their price before tax, never who made them.</li>
</ul>
<h3>How pages are used</h3>
<ul>
<li>This website also sends events to PostHog, through its own address at <code>outbound.edbn.me/ingest</code>: the pages you view and when you leave them, what you click, where on the page you click and how far you scroll, clicks that do nothing, how quickly pages load, and errors in the website's code, with what it writes to the browser console.</li>
<li>It sends the same moments Plausible counts, above, including a finished purchase's price before tax, never who made it.</li>
<li>Each event carries the page's address and where you came from, your browser, operating system, kind of device and screen size, and the rough location (country, region and city) PostHog works out from your IP address. PostHog then drops the IP address. Arriving from a Polar checkout, only polar.sh is kept, not the checkout's address.</li>
<li>PostHog also records how pages change while you use them (what is on screen, the pointer, scrolling and clicks), so we can replay a visit and see where the website is confusing or broken. Recordings never include what you type into the forms, and leave out your license key and email address entirely. Network requests show only their address and timing.</li>
<li>It is the same PostHog project as our other website, ui.edbn.me, but nothing joins a visit here to one there, and you are never named to it. See <a href="https://posthog.com/privacy">PostHog's privacy policy</a>.</li>
</ul>
<h3>What this website keeps in your browser</h3>
<ul>
<li>A random id from PostHog, in local storage, and the current visit's id, in session storage, so that events from the same browser group into visits. PostHog sets no cookies here.</li>
<li>A <code>lang</code> cookie, for a year, only if you pick a language at the bottom of a page. It is sent back so the right language is shown, and does nothing else.</li>
<li>After you buy, your key, for a year, so the homepage can show it if you lose it. It never leaves your browser. Click Forget to remove it.</li>
<li>That you joined the waitlist and for which platform, and which order this browser has already counted, so neither is repeated. During a checkout, its id, in that tab only.</li>
Expand Down Expand Up @@ -124,7 +134,7 @@ import Topbar from "../components/Topbar.astro";
<h2 id="why">10. Why we use it</h2>
<ul>
<li><strong>To deliver what you bought</strong>, and to support it: your order, key, Macs and messages. This is needed to perform our contract with you.</li>
<li><strong>To run and protect the website and count visits</strong>, in ways that don't identify you to us. These are our legitimate interests, and you can object to them.</li>
<li><strong>To run and protect the website, count visits, and see how it is used and where it breaks</strong>, without knowing who you are. These are our legitimate interests, and you can object to them.</li>
<li><strong>To email you about Windows or iPhone, or reply to feedback</strong>, because you asked us to. You can withdraw that at any time.</li>
<li><strong>To keep records the law requires</strong>, such as tax records, which Polar and Apple keep as the sellers of record.</li>
<li>We make no automated decisions about you that have legal or similar effects, and build no profiles.</li>
Expand All @@ -136,6 +146,7 @@ import Topbar from "../components/Topbar.astro";
<li><strong>Polar</strong>: our reseller for purchases on this website. It handles payments, tax, receipts and refunds as the seller, and keeps license keys for us. See <a href="https://polar.sh/legal/privacy-policy">Polar's privacy policy</a>.</li>
<li><strong>Apple</strong>: purchases, updates and refunds for the App Store copy.</li>
<li><strong>Plausible</strong>: counting visits, without cookies or personal data.</li>
<li><strong>PostHog</strong>: how the website is used, its errors, and recordings of visits, as in <a href="#site">section 6</a>.</li>
<li><strong>Supabase</strong>: the database for the waitlist and feedback.</li>
<li><strong>GitHub</strong>: hosting the source code, and the downloads when this website can't send them. See <a href="https://docs.github.com/en/site-policy/privacy-policies/github-general-privacy-statement">GitHub's privacy statement</a>.</li>
<li>We share personal data only with these services, only for these purposes, and otherwise only when the law requires it or to protect our rights. If Outbound is ever sold, it would pass to the new owner under this policy.</li>
Expand All @@ -153,6 +164,7 @@ import Topbar from "../components/Topbar.astro";
<li>The waitlist: until the one email is sent, then deleted.</li>
<li>Feedback and email: as long as they help to answer you or improve Outbound, and deleted sooner when you ask.</li>
<li>Visit counts: Plausible keeps only totals, which identify no one.</li>
<li>PostHog events and recordings: as long as PostHog keeps them for our plan, and deleted sooner when you ask.</li>
</ul>

<h2 id="security">14. Security</h2>
Expand Down
44 changes: 44 additions & 0 deletions worker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
// iPhone: { ok: true }, the same whether or not it was already there.
// POST /api/feedback { message, email?, lang, app? }
// Keeps a message from the feedback page: { ok: true }.
// GET/POST /ingest/... PostHog, through the site's own address (posthog below).
//
// POLAR_ACCESS_TOKEN is a secret: a Polar organization token with checkouts:read, checkouts:write,
// orders:read, benefits:read and license_keys:read. The waitlist and feedback need three more: SUPABASE_URL,
Expand Down Expand Up @@ -86,6 +87,7 @@ export default {
if (url.pathname === "/download") return newest(request, env);
if (url.pathname.startsWith("/download/")) return download(request, env, ctx, url);
if (url.pathname === "/buy") return buy(request, env, url);
if (url.pathname.startsWith("/ingest/")) return posthog(request, url);
if (TRANSLATED.has(url.pathname)) return forAppStore(url, await page(request, env, url));
if (!url.pathname.startsWith("/api/")) return forAppStore(url, await priced(request, env));
if (request.method !== "POST") return reply({ error: "Use POST." }, 405);
Expand All @@ -103,6 +105,48 @@ export default {
},
};

// PostHog, which the loader (Website/lib/loader.mjs) starts on outbound.edbn.me, sends its events and fetches its
// scripts through /ingest on the site's own address, so blockers that match PostHog's own hosts don't drop them.
// Only the headers PostHog needs go on, with the visitor's IP for the rough location (the project drops the IP).
const POSTHOG_API = "https://us.i.posthog.com";
const POSTHOG_ASSETS = "https://us-assets.i.posthog.com";
const POSTHOG_REQUEST_HEADERS = ["content-type", "user-agent", "accept"];
// Encoding and length stay behind: fetch has already decoded the body.
const POSTHOG_RESPONSE_HEADERS = ["content-type", "cache-control", "etag", "vary"];

async function posthog(request, url) {
if (request.method !== "GET" && request.method !== "HEAD" && request.method !== "POST") {
return new Response(null, { status: 405 });
}
// The path keeps its trailing slash (/e/, /flags/), which PostHog expects.
const path = url.pathname.slice("/ingest".length);
const host = path.startsWith("/static/") || path.startsWith("/array/") ? POSTHOG_ASSETS : POSTHOG_API;
const headers = new Headers();
for (const name of POSTHOG_REQUEST_HEADERS) {
const value = request.headers.get(name);
if (value) headers.set(name, value);
}
const ip = request.headers.get("cf-connecting-ip");
if (ip) headers.set("x-forwarded-for", ip);
let upstream;
try {
upstream = await fetch(new URL(`${path}${url.search}`, host), {
method: request.method,
headers,
body: request.method === "POST" ? await request.arrayBuffer() : undefined,
signal: AbortSignal.timeout(10_000),
});
} catch {
return new Response(null, { status: 502 });
}
const answer = new Headers({ "X-Content-Type-Options": "nosniff" });
for (const name of POSTHOG_RESPONSE_HEADERS) {
const value = upstream.headers.get(name);
if (value) answer.set(name, value);
}
return new Response(upstream.body, { status: upstream.status, headers: answer });
}

// The newest disk image is the first in the site's own update feed, which scripts/release.sh writes once the release
// is up. No call to GitHub's API, whose limits shared addresses run into. Before any release, the releases page.
async function newest(request, env) {
Expand Down
2 changes: 1 addition & 1 deletion wrangler.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"binding": "ASSETS",
"not_found_handling": "404-page",
"run_worker_first": [
"/api/*", "/buy", "/download", "/download/*", "/", "/support", "/thanks", "/waitlist", "/feedback", "/*/",
"/api/*", "/ingest/*", "/buy", "/download", "/download/*", "/", "/support", "/thanks", "/waitlist", "/feedback", "/*/",
"/*/support", "/*/thanks", "/*/waitlist", "/*/feedback", "/license", "/privacy", "/terms"
]
},
Expand Down
Loading