Skip to content

The native runtime for three.js: three.js, down to the metal. 45× smaller than Electron, on a Sony PS3, and path-traced at 60 fps on ray-tracing GPUs.

Download: ThreeRT for Steam Deck and for Android beside macOS and iPhone; the release files from R2, as attachments (#62)

Evan (Yifeng) Wang6e51cb6afe5b
diff --git a/site/README.md b/site/README.md
index c0003f9..1630774 100644
--- a/site/README.md
+++ b/site/README.md
@@ -20,19 +20,24 @@ bun site/tools/deploy.ts # build out/site (strict, see below), then wrangler
```
It is a Cloudflare Worker, `threert-site`: static assets from `out/site` on the custom domains threert.dev and
-www.threert.dev; `site/worker.ts` redirects www to the apex and the old Showcase page to threert.app, serves the clients' disk images
+www.threert.dev; `site/worker.ts` redirects www to the apex and the old Showcase page to threert.app, serves the clients' files
from R2 and hands everything else to the assets.
-Workers static assets take **25 MiB a file**, and the client's disk image is about 32 MiB (it carries the `threert`
-command line). So the image is not a static asset: it lives in the R2 bucket `threert-releases` under its file name,
-and `worker.ts` serves it at the URL the Download page links, `/releases/<file>` (ranges, `ETag`, `HEAD`). R2 rather
+Workers static assets take **25 MiB a file**, and the macOS disk image is about 34 MiB (it carries the `threert`
+command line). So the clients' files are not static assets: the disk image (`.dmg`), the Linux tarball (`.tar.gz`)
+and the Android APK (`.apk`) live in the R2 bucket `threert-releases` under their file names, and `worker.ts` serves
+them at the URL the Download page links, `/releases/<file>` (ranges, `ETag`, `HEAD`), each with its type
+(`application/x-apple-diskimage`, `application/gzip`, `application/vnd.android.package-archive`) and
+`content-disposition: attachment`, so a phone's browser saves the APK instead of trying to show it. R2 rather
than a GitHub release because the client is closed source and has no public repository to carry one. Once:
```bash
bunx wrangler@4 r2 bucket create threert-releases
```
-`deploy.ts` uploads the image `releases/latest.json` names, then deploys. `build.ts` leaves the image out of
-`out/site` (`--with-image` copies it, for a plain file host). Locally, `serve.ts` serves it from `site/releases/`.
+`deploy.ts` uploads every file `releases/latest.json` names, then deploys. A file the bucket already has is not sent
+again: the script asks the live site (`HEAD /releases/<file>`) and skips one with the same size (and the same MD5,
+where the object's ETag is one). `build.ts` leaves the clients' files out of `out/site` (`--with-image` copies them,
+for a plain file host). Locally, `serve.ts` serves them from `site/releases/`.
To check the Worker itself without an account: `bunx wrangler@4 r2 object put threert-releases/<file> --file
site/releases/<file> --local --config site/wrangler.jsonc`, then `bunx wrangler@4 dev --config site/wrangler.jsonc`.
@@ -52,7 +57,7 @@ The markup is repeated in each page; change it in all of them (the privacy page
| Page | What is on it |
|---|---|
| `index.html` | The landing page (below). |
-| `download/` | ThreeRT for macOS (the build `releases/latest.json` names) and ThreeRT for iPhone (a TestFlight or App Store link once `ios.url` is set), then how a client loads a game: `threert dev`, scan, traced and live. |
+| `download/` | The four clients, a card each (below), then how a client loads a game: `threert dev`, scan, traced and live. |
| `docs/` | Getting started: install the client, open an example, write a scene, the dev loop with the `threert` CLI, the package format and publishing to threert.app, links to the reference documents in `docs/` on GitHub. |
| `privacy/` | What the apps and the site do with data, including the requests the pages make to other services (below). |
| `showcase/` | Gone as a page: what it listed is published on threert.app. The Worker answers `/showcase`, `/showcase/` and `/showcase/index.html` with a 301 to `https://threert.app/` (old links: the npm packages' READMEs, the pages of packages built before, earlier apps); `showcase/index.html` is what is left for a host without the Worker, a page that sends the reader on. `showcase/community.json` stays where it is, served as before: ThreeRT for macOS before 0.4.0 reads it (and `play/index.json`) for its Showcase. Nothing is added to it any more: people publish with `threert publish`. |
@@ -60,8 +65,10 @@ The markup is repeated in each page; change it in all of them (the privacy page
### The landing page
The buttons, in the hero and at the end, in this order of weight: **Explore apps** (filled, to threert.app), **Star on
-GitHub** (outlined, with the count), and under them a line with **Download** as a link (named for the visitor's
-platform by `js/site.js`). One filled button a row; three equal buttons were the thing to avoid.
+GitHub** (outlined, with the count), and under them a line with **Download** as a link, named for the visitor's
+platform by `js/site.js` (`a[data-dl]`), then the other clients in a word each (`[data-dl-others]`: "Download for
+macOS · iPhone · Steam Deck · Android"). One filled button a row; three equal buttons were the thing to avoid, and
+the clients do not get buttons here.
1. **Hero:** a reel behind the headline: a grid of short clips of this repository's demos (Bistro with a crowd,
Tokyo at dusk, Kabukichō, the voxel level, the showcase cases) and of OpenStrike, all ThreeRT live, ray traced,
@@ -91,6 +98,26 @@ platform by `js/site.js`). One filled button a row; three equal buttons were the
`threert publish` does is what https://threert.app/publish says; check there before changing it.
12. **Just light.**
+### The Download page
+
+Four cards, the same anatomy in each: a glyph, the name, one requirement line, three short lines, then one button
+with the version and the size beside it, and under it at most a fine line and the file's SHA-256 behind a
+disclosure. **Keep it that terse**: a card that grows a paragraph stops matching the others.
+
+| Card | From `latest.json` | Under the button |
+|---|---|---|
+| ThreeRT for macOS | `macos`: the disk image | SHA-256 |
+| ThreeRT for iPhone | `ios.url`: TestFlight or the App Store | the link as a QR code in the card's corner |
+| ThreeRT for Steam Deck | `linux`: the tarball (x86_64; Linux is in the requirement line) | the two commands that install it, in a block with a Copy button (`tar xzf ~/Downloads/<file>`, `ThreeRT/install.sh`: what the tarball's README says, with the place a browser saves to), one line on what they do, SHA-256 |
+| ThreeRT for Android | `android`: the APK (arm64) | one line on installing it, SHA-256; the APK's address as a QR code in the corner |
+
+Two cards a row from 1021 px up, one column below. The two cards of a row share their rows (`subgrid`), so the
+buttons are level whatever the lines above them wrap to; the pairs stay together (macOS with iPhone, Steam Deck with
+Android). The visitor's own client comes first and is the lit card (`platform()` in `js/site.js`: an Android browser
+says Linux too, so it is asked first; `Linux x86_64` is what a Steam Deck's browsers say in Desktop Mode and in Game
+Mode); the QR codes show from 1241 px up, and never for the device the visitor is on. A client `latest.json` has no
+entry for gets a disabled button and "No … build is published on this host yet."
+
### threert.app's apps on the landing page
`js/platform.js` decides which apps are shown and builds a tile; it has no DOM and no imports, so the page and the
@@ -126,27 +153,41 @@ in its Showcase and opens its packages. Without `releases/` the Download page sa
`serve.ts` and `build.ts` warn; `build.ts --require-release` (what `deploy.ts` runs) stops instead, so a deploy never
puts up a Download button with nothing behind it.
-`releases/latest.json`, next to the file it names:
+`releases/latest.json`, next to the files it names. An entry a client; each has its own `version` and `date`,
+because clients are released on different days (an entry without them has the top-level ones, which are the macOS
+release's). A client without an entry is not published on this host:
```jsonc
{
- "version": "0.1.0", "date": "2026-11-11",
- "macos": { "file": "ThreeRT-0.1.0-macos-arm64.dmg", "size": 33981234, "sha256": "…", "minOS": "14.0", "arch": "arm64",
+ "version": "0.4.0", "date": "2026-11-13",
+ "macos": { "version": "0.4.0", "date": "2026-11-13",
+ "file": "ThreeRT-0.4.0-macos-arm64.dmg", "size": 35754483, "sha256": "…", "minOS": "14.0", "arch": "arm64",
"url": null, // null: `releases/<file>` on this host (R2 behind the Worker; site/releases/ locally);
- // or the https URL of the image when it is hosted elsewhere (`release.ts --macos-url`)
+ // or the https URL of the file when it is hosted elsewhere. The same in every entry
"signed": "developer-id", // or "adhoc" (a local preview)
"notarized": true }, // build.ts --require-release (the deploy) refuses anything but a notarized Developer ID build
- "ios": { "url": null, // the TestFlight / App Store link; null: "TestFlight beta not open yet"
+ "ios": { "version": "0.4.0", "date": "2026-11-13",
+ "url": null, // the TestFlight / App Store link; null: "TestFlight beta not open yet"
"channel": "testflight", // or "appstore"
- "minOS": "17.0" }
+ "minOS": "17.0" },
+ "linux": { "version": "0.4.0", "date": "2026-11-13",
+ "file": "ThreeRT-0.4.0-linux-x86_64.tar.gz", "url": null, "size": 18871783, "sha256": "…", "arch": "x86_64",
+ "needs": "SteamOS 3 or a Linux with Vulkan ray queries" },
+ "android": { "version": "0.4.0", "date": "2026-11-13",
+ "file": "ThreeRT-0.4.0-android-arm64.apk", "url": null, "size": 10012854, "sha256": "…", "arch": "arm64",
+ "minOS": "10", // the Android release
+ "signed": true } // with the release key; the deploy refuses anything else
}
```
+`build.ts` checks that every file named is in `site/releases/` at the size named (`--require-release`: or stops).
+The release script keeps the entries and files of the clients a release does not make.
+
`releases/appcast.xml`, written by the same release for a signed build, is the update feed installed copies of ThreeRT
for macOS read (Sparkle, from 0.3.0; `https://threert.dev/releases/appcast.xml` is in the app's Info.plist): one item,
the release, its image's URL and length and the EdDSA signature the apps check. It is a static asset next to
`latest.json`; the image it names is the one `deploy.ts` puts in R2 first. `build.ts` stops on a feed that offers
-another version, file or size than `latest.json`, or a non-https URL.
+another version, file or size than `latest.json`'s macOS entry, or a non-https URL.
`play/index.json`, next to a thumbnail and a package directory for each game:
@@ -175,14 +216,14 @@ where it is served:
| `showcase/` | The page that sends old links on to threert.app, and `community.json` for clients before 0.4.0 |
| `css/threert.css` | The visual system: ink, bone and tungsten tokens, type, the nav and footer (with the Star button and the arrow of a link to threert.app), the comparison and player components, the cards, steps and QR tiles of the inner pages |
| `js/threert.js` | The wipe comparison (and the clip that can play over its two stills), the reel behind the landing page's headline, the synced camera-move player, the code highlighter. A divider follows a finger only once it moves sideways, so scrolling past one does not move it |
-| `js/site.js` | What the pages share: the visitor's platform, the release on this host, the Star buttons' count, QR codes |
+| `js/site.js` | What the pages share: the visitor's platform (macOS, iPhone, Android, Linux x86_64), the clients released on this host, the Star buttons' count, QR codes |
| `js/platform.js` | threert.app on the landing page: which apps are shown, and a tile's markup (shared with `tools/platform.ts`) |
| `js/devices.js` | The 3D device rows (three.js), with a still fallback when WebGL is off |
| `brand/card.jpg` | The share card (Open Graph, 1200 x 630): the hero's headline over the reel's still, a screenshot of the page with the nav's links, the lede and the buttons hidden |
| `brand/` | The mark ("Three bounces": the three.js triangle, tilted as three.js draws it, and the closed light path inside it, which is three.js's own inner triangle) and its variants. `js/mark.js` draws it live in the lockup and on the landing page, and turns the path on hover. `avatar.svg` is the profile picture (X, Discord): the mark on black for a round crop, its triangle concentric with the circle, heavier strokes (4.2 against 3.2) so it holds at 32 px |
| `media/` | The renders, WebP, and the clips (the reel, the Bistro comparison), H.264. Generated; never retouched |
| `serve.ts`, `tools/` | Local server, static build, deploy, media and device-still generators; `tools/platform.ts` bakes threert.app's apps and OpenStrikeRT's pictures into the landing page; `tools/vendor.ts` names the npm files the pages import (three.js, qrcode-generator) |
-| `worker.ts`, `wrangler.jsonc` | The Cloudflare Worker (www redirect, the old Showcase page to threert.app, disk images from R2, byte ranges for the clips, static assets) and its config (threert.dev) |
+| `worker.ts`, `wrangler.jsonc` | The Cloudflare Worker (www redirect, the old Showcase page to threert.app, the clients' files from R2 as downloads, byte ranges for the clips, static assets) and its config (threert.dev) |
| `releases/`, `play/` | Generated, not committed (above) |
## Media
diff --git a/site/docs/index.html b/site/docs/index.html
index 2dce013..42bcc71 100644
--- a/site/docs/index.html
+++ b/site/docs/index.html
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>ThreeRT Docs — getting started</title>
-<meta name="description" content="Install the ThreeRT client, open an example, write a scene with a three.js-style API, run it on a Mac and an iPhone with threert dev, and publish it to threert.app.">
+<meta name="description" content="Install the ThreeRT client (macOS, iPhone, Steam Deck, Android), open an example, write a scene with a three.js-style API, run it on a Mac and an iPhone with threert dev, and publish it to threert.app.">
<link rel="icon" href="../brand/favicon.svg" type="image/svg+xml">
<link rel="stylesheet" href="../css/threert.css">
<style>
@@ -81,7 +81,7 @@
<section id="install">
<span class="num">01</span>
<h2>Install the client</h2>
- <p>The client is the runtime: it fetches a game’s code, runs it and traces it on the device’s own GPU. There is one for macOS (macOS 14 or later, Apple silicon) and one for iPhone and iPad (iOS 17 or later). The macOS one also carries the <code>threert</code> command line you develop with (<a href="#dev">step 4</a>).</p>
+ <p>The client is the runtime: it fetches a game’s code, runs it and traces it on the device’s own GPU. There is one for macOS (macOS 14 or later, Apple silicon), one for iPhone and iPad (iOS 17 or later), one for the Steam Deck and Linux (x86_64) and one for Android (arm64, Android 10 or later); the last two play what is on threert.app. The macOS one also carries the <code>threert</code> command line you develop with (<a href="#dev">step 4</a>).</p>
<div class="acts"><a class="btn primary sm" href="../download/" data-dl><span>Download</span></a></div>
</section>
diff --git a/site/download/index.html b/site/download/index.html
index de93eb0..df3084c 100644
--- a/site/download/index.html
+++ b/site/download/index.html
@@ -3,25 +3,34 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
-<title>Download ThreeRT — macOS and iPhone</title>
-<meta name="description" content="ThreeRT for macOS and for iPhone and iPad: the clients that open ThreeRT apps and games, from threert.app or your own dev server, and path-trace them on your own GPU.">
+<title>Download ThreeRT — macOS, iPhone, Steam Deck and Android</title>
+<meta name="description" content="ThreeRT for macOS, iPhone and iPad, Steam Deck and Linux, and Android: the free clients that open ThreeRT apps and games, from threert.app or your own dev server, and path-trace them on your own GPU.">
<link rel="icon" href="../brand/favicon.svg" type="image/svg+xml">
<link rel="stylesheet" href="../css/threert.css">
<style>
- .dl { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: stretch; }
- .dl .card { display: grid; grid-template-rows: auto auto 1fr auto; gap: 22px; }
+ /* Four cards, two a row. A card's three parts (what it is, three lines, the button) sit on rows the two cards of a
+ row share, so the buttons are level whatever the lines above them wrap to. */
+ .dl { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
+ .dl .card { display: grid; grid-template-rows: auto 1fr auto; row-gap: 22px; }
+ @supports (grid-template-rows: subgrid) { .dl .card { grid-row: span 3; grid-template-rows: subgrid; } }
.dl .top { display: flex; align-items: center; gap: 16px; min-height: 76px; }
.dl .glyph { flex: none; width: 52px; height: 52px; border-radius: 14px; border: 1px solid var(--line-2); display: grid; place-items: center; color: var(--bone); background: var(--ink-2); }
.dl h2 { font: 600 28px/1.1 var(--font-sans); letter-spacing: -0.035em; }
- .dl .req { display: block; margin-top: 6px; font: 500 12px var(--font-mono); color: var(--mute); }
- .dl .act { display: grid; gap: 14px; justify-items: start; padding-top: 22px; border-top: 1px solid var(--line); }
+ .dl .req { display: block; margin-top: 6px; font: 500 12px/1.45 var(--font-mono); color: var(--mute); }
+ .dl .act { display: grid; gap: 14px; justify-items: start; align-content: start; padding-top: 22px; border-top: 1px solid var(--line); min-width: 0; }
.dl .act .row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.dl details { font: 400 12px/1.6 var(--font-mono); color: var(--mute); max-width: 100%; }
.dl details summary { cursor: pointer; }
+ .dl details summary span { white-space: nowrap; }
.dl details p { margin-top: 6px; overflow-wrap: anywhere; color: var(--bone-2); }
.dl .top .qr { margin-left: auto; width: 76px; height: 76px; padding: 5px; border-radius: 10px; }
.dl .top .qr[hidden] { display: none; }
.dl .act > .fine, .dl .act > details:not([open]) { min-height: 22px; line-height: 22px; }
+ /* The Deck's two commands: a block to copy. */
+ .dl .cmd { position: relative; justify-self: stretch; min-width: 0; }
+ .dl .cmd pre { margin: 0; padding: 11px 14px; border-radius: 12px; font-size: 12px; line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; }
+ .dl .cmd button { position: absolute; bottom: 8px; right: 8px; height: 26px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--ink-2); color: var(--bone-2); font: 500 11.5px/1 var(--font-mono); cursor: pointer; }
+ .dl .cmd button:hover { color: var(--bone); border-color: var(--bone-2); }
.how .lede { max-width: 62ch; }
.term { margin-top: 44px; display: grid; grid-template-columns: 1.25fr 1fr; gap: 18px; align-items: stretch; }
.term pre { margin: 0; font-size: 12.5px; line-height: 1.75; }
@@ -32,8 +41,12 @@
.any { margin-top: 56px; padding-top: 36px; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; align-items: end; }
.any h3 { font: 620 clamp(26px, 3vw, 40px)/1.08 var(--font-sans); letter-spacing: -0.04em; }
.any p { color: var(--bone-2); font-size: 16px; }
- @media (max-width: 1100px) { .dl, .term, .any { grid-template-columns: 1fr; } .any { gap: 18px; } }
- @media (max-width: 520px) { .term .scan { grid-template-columns: 1fr; } .dl .top .qr, .dl .on-mac { display: none; } }
+ @media (max-width: 1100px) { .term, .any { grid-template-columns: 1fr; } .any { gap: 18px; } }
+ /* The QR codes are for a desk: below it the cards are too narrow to hold one beside a requirement line. */
+ @media (max-width: 1240px) { .dl .top { min-height: 0; } .dl .top .qr, .dl .on-desk { display: none; } }
+ @media (max-width: 1180px) { .dl h2 { font-size: 24px; } .dl .req, .dl .cmd pre { font-size: 11.5px; } }
+ @media (max-width: 1020px) { .dl { grid-template-columns: 1fr; } .dl h2 { font-size: 28px; } .dl .req, .dl .cmd pre { font-size: 12px; } }
+ @media (max-width: 520px) { .term .scan { grid-template-columns: 1fr; } .dl h2 { font-size: 21px; } }
</style>
</head>
<body>
@@ -59,24 +72,23 @@
<div class="card lit" id="mac">
<div class="top">
<div class="glyph" aria-hidden="true"><svg width="26" height="26" viewBox="0 0 26 26" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round" stroke-linecap="round"><rect x="4.5" y="5" width="17" height="11.5" rx="1.6"/><path d="M2 20.5h22"/></svg></div>
- <div><h2>ThreeRT for macOS</h2><span class="req">macOS 14 or later · Apple silicon</span></div>
+ <div><h2>ThreeRT for macOS</h2><span class="req">macOS&nbsp;14 or&nbsp;later · Apple&nbsp;silicon</span></div>
</div>
<ul class="ticks">
<li>Everything on <a href="https://threert.app/" rel="noopener">threert.app</a>, traced on your Mac</li>
<li>Hardware ray tracing on M3 and later</li>
<li>Includes the <code>threert</code> command line; updates itself</li>
</ul>
- <span></span>
<div class="act" id="macAct">
<p class="fine">Looking for the build on this host…</p>
- <noscript><p class="fine">The download link is filled in by a script. With scripts off, the build is at <a href="../releases/latest.json">releases/latest.json</a>.</p></noscript>
+ <noscript><p class="fine">The download links are filled in by a script. With scripts off, the builds are named in <a href="../releases/latest.json">releases/latest.json</a>.</p></noscript>
</div>
</div>
<div class="card" id="ios">
<div class="top">
<div class="glyph" aria-hidden="true"><svg width="26" height="26" viewBox="0 0 26 26" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round" stroke-linecap="round"><rect x="7.5" y="2.5" width="11" height="21" rx="2.6"/><path d="M11.5 5.2h3"/></svg></div>
- <div><h2>ThreeRT for iPhone</h2><span class="req">iOS 17 or later · iPhone and iPad</span></div>
+ <div><h2>ThreeRT for iPhone</h2><span class="req">iOS&nbsp;17 or&nbsp;later · iPhone and&nbsp;iPad</span></div>
<div class="qr" id="iosQr" hidden></div>
</div>
<ul class="ticks">
@@ -84,11 +96,41 @@
<li>Hardware ray tracing on iPhone 15 Pro and later</li>
<li>Reloads on every save of your project</li>
</ul>
- <span></span>
<div class="act" id="iosAct">
<p class="fine">Looking for the build on this host…</p>
</div>
</div>
+
+ <div class="card" id="deck">
+ <div class="top">
+ <div class="glyph" aria-hidden="true"><svg width="26" height="26" viewBox="0 0 26 26" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round" stroke-linecap="round"><rect x="1.5" y="7" width="23" height="12" rx="3.2"/><rect x="8" y="9.6" width="10" height="6.8" rx="0.8"/><circle cx="4.8" cy="11.4" r="1.1"/><circle cx="21.2" cy="14.6" r="1.1"/></svg></div>
+ <div><h2>ThreeRT for Steam Deck</h2><span class="req">SteamOS&nbsp;3 · Linux&nbsp;x86_64 · Vulkan&nbsp;ray&nbsp;queries</span></div>
+ </div>
+ <ul class="ticks">
+ <li>Everything on <a href="https://threert.app/" rel="noopener">threert.app</a>, in Game Mode</li>
+ <li>Hardware ray tracing on the Deck’s own GPU</li>
+ <li>Tested on a Steam Deck; untested on desktop Linux</li>
+ </ul>
+ <div class="act" id="deckAct">
+ <p class="fine">Looking for the build on this host…</p>
+ </div>
+ </div>
+
+ <div class="card" id="android">
+ <div class="top">
+ <div class="glyph" aria-hidden="true"><svg width="26" height="26" viewBox="0 0 26 26" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round" stroke-linecap="round"><rect x="2.5" y="7.5" width="21" height="11" rx="2.4"/><circle cx="5.6" cy="13" r="0.5"/><path d="M20.4 11v4"/></svg></div>
+ <div><h2>ThreeRT for Android</h2><span class="req">Android&nbsp;10 or&nbsp;later · arm64 · Vulkan&nbsp;ray&nbsp;queries</span></div>
+ <div class="qr" id="androidQr" hidden></div>
+ </div>
+ <ul class="ticks">
+ <li>Everything on <a href="https://threert.app/" rel="noopener">threert.app</a>, with a controller or touch</li>
+ <li>For flagship chips with hardware ray tracing</li>
+ <li>Verified on a Snapdragon 8 Gen 2 handheld</li>
+ </ul>
+ <div class="act" id="androidAct">
+ <p class="fine">Looking for the build on this host…</p>
+ </div>
+ </div>
</div>
</div>
</section>
@@ -139,55 +181,91 @@
<p class="legal">A research project from <a href="https://meshy.ai/" rel="noopener">MeshyAI</a> · © 2026 MeshyAI · <a href="../privacy/">Privacy</a></p>
</div>
<div class="note">
- <p>ThreeRT for macOS and ThreeRT for iPhone are free to use. The engine they run is open source: <a href="https://github.com/meshy-dev/ThreeRT" rel="noopener">meshy-dev/ThreeRT</a>.</p>
- <p>Mac, macOS, iPhone, iPad and TestFlight are trademarks of Apple Inc.</p>
+ <p>The ThreeRT clients are free to use. The engine they run is open source: <a href="https://github.com/meshy-dev/ThreeRT" rel="noopener">meshy-dev/ThreeRT</a>.</p>
+ <p>Mac, macOS, iPhone, iPad and TestFlight are trademarks of Apple Inc. Steam Deck and SteamOS are trademarks of Valve Corporation. Android is a trademark of Google LLC.</p>
</div>
</div>
</footer>
<script type="module">
- import { guard, release, macUrl, megabytes, qrTiles, qrSvg, platform } from "../js/site.js";
+ import { guard, release, clientUrl, megabytes, qrTiles, qrSvg, platform } from "../js/site.js";
const esc = (s) => String(s).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/"/g, "&quot;");
const DL = `<svg width="15" height="15" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M8 1.5v9M4.2 7 8 10.8 11.8 7M2 14.5h12"/></svg>`;
+ const $ = (q) => document.querySelector(q);
+
+ // The visitor's own client first, and lit; the one for a device like it beside it. Before anything is fetched, so
+ // nothing moves afterwards.
+ const here = platform();
+ const order = { ios: ["ios", "mac", "deck", "android"], linux: ["deck", "android", "mac", "ios"], android: ["android", "deck", "mac", "ios"] }[here];
+ if (order) {
+ $(".dl").append(...order.map((id) => document.getElementById(id)));
+ for (const card of $(".dl").children) card.classList.toggle("lit", card.id === order[0]);
+ }
guard("qr", () => qrTiles());
guard("release", async () => {
const r = await release();
- const mac = document.querySelector("#macAct"), ios = document.querySelector("#iosAct");
+ // One button a card, its version and size beside it.
+ const row = (href, label, a, b, attrs = "download") => `<div class="row"><a class="btn primary" href="${esc(href)}" ${attrs}>${DL}<span>${label}</span></a>
+ <span class="kv"><span><b>${esc(a)}</b></span><span>${esc(b)}</span></span></div>`;
+ const sha = (e) => `<details><summary>${esc(e.file)} · <span>SHA-256</span></summary><p>${esc(e.sha256 ?? "")}</p></details>`;
+ const none = (name) => `<div class="row"><span class="btn off" aria-disabled="true">No build on this host</span></div>
+ <p class="fine">No ${name} build is published on this host yet.</p>`;
+ const version = (e) => e.version ?? r.version;
- // macOS: the disk image this host carries.
+ // macOS: the disk image. Signed with a Developer ID and notarized (the deploy refuses anything else): it opens
+ // like any app.
const m = r?.macos;
- if (m?.file) {
- // Signed with a Developer ID and notarized (the deploy refuses anything else): it opens like any app.
- mac.innerHTML = `
- <div class="row"><a class="btn primary" href="${esc(macUrl(m))}" download>${DL}<span>Download for macOS</span></a>
- <span class="kv"><span><b>${esc(r.version)}</b></span><span>${megabytes(m.size)}</span></span></div>
- <details><summary>${esc(m.file)} · SHA-256</summary><p>${esc(m.sha256 ?? "")}</p></details>`;
- } else {
- mac.innerHTML = `<div class="row"><span class="btn off" aria-disabled="true">No build on this host</span></div>
- <p class="fine">No macOS build is published on this host yet.</p>`;
- }
+ $("#macAct").innerHTML = m?.file ? row(clientUrl(m), "Download for macOS", version(m), megabytes(m.size)) + sha(m) : none("macOS");
// iPhone: a link once the beta is open; until then, say so.
const i = r?.ios;
if (i?.url) {
const where = i.channel === "appstore" ? "the App Store" : "TestFlight";
- ios.innerHTML = `
- <div class="row"><a class="btn primary" href="${esc(i.url)}" rel="noopener">${DL}<span>Get it on ${where}</span></a>
- <span class="kv"><span><b>${i.channel === "appstore" ? esc(r.version) : "Beta"}</b></span><span>Free</span></span></div>
- <p class="fine on-mac">On a Mac? Point the iPhone’s camera at the code above.</p>`;
- const qr = document.querySelector("#iosQr");
- qr.innerHTML = await qrSvg(i.url, `ThreeRT for iPhone on ${where}`);
- qr.hidden = false;
+ $("#iosAct").innerHTML = row(i.url, `Get it on ${where}`, i.channel === "appstore" ? version(i) : "Beta", "Free", `rel="noopener"`) +
+ (here === "ios" ? "" : `<p class="fine on-desk">Point the iPhone’s camera at the code above.</p>`);
+ if (here !== "ios") {
+ $("#iosQr").innerHTML = await qrSvg(i.url, `ThreeRT for iPhone on ${where}`);
+ $("#iosQr").hidden = false;
+ }
} else {
- ios.innerHTML = `<div class="row"><span class="btn off" aria-disabled="true">TestFlight beta not open yet</span></div>
+ $("#iosAct").innerHTML = `<div class="row"><span class="btn off" aria-disabled="true">TestFlight beta not open yet</span></div>
<p class="fine">The iPhone app has no public build yet. Its TestFlight link will be on this page when the beta opens.</p>`;
}
- // Lead with the visitor's own platform.
- if (platform() === "ios") document.querySelector(".dl").prepend(document.querySelector("#ios"));
+ // Steam Deck and Linux: the tarball, and the two commands that install it (the file a browser saves is in
+ // ~/Downloads; install.sh adds a shortcut to Steam, so ThreeRT is in the library in Game Mode).
+ const l = r?.linux;
+ if (l?.file) {
+ const commands = `tar xzf ~/Downloads/${l.file}\nThreeRT/install.sh`;
+ $("#deckAct").innerHTML = row(clientUrl(l), "Download for Steam Deck", version(l), megabytes(l.size)) +
+ `<div class="cmd"><pre class="code">${esc(commands)}</pre><button type="button" aria-label="Copy the two commands">Copy</button></div>
+ <p class="fine">Run in Desktop Mode’s Konsole. Adds ThreeRT to your Steam library.</p>` + sha(l);
+ const copy = $("#deckAct .cmd button");
+ copy.addEventListener("click", async () => {
+ try {
+ await navigator.clipboard.writeText(commands + "\n");
+ copy.textContent = "Copied";
+ } catch {
+ // No clipboard (an insecure context, a refusal): select the lines, to copy by hand.
+ getSelection().selectAllChildren($("#deckAct .cmd pre"));
+ }
+ setTimeout(() => (copy.textContent = "Copy"), 1600);
+ });
+ } else $("#deckAct").innerHTML = none("Steam Deck");
+
+ // Android: the APK. Signed with the release key (the deploy refuses anything else).
+ const a = r?.android;
+ if (a?.file) {
+ $("#androidAct").innerHTML = row(clientUrl(a), "Download for Android", version(a), megabytes(a.size)) +
+ `<p class="fine">Open the file and allow installs from your browser.</p>` + sha(a);
+ if (here !== "android") {
+ $("#androidQr").innerHTML = await qrSvg(clientUrl(a), "ThreeRT for Android: the APK");
+ $("#androidQr").hidden = false;
+ }
+ } else $("#androidAct").innerHTML = none("Android");
});
</script>
</body>
diff --git a/site/index.html b/site/index.html
index e691032..a8c30ca 100644
--- a/site/index.html
+++ b/site/index.html
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>ThreeRT — Hardware ray-traced three.js</title>
-<meta name="description" content="ThreeRT is a real-time path tracer behind a three.js-style API: Bistro and Zero-Day fully path-traced at 60 fps. Open source, MIT. Apps and games made with it are published at threert.app.">
+<meta name="description" content="ThreeRT is a real-time path tracer behind a three.js-style API: Bistro and Zero-Day fully path-traced at 60 fps. Open source, MIT. Apps and games made with it are published at threert.app; free clients for macOS, iPhone, Steam Deck and Android.">
<link rel="canonical" href="https://threert.dev/">
<meta name="theme-color" content="#060709">
<meta property="og:site_name" content="ThreeRT">
@@ -19,7 +19,7 @@
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@ThreeRT3D">
<link rel="icon" href="brand/favicon.svg" type="image/svg+xml">
-<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"WebSite","name":"ThreeRT","url":"https://threert.dev/","description":"Hardware ray-traced three.js: a real-time path tracer behind a three.js-style API. Apps and games made with it are published at threert.app.","publisher":{"@type":"Organization","name":"MeshyAI","url":"https://meshy.ai/"}},{"@type":"SoftwareSourceCode","name":"ThreeRT","description":"A real-time path tracer behind a three.js-style API: a Rust and wgpu engine, TypeScript scene and gameplay packages.","url":"https://threert.dev/","codeRepository":"https://github.com/meshy-dev/ThreeRT","license":"https://opensource.org/licenses/MIT","programmingLanguage":["Rust","TypeScript"]}]}</script>
+<script type="application/ld+json">{"@context":"https://schema.org","@graph":[{"@type":"WebSite","name":"ThreeRT","url":"https://threert.dev/","description":"Hardware ray-traced three.js: a real-time path tracer behind a three.js-style API. Apps and games made with it are published at threert.app.","publisher":{"@type":"Organization","name":"MeshyAI","url":"https://meshy.ai/"}},{"@type":"SoftwareSourceCode","name":"ThreeRT","description":"A real-time path tracer behind a three.js-style API: a Rust and wgpu engine, TypeScript scene and gameplay packages.","url":"https://threert.dev/","codeRepository":"https://github.com/meshy-dev/ThreeRT","license":"https://opensource.org/licenses/MIT","programmingLanguage":["Rust","TypeScript"]},{"@type":"SoftwareApplication","name":"ThreeRT","description":"The free clients that open ThreeRT apps and games and path-trace them on the device's own GPU.","url":"https://threert.dev/download/","applicationCategory":"GameApplication","operatingSystem":"macOS 14, iOS 17, SteamOS 3 and Linux x86_64, Android 10","offers":{"@type":"Offer","price":"0","priceCurrency":"USD"}}]}</script>
<link rel="stylesheet" href="css/threert.css">
<noscript><style>.rv { opacity: 1; transform: none; }</style></noscript>
<script type="importmap">{ "imports": { "three": "./vendor/three/three.module.js", "three/addons/": "./vendor/three/addons/" } }</script>
@@ -243,7 +243,7 @@
<h1 class="h-display">Hardware<span class="l2">ray-traced</span><span class="l2 ray-text">three.js.</span></h1>
<p class="lede" style="max-width:52ch">ThreeRT is the first three.js-style engine to fully path-trace industry-standard scenes at 60 fps.<sup>1</sup></p>
<div class="cta"><a class="btn primary" href="https://threert.app/" rel="noopener"><span>Explore apps</span></a><a class="btn ghost star" href="https://github.com/meshy-dev/ThreeRT" rel="noopener" aria-label="Star ThreeRT on GitHub"><svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M8 .2a8 8 0 0 0-2.53 15.59c.4.07.55-.17.55-.38v-1.34c-2.23.48-2.7-1.07-2.7-1.07-.36-.93-.89-1.17-.89-1.17-.73-.5.05-.49.05-.49.8.06 1.23.83 1.23.83.72 1.22 1.88.87 2.33.66.07-.52.28-.87.5-1.07-1.77-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82a7.6 7.6 0 0 1 4 0c1.53-1.03 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.28.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48v2.19c0 .21.15.46.55.38A8 8 0 0 0 8 .2Z"/></svg><span>Star<span class="w"> on GitHub</span></span><b data-stars hidden></b></a></div>
- <p class="plat"><a href="download/" data-dl>Download ThreeRT</a> · macOS 14+ on Apple silicon · iPhone and iPad, iOS 17+</p>
+ <p class="plat"><a href="download/" data-dl>Download ThreeRT</a> · <span data-dl-others>macOS · iPhone · Steam&nbsp;Deck · Android</span></p>
</div>
</div>
</header>
@@ -371,7 +371,7 @@
<div>
<h3>Native client</h3><span class="req">hardware ray tracing</span>
<p class="sub">Every light path traced, at 60 fps.</p>
- <ul><li>Dynamic resolution holds the frame rate</li><li><span>Installs like any game client: <a href="download/">macOS and iPhone</a></span></li></ul>
+ <ul><li>Dynamic resolution holds the frame rate</li><li><span>Installs like any game client: <a href="download/">macOS, iPhone, Steam Deck, Android</a></span></li></ul>
</div>
<div class="shelf3d" id="shelfNative"></div>
</div>
@@ -476,7 +476,7 @@ return { scene, camera };</pre></li>
<div class="no rv"><s>Shadow maps.</s> <s>Light probes.</s> <s>Lightmaps.</s><br><s>Screen-space GI.</s> <s>Baking.</s></div>
<div class="yes rv">Just <span class="ray-text">light</span>.</div>
<div class="cta rv"><a class="btn primary" href="https://threert.app/" rel="noopener"><span>Explore apps</span></a><a class="btn ghost star" href="https://github.com/meshy-dev/ThreeRT" rel="noopener" aria-label="Star ThreeRT on GitHub"><svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor" aria-hidden="true"><path d="M8 .2a8 8 0 0 0-2.53 15.59c.4.07.55-.17.55-.38v-1.34c-2.23.48-2.7-1.07-2.7-1.07-.36-.93-.89-1.17-.89-1.17-.73-.5.05-.49.05-.49.8.06 1.23.83 1.23.83.72 1.22 1.88.87 2.33.66.07-.52.28-.87.5-1.07-1.77-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82a7.6 7.6 0 0 1 4 0c1.53-1.03 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.28.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48v2.19c0 .21.15.46.55.38A8 8 0 0 0 8 .2Z"/></svg><span>Star<span class="w"> on GitHub</span></span><b data-stars hidden></b></a></div>
- <p class="plat rv" style="margin-top:16px"><a href="download/" data-dl>Download ThreeRT</a> · macOS 14+ on Apple silicon · iPhone and iPad, iOS 17+</p>
+ <p class="plat rv" style="margin-top:16px"><a href="download/" data-dl>Download ThreeRT</a> · <span data-dl-others>macOS · iPhone · Steam&nbsp;Deck · Android</span></p>
</div>
</section>
diff --git a/site/js/site.js b/site/js/site.js
index 9b7e9f3..9c0249c 100644
--- a/site/js/site.js
+++ b/site/js/site.js
@@ -8,21 +8,37 @@ import { mark } from "./mark.js";
export const ROOT = new URL("..", import.meta.url);
export const GITHUB = "https://github.com/meshy-dev/ThreeRT";
-/** "macos" | "ios" | "other". An iPad asks for the desktop site as a Mac with a touch screen. */
-export function platform() {
- const ua = navigator.userAgent;
- if (/iPhone|iPod|iPad/.test(ua) || (/Macintosh/.test(ua) && navigator.maxTouchPoints > 1)) return "ios";
+/** The clients there are, as a visitor knows the device each is for. */
+export const CLIENTS = { macos: "macOS", ios: "iPhone", linux: "Steam Deck", android: "Android" };
+
+/**
+ * "macos" | "ios" | "android" | "linux" | "other": the client a visitor's device takes. An iPad asks for the desktop
+ * site as a Mac with a touch screen. An Android browser says Linux too, so it is asked first. "linux" is x86_64
+ * alone, what the tarball is built for: a Steam Deck's browsers say "X11; Linux x86_64", in Desktop Mode and in Game
+ * Mode alike.
+ */
+export function platform(ua = navigator.userAgent, touchPoints = navigator.maxTouchPoints) {
+ if (/iPhone|iPod|iPad/.test(ua) || (/Macintosh/.test(ua) && touchPoints > 1)) return "ios";
+ if (/Android/.test(ua)) return "android";
if (/Macintosh|Mac OS X/.test(ua)) return "macos";
+ if (/Linux x86_64/.test(ua)) return "linux";
return "other";
}
-/** The download links (`a[data-dl]`, leading to the download page) name the visitor's platform. */
+/**
+ * The download links (`a[data-dl]`, leading to the download page) name the visitor's platform, and the list beside
+ * one (`[data-dl-others]`) the other clients.
+ */
export function downloadButtons(root = document) {
- const text = { macos: "Download for macOS", ios: "Get ThreeRT for iPhone", other: "Download" }[platform()];
+ const p = platform();
+ const text = { macos: "Download for macOS", ios: "Get ThreeRT for iPhone", linux: "Download for Steam Deck", android: "Download for Android", other: "Download" }[p];
for (const a of root.querySelectorAll("a[data-dl]")) {
const label = a.querySelector("span") ?? a;
label.textContent = text;
}
+ // (A name stays whole: the line breaks at a dot.)
+ const others = Object.entries(CLIENTS).filter(([k]) => k !== p).map(([, name]) => name.replaceAll(" ", "\u00a0")).join(" · ");
+ for (const el of root.querySelectorAll("[data-dl-others]")) el.textContent = others;
}
async function json(rel) {
@@ -34,12 +50,19 @@ async function json(rel) {
}
}
-/** The client release on this host: {version, date, macos: {file, url, size, sha256, minOS, arch, signed, notarized}, ios: {url, channel, minOS}}, or null. */
+/**
+ * The clients released on this host, or null: {version, date, macos, ios, linux, android}, an entry a client, each
+ * with its own `version` (clients are released on different days; an entry without one has the top-level version):
+ * macos {file, url, size, sha256, minOS, arch, signed, notarized}, ios {url, channel, minOS},
+ * linux {file, url, size, sha256, arch, needs}, android {file, url, size, sha256, arch, minOS, signed}.
+ * A client without an entry is not published here.
+ */
export const release = () => json("releases/latest.json");
export const fileUrl = (file) => new URL(`releases/${file}`, ROOT).href;
-/** Where a release's macOS disk image is: `macos.url` when it is hosted elsewhere (it is over this host's size limit), else next to latest.json. */
-export const macUrl = (m) => (m.url ? m.url : fileUrl(m.file));
+/** Where a client's file is: its `url` when it is hosted elsewhere, else next to latest.json. */
+export const clientUrl = (entry) => (entry.url ? entry.url : fileUrl(entry.file));
+export const macUrl = clientUrl;
export const megabytes = (bytes) => `${(bytes / 1e6).toFixed(bytes < 1e7 ? 1 : 0)} MB`;
let qrcode;
diff --git a/site/privacy/index.html b/site/privacy/index.html
index fb1b2b8..da66ded 100644
--- a/site/privacy/index.html
+++ b/site/privacy/index.html
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Privacy — ThreeRT</title>
-<meta name="description" content="What ThreeRT for macOS, ThreeRT for iPhone and iPad, and threert.dev do with your data: no accounts, no analytics, nothing collected.">
+<meta name="description" content="What the ThreeRT clients (macOS, iPhone and iPad, Steam Deck and Linux, Android) and threert.dev do with your data: no accounts, no analytics, nothing collected.">
<link rel="icon" href="../brand/favicon.svg" type="image/svg+xml">
<link rel="stylesheet" href="../css/threert.css">
<style>
@@ -29,7 +29,7 @@
<div class="wrap">
<span class="eyebrow">Privacy</span>
<h1 class="h-1">Nothing to sign up for.<br><span class="mute">Nothing collected.</span></h1>
- <p class="lede">ThreeRT for macOS, ThreeRT for iPhone and iPad, and this site have no accounts, no analytics and no advertising. This page says what they do touch.</p>
+ <p class="lede">The ThreeRT clients (macOS, iPhone and iPad, Steam Deck and Linux, Android) and this site have no accounts, no analytics and no advertising. This page says what they do touch.</p>
</div>
</header>
@@ -40,11 +40,12 @@
<ul>
<li><b>Games you open.</b> The apps download a game from the address you give them: a <code>threert dev</code> server on your own network, threert.dev, or a link you open. That server sees the request, as any web server does.</li>
<li><b>Logs back to your dev server.</b> A game opened from a <code>threert dev</code> server sends its console output back to that server, so it shows in your terminal. Nothing else receives it.</li>
- <li><b>Showcase.</b> ThreeRT for macOS reads the list of apps and games and their pictures from threert.app (versions before 0.4.0: from threert.dev). Playing one from there tells threert.app that it was played, with a random number the app made up on this device, so one device counts once a day. The number says nothing about you and is kept two days.</li>
+ <li><b>The store.</b> ThreeRT for macOS, for Steam Deck and for Android read the list of apps and games and their pictures from threert.app (versions before 0.4.0: from threert.dev). Playing one from there tells threert.app that it was played, with a random number the app made up on this device, so one device counts once a day. The number says nothing about you and is kept two days.</li>
<li><b>Multiplayer rooms.</b> A game that plays in a room connects to it on threert.app and sends what the game needs: the name you chose, a random player number kept on this device, and your moves. A room keeps them while it is open and no longer.</li>
+ <li><b>Updates.</b> ThreeRT for macOS, for Steam Deck and for Android ask threert.dev which version is current. The request carries nothing about you.</li>
<li><b>Sharing a Mac's GPU</b> (ThreeRT for macOS, only when you turn it on): the frames and input go through the relay you set in Settings, by default one on your own machine.</li>
</ul>
- <p>Playing needs no account. There is no advertising identifier, no crash or usage reporting, and no third-party SDK in either app.</p>
+ <p>Playing needs no account. There is no advertising identifier, no crash or usage reporting, and no third-party SDK in any of the apps.</p>
<h2>threert.app</h2>
<p>Browsing and playing on threert.app need no account. Publishing does: you sign in with GitHub, and threert.app keeps your GitHub user number, login, display name and avatar address. It does not ask GitHub for your e-mail address or for access to your repositories.</p>
diff --git a/site/serve.ts b/site/serve.ts
index 9f674bb..56ab2da 100644
--- a/site/serve.ts
+++ b/site/serve.ts
@@ -24,6 +24,7 @@ const TYPES: Record<string, string> = {
".json": "application/json", ".ts": "text/plain; charset=utf-8", ".svg": "image/svg+xml", ".webp": "image/webp", ".png": "image/png", ".jpg": "image/jpeg", ".jpeg": "image/jpeg",
".glb": "model/gltf-binary", ".gltf": "model/gltf+json", ".bin": "application/octet-stream", ".hdr": "application/octet-stream", ".exr": "application/octet-stream", ".ktx2": "image/ktx2",
".mp4": "video/mp4", ".dmg": "application/x-apple-diskimage", ".zip": "application/zip",
+ ".apk": "application/vnd.android.package-archive", ".gz": "application/gzip",
};
for (const f of Object.values(VENDOR)) if (!existsSync(f)) console.warn(`missing ${f}: run npm install at the repo root`);
@@ -58,6 +59,8 @@ Bun.serve({
const headers: Record<string, string> = { "cache-control": "no-cache", "content-type": TYPES[extname(file).toLowerCase()] ?? "application/octet-stream" };
// Packages are fetched by native clients and by pages on other origins (a playground, a game's own site).
if (rel.startsWith("play/")) headers["access-control-allow-origin"] = "*";
+ // The clients' files are downloads, as the Worker serves them.
+ if (/^releases\/[^/]+\.(dmg|tar\.gz|apk)$/.test(rel)) headers["content-disposition"] = `attachment; filename="${rel.slice("releases/".length)}"`;
return new Response(Bun.file(file), { headers });
},
});
diff --git a/site/tools/build.ts b/site/tools/build.ts
index db62599..3356a10 100644
--- a/site/tools/build.ts
+++ b/site/tools/build.ts
@@ -2,12 +2,14 @@
// The pages plus the npm files they import (three.js, the QR encoder); no bundling, nothing rewritten.
//
// Two directories are generated elsewhere and copied when they are there (site/README.md):
-// site/releases/ latest.json and the client build it names (the Download page), appcast.xml (the apps' update feed)
+// site/releases/ latest.json and the clients' files it names (the Download page), appcast.xml (the Macs' update feed)
// site/play/ index.json and the example packages (what clients before 0.4.0 list in their Showcase; the
// apps themselves are published on threert.app now)
// Without releases/ the Download page says that no build is published on this host; the build warns. --require-release makes that
-// (and a file over the host's size limit) an error: what the deploy uses. The disk image itself stays out of the build
-// (--with-image copies it): threert.dev serves it from R2.
+// (and a file latest.json names that is not there, or a file over the host's size limit) an error: what the deploy
+// uses. A client latest.json does not name is not an error: the page says it is not published here. The clients'
+// files themselves (.dmg, .tar.gz, .apk) stay out of the build (--with-image copies them): threert.dev serves them
+// from R2.
import { cpSync, copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync } from "node:fs";
import { dirname, join, relative, resolve } from "node:path";
import { VENDOR } from "./vendor.ts";
@@ -29,39 +31,54 @@ for (const [rel, file] of Object.entries(VENDOR)) {
copyFileSync(file, join(out, rel));
}
-// The client release.
+// The clients' release.
+/** A client's file: never a static asset here (worker.ts serves it from R2), whatever its size. */
+const CLIENT_FILE = /\.(dmg|tar\.gz|apk)$/;
const latest = join(site, "releases/latest.json");
if (existsSync(latest)) {
const r = JSON.parse(readFileSync(latest, "utf8"));
- const file = r.macos?.file && join(site, "releases", r.macos.file);
- // The disk image is never a static asset here: with the command line in it, it is over the 25 MiB a file the host
- // takes. On threert.dev the Worker serves /releases/<file> from R2 (worker.ts; deploy.ts uploads it), or `macos.url`
- // names another place. --with-image copies it into the build, for a plain file host without that limit.
+ // The disk image is over the 25 MiB a file the host takes (the `threert` command line is in it), and every client
+ // file is a download. On threert.dev the Worker serves /releases/<file> from R2 (worker.ts; deploy.ts uploads what
+ // latest.json names), or an entry's `url` names another place. --with-image copies the files into the build, for a
+ // plain file host without that limit.
const withImage = args.includes("--with-image");
- if (r.macos?.url) {
- if (!/^https:\/\//.test(r.macos.url)) problems.push(`site/releases/latest.json: macos.url is not an https URL (${r.macos.url})`);
- } else if (!file || !existsSync(file)) problems.push(`site/releases/latest.json names ${r.macos?.file ?? "no macOS file"}, which is not in site/releases/`);
- else if (statSync(file).size !== r.macos.size) problems.push(`site/releases/${r.macos.file} is ${statSync(file).size} bytes, latest.json says ${r.macos.size}`);
+ const said: string[] = [];
+ for (const [key, name, required] of [["macos", "macOS", true], ["linux", "Linux", false], ["android", "Android", false]] as const) {
+ const e = r[key];
+ if (!e && !required) {
+ said.push(`${name} not published`);
+ continue;
+ }
+ const file = e?.file && join(site, "releases", e.file);
+ if (e?.url) {
+ if (!/^https:\/\//.test(e.url)) problems.push(`site/releases/latest.json: ${key}.url is not an https URL (${e.url})`);
+ } else if (!file || !existsSync(file)) problems.push(`site/releases/latest.json names ${e?.file ?? `no ${name} file`}, which is not in site/releases/`);
+ else if (statSync(file).size !== e.size) problems.push(`site/releases/${e.file} is ${statSync(file).size} bytes, latest.json says ${e.size}`);
+ said.push(`${name} ${e?.version ?? r.version} ${e?.url ?? e?.file ?? "no file"}`);
+ }
// A public build opens like any app: never one that asks the user to get past Gatekeeper.
if (r.macos && (r.macos.signed !== "developer-id" || r.macos.notarized !== true))
problems.push(`site/releases/latest.json: the macOS build is ${r.macos.signed ?? "unsigned"}${r.macos.notarized ? "" : ", not notarized"} (release.ts --sign <Developer ID> --notarize <profile>)`);
- // The update feed installed apps read (the client's tools/sparkle.ts): it must offer the image latest.json names, at
+ // An APK signed with the debug key could never be updated by a real release.
+ if (r.android && r.android.signed !== true) problems.push("site/releases/latest.json: the Android build is not signed with the release key (android.signed is not true)");
+ // The update feed installed Macs read (the client's tools/sparkle.ts): it must offer the image latest.json names, at
// its size, or an app would download something else than the Download page offers (or fail the length check).
const feed = join(site, "releases/appcast.xml");
if (existsSync(feed) && r.macos) {
const xml = readFileSync(feed, "utf8");
const enc = /<enclosure\s+url="([^"]+)"\s+length="(\d+)"[^>]*sparkle:edSignature="[^"]+"/.exec(xml);
const ver = /<sparkle:version>([^<]+)<\/sparkle:version>/.exec(xml)?.[1];
+ const macVersion = r.macos.version ?? r.version;
if (!enc) problems.push("site/releases/appcast.xml: no enclosure with a URL, a length and an EdDSA signature");
else {
if (!/^https:\/\//.test(enc[1])) problems.push(`site/releases/appcast.xml: the update is not on https (${enc[1]})`);
if (!enc[1].endsWith(`/${r.macos.file}`) && enc[1] !== r.macos.url) problems.push(`site/releases/appcast.xml offers ${enc[1]}, latest.json ${r.macos.url ?? r.macos.file}`);
if (Number(enc[2]) !== r.macos.size) problems.push(`site/releases/appcast.xml says ${enc[2]} bytes, latest.json ${r.macos.size}`);
- if (ver !== r.version) problems.push(`site/releases/appcast.xml offers ${ver}, latest.json is ${r.version}`);
+ if (ver !== macVersion) problems.push(`site/releases/appcast.xml offers ${ver}, latest.json's macOS build is ${macVersion}`);
}
}
- cpSync(join(site, "releases"), join(out, "releases"), { recursive: true, filter: (src) => withImage || !src.endsWith(".dmg") });
- console.log(`release ${r.version}: ${r.macos?.url ?? r.macos?.file ?? "no macOS build"}${r.macos?.url || withImage ? "" : " (served from R2: deploy.ts uploads it)"}; updates ${existsSync(feed) ? "releases/appcast.xml" : "none (no appcast.xml)"}; iOS ${r.ios?.url ?? "not published"}`);
+ cpSync(join(site, "releases"), join(out, "releases"), { recursive: true, filter: (src) => withImage || !CLIENT_FILE.test(src) });
+ console.log(`release: ${said.join("; ")}${withImage ? "" : " (files served from R2: deploy.ts uploads them)"}; updates ${existsSync(feed) ? "releases/appcast.xml" : "none (no appcast.xml)"}; iOS ${r.ios?.url ?? "not published"}`);
} else {
problems.push("no site/releases/latest.json: the Download page will say that no build is published on this host");
}
@@ -88,7 +105,7 @@ for (const [, ref] of readFileSync(join(site, "index.html"), "utf8").matchAll(/(
const walk = (d: string): string[] => readdirSync(d, { withFileTypes: true }).flatMap((e) => (e.isDirectory() ? walk(join(d, e.name)) : [join(d, e.name)]));
for (const f of walk(out)) {
const size = statSync(f).size;
- if (size > MAX_FILE && !f.endsWith(".dmg")) problems.push(`${relative(out, f)} is ${(size / 1048576).toFixed(1)} MiB: over the 25 MiB a file that Workers static assets take`);
+ if (size > MAX_FILE && !CLIENT_FILE.test(f)) problems.push(`${relative(out, f)} is ${(size / 1048576).toFixed(1)} MiB: over the 25 MiB a file that Workers static assets take`);
}
for (const p of problems) console.warn(`${strict ? "error" : "warning"}: ${p}`);
diff --git a/site/tools/deploy.ts b/site/tools/deploy.ts
index 5d9065e..5e933a5 100644
--- a/site/tools/deploy.ts
+++ b/site/tools/deploy.ts
@@ -1,21 +1,52 @@
// Builds the site and deploys it to threert.dev (Cloudflare Workers: static assets, custom domains, and the clients'
-// disk images from R2).
+// files from R2).
// bun site/tools/deploy.ts needs `wrangler login` as a member of the account in site/wrangler.jsonc
// The build is strict: it stops when site/releases/ or site/play/ is missing or incomplete, so a deploy never puts up
// a Download button with nothing behind it (site/README.md: where the two directories come from).
-// The disk image latest.json names goes to the R2 bucket first (site/wrangler.jsonc: `threert-releases`, created once
-// with `bunx wrangler@4 r2 bucket create threert-releases`), so the page never links an image that is not there yet.
+// Every file latest.json names (the macOS disk image, the Linux tarball, the Android APK) goes to the R2 bucket
+// first (site/wrangler.jsonc: `threert-releases`, created once with `bunx wrangler@4 r2 bucket create
+// threert-releases`), so the page never links a file that is not there yet. A file the bucket already has is not
+// sent again: the live site is asked for it (HEAD /releases/<file>: the Worker answers with the object's size and
+// ETag), and the same size, and the same MD5 where the ETag is one, means it is there.
import { $ } from "bun";
-import { existsSync, readFileSync } from "node:fs";
+import { createHash } from "node:crypto";
+import { existsSync, readFileSync, statSync } from "node:fs";
import { join, resolve } from "node:path";
+import { clientFile } from "../worker.ts";
const site = resolve(import.meta.dir, "..");
const config = resolve(site, "wrangler.jsonc");
+/** Where the Worker answers (site/wrangler.jsonc `routes`). */
+const ORIGIN = "https://threert.dev";
+
+/** Whether the bucket has this very file, as far as the live site can tell. Any doubt is "no": it is sent again. */
+async function hosted(name: string, file: string): Promise<boolean> {
+ try {
+ const r = await fetch(`${ORIGIN}/releases/${name}`, { method: "HEAD", signal: AbortSignal.timeout(15000) });
+ if (!r.ok || Number(r.headers.get("content-length")) !== statSync(file).size) return false;
+ // (An object put in one piece has its MD5 as its ETag; one put in parts has "<hash>-<parts>", which says nothing.)
+ const md5 = /^"?([0-9a-f]{32})"?$/.exec(r.headers.get("etag") ?? "")?.[1];
+ return !md5 || md5 === createHash("md5").update(readFileSync(file)).digest("hex");
+ } catch {
+ return false;
+ }
+}
+
await $`bun ${resolve(site, "tools/build.ts")} --require-release`;
const latest = JSON.parse(readFileSync(join(site, "releases/latest.json"), "utf8"));
-if (!latest.macos?.url) {
- const file = join(site, "releases", latest.macos.file);
+for (const key of ["macos", "linux", "android"]) {
+ const entry = latest[key];
+ // (An entry with a `url` is hosted elsewhere.)
+ if (!entry?.file || entry.url) continue;
+ const file = join(site, "releases", entry.file);
if (!existsSync(file)) throw new Error(`${file} is missing`);
- await $`bunx wrangler@4 r2 object put ${`threert-releases/${latest.macos.file}`} --file ${file} --content-type application/x-apple-diskimage --remote --config ${config}`;
+ // The type the Worker serves it with; a name it would not serve stops here.
+ const type = clientFile(`/releases/${entry.file}`)?.type;
+ if (!type) throw new Error(`${entry.file}: not a file the Worker serves (/releases/<name>.dmg, .tar.gz or .apk)`);
+ if (await hosted(entry.file, file)) {
+ console.log(`${entry.file}: already in R2, not sent again`);
+ continue;
+ }
+ await $`bunx wrangler@4 r2 object put ${`threert-releases/${entry.file}`} --file ${file} --content-type ${type} --remote --config ${config}`;
}
await $`bunx wrangler@4 deploy --config ${config}`;
diff --git a/site/worker.ts b/site/worker.ts
index de386a1..c797850 100644
--- a/site/worker.ts
+++ b/site/worker.ts
@@ -1,11 +1,12 @@
// The site on Cloudflare Workers: static assets (out/site, built by site/tools/build.ts) on threert.dev, the clients'
-// disk images from R2, and byte ranges for the clips (media/**.mp4), which the assets alone do not answer.
+// files from R2, and byte ranges for the clips (media/**.mp4), which the assets alone do not answer.
// www.threert.dev redirects to the apex, and the old Showcase page to threert.app.
//
-// Why R2: the disk image (releases/ThreeRT-<version>-macos-arm64.dmg, about 32 MiB with the `threert` command line in
+// Why R2: the disk image (releases/ThreeRT-<version>-macos-arm64.dmg, about 34 MiB with the `threert` command line in
// it) is over the 25 MiB a file that static assets take, and the client is closed source, so it has no public
-// repository whose releases could carry it. The bucket holds the images under their file names; this Worker serves
-// them at the same URL the Download page already links, /releases/<file>, with ranges (a resumed download).
+// repository whose releases could carry it. The bucket holds every client's file under its name (the disk image, the
+// Linux tarball, the Android APK); this Worker serves them at the URL the Download page links, /releases/<file>, as
+// downloads (a phone's browser saves an APK instead of trying to show it), with ranges (a resumed download).
interface R2Range {
offset?: number;
length?: number;
@@ -29,15 +30,24 @@ interface Env {
RELEASES: R2Bucket;
}
-/** /releases/<name>.dmg -> the bucket key (the file name), or null for everything else. */
-export function imageKey(pathname: string): string | null {
- return /^\/releases\/([A-Za-z0-9][A-Za-z0-9._-]*\.dmg)$/.exec(pathname)?.[1] ?? null;
+/** What a client's file is served as, by its ending (site/tools/deploy.ts stores it with the same type). */
+const CLIENT_TYPES: Record<string, string> = {
+ ".dmg": "application/x-apple-diskimage",
+ ".tar.gz": "application/gzip",
+ ".apk": "application/vnd.android.package-archive",
+};
+
+/** /releases/<name>.dmg, .tar.gz or .apk -> the bucket key (the file name) and its type, or null for everything else. */
+export function clientFile(pathname: string): { key: string; type: string } | null {
+ const m = /^\/releases\/([A-Za-z0-9][A-Za-z0-9._-]*?(\.dmg|\.tar\.gz|\.apk))$/.exec(pathname);
+ return m ? { key: m[1], type: CLIENT_TYPES[m[2]] } : null;
}
-async function image(request: Request, env: Env, key: string): Promise<Response> {
+async function file(request: Request, env: Env, key: string, type: string): Promise<Response> {
if (request.method !== "GET" && request.method !== "HEAD") return new Response("method not allowed", { status: 405, headers: { allow: "GET, HEAD" } });
const headers = new Headers({
- "content-type": "application/x-apple-diskimage",
+ "content-type": type,
+ // Always a download: an APK or a tarball a browser tried to show would be a page of bytes.
"content-disposition": `attachment; filename="${key}"`,
"accept-ranges": "bytes",
// An hour, then revalidated by ETag: a build may be replaced under its name before its version is final.
@@ -115,7 +125,9 @@ async function clip(request: Request, env: Env): Promise<Response> {
* catalogue there. Only the page: showcase/community.json stays an asset, because clients before 0.4.0 read it.
*/
export const isShowcase = (pathname: string) => /^\/showcase(\/(index\.html)?)?$/.test(pathname);
-export const PLATFORM = "https://threert.app/";
+// (Not exported: the runtime takes a module's named exports for handlers, and `wrangler dev` refuses to start a
+// Worker that exports a string.)
+const PLATFORM = "https://threert.app/";
export default {
async fetch(request: Request, env: Env): Promise<Response> {
@@ -125,8 +137,8 @@ export default {
return Response.redirect(url.toString(), 301);
}
if (isShowcase(url.pathname)) return Response.redirect(PLATFORM, 301);
- const key = imageKey(url.pathname);
- if (key) return image(request, env, key);
+ const client = clientFile(url.pathname);
+ if (client) return file(request, env, client.key, client.type);
if (isClip(url.pathname)) return clip(request, env);
return env.ASSETS.fetch(request);
},
diff --git a/site/wrangler.jsonc b/site/wrangler.jsonc
index e2e1521..74f8975 100644
--- a/site/wrangler.jsonc
+++ b/site/wrangler.jsonc
@@ -8,11 +8,13 @@
"assets": {
"directory": "../out/site",
"binding": "ASSETS",
- // The worker runs first: www redirects, /releases/*.dmg comes from R2, every other request goes to the assets.
+ // The worker runs first: www redirects, the clients' files under /releases/ come from R2, every other request
+ // goes to the assets.
"run_worker_first": true
},
- // The clients' disk images (over the 25 MiB a file that static assets take): site/tools/deploy.ts uploads
- // site/releases/*.dmg here, worker.ts serves them at /releases/<file>. Create it once:
+ // The clients' files (the disk image is over the 25 MiB a file that static assets take; the tarball and the APK
+ // go the same way, served as downloads): site/tools/deploy.ts uploads the files site/releases/latest.json names
+ // here, worker.ts serves them at /releases/<file>. Create it once:
// bunx wrangler@4 r2 bucket create threert-releases
"r2_buckets": [{ "binding": "RELEASES", "bucket_name": "threert-releases" }],
"routes": [