Files
Ryan Vogel bdeac1bd08 site: add /hex/iphone and /hex/privacy for the iPhone app's App Store listing (#2056)
App Store Connect needs a support URL and a privacy policy URL for Hex for
iPhone, and both returned 404. Adds them as static pages in the Labs pages'
look:

- /hex/iphone (support URL): what Hex for iPhone is, setup (microphone,
  Keyboards, Allow Full Access, the General › Keyboard fallback), why Full
  Access, a short FAQ (on device, free, languages, music, offline, the
  orange dot) and where to get help (GitHub issues, private security
  reports).
- /hex/privacy: the iPhone app's privacy policy, from the App Store drafts.

Facts checked against ios/: Hex Keyboard makes no network requests; the only
download Hex itself makes is FluidAudio's Parakeet English model from
Hugging Face where Apple's speech model isn't available (before iOS 26);
Custom vocabulary, Learn how I type and Record typing logs are off by
default and stay in the App Group; typing logs skip secure, one-time code
and card fields and are kept 14 days.

src/labs.ts exports its page shell with a crumb and extra styles, so the
iPhone pages reuse its head (title, description, canonical, Open Graph and
Twitter tags) instead of a second template. The social card moves from
scripts/labs.ts to scripts/card.ts with the kicker ("Hex Labs", "Hex for
iPhone") as a parameter; Labs cards are unchanged. scripts/iphone.ts writes
both pages, their cards and their sitemap entries; build.ts runs it after
the Labs pages.

Verified: bun run build --mode dev, bun test (13 pass), both pages served
at /hex/iphone and /hex/privacy with .html fallback and screenshotted at
1280 px and 390 px, and the two cards inspected.
2026-11-20 16:09:10 +00:00

30 lines
1.7 KiB
TypeScript

// Writes the Hex for iPhone pages into the built site: iphone.html
// (/hex/iphone, the App Store support URL), privacy.html (/hex/privacy, its
// privacy policy URL), a social card beside each (scripts/card.ts), and both
// in the sitemap.
//
// bun scripts/iphone.ts --mode dev
import { getWorkerAssetsDir } from "@cloudflare/build-output-utils"
import { readFileSync, writeFileSync } from "node:fs"
import { join, resolve } from "node:path"
import { parseArgs } from "node:util"
import { originForMode } from "../src/base"
import { CARDS, IPHONE_PATH, PRIVACY_PATH, renderIphone, renderPrivacy } from "../src/iphone"
import { card } from "./card"
const { values } = parseArgs({ options: { mode: { type: "string" }, out: { type: "string" } } })
const origin = originForMode(values.mode)
const assets = values.out ?? getWorkerAssetsDir(resolve(import.meta.dirname, ".."))
const address = (path: string) => `${origin.replace("https://", "")}${path.slice("/hex".length)}`
const site = (path: string) => join(assets, path.slice("/hex/".length))
writeFileSync(site(`${IPHONE_PATH}.html`), renderIphone(origin))
writeFileSync(site(`${IPHONE_PATH}.png`), await card("Hex for iPhone", CARDS.iphone.title, CARDS.iphone.line, address(IPHONE_PATH)))
writeFileSync(site(`${PRIVACY_PATH}.html`), renderPrivacy(origin))
writeFileSync(site(`${PRIVACY_PATH}.png`), await card("Hex for iPhone", CARDS.privacy.title, CARDS.privacy.line, address(PRIVACY_PATH)))
const sitemap = join(assets, "sitemap.xml")
const urls = [IPHONE_PATH, PRIVACY_PATH].map((path) => ` <url><loc>${origin}${path.slice("/hex".length)}</loc></url>`)
writeFileSync(sitemap, readFileSync(sitemap, "utf8").replace("</urlset>", `${urls.join("\n")}\n</urlset>`))
console.log("iPhone: 2 pages (iphone, privacy).")