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
2 changes: 1 addition & 1 deletion Website/public/appcast.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<sparkle:version>12</sparkle:version>
<sparkle:shortVersionString>1.9</sparkle:shortVersionString>
<sparkle:minimumSystemVersion>13.0</sparkle:minimumSystemVersion>
<enclosure url="https://github.com/kewonit/outbound/releases/download/v1.9/Outbound-v1.9.dmg" type="application/octet-stream" sparkle:edSignature="pDskzjSmlr8Ku/fjhmQpShHXktWeUF2tLeyBa5U7/fD9isuFcDgDR0r7T1XELxImLdA/WqrIpMwHJ+mf4F37CQ==" length="5916654"/>
<enclosure url="https://outbound.edbn.me/download/Outbound-v1.9.dmg" type="application/octet-stream" sparkle:edSignature="pDskzjSmlr8Ku/fjhmQpShHXktWeUF2tLeyBa5U7/fD9isuFcDgDR0r7T1XELxImLdA/WqrIpMwHJ+mf4F37CQ==" length="5916654"/>
</item>
<item>
<title>Outbound v1.8.1</title>
Expand Down
6 changes: 3 additions & 3 deletions Website/src/pages/[...lang]/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const DIRECT = new Set([9, 10, 11]);
<p class="lede" set:html={t("hero.lede")}></p>
<div class="cta-row" data-direct>
<a class="btn btn-light" href="#buy" data-url="buy" data-soon={t("buy.soon")} set:html={t("buy.button")}></a>
<a class="btn btn-dark" href="https://github.com/kewonit/outbound/releases" data-url="download" data-soon="" set:html={t("download.already")}></a>
<a class="btn btn-dark" href="/download" data-url="download" data-soon="" set:html={t("download.already")}></a>
</div>
<p class="hero-light"><svg viewBox="0 0 16 16" aria-hidden="true"><path d="M2 11a6 6 0 0 1 12 0"/><path d="M8 11 5 8"/></svg><span set:html={t("hero.light")}></span></p>
{/* Shown to buyers for a year after checkout, from this browser's storage only, while app.js puts their key
Expand Down Expand Up @@ -132,7 +132,7 @@ const DIRECT = new Set([9, 10, 11]);
<h3 class="tier-name" set:html={t("buy.already")}></h3>
<p class="tier-price" set:html={t("buy.download")}></p>
<p class="tier-desc" set:html={t("buy.paste")}></p>
<a class="btn btn-dark btn-sm" href="https://github.com/kewonit/outbound/releases" data-url="download" data-soon="" set:html={t("download.already")}></a>
<a class="btn btn-dark btn-sm" href="/download" data-url="download" data-soon="" set:html={t("download.already")}></a>
</article>
</div>
</div>
Expand Down Expand Up @@ -188,7 +188,7 @@ const DIRECT = new Set([9, 10, 11]);
<h2><span set:html={t("footer.tagline")}></span><span class="caret" aria-hidden="true"></span></h2>
<div class="cta-row" data-direct>
<a class="btn btn-light" href="#buy" data-url="buy" data-soon={t("buy.soon")} set:html={t("buy.button")}></a>
<a class="btn btn-dark" href="https://github.com/kewonit/outbound/releases" data-url="download" data-soon="" set:html={t("download.already")}></a>
<a class="btn btn-dark" href="/download" data-url="download" data-soon="" set:html={t("download.already")}></a>
</div>
<Latest lang={lang} />
</div>
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 @@ -23,7 +23,7 @@ const href = (path: string) => localHref(lang, path);
<ol class="steps">
<li data-needs="download">
<strong set:html={t("thanks.step1")}></strong>
<div class="cta-row"><a class="btn btn-dark" href="https://github.com/kewonit/outbound/releases" data-url="download" data-soon="" set:html={t("download.button")}></a></div>
<div class="cta-row"><a class="btn btn-dark" href="/download" data-url="download" data-soon="" set:html={t("download.button")}></a></div>
</li>
<li>
<strong data-i18n="thanks.step2" set:html={t("thanks.step2")}></strong> <span data-i18n="thanks.step2Detail" set:html={t("thanks.step2Detail")}></span>
Expand Down
8 changes: 4 additions & 4 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 2 November 2026</p>
<p class="updated">Last updated 21 November 2026</p>

<nav class="contents" aria-label="On this page">
<a href="#who">1. Who we are</a>
Expand Down Expand Up @@ -69,7 +69,7 @@ import Topbar from "../components/Topbar.astro";
</ul>
<h3>Updates</h3>
<ul>
<li>Once a day Outbound asks this website whether there is a new version, and downloads it from GitHub if there is. Nothing about you is sent beyond what any web request carries: your IP address, and the versions of Outbound and macOS.</li>
<li>Once a day Outbound asks this website whether there is a new version, and downloads it from this website if there is, or from GitHub if this website can't send it. Nothing about you is sent beyond what any web request carries: your IP address, and the versions of Outbound and macOS.</li>
</ul>

<h2 id="mac">5. What stays on your Mac</h2>
Expand Down Expand Up @@ -132,12 +132,12 @@ import Topbar from "../components/Topbar.astro";

<h2 id="who-else">11. Who else handles it</h2>
<ul>
<li><strong>Cloudflare</strong>: hosting, security and email forwarding for this website.</li>
<li><strong>Cloudflare</strong>: hosting this website and the downloads, security, and email forwarding.</li>
<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>Supabase</strong>: the database for the waitlist and feedback.</li>
<li><strong>GitHub</strong>: hosting the downloads and the source code. See <a href="https://docs.github.com/en/site-policy/privacy-policies/github-general-privacy-statement">GitHub's privacy statement</a>.</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>
</ul>

Expand Down
27 changes: 20 additions & 7 deletions scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@ cd "$(dirname "$0")/.."
#
# scripts/release.sh 1.1 "What's new, in a sentence or two."
#
# It bumps the version, builds, signs and notarizes the app, publishes it as a GitHub release, and adds it to
# the appcast and the changelog on the website. Every copy checks that appcast once a day, downloads the update, checks its
# signature, and installs it the next time the Mac is left alone.
# It bumps the version, builds, signs and notarizes the app, publishes it as a GitHub release and in the site's own
# storage on Cloudflare, where downloads and updates come from, and adds it to the appcast and the changelog on the
# website. Every copy checks that appcast once a day, downloads the update, checks its signature, and installs it the
# next time the Mac is left alone.
#
# Needs the Developer ID identity, the outbound-notary profile, and Sparkle's signing key in the login
# keychain (made once with generate_keys --account app.outbound.Outbound; keep a backup of it).
# keychain (made once with generate_keys --account app.outbound.Outbound; keep a backup of it), and Wrangler
# logged in to Cloudflare (npx wrangler login).
usage='Usage: scripts/release.sh <version> "<what is new>"'
version="${1:?$usage}"
notes="${2:?$usage}"
[[ "$version" =~ ^[0-9]+(\.[0-9]+){1,2}$ ]] || { echo "A version looks like 1.9 or 1.9.1." >&2; exit 1; }
identity="Developer ID Application: Kartik Kulloli (55W3P96VL4)"
plist=Configuration/Info.plist
appcast=Website/public/appcast.xml
Expand All @@ -25,6 +28,13 @@ git pull --ff-only --quiet
! gh release view "v$version" >/dev/null 2>&1 || { echo "v$version is already out." >&2; exit 1; }
swift package resolve >/dev/null
sign_update=.build/artifacts/sparkle/Sparkle/bin/sign_update
[[ -d node_modules ]] || npm ci --silent
bucket=outbound-downloads
npx wrangler r2 bucket info "$bucket" >/dev/null 2>&1 ||
{ echo "Can't reach the $bucket bucket on Cloudflare: log in with npx wrangler login." >&2; exit 1; }
# Caches near downloaders keep a file for a day, so once the appcast offers a version, its files are never replaced.
# A release that stopped before that can be run again: nothing was offered yet.
! grep -qF "/Outbound-v$version.dmg\"" "$appcast" || { echo "The appcast already offers v$version." >&2; exit 1; }

# The new version, and a build number one past the last, which is what Sparkle compares.
build=$(( $(plutil -extract CFBundleVersion raw "$plist") + 1 ))
Expand All @@ -39,7 +49,11 @@ zip="build/Outbound-v$version.zip"
cp build/Outbound.dmg "$dmg"
cp build/Outbound.zip "$zip"

# Publish the disk image first, so the appcast never points at a file that isn't there yet.
# Publish the disk image first, so the appcast never points at a file that isn't there yet: in the bucket, which the
# site serves downloads and updates from at /download/, and on GitHub, as the record of the release.
for file in "$dmg" "$zip"; do
npx wrangler r2 object put "$bucket/$(basename "$file")" --file "$file" --remote >/dev/null
done
gh release create "v$version" "$dmg" "$zip" --target "$(git rev-parse HEAD)" \
--title "Outbound v$version" --notes "$notes"

Expand All @@ -52,7 +66,7 @@ item=" <item>
<sparkle:version>$build</sparkle:version>
<sparkle:shortVersionString>$version</sparkle:shortVersionString>
<sparkle:minimumSystemVersion>$(plutil -extract LSMinimumSystemVersion raw Configuration/Info.plist)</sparkle:minimumSystemVersion>
<enclosure url=\"https://github.com/kewonit/outbound/releases/download/v$version/Outbound-v$version.dmg\" type=\"application/octet-stream\" $signature/>
<enclosure url=\"https://outbound.edbn.me/download/Outbound-v$version.dmg\" type=\"application/octet-stream\" $signature/>
</item>"
ITEM="$item" awk '{ print } /<language>/ && !done { print ENVIRON["ITEM"]; done = 1 }' "$appcast" > "$appcast.new"
mv "$appcast.new" "$appcast"
Expand All @@ -69,7 +83,6 @@ fi
git add "$entry"

# The site serves the appcast, so it has to build before the update can go out.
[[ -d node_modules ]] || npm ci --silent
npm run build >/dev/null ||
{ echo "The site doesn't build, so v$version isn't offered yet: fix it, then commit and push." >&2; exit 1; }
git commit --quiet -am "Offer Outbound v$version as an update"
Expand Down
95 changes: 86 additions & 9 deletions worker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
// With ?from=appstore, as the Mac App Store copy opens them, without any way
// to buy or download it here (forAppStore).
// GET /buy[?currency=usd] On to a new Polar checkout for Outbound, in that money, or in dollars.
// GET /download The newest disk image, Outbound-v1.0.dmg and so on, from GitHub.
// GET /download On to the newest disk image, /download/Outbound-v1.0.dmg and so on.
// GET /download/Outbound-v1.0.dmg That version's disk image, or its .zip, from the site's own storage.
// POST /api/checkout A new Polar checkout for Outbound, in the buyer's money: { id, url, expires_at }.
// POST /api/license { checkout } That checkout's license key once it is paid:
// { status: "ready", key, email, paid } or { status: "pending" | "open" | ... }.
Expand Down Expand Up @@ -42,6 +43,9 @@ const MESSAGE_LIMIT = 2000;
const VERSION = /^\d{1,3}(\.\d{1,3}){0,2}$/;
// The app's line about how the painting runs on that Mac: chip, macOS, holds, GPU errors and cost.
const DIAG = /^[A-Za-z0-9 =:,._-]{1,160}$/;
// What a release puts up for download: its disk image and its zip, by version. scripts/release.sh makes versions like
// 1.9 and 1.9.1; a name of any other version still finds its GitHub release.
const RELEASE_FILE = /^Outbound-v(\d[\w.-]{0,30})\.(dmg|zip)$/;
// Outbound's price in the visitor's own money, in the countries most buyers come from, as Cloudflare places them:
// the currency its checkout charges, and how the pages write the price. The Outbound product in Polar needs a price
// of that amount in each currency. Everywhere else, and for anyone who asks for dollars, it's $4.99. Turkish pages
Expand Down Expand Up @@ -77,9 +81,10 @@ const PRICES = {
const PRICE_OR_DOLLARS = /(<a\b[^>]*\sdata-dollars\b[^>]*>)([\s\S]*?<\/a>)|\$4\.99(?![\d.,])/g;

export default {
async fetch(request, env) {
async fetch(request, env, ctx) {
const url = new URL(request.url);
if (url.pathname === "/download") return download(request, env);
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 (TRANSLATED.has(url.pathname)) return forAppStore(url, await page(request, env, url));
if (!url.pathname.startsWith("/api/")) return forAppStore(url, await priced(request, env));
Expand All @@ -98,15 +103,87 @@ export default {
},
};

// The newest disk image, read from the site's own update feed, which scripts/release.sh writes once the release
// 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 download(request, env) {
async function newest(request, env) {
const feed = await env.ASSETS.fetch(new Request(new URL("/appcast.xml", request.url)));
const match = (await feed.text()).match(/<enclosure url="(https:\/\/github\.com\/kewonit\/outbound\/[^"]+\.dmg)"/);
return new Response(null, {
status: 302,
headers: { Location: match ? match[1] : "https://github.com/kewonit/outbound/releases/latest", "Cache-Control": "no-store" },
const match = (await feed.text()).match(/<enclosure url="[^"]*\/(Outbound-v[\w.-]+\.dmg)"/);
return redirect(match ? `/download/${match[1]}` : "https://github.com/kewonit/outbound/releases/latest");
}

// A release's disk image or zip, from the site's own storage on Cloudflare (DOWNLOADS, in R2), which
// scripts/release.sh fills. GitHub sent them slowly, at times about 20 KB a second, to the app's updates as well.
// Once sent whole, a file is kept for a day in the cache where it was asked for. A download resumed part way gets the
// rest, from the cache or from storage. A file that isn't in storage, or storage that fails, sends the download on to
// the file's GitHub release.
async function download(request, env, ctx, url) {
const name = url.pathname.slice("/download/".length);
const release = name.match(RELEASE_FILE);
if (!release) return env.ASSETS.fetch(request);
if (request.method !== "GET" && request.method !== "HEAD") {
return new Response(null, { status: 405, headers: { Allow: "GET, HEAD" } });
}
const github = `https://github.com/kewonit/outbound/releases/download/v${release[1]}/${name}`;
const key = new Request(`${url.origin}${url.pathname}`, request);
const part = request.method === "GET" && request.headers.has("Range");
if (request.method === "GET") {
// The cache failing is no reason to skip storage.
const kept = await caches.default.match(key).catch(() => null);
if (kept) return kept;
}
let file;
try {
if (request.method === "HEAD") {
file = await env.DOWNLOADS.head(name);
} else if (part) {
// A range storage can't serve, past the end or in several pieces, gets the whole file instead. So does a
// download resumed on a file that has changed since it began.
file = await env.DOWNLOADS.get(name, { range: request.headers }).catch(() => undefined);
const since = request.headers.get("If-Range");
if (file?.range && since && since !== file.httpEtag) {
file.body?.cancel();
file = undefined;
}
if (file === undefined) file = await env.DOWNLOADS.get(name);
} else {
file = await env.DOWNLOADS.get(name);
}
} catch (error) {
console.error(`/download/${name}: ${error.message}`);
return redirect(github);
}
if (!file) return redirect(github);
const headers = new Headers({
"Content-Type": release[2] === "dmg" ? "application/x-apple-diskimage" : "application/zip",
"Content-Disposition": `attachment; filename="${name}"`,
"Content-Length": String(file.size),
"Accept-Ranges": "bytes",
// Only a day, in case a file ever has to be replaced, though scripts/release.sh never replaces one already offered.
"Cache-Control": "public, max-age=86400",
ETag: file.httpEtag,
// As every page has (Website/public/_headers, which reaches only the files the site serves itself).
"Strict-Transport-Security": "max-age=63072000; includeSubDomains; preload",
"X-Content-Type-Options": "nosniff",
});
if (!file.body) return new Response(null, { headers });
const [first, last] = file.range ? span(file.range, file.size) : [0, file.size - 1];
if (first > 0 || last < file.size - 1) {
headers.set("Content-Range", `bytes ${first}-${last}/${file.size}`);
headers.set("Content-Length", String(last - first + 1));
return new Response(file.body, { status: 206, headers });
}
const response = new Response(file.body, { headers });
// A plain download fills the cache; one that asked for a part and got the whole file is left out of it.
if (!part) ctx.waitUntil(caches.default.put(key, response.clone()).catch(() => {}));
return response;
}

// The first and last byte an R2 range covers, in a file of that size.
function span(range, size) {
if (range.suffix !== undefined) return [Math.max(size - range.suffix, 0), size - 1];
const first = range.offset ?? 0;
const last = range.length === undefined ? size - 1 : first + range.length - 1;
return [first, Math.min(last, size - 1)];
}

// An English page, or a redirect to the same page in the visitor's language. Search engines, which send no
Expand Down
10 changes: 8 additions & 2 deletions wrangler.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
// Secrets, set once and kept across deploys with npx wrangler secret put NAME: POLAR_ACCESS_TOKEN, and for the
// waitlist and feedback SUPABASE_URL, SUPABASE_KEY and WAITLIST_TOKEN (worker/supabase.sql). Locally they go in
// .dev.vars.
//
// Each release's disk image and zip go in the R2 bucket outbound-downloads (scripts/release.sh puts them there), which
// the Worker serves at /download/Outbound-v1.0.dmg and so on. It is private: nothing reaches it but the Worker.
"name": "outbound",
// The edbn.me account, which holds the site and its bucket.
"account_id": "1f859c2c2ed610755277b10e37f7005e",
"main": "worker/index.js",
"compatibility_date": "2026-10-01",
"build": { "command": "npm run build" },
Expand All @@ -15,8 +20,8 @@
"binding": "ASSETS",
"not_found_handling": "404-page",
"run_worker_first": [
"/api/*", "/buy", "/download", "/", "/support", "/thanks", "/waitlist", "/feedback", "/*/", "/*/support", "/*/thanks",
"/*/waitlist", "/*/feedback", "/license", "/privacy", "/terms"
"/api/*", "/buy", "/download", "/download/*", "/", "/support", "/thanks", "/waitlist", "/feedback", "/*/",
"/*/support", "/*/thanks", "/*/waitlist", "/*/feedback", "/license", "/privacy", "/terms"
]
},
"vars": {
Expand All @@ -32,6 +37,7 @@
// Polar's own checkout link for Outbound for 1 Mac, where the site's Buy goes when a checkout can't be made.
"POLAR_CHECKOUT_LINK": "https://buy.polar.sh/polar_cl_6pzC7vjcRHCZEWxV1M5mQ6zrmGvVYPv3dJpzc2Qv9a9"
},
"r2_buckets": [{ "binding": "DOWNLOADS", "bucket_name": "outbound-downloads" }],
"ratelimits": [
{ "name": "CHECKOUTS", "namespace_id": "1101", "simple": { "limit": 10, "period": 60 } },
{ "name": "LOOKUPS", "namespace_id": "1102", "simple": { "limit": 60, "period": 60 } },
Expand Down
Loading