From aeae364384123a746c03f85e64948c44aa5304cb Mon Sep 17 00:00:00 2001 From: Siubeng Date: Fri, 23 Oct 2026 11:56:18 +0000 Subject: [PATCH 1/4] feat: add WheelPlay website with Cloudflare deployment configs --- .github/workflows/debug-build.yml | 4 + .github/workflows/website.yml | 38 + README.md | 4 + README.zh-CN.md | 4 + package.json | 3 + website/.gitignore | 2 + website/README.md | 92 ++ website/package.json | 14 + website/public/404.html | 29 + website/public/_headers | 7 + website/public/app.js | 67 + website/public/index.html | 727 +++++++++++ website/public/style.css | 2034 +++++++++++++++++++++++++++++ website/scripts/build.mjs | 16 + website/scripts/serve.mjs | 69 + website/wrangler.jsonc | 6 + website/wrangler.worker.jsonc | 10 + 17 files changed, 3126 insertions(+) create mode 100644 .github/workflows/website.yml create mode 100644 website/.gitignore create mode 100644 website/README.md create mode 100644 website/package.json create mode 100644 website/public/404.html create mode 100644 website/public/_headers create mode 100644 website/public/app.js create mode 100644 website/public/index.html create mode 100644 website/public/style.css create mode 100644 website/scripts/build.mjs create mode 100644 website/scripts/serve.mjs create mode 100644 website/wrangler.jsonc create mode 100644 website/wrangler.worker.jsonc diff --git a/.github/workflows/debug-build.yml b/.github/workflows/debug-build.yml index ab42c62b..e8cce632 100644 --- a/.github/workflows/debug-build.yml +++ b/.github/workflows/debug-build.yml @@ -4,9 +4,13 @@ on: push: paths-ignore: - '**.md' + - 'website/**' + - '.github/workflows/website.yml' pull_request: paths-ignore: - '**.md' + - 'website/**' + - '.github/workflows/website.yml' workflow_dispatch: concurrency: diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml new file mode 100644 index 00000000..373b6dab --- /dev/null +++ b/.github/workflows/website.yml @@ -0,0 +1,38 @@ +name: Website + +on: + push: + paths: + - 'website/**' + - 'docs/assets/app-icon.svg' + - 'docs/licenses/Material-Symbols-Apache-2.0.txt' + - '.github/workflows/website.yml' + pull_request: + paths: + - 'website/**' + - 'docs/assets/app-icon.svg' + - 'docs/licenses/Material-Symbols-Apache-2.0.txt' + - '.github/workflows/website.yml' + workflow_dispatch: + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + defaults: + run: + working-directory: website + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '22' + - run: npm run check + - run: npm run build + - uses: actions/upload-artifact@v4 + with: + name: wheelplay-website + path: website/dist/ + if-no-files-found: error diff --git a/README.md b/README.md index f9473e10..5182226b 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,10 @@ WheelPlay is an Android-hosted CarPlay server for local networks. It streams you Install the app on an Android device and open the displayed address in your car's browser. No browser-side client installation or additional server is required. +## Product website + +The product website lives in [`website/`](website/README.md), separately from the Android-hosted LAN client. With Node.js 22+, run `npm run site:dev` to preview or `npm run site:build` to generate `website/dist/`. No npm dependencies are required. See the [website guide](website/README.md) for Cloudflare Pages and Workers deployment. + ## Features - **Browser display and touch control**: CarPlay streaming, touch input, and fullscreen display. diff --git a/README.zh-CN.md b/README.zh-CN.md index b85de3b3..84aa3aed 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -6,6 +6,10 @@ WheelPlay 是一款 Android 局域网 CarPlay 服务端应用,可将 iPhone 应用安装在 Android 设备上,车机通过浏览器访问即可使用,无需安装客户端或部署额外服务器。 +## 项目官网 + +介绍网站位于 [`website/`](website/README.md),与 Android 内置的局域网浏览器客户端独立。使用 Node.js 22+ 在仓库根目录运行 `npm run site:dev` 预览,运行 `npm run site:build` 生成 `website/dist/`。无需安装 npm 依赖;Cloudflare Pages 和 Workers 部署配置见[官网说明](website/README.md)。 + ## 功能 - **浏览器显示与触控**:支持 CarPlay 画面串流、触摸操作和全屏显示。 diff --git a/package.json b/package.json index acd28e67..d599a962 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,9 @@ "node": ">=22" }, "scripts": { + "site:dev": "npm run dev --prefix website", + "site:build": "npm run build --prefix website", + "site:check": "npm run check --prefix website", "dev": "node scripts/preview.mjs", "demo": "node scripts/preview.mjs --demo", "test": "node --test test/*.test.js", diff --git a/website/.gitignore b/website/.gitignore new file mode 100644 index 00000000..0faa798a --- /dev/null +++ b/website/.gitignore @@ -0,0 +1,2 @@ +dist/ +.wrangler/ diff --git a/website/README.md b/website/README.md new file mode 100644 index 00000000..40fe0038 --- /dev/null +++ b/website/README.md @@ -0,0 +1,92 @@ +# WheelPlay 官网 + +独立于 Android 内置浏览器客户端的静态产品官网。采用原生 HTML、CSS 和 JavaScript,无运行时第三方依赖、远程字体、分析 SDK 或设备连接请求。只有深浅主题偏好会写入浏览器 localStorage;导航/音乐/配对面板均为明确标注的界面示意。 + +参考 [Lovable JSON Formatter 模板](https://lovable.dev/templates/apps/developer-tools/json-formatter) 的蓝色强调、双栏工作区和标签式输出布局,重新设计为产品介绍网站。模板说明页可访问,交互预览未能访问;未复制模板源码或声称逐像素复刻。产品功能以本仓库 README 和文档为依据。 + +## 本地开发 + +需要 Node.js 22+,不需要运行 `npm install`,也不需要 Android SDK。 + +从仓库根目录运行: + +```sh +npm run site:dev +npm run site:check +npm run site:build +``` + +预览地址为 `http://127.0.0.1:4173`。可通过 `PORT=4180 npm run site:dev` 修改端口。预览服务器启动时构建一次,修改文件后需重新运行构建或重启预览;不含自动刷新。构建只清理并重建 `website/dist/`,不会修改 Android 资源。 + +| 路径 | 用途 | +| --- | --- | +| `public/index.html` | 官网结构、产品文案、GitHub 和文档链接 | +| `public/style.css` | 响应式样式、深浅主题、减少动态效果支持 | +| `public/app.js` | 主题切换、键盘可操作的预览标签页 | +| `public/_headers` | Cloudflare 静态资源响应头,本地预览也会应用 | +| `public/404.html` | 独立 404 页面,避免将未知路径当作 SPA 首页 | +| `scripts/build.mjs` | 拷贝静态文件及仓库现有 App 图标和图标许可证 | +| `wrangler.worker.jsonc` | Workers Static Assets 配置,通过 `--config` 显式选择 | +| `wrangler.jsonc` | Pages Git 集成和 CLI 的默认配置 | + +## Cloudflare Pages + +在 Cloudflare 中连接本仓库,选择 Pages 项目: + +| 设置 | 值 | +| --- | --- | +| 框架预设 | None | +| 根目录 | `website` | +| 构建命令 | `npm run build` | +| 输出目录 | `dist` | +| Node.js 版本 | `22` 或更新版本,可设置 `NODE_VERSION=22` | +| 生产分支 | 选择官网代码所在分支;合并后可设为 `main` | + +构建需要完整仓库中的 `docs/assets/app-icon.svg` 和 `docs/licenses/Material-Symbols-Apache-2.0.txt`,请勿只上传未构建的 `website/` 源文件。Pages 会读取默认 `wrangler.jsonc` 中的 `pages_build_output_dir`。Pages 不支持自定义配置路径,因此保留默认文件名;Workers 使用独立命名的配置。 + +也可以先在本地构建,再通过 Wrangler 上传(以下命令从仓库根目录运行): + +```sh +npm run site:build +npx wrangler@4.152.0 pages deploy --cwd website +``` + +首次使用需登录 Cloudflare,并选择或创建 `wheelplay-website` Pages 项目。若项目名不同,更新 `wrangler.jsonc` 中的 `name`。Git 集成和直接上传的项目创建方式请按自己的发布流程选择。 + +## Cloudflare Workers + +同一构建也支持 Workers Static Assets。官网目前没有后端业务,因此无需自定义 Worker handler、数据库或 Secrets。静态资源配置本身即可作为 Worker 部署,不必把 CarPlay 局域网服务迁到云端。 + +从仓库根目录运行: + +```sh +npm run site:build +# 仅校验打包,不发布 +npx wrangler@4.152.0 deploy --config website/wrangler.worker.jsonc --dry-run +# 在你的 Cloudflare 账户下发布 +npx wrangler@4.152.0 deploy --config website/wrangler.worker.jsonc +``` + +使用 Workers Git 构建时,设置根目录 `website`、构建命令 `npm run build`、部署命令 `npx wrangler@4.152.0 deploy --config wrangler.worker.jsonc`。按需修改配置中的 `name`。后续若需要真正的 API,可在此配置中增加 `main` 和 Assets binding,而不影响 Android 应用。 + +Pages 和 Workers 是两种独立托管方式,任选其一即可运行官网;无需同时部署。部署凭据只配置在你的 Cloudflare 账户或 CI Secrets 中,不写入仓库。 + +官方参考:[Pages 静态 HTML](https://developers.cloudflare.com/pages/framework-guides/deploy-anything/)、[Workers Static Assets](https://developers.cloudflare.com/workers/static-assets/get-started/)。 + +## 内容维护 + +- 下载入口使用现有 GitHub Actions 工作流与实际产物名 `wheelplay-debug-apk`。没有假设存在稳定版 Release;获取开发产物需要登录 GitHub,且过期产物可能不可下载。发布稳定版后可在 `index.html` 替换入口及相邻说明。 +- 页面默认中文,提供英文项目文档入口;未声称官网支持双语切换。 +- 导航图和音乐图案是本站 CSS/SVG 示意,不是真实 CarPlay 截图;预览不播放音频,也不连接设备。 +- 沿用仓库现有绿色 App 图标。Material Symbols 图标许可证随构建输出到 `/assets/Material-Symbols-Apache-2.0.txt`,来源见 [`docs/APP_ICON.md`](../docs/APP_ICON.md)。其余简单线条图标和场景由本站绘制。 +- 官网部署地址确定前,不写入虚构的 canonical、站点地图域名或分享图 URL。确定域名后可补充这些 SEO 元数据。 +- CSP 限制外部脚本和网络请求。若后续添加分析或外部 API,需同步维护 `_headers`,而不是直接关闭 CSP。 + +## 验证 + +`npm run site:check` 检查脚本语法,`npm run site:build` 生成完整静态产物;网站 CI 执行这两项并上传构建产物。发布前可用浏览器确认以下行为: + +- 桌面和手机上无横向溢出;三个预览标签均可切换。 +- 标签页支持方向键、Home/End;深浅主题刷新后保留,禁用存储时仍可切换。 +- FAQ 可展开;无 JavaScript 时仍能阅读正文、使用文档/构建链接和展开 FAQ。 +- 未知路径返回 404,图标、CSS、JS 加载成功;控制台无 CSP 错误。 diff --git a/website/package.json b/website/package.json new file mode 100644 index 00000000..2276ca3a --- /dev/null +++ b/website/package.json @@ -0,0 +1,14 @@ +{ + "name": "wheelplay-website", + "version": "1.0.0", + "private": true, + "type": "module", + "engines": { + "node": ">=22" + }, + "scripts": { + "build": "node scripts/build.mjs", + "dev": "node scripts/serve.mjs", + "check": "node --check public/app.js && node --check scripts/build.mjs && node --check scripts/serve.mjs" + } +} diff --git a/website/public/404.html b/website/public/404.html new file mode 100644 index 00000000..95f3b386 --- /dev/null +++ b/website/public/404.html @@ -0,0 +1,29 @@ + + + + + + + 页面未找到 · WheelPlay + + + + +
+ WheelPlay +

404 / WRONG TURN

+

换条路,
回到出发点。

+

这个页面不存在,或已经移动。

+ 返回首页 +
+ + diff --git a/website/public/_headers b/website/public/_headers new file mode 100644 index 00000000..4ac0203d --- /dev/null +++ b/website/public/_headers @@ -0,0 +1,7 @@ +/* + Content-Security-Policy: default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; connect-src 'none'; font-src 'self'; object-src 'none'; base-uri 'self'; form-action 'none'; frame-ancestors 'none' + X-Content-Type-Options: nosniff + Referrer-Policy: strict-origin-when-cross-origin + Permissions-Policy: camera=(), microphone=(), geolocation=() + X-Frame-Options: DENY + Cache-Control: public, max-age=0, must-revalidate diff --git a/website/public/app.js b/website/public/app.js new file mode 100644 index 00000000..e0ad26ca --- /dev/null +++ b/website/public/app.js @@ -0,0 +1,67 @@ +// This site is a product introduction. It never contacts a phone or a CarPlay server. +const themeButton = document.querySelector(".theme-toggle"); +const preference = window.matchMedia("(prefers-color-scheme: dark)"); +let chosenTheme; +try { + chosenTheme = localStorage.getItem("wheelplay-site-theme"); +} catch { + /* Storage is optional. */ +} +if (!["light", "dark"].includes(chosenTheme)) chosenTheme = null; + +function applyTheme(theme) { + document.documentElement.dataset.theme = theme; + const dark = theme === "dark"; + themeButton.setAttribute("aria-pressed", String(dark)); + themeButton.setAttribute( + "aria-label", + dark ? "切换到浅色主题" : "切换到深色主题", + ); + document.querySelector('meta[name="theme-color"]').content = dark + ? "#101720" + : "#f8fafc"; +} +applyTheme(chosenTheme || (preference.matches ? "dark" : "light")); +themeButton.hidden = false; +themeButton.addEventListener("click", () => { + chosenTheme = + document.documentElement.dataset.theme === "dark" ? "light" : "dark"; + applyTheme(chosenTheme); + try { + localStorage.setItem("wheelplay-site-theme", chosenTheme); + } catch { + /* Continue without persistence. */ + } +}); +preference.addEventListener("change", (event) => { + if (!chosenTheme) applyTheme(event.matches ? "dark" : "light"); +}); + +const tabs = [...document.querySelectorAll('[role="tab"]')]; +function selectTab(tab) { + for (const candidate of tabs) { + const selected = candidate === tab; + candidate.setAttribute("aria-selected", String(selected)); + candidate.tabIndex = selected ? 0 : -1; + document.getElementById(candidate.getAttribute("aria-controls")).hidden = + !selected; + } + document.getElementById("preview-mode").textContent = + `${tab.dataset.view.toUpperCase()} / PREVIEW`; +} +for (const [index, tab] of tabs.entries()) { + tab.addEventListener("click", () => selectTab(tab)); + tab.addEventListener("keydown", (event) => { + const targets = { + ArrowRight: (index + 1) % tabs.length, + ArrowLeft: (index + tabs.length - 1) % tabs.length, + Home: 0, + End: tabs.length - 1, + }; + if (!(event.key in targets)) return; + event.preventDefault(); + const target = tabs[targets[event.key]]; + selectTab(target); + target.focus(); + }); +} diff --git a/website/public/index.html b/website/public/index.html new file mode 100644 index 00000000..0d052de2 --- /dev/null +++ b/website/public/index.html @@ -0,0 +1,727 @@ + + + + + + + + + + + + + WheelPlay · 让 CarPlay,在浏览器里就位 + + + + + + + + +
+
+ 为你的车机,打开一种新可能 +

让 CarPlay,
在浏览器里就位。

+

+ 一部 Android,一块车机屏幕。
把 iPhone + 的熟悉体验,带到你的每一次出发。 +

+ +
+ Android 9+车机无需安装 App局域网直连 +
+
+ +
+
+
+ + WheelPlay / 浏览器里的驾驶搭档交互示意 +
+
+ +
+
+
+ +
+ 体验预览 +
+
+
+ +
+ +
+ +
+ 前方 300 米右转,驶入新的旅程 +
+
+
+ 12 分钟6.8 公里 · 一路向前 +
+
+
+
+ + On the road你的随行歌单 + +
+
+ +
+ 下一站,回家熟悉的路,熟悉的体验 +
+
+
+
+ + +
+
+ 浏览器显示与触控NAVIGATION / PREVIEW +
+
+
+
+

+ + 上方为交互示意,并非真实 CarPlay 截图或在线连接入口;实际界面由 iPhone + 与所用 App 决定。 +

+
+ +
+
+
+

LESS SETUP. MORE POSSIBILITY.

+

屏幕之间,
不必有那么多距离。

+
+

让 Android 做好连接,
让车机浏览器专注于眼前的体验。

+
+
+
+ 01 / DISPLAY +

打开浏览器,就是新视野。

+

+ 显示、触控、全屏,一张网页就能完成。车机端无需安装额外客户端。 +

+
+ 触摸操作全屏显示 +
+
+
+ 02 / STREAM +

为不同的屏幕,留一条路。

+

+ 支持 WebRTC + 视频直通,也提供图片兼容模式。按你的设备和网络,选择合适的串流方式。 +

+
+ H.264 / HEVCJPEG / WebP +
+
+
+ 03 / CONTROL +

合不合适,由你来调。

+

+ 调整分辨率、帧率与安全区域,选择音频输出和定位来源,让设置适应你的使用习惯。 +

+
+ 显示偏好音频路由 +
+
+
+
+ +
+
+
+

READY WHEN YOU ARE.

+

从这里,
开始连接。

+

+ 准备一部 iPhone、一台 Android 9+ 设备,
以及支持现代网页与触控的车机浏览器。 +

+ 获取开发构建 +

+ 前往 GitHub Actions,选择成功运行中的
wheelplay-debug-apk + 构建产物。
下载需要登录 GitHub,且产物可能过期。 +

+ 也可以从源码构建 +
+
    +
  1. + 01 +
    +

    在 Android 上,准备好 WheelPlay

    +

    + 安装并打开应用。开源构建默认不含 CarPlay + 认证资源,请先在设置中导入有效资源,校验通过后启动服务。 +

    + 查看认证资源导入说明 +
    +
  2. +
  3. + 02 +
    +

    同一网络,打开同一个入口

    +

    + 让 Android 与车机接入同一局域网,在车机浏览器中打开 WheelPlay + 应用显示的访问地址。 +

    + 使用 App 中的实际地址,无需访问本官网连接。 +
    +
  4. +
  5. + 03 +
    +

    配对、连接,把 CarPlay 带上车

    +

    + 扫描网页二维码或输入配对码,启动显示。保持 Android + 应用在前台,按提示通过 USB 或无线连接 iPhone,并允许使用 + CarPlay。 +

    + 阅读完整使用步骤 +
    +
  6. +
+
+
+ +
+
+

GOOD TO KNOW.

+

出发之前,
你可能想知道。

+ 遇到问题?在 GitHub 反馈 +
+
+
+ + 我的车机可以使用吗? + +

+ 车机浏览器需要支持现代网页与触控,并能通过局域网访问 Android + 服务设备。不同品牌、系统版本和网络环境的兼容性不同,无法保证所有车型可用。建议先在车辆停稳后验证。 +

+
+
+ + 使用 WheelPlay 需要 Root 吗? + +

+ 普通局域网连接和 Web 服务无需 + Root。针对限制私有网段访问的浏览器,项目提供实验性的 Tesla + 兼容模式,包括免 Root VPN 与 Root + 热点路由两种方案,均需按设备实测。查看兼容模式说明 ↗ +

+
+
+ + 声音和麦克风从哪里走? + +

+ 默认由 Android + 处理音频和麦克风,可在设置中启用浏览器路由。浏览器麦克风需要可信的本地 + HTTPS 证书及相应浏览器能力;不支持时可继续使用 Android 麦克风。查看音频配置说明 ↗ +

+
+
+ + 需要服务器或公网连接吗? + +

+ CarPlay 串流由 Android + 在局域网内提供,无需额外云端服务器;导航、音乐等 App + 的在线内容仍可能需要互联网。服务仅用于可信局域网,请勿暴露到公网。本官网只提供介绍与使用指引,不承载设备连接。 +

+
+
+ + 为什么安装后需要导入认证资源? + +

+ 公开分发的开源构建默认不包含 CarPlay 认证资源。需要在「设置 → + CarPlay 认证资源」导入有效资源,通过校验后才能启动服务。导入在 + Android 本机完成。查看支持的导入方式 ↗ +

+
+
+ 它是开源项目吗? +

+ 是。WheelPlay 基于 DiPlay / xcertplay 开发,项目采用 GPL-3.0 + 许可证并保留上游及第三方声明。你可以阅读源码、提交问题或参与改进;第三方组件与素材遵循各自许可证。查看许可证 ↗ +

+
+
+
+ +
+
+

OPEN SOURCE. OPEN POSSIBILITIES.

+

下一程,一起把体验变得更好。

+

从一次使用、一条反馈,到一份代码贡献。

+
+ 在 GitHub 探索 WheelPlay +
+
+ + + diff --git a/website/public/style.css b/website/public/style.css new file mode 100644 index 00000000..816423f3 --- /dev/null +++ b/website/public/style.css @@ -0,0 +1,2034 @@ +@charset "UTF-8"; +:root { + color-scheme: light; + --bg: #f8fafc; + --surface: #fff; + --soft: #f0f4f8; + --text: #17263d; + --muted: #637084; + --faint: #6b7a90; + --line: #e0e6ee; + --blue: #2869e8; + --blue-soft: #eaf1ff; + --green: #399268; + --shadow: 0 18px 60px -28px #203b6a45; + font-family: + Inter, + -apple-system, + BlinkMacSystemFont, + "Segoe UI", + "PingFang SC", + "Microsoft YaHei", + sans-serif; + font-synthesis: none; +} +:root[data-theme="dark"] { + color-scheme: dark; + --bg: #101720; + --surface: #17212e; + --soft: #1c2939; + --text: #e7edf6; + --muted: #adb9ca; + --faint: #9aabc3; + --line: #2d3b4e; + --blue: #87adff; + --blue-soft: #203558; + --green: #75caa0; + --shadow: 0 18px 60px -28px #0009; +} +@media (prefers-color-scheme: dark) { + :root:not([data-theme]) { + color-scheme: dark; + --bg: #101720; + --surface: #17212e; + --soft: #1c2939; + --text: #e7edf6; + --muted: #adb9ca; + --faint: #9aabc3; + --line: #2d3b4e; + --blue: #87adff; + --blue-soft: #203558; + --green: #75caa0; + --shadow: 0 18px 60px -28px #0009; + } +} +* { + box-sizing: border-box; +} +html { + scroll-behavior: smooth; + scroll-padding-top: 96px; +} +body { + margin: 0; + background: var(--bg); + color: var(--text); + font-size: 14px; + line-height: 1.65; + -webkit-font-smoothing: antialiased; +} +a { + color: inherit; + text-decoration: none; +} +button { + font: inherit; + cursor: pointer; +} +svg { + display: block; +} +img { + display: block; + max-width: 100%; +} +button, +a, +summary { + -webkit-tap-highlight-color: transparent; +} +button:focus-visible, +a:focus-visible, +summary:focus-visible, +[tabindex="0"]:focus-visible { + outline: 3px solid var(--blue); + outline-offset: 5px; +} +a, +button { + touch-action: manipulation; +} +[hidden] { + display: none !important; +} +::selection { + background: #bed5ff; + color: #152b52; +} +h1, +h2, +h3, +p { + margin: 0; +} +h1, +h2, +h3 { + font-weight: 650; +} +h2 { + font-size: 38px; + line-height: 1.4; + letter-spacing: -1.6px; +} +h3 { + font-size: 18px; + line-height: 1.5; +} +.container { + width: min(1160px, calc(100% - 64px)); + margin-inline: auto; +} +.mono, +.eyebrow, +.feature-number { + font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; +} +.eyebrow { + font-size: 11px; + letter-spacing: 1.7px; + font-weight: 600; + color: var(--blue); + margin-bottom: 18px; +} +.section { + padding-block: 96px; +} +.skip-link { + position: fixed; + top: 12px; + left: 16px; + transform: translateY(-160%); + z-index: 100; + background: var(--surface); + padding: 10px 20px; +} +.skip-link:focus { + transform: translateY(0); +} +.site-header { + height: 76px; + border-bottom: 1px solid var(--line); + background: var(--bg); +} +.header-inner { + height: 100%; + width: min(1320px, calc(100% - 64px)); + margin: auto; + display: flex; + align-items: center; + justify-content: space-between; + gap: 24px; +} +.brand { + display: inline-flex; + align-items: center; + gap: 10px; + font-size: 20px; + font-weight: 700; + letter-spacing: -0.65px; + flex-shrink: 0; +} +.brand img { + border-radius: 9px; +} +.brand-label { + font-size: 10px; + letter-spacing: 0.3px; + font-weight: 500; + margin-left: 3px; + color: var(--muted); + border: 1px solid var(--line); + border-radius: 5px; + padding: 2px 6px; +} +.site-header nav { + display: flex; + gap: 32px; + color: var(--muted); + font-size: 13px; +} +.site-header nav a:hover, +.text-link:hover, +.site-footer a:hover { + color: var(--blue); +} +.header-actions { + display: flex; + align-items: center; + gap: 22px; +} +.icon-button { + width: 36px; + height: 36px; + display: grid; + place-items: center; + border: 1px solid transparent; + border-radius: 7px; + background: none; + color: var(--muted); +} +.icon-button:hover { + background: var(--soft); + border-color: var(--line); +} +.icon-button svg { + width: 19px; + height: 19px; +} +.github-link { + display: flex; + align-items: center; + gap: 9px; + font-size: 12px; + font-weight: 600; +} +.github-link svg { + width: 18px; + height: 18px; +} +.github-link > span:last-child { + color: var(--faint); +} +.hero { + text-align: center; + padding-top: 65px; + padding-bottom: 42px; +} +.announcement { + display: inline-flex; + gap: 9px; + align-items: center; + font-size: 11px; + font-weight: 500; + background: var(--blue-soft); + border: 1px solid color-mix(in srgb, var(--blue) 15%, transparent); + color: var(--blue); + padding: 5px 12px; + border-radius: 20px; + margin-bottom: 23px; +} +.announcement > span:last-child { + margin-left: 4px; +} +.status-dot { + display: inline-block; + width: 6px; + height: 6px; + border-radius: 50%; + background: var(--green); + flex-shrink: 0; +} +.announcement .status-dot { + background: var(--blue); +} +h1 { + font-size: clamp(40px, 4.4vw, 62px); + font-weight: 700; + line-height: 1.28; + letter-spacing: -2.6px; +} +h1 > span { + color: var(--blue); +} +.hero-description { + font-size: 16px; + line-height: 1.9; + color: var(--muted); + margin-top: 19px; + letter-spacing: 0.3px; +} +.hero-actions { + display: flex; + justify-content: center; + gap: 12px; + margin-top: 26px; +} +.button { + min-height: 45px; + padding: 11px 19px; + border-radius: 7px; + display: inline-flex; + align-items: center; + justify-content: center; + gap: 11px; + font-size: 13px; + font-weight: 600; + line-height: 1.4; + transition: + background 0.18s, + transform 0.18s; + white-space: nowrap; +} +.button:hover { + transform: translateY(-2px); +} +.button svg { + width: 16px; + height: 16px; +} +.primary { + background: #2869e8; + color: white; + border: 1px solid #2869e8; + box-shadow: 0 3px 6px #2869e81a; +} +.primary:hover { + background: #1859d9; +} +.secondary { + background: var(--surface); + border: 1px solid var(--line); +} +.secondary:hover { + background: var(--soft); +} +.hero-notes { + display: flex; + justify-content: center; + gap: 25px; + margin-top: 20px; + font-size: 10px; + color: var(--muted); +} +.hero-notes span { + display: flex; + gap: 5px; + align-items: center; +} +.hero-notes svg { + width: 12px; + height: 12px; + fill: none; + stroke: var(--green); + stroke-width: 1.7; +} +.workspace { + background: var(--surface); + border: 1px solid var(--line); + border-radius: 12px; + box-shadow: var(--shadow); + overflow: hidden; +} +.workspace-bar { + height: 44px; + padding: 0 16px; + display: flex; + align-items: center; + gap: 20px; + border-bottom: 1px solid var(--line); + background: var(--surface); +} +.window-dots { + display: flex; + gap: 5px; +} +.window-dots i { + width: 8px; + height: 8px; + border-radius: 50%; + background: var(--line); +} +.window-dots i:first-child { + background: #e6acaa; +} +.window-dots i:nth-child(2) { + background: #e6c88c; +} +.window-dots i:nth-child(3) { + background: #9acbb0; +} +.workspace-title { + font-size: 10px; + color: var(--muted); + flex: 1; +} +.workspace-title > span { + margin: 0 9px; + color: var(--faint); +} +.demo-badge { + font-size: 9px; + letter-spacing: 1px; + color: var(--muted); + border: 1px solid var(--line); + padding: 1px 7px; + border-radius: 4px; +} +.workspace-body { + display: grid; + grid-template-columns: 30% 70%; +} +.source-panel { + padding: 24px 24px 18px; + border-right: 1px solid var(--line); + display: flex; + flex-direction: column; +} +.panel-heading { + display: flex; + align-items: center; + gap: 9px; + font-size: 11px; + font-weight: 600; +} +.small-icon { + color: var(--blue); + font-size: 20px; + line-height: 1; +} +.panel-heading .mono { + font-size: 9px; + color: var(--faint); + margin-left: auto; + font-weight: 400; +} +.device-flow { + margin-top: 25px; +} +.device-step { + display: flex; + align-items: center; + gap: 11px; + position: relative; +} +.device-icon { + width: 40px; + height: 40px; + border: 1px solid var(--line); + border-radius: 10px; + display: grid; + place-items: center; + background: var(--bg); + flex-shrink: 0; +} +.device-icon svg { + width: 22px; + height: 22px; + fill: none; + stroke: var(--muted); + stroke-width: 1.5; +} +.app-icon { + border: 0; +} +.device-step strong { + font-size: 11px; + font-weight: 600; +} +.device-step p { + font-size: 10px; + color: var(--muted); + margin-top: 2px; +} +.step-number { + margin-left: auto; + font: 9px monospace; + color: var(--faint); +} +.flow-line { + height: 36px; + margin: 5px 0 5px 20px; + border-left: 1px dashed var(--line); + display: flex; + align-items: center; +} +.flow-line span { + font-size: 9px; + color: var(--muted); + margin-left: 30px; +} +.local-note { + display: flex; + gap: 9px; + border-top: 1px solid var(--line); + margin-top: 25px; + padding-top: 16px; +} +.local-note svg { + width: 17px; + height: 17px; + fill: none; + stroke: var(--green); + stroke-width: 1.5; + flex-shrink: 0; +} +.local-note strong { + font-size: 10px; + font-weight: 500; +} +.local-note p { + font-size: 9px; + color: var(--muted); + margin-top: 3px; +} +.preview-panel { + min-width: 0; + background: var(--bg); +} +.preview-toolbar { + height: 52px; + display: flex; + align-items: center; + justify-content: space-between; + padding: 0 20px; + border-bottom: 1px solid var(--line); + gap: 10px; +} +.preview-tabs { + display: flex; + gap: 6px; +} +.preview-tabs button { + font-size: 10px; + font-weight: 500; + color: var(--muted); + border: 1px solid transparent; + background: none; + border-radius: 5px; + padding: 5px 10px; + min-height: 32px; +} +.preview-tabs button[aria-selected="true"] { + background: var(--surface); + color: var(--blue); + border-color: var(--line); + box-shadow: 0 2px 3px #142b4c06; +} +.preview-tabs button:hover { + color: var(--blue); +} +.preview-label { + display: flex; + align-items: center; + gap: 5px; + font-size: 9px; + color: var(--muted); + white-space: nowrap; +} +.display-shell { + padding: 20px 20px 15px; +} +.car-display { + height: 288px; + background: #17202a; + color: #f4f6fa; + border: 5px solid #202a37; + border-radius: 13px; + display: flex; + overflow: hidden; + box-shadow: 0 8px 18px #0f223024; +} +.car-sidebar { + display: flex; + align-items: center; + flex-direction: column; + width: 48px; + padding: 13px 0 10px; + flex-shrink: 0; + background: #222e3b; +} +.car-time { + font-size: 12px; + font-weight: 650; +} +.signal { + font-size: 8px; + color: #b5c2d3; + margin-bottom: 16px; + margin-top: 2px; +} +.dock-icon { + display: grid; + place-items: center; + width: 29px; + height: 29px; + margin-bottom: 11px; + border-radius: 8px; + font-size: 24px; + font-weight: 500; + line-height: 1; + color: white; +} +.map-icon { + background: #4b93a6; +} +.music-icon { + background: #e55c76; +} +.phone-icon { + background: #57a179; +} +.dock-home { + font-size: 24px; + line-height: 1; + margin-top: auto; +} +.map-surface { + position: relative; + flex: 1; + min-width: 0; + overflow: hidden; +} +.map-art { + width: 100%; + height: 100%; + display: block; +} +.turn-card { + display: flex; + gap: 10px; + align-items: center; + position: absolute; + top: 12px; + left: 12px; + right: 12px; + background: #253c38; + box-shadow: 0 3px 7px #20352930; + border-radius: 8px; + padding: 12px; +} +.turn-card > span { + font-size: 29px; + line-height: 1; +} +.turn-card strong { + font-size: 13px; + font-weight: 650; + display: block; +} +.turn-card div > span { + font-size: 9px; + color: #d6e5dc; +} +.arrival-card { + position: absolute; + bottom: 10px; + left: 10px; + right: 10px; + background: #fffffff5; + border-radius: 8px; + padding: 9px 12px; + color: #243647; + box-shadow: 0 3px 10px #20352915; +} +.arrival-card strong { + font-size: 20px; + line-height: 1.2; + display: block; +} +.arrival-card small { + font-size: 11px; + font-weight: 500; +} +.arrival-card > span { + font-size: 9px; + color: #566774; +} +.arrival-card .route-symbol { + position: absolute; + right: 13px; + top: 17px; + font-size: 20px; + color: #328263; +} +.dashboard-widgets { + width: 30%; + padding: 9px; + display: flex; + flex-direction: column; + gap: 8px; + min-width: 145px; +} +.mini-music { + background: #30383e; + flex: 1; + display: flex; + flex-direction: column; + align-items: center; + padding: 12px 6px 8px; + border-radius: 8px; +} +.album-art { + position: relative; + overflow: hidden; + background: #d5bca0; + width: 76px; + height: 76px; + border-radius: 5px; + isolation: isolate; +} +.album-art:before, +.album-art:after { + content: ""; + position: absolute; + border-radius: 50%; + width: 115%; + height: 65%; + background: #6e7c73; + left: -25%; + bottom: -9%; + transform: rotate(24deg); +} +.album-art:after { + left: 35%; + bottom: -10%; + background: #3e625c; + transform: rotate(-25deg); +} +.album-art > span { + position: absolute; + right: 15%; + top: 14%; + width: 21%; + height: 21%; + border-radius: 50%; + background: #f6e4bd; +} +.mini-music > strong { + font-size: 12px; + font-weight: 500; + margin-top: 9px; +} +.mini-music > span { + font-size: 8px; + color: #c1c7cb; + margin-top: 1px; +} +.music-controls { + display: flex; + align-items: center; + justify-content: center; + gap: 24px; + font-size: 23px; + line-height: 1.2; + margin-top: 12px; + color: #edf3f6; +} +.music-controls > span { + font-size: 20px; +} +.destination-widget { + display: flex; + gap: 7px; + align-items: center; + padding: 11px 7px; + background: #30383e; + border-radius: 8px; +} +.home-symbol { + font-size: 25px; + color: #aacbf5; +} +.destination-widget strong { + font-size: 10px; + display: block; + font-weight: 500; +} +.destination-widget div > span { + font-size: 7px; + color: #c1c7cb; +} +.preview-status { + display: flex; + align-items: center; + justify-content: space-between; + padding: 0 21px 14px; + font-size: 9px; + color: var(--muted); +} +.preview-status > span:first-child { + display: flex; + align-items: center; + gap: 6px; +} +.preview-status .mono { + font-size: 8px; + letter-spacing: 0.7px; +} +.demo-caption { + display: flex; + justify-content: center; + align-items: baseline; + gap: 6px; + font-size: 10px; + color: var(--muted); + margin-top: 17px; + line-height: 1.8; + text-align: center; +} +.demo-caption > span { + color: var(--blue); +} +.music-display { + padding: 26px; + align-items: center; + justify-content: center; + gap: 28px; + background: #24322f; +} +.music-art-large { + width: 168px; + height: 190px; + flex-shrink: 0; +} +.music-art-large > div { + position: relative; + z-index: 2; + color: #354b42; + font-size: 28px; + font-weight: 800; + line-height: 0.95; + letter-spacing: -2px; + padding: 17px; +} +.music-copy .eyebrow { + font-size: 7px; + letter-spacing: 0.8px; + color: #c4d4c5; + margin-bottom: 8px; +} +.music-copy h3 { + font-size: 20px; + font-weight: 550; + line-height: 1.4; +} +.music-copy p { + font-size: 9px; + line-height: 1.9; + color: #c4d4ce; + margin-top: 9px; +} +.illustrated-track { + display: flex; + flex-direction: column; + margin-top: 16px; + gap: 3px; +} +.illustrated-track > span:first-child { + font-size: 11px; +} +.illustrated-track > span:last-child { + font-size: 8px; + color: #c4d4ce; +} +.track-progress { + height: 2px; + background: #63736e; + margin-top: 9px; +} +.track-progress span { + display: block; + height: 100%; + width: 35%; + background: #e4eadf; +} +.music-copy .music-controls { + font-size: 20px; + margin-top: 7px; + gap: 28px; +} +.music-copy .music-controls > span { + font-size: 14px; +} +.connection-display { + align-items: center; + flex-direction: column; + justify-content: center; + background: #202e43; + text-align: center; + gap: 7px; +} +.connection-symbol { + font-size: 32px; + color: #a3c1f7; + line-height: 0.8; +} +.connection-display h3 { + font-size: 20px; + line-height: 1.4; + font-weight: 550; +} +.connection-display p { + font-size: 10px; + color: #c2d0e4; + line-height: 1.7; +} +.pair-code { + display: flex; + gap: 6px; + margin: 4px 0; +} +.pair-code span { + font: 22px monospace; + border: 1px solid #51627d; + background: #2c3e58; + border-radius: 5px; + padding: 5px 10px; +} +.connection-footnote { + font-size: 8px; + color: #b2c5e1; +} +.section-intro { + display: flex; + justify-content: space-between; + align-items: flex-end; + margin-bottom: 42px; +} +.section-intro > p { + color: var(--muted); + line-height: 1.9; + font-size: 13px; + padding-bottom: 5px; +} +.feature-grid { + display: grid; + grid-template-columns: repeat(3, 1fr); + border-top: 1px solid var(--line); + border-bottom: 1px solid var(--line); +} +.feature-grid article { + padding: 28px 30px 30px 0; +} +.feature-grid article + article { + border-left: 1px solid var(--line); + padding-left: 30px; +} +.feature-number { + font-size: 9px; + color: var(--faint); + letter-spacing: 1.3px; + display: block; +} +.feature-icon { + width: 30px; + height: 30px; + fill: none; + stroke: var(--blue); + stroke-width: 1.5; + margin: 25px 0 20px; +} +.feature-grid h3 { + font-size: 17px; + letter-spacing: -0.4px; +} +.feature-grid p { + color: var(--muted); + font-size: 12px; + line-height: 1.9; + margin-top: 12px; + max-width: 300px; +} +.feature-tags { + display: flex; + gap: 7px; + margin-top: 22px; +} +.feature-tags span { + font-size: 9px; + color: var(--muted); + background: var(--soft); + border-radius: 4px; + padding: 3px 7px; +} +.start-section { + border-block: 1px solid var(--line); + background: var(--surface); +} +.start-layout { + display: grid; + grid-template-columns: 1fr 1.2fr; + gap: 80px; +} +.start-intro > p:not(.eyebrow) { + color: var(--muted); + font-size: 12px; + line-height: 1.9; + margin-top: 20px; +} +.start-intro .button { + margin-top: 24px; +} +.start-intro .download-note { + font-size: 10px !important; + line-height: 1.9 !important; + margin-top: 12px !important; +} +.start-intro code { + font-size: 10px; +} +.text-link { + color: var(--blue); + font-size: 11px; + font-weight: 500; + display: inline-block; +} +.text-link > span { + margin-left: 4px; +} +.start-intro .text-link { + margin-top: 14px; +} +.setup-steps { + list-style: none; + padding: 0; + margin: 0; +} +.setup-steps li { + display: flex; + gap: 22px; + position: relative; + padding-bottom: 32px; +} +.setup-steps li:not(:last-child):before { + content: ""; + position: absolute; + left: 17px; + top: 43px; + bottom: 7px; + width: 1px; + background: var(--line); +} +.setup-steps li:last-child { + padding-bottom: 0; +} +.setup-number { + flex-shrink: 0; + display: grid; + place-items: center; + font: 11px monospace; + width: 36px; + height: 36px; + border: 1px solid var(--line); + border-radius: 50%; + color: var(--blue); + background: var(--bg); +} +.setup-steps h3 { + font-size: 16px; + line-height: 1.7; + margin-top: 4px; +} +.setup-steps p { + color: var(--muted); + font-size: 12px; + line-height: 1.9; + margin-top: 9px; + max-width: 430px; +} +.setup-steps .text-link { + margin-top: 9px; +} +.step-hint { + display: block; + font-size: 10px; + color: var(--muted); + padding-left: 9px; + border-left: 2px solid var(--line); + margin-top: 10px; +} +.faq-section { + display: grid; + grid-template-columns: 1fr 1.2fr; + gap: 80px; +} +.faq-intro .text-link { + margin-top: 24px; +} +.faq-list details { + border-bottom: 1px solid var(--line); +} +.faq-list details:first-child { + border-top: 1px solid var(--line); +} +.faq-list summary { + display: flex; + justify-content: space-between; + gap: 16px; + align-items: center; + list-style: none; + cursor: pointer; + padding: 21px 0; + font-size: 13px; + font-weight: 550; +} +.faq-list summary::-webkit-details-marker { + display: none; +} +.faq-list summary > span { + font-size: 20px; + font-weight: 300; + color: var(--faint); + transition: transform 0.2s; +} +.faq-list details[open] summary > span { + transform: rotate(45deg); +} +.faq-list details > p { + font-size: 12px; + color: var(--muted); + line-height: 1.9; + padding: 0 24px 22px 0; +} +.faq-list p a { + color: var(--blue); + text-decoration: underline; + text-underline-offset: 3px; +} +.closing { + display: flex; + align-items: center; + justify-content: space-between; + gap: 32px; + padding: 38px; + background: var(--blue-soft); + border: 1px solid color-mix(in srgb, var(--blue) 12%, transparent); + border-radius: 10px; +} +.closing .eyebrow { + font-size: 9px; + letter-spacing: 1.4px; + margin-bottom: 12px; +} +.closing h2 { + font-size: 25px; + letter-spacing: -0.8px; +} +.closing p:not(.eyebrow) { + color: var(--muted); + font-size: 12px; + margin-top: 9px; +} +.closing .button { + font-size: 12px; +} +.site-footer { + margin-top: 68px; + padding-bottom: 25px; +} +.footer-top { + display: flex; + align-items: center; + gap: 25px; + padding-bottom: 24px; + border-bottom: 1px solid var(--line); +} +.footer-top .brand { + font-size: 17px; +} +.footer-top > span { + font-size: 10px; + color: var(--muted); +} +.footer-top > div { + margin-left: auto; + display: flex; + gap: 23px; + font-size: 10px; + color: var(--muted); +} +.footer-bottom { + display: flex; + justify-content: space-between; + gap: 20px; + padding-top: 18px; + font-size: 9px; + color: var(--muted); +} +.footer-bottom p { + text-align: right; +} +.not-found { + min-height: 100svh; + display: grid; + place-items: center; + padding: 32px; +} +.not-found main { + max-width: 600px; +} +.not-found .brand { + margin-bottom: 60px; +} +.not-found h1 { + font-size: 54px; +} +.not-found main > p:not(.eyebrow) { + color: var(--muted); + margin-top: 20px; +} +.not-found .button { + margin-top: 28px; +} +@media (min-width: 1500px) { + .hero { + padding-top: 80px; + padding-bottom: 50px; + } +} +@media (max-width: 1000px) { + .workspace-body { + grid-template-columns: 31% 69%; + } + .source-panel { + padding: 20px 16px 16px; + } + .panel-heading .mono { + display: none; + } + .device-step { + gap: 8px; + } + .device-step strong { + font-size: 10px; + } + .device-step p { + font-size: 9px; + } + .step-number { + display: none; + } + .car-display { + height: 272px; + } + .display-shell { + padding: 16px 14px 12px; + } + .preview-toolbar { + padding-inline: 14px; + } + .dashboard-widgets { + min-width: 124px; + padding: 7px; + } + .destination-widget { + padding: 8px 5px; + } + .destination-widget div > span { + font-size: 6px; + } + .source-panel .local-note { + margin-top: auto; + } + .device-flow { + margin-bottom: 24px; + } + .preview-label { + display: none; + } + .turn-card { + padding: 9px; + gap: 6px; + left: 8px; + right: 8px; + } + .turn-card strong { + font-size: 11px; + } + .turn-card div > span { + font-size: 8px; + } + .music-display { + padding: 22px 15px; + gap: 18px; + } + .music-art-large { + width: 125px; + height: 170px; + } + .music-copy h3 { + font-size: 18px; + } + .start-layout, + .faq-section { + gap: 40px; + } + .feature-grid h3 { + font-size: 15px; + } + .feature-grid article { + padding-right: 22px; + } + .feature-grid article + article { + padding-left: 22px; + } + .footer-top { + gap: 15px; + } + .footer-top > div { + gap: 13px; + } +} +@media (max-width: 760px) { + .container, + .header-inner { + width: calc(100% - 40px); + } + .site-header { + height: 66px; + } + .site-header nav { + gap: 18px; + font-size: 12px; + } + .brand { + font-size: 18px; + } + .brand-label { + display: none; + } + .header-actions { + gap: 10px; + } + .github-link span { + display: none; + } + .hero { + padding-top: 48px; + padding-bottom: 34px; + } + h1 { + font-size: 48px; + letter-spacing: -2px; + } + .hero-description { + font-size: 14px; + } + .hero-notes { + gap: 17px; + } + .workspace-body { + display: flex; + flex-direction: column; + } + .source-panel { + border-right: 0; + border-bottom: 1px solid var(--line); + padding: 17px 18px; + } + .panel-heading { + font-size: 10px; + } + .panel-heading .mono { + display: block; + } + .device-flow { + display: flex; + align-items: center; + justify-content: space-between; + margin: 17px 0 0; + gap: 6px; + } + .device-step { + flex-direction: column; + gap: 7px; + text-align: center; + flex: 1; + } + .device-step strong { + font-size: 10px; + white-space: nowrap; + } + .device-step p { + display: none; + } + .flow-line { + height: 1px; + min-width: 12px; + width: 22px; + margin: 0 0 22px; + border-left: 0; + border-top: 1px dashed var(--line); + flex: 0 1 22px; + } + .flow-line span { + display: none; + } + .local-note { + display: none; + } + .preview-toolbar { + height: 50px; + padding: 0 18px; + } + .preview-label { + display: flex; + } + .display-shell { + padding: 16px 16px 12px; + } + .car-display { + height: 280px; + } + .dashboard-widgets { + min-width: 145px; + } + .turn-card { + padding: 12px; + left: 12px; + right: 12px; + } + .turn-card strong { + font-size: 13px; + } + .turn-card div > span { + font-size: 9px; + } + .mini-music { + padding-top: 13px; + } + .destination-widget { + padding: 10px; + } + .destination-widget div > span { + font-size: 7px; + } + .preview-status { + padding: 0 18px 13px; + } + .demo-caption { + font-size: 9px; + padding-inline: 10px; + } + .section { + padding-block: 64px; + } + h2 { + font-size: 32px; + letter-spacing: -1.3px; + } + .section-intro { + margin-bottom: 28px; + gap: 20px; + } + .section-intro > p { + font-size: 11px; + } + .feature-grid article { + padding: 22px 16px 24px 0; + } + .feature-grid article + article { + padding-left: 16px; + } + .feature-grid h3 { + font-size: 14px; + } + .feature-grid p { + font-size: 11px; + } + .feature-number { + font-size: 8px; + } + .feature-tags { + flex-wrap: wrap; + gap: 4px; + } + .feature-tags span { + font-size: 8px; + } + .feature-icon { + margin-block: 20px 16px; + } + .start-layout, + .faq-section { + grid-template-columns: 1fr; + gap: 38px; + } + .start-intro h2 br, + .faq-intro h2 br { + display: none; + } + .start-intro > p:not(.eyebrow) { + margin-top: 14px; + } + .start-intro .download-note br { + display: none; + } + .setup-steps p { + max-width: 100%; + } + .setup-steps li { + gap: 18px; + } + .faq-intro .text-link { + margin-top: 14px; + } + .closing { + padding: 28px; + align-items: flex-start; + flex-direction: column; + gap: 24px; + } + .closing h2 { + font-size: 22px; + } + .footer-top { + flex-wrap: wrap; + } + .footer-top > div { + width: 100%; + margin: 0; + gap: 20px; + } + .footer-bottom { + flex-direction: column; + gap: 8px; + } + .footer-bottom p { + text-align: left; + } + .site-footer { + margin-top: 44px; + } + .music-art-large { + width: 165px; + height: 190px; + } + .music-display { + gap: 25px; + } + .music-copy h3 { + font-size: 20px; + } +} +@media (max-width: 480px) { + .container, + .header-inner { + width: calc(100% - 32px); + } + .header-inner { + gap: 12px; + } + .brand { + font-size: 17px; + gap: 8px; + } + .brand img { + width: 28px; + height: 28px; + border-radius: 7px; + } + .site-header nav { + gap: 14px; + font-size: 11px; + } + .site-header nav a:first-child { + display: none; + } + .header-actions { + gap: 5px; + } + .github-link { + display: none; + } + .icon-button { + width: 32px; + height: 36px; + } + .hero { + padding-top: 39px; + } + .announcement { + font-size: 10px; + margin-bottom: 23px; + padding: 4px 10px; + } + h1 { + font-size: 41px; + line-height: 1.35; + letter-spacing: -2px; + } + .hero-description { + font-size: 13px; + margin-top: 17px; + } + .hero-actions { + gap: 8px; + margin-top: 24px; + } + .button { + font-size: 11px; + padding: 11px 13px; + gap: 6px; + min-height: 44px; + } + .hero-notes { + gap: 12px; + font-size: 9px; + margin-top: 17px; + } + .hero-notes svg { + width: 10px; + } + .workspace-bar { + padding: 0 12px; + gap: 12px; + height: 38px; + } + .workspace-title { + font-size: 9px; + } + .workspace-title > span { + margin-inline: 5px; + } + .demo-badge { + font-size: 8px; + padding: 1px 5px; + letter-spacing: 0; + } + .window-dots { + gap: 4px; + } + .window-dots i { + width: 6px; + height: 6px; + } + .source-panel { + padding: 14px; + } + .device-icon { + width: 34px; + height: 34px; + border-radius: 8px; + } + .device-icon svg { + width: 19px; + } + .device-step strong { + font-size: 9px; + } + .preview-toolbar { + padding: 0 10px; + height: 48px; + } + .preview-tabs { + gap: 2px; + } + .preview-tabs button { + font-size: 10px; + padding-inline: 9px; + min-height: 36px; + } + .preview-label { + font-size: 8px; + } + .display-shell { + padding: 10px 9px; + } + .car-display { + height: 235px; + border-width: 4px; + border-radius: 10px; + } + .car-sidebar { + width: 35px; + padding-top: 10px; + } + .car-time { + font-size: 10px; + } + .signal { + font-size: 6px; + margin-bottom: 12px; + } + .dock-icon { + width: 24px; + height: 24px; + font-size: 19px; + margin-bottom: 9px; + border-radius: 6px; + } + .dock-home { + font-size: 22px; + } + .dashboard-widgets { + min-width: 95px; + width: 31%; + padding: 6px; + gap: 6px; + } + .album-art { + width: 57px; + height: 57px; + } + .mini-music { + padding: 9px 4px 6px; + } + .mini-music > strong { + font-size: 9px; + margin-top: 8px; + } + .mini-music > span { + font-size: 7px; + } + .music-controls { + gap: 14px; + font-size: 20px; + margin-top: 11px; + } + .music-controls > span { + font-size: 15px; + } + .destination-widget { + padding: 9px 5px; + gap: 5px; + } + .destination-widget strong { + font-size: 8px; + } + .destination-widget div > span { + display: none; + } + .home-symbol { + font-size: 22px; + } + .turn-card { + left: 6px; + right: 6px; + top: 8px; + gap: 7px; + padding: 8px; + } + .turn-card > span { + font-size: 25px; + } + .turn-card strong { + font-size: 10px; + } + .turn-card div > span { + font-size: 7px; + } + .arrival-card { + bottom: 8px; + left: 6px; + right: 6px; + padding: 8px; + } + .arrival-card strong { + font-size: 17px; + } + .arrival-card small { + font-size: 9px; + } + .arrival-card > span { + font-size: 7px; + } + .arrival-card .route-symbol { + right: 8px; + font-size: 17px; + } + .preview-status { + font-size: 8px; + padding: 0 12px 11px; + } + .preview-status .mono { + font-size: 7px; + letter-spacing: 0.1px; + } + .demo-caption { + font-size: 9px; + margin-top: 13px; + padding: 0 6px; + } + .section { + padding-block: 54px; + } + .eyebrow { + font-size: 9px; + letter-spacing: 1.2px; + margin-bottom: 14px; + } + h2 { + font-size: 29px; + } + .section-intro { + display: block; + margin-bottom: 26px; + } + .section-intro > p { + font-size: 12px; + margin-top: 15px; + } + .section-intro > p br { + display: none; + } + .feature-grid { + grid-template-columns: 1fr; + } + .feature-grid article, + .feature-grid article + article { + padding: 26px 0; + border-left: 0; + position: relative; + } + .feature-grid article + article { + border-top: 1px solid var(--line); + } + .feature-icon { + position: absolute; + right: 3px; + top: 21px; + width: 26px; + height: 26px; + margin: 0; + } + .feature-number { + font-size: 9px; + } + .feature-grid h3 { + font-size: 17px; + margin-top: 20px; + } + .feature-grid p { + font-size: 12px; + margin-top: 10px; + max-width: 100%; + } + .feature-tags { + margin-top: 16px; + gap: 7px; + } + .feature-tags span { + font-size: 9px; + } + .setup-steps li { + gap: 14px; + } + .setup-steps h3 { + font-size: 14px; + } + .setup-steps p { + font-size: 12px; + } + .setup-number { + width: 32px; + height: 32px; + font-size: 10px; + } + .setup-steps li:not(:last-child):before { + left: 15px; + top: 39px; + } + .start-intro > p:not(.eyebrow) { + font-size: 12px; + } + .start-intro .button { + font-size: 12px; + } + .faq-section { + gap: 28px; + } + .faq-list summary { + font-size: 12px; + min-height: 64px; + padding-block: 18px; + } + .faq-list details > p { + font-size: 12px; + padding-right: 8px; + } + .closing { + padding: 25px 22px; + } + .closing h2 { + font-size: 20px; + line-height: 1.6; + } + .closing .eyebrow { + font-size: 8px; + letter-spacing: 0.8px; + } + .closing p:not(.eyebrow) { + font-size: 11px; + } + .closing .button { + font-size: 11px; + } + .footer-top > span { + font-size: 9px; + } + .footer-bottom { + font-size: 8px; + } + .music-display { + padding: 16px 10px; + gap: 15px; + } + .music-art-large { + width: 93px; + height: 135px; + } + .music-art-large > div { + font-size: 23px; + padding: 12px; + } + .music-copy .eyebrow { + font-size: 6px; + letter-spacing: 0; + margin-bottom: 8px; + } + .music-copy h3 { + font-size: 17px; + } + .music-copy p { + font-size: 8px; + line-height: 1.7; + margin-top: 7px; + } + .illustrated-track { + margin-top: 10px; + } + .illustrated-track > span:first-child { + font-size: 9px; + } + .illustrated-track > span:last-child { + font-size: 7px; + } + .music-copy .music-controls { + font-size: 18px; + } + .connection-display { + gap: 5px; + } + .connection-symbol { + font-size: 28px; + } + .connection-display h3 { + font-size: 17px; + } + .connection-display p { + font-size: 9px; + } + .pair-code { + gap: 5px; + } + .pair-code span { + font-size: 20px; + padding: 4px 8px; + } + .connection-footnote { + font-size: 7px; + } +} +@media (prefers-reduced-motion: reduce) { + html { + scroll-behavior: auto; + } + *, + *:before, + *:after { + transition: none !important; + animation: none !important; + } + .button:hover { + transform: none; + } +} + +/* Keep decorative symbols independent of installed font glyphs. */ +.small-icon svg { + width: 18px; + height: 18px; +} +.turn-card > span svg { + width: 27px; + height: 27px; +} +.demo-caption > span svg { + width: 12px; + height: 12px; +} +.connection-symbol svg { + width: 28px; + height: 28px; +} +.dock-icon svg { + width: 19px; + height: 19px; +} +/* Body copy remains readable outside the compact illustrative workspace. */ +.feature-grid p, +.setup-steps p, +.faq-list details > p, +.start-intro > p:not(.eyebrow) { + font-size: 14px; +} +.text-link { + font-size: 12px; +} +.footer-top > span, +.footer-top > div { + font-size: 11px; +} +.footer-bottom { + font-size: 10px; +} +@media (max-width: 480px) { + .feature-grid p, + .setup-steps p, + .faq-list details > p, + .start-intro > p:not(.eyebrow) { + font-size: 13px; + } + .turn-card > span svg { + width: 21px; + height: 21px; + } + .footer-top > span { + font-size: 9px; + } + .footer-bottom { + font-size: 9px; + } +} diff --git a/website/scripts/build.mjs b/website/scripts/build.mjs new file mode 100644 index 00000000..04ac3956 --- /dev/null +++ b/website/scripts/build.mjs @@ -0,0 +1,16 @@ +import { cp, mkdir, rm } from "node:fs/promises"; + +const root = new URL("../", import.meta.url); +const output = new URL("dist/", root); +await rm(output, { recursive: true, force: true }); +await mkdir(new URL("assets/", output), { recursive: true }); +await cp(new URL("public/", root), output, { recursive: true }); +await cp( + new URL("../docs/assets/app-icon.svg", root), + new URL("assets/app-icon.svg", output), +); +await cp( + new URL("../docs/licenses/Material-Symbols-Apache-2.0.txt", root), + new URL("assets/Material-Symbols-Apache-2.0.txt", output), +); +console.log("WheelPlay website built → website/dist"); diff --git a/website/scripts/serve.mjs b/website/scripts/serve.mjs new file mode 100644 index 00000000..b78b034e --- /dev/null +++ b/website/scripts/serve.mjs @@ -0,0 +1,69 @@ +import { createServer } from "node:http"; +import { readFile } from "node:fs/promises"; +import { fileURLToPath } from "node:url"; +import { extname, resolve, sep } from "node:path"; +import "./build.mjs"; + +const root = fileURLToPath(new URL("../dist/", import.meta.url)); +const port = Number(process.env.PORT || 4173); +const types = { + ".html": "text/html; charset=utf-8", + ".css": "text/css; charset=utf-8", + ".js": "text/javascript; charset=utf-8", + ".svg": "image/svg+xml", + ".txt": "text/plain; charset=utf-8", +}; +const headers = Object.fromEntries( + (await readFile(resolve(root, "_headers"), "utf8")) + .split("\n") + .filter((line) => line.startsWith(" ")) + .map((line) => { + const colon = line.indexOf(":"); + return [line.slice(0, colon).trim(), line.slice(colon + 1).trim()]; + }), +); + +createServer(async (request, response) => { + if (!["GET", "HEAD"].includes(request.method)) { + response.writeHead(405, { ...headers, Allow: "GET, HEAD" }); + response.end(); + return; + } + try { + const pathname = decodeURIComponent( + new URL(request.url, "http://localhost").pathname, + ); + const path = resolve( + root, + `.${pathname === "/" ? "/index.html" : pathname}`, + ); + if ( + !path.startsWith(root.endsWith(sep) ? root : root + sep) || + ["_headers", "_redirects"].includes(pathname.slice(1)) + ) { + response.writeHead(404, headers); + response.end(); + return; + } + const body = await readFile(path); + response.writeHead(200, { + ...headers, + "Content-Type": types[extname(path)] || "application/octet-stream", + }); + response.end(request.method === "HEAD" ? undefined : body); + } catch { + response.writeHead(404, { + ...headers, + "Content-Type": "text/html; charset=utf-8", + }); + response.end( + request.method === "HEAD" + ? undefined + : await readFile(resolve(root, "404.html")), + ); + } +}).listen(port, "127.0.0.1", () => + console.log( + `WheelPlay website: http://127.0.0.1:${port} (rerun to rebuild after edits)`, + ), +); diff --git a/website/wrangler.jsonc b/website/wrangler.jsonc new file mode 100644 index 00000000..556f2053 --- /dev/null +++ b/website/wrangler.jsonc @@ -0,0 +1,6 @@ +{ + "$schema": "https://raw.githubusercontent.com/cloudflare/workers-sdk/main/packages/wrangler/config-schema.json", + "name": "wheelplay-website", + "compatibility_date": "2026-10-23", + "pages_build_output_dir": "./dist", +} diff --git a/website/wrangler.worker.jsonc b/website/wrangler.worker.jsonc new file mode 100644 index 00000000..9bedd816 --- /dev/null +++ b/website/wrangler.worker.jsonc @@ -0,0 +1,10 @@ +{ + "$schema": "https://raw.githubusercontent.com/cloudflare/workers-sdk/main/packages/wrangler/config-schema.json", + "name": "wheelplay-website", + "compatibility_date": "2026-10-23", + "assets": { + "directory": "./dist", + "html_handling": "auto-trailing-slash", + "not_found_handling": "404-page", + }, +} From 828134493227d60d334e7b1eb03e4c184b67cd69 Mon Sep 17 00:00:00 2001 From: Siubeng Date: Fri, 23 Oct 2026 20:42:59 +0800 Subject: [PATCH 2/4] refactor: migrate WheelPlay website to Astro --- .github/workflows/website.yml | 6 +- README.md | 2 +- README.zh-CN.md | 2 +- package.json | 2 + website/.gitignore | 1 + website/README.md | 98 +- website/astro.config.mjs | 9 + website/package-lock.json | 4667 +++++++++++++++++ website/package.json | 17 +- website/public/404.html | 29 - website/public/app.js | 67 - website/public/index.html | 727 --- website/scripts/build.mjs | 16 - website/scripts/serve.mjs | 69 - website/src/components/Brand.astro | 13 + website/src/components/Closing.astro | 10 + .../src/components/ExperiencePreview.astro | 347 ++ website/src/components/FAQ.astro | 84 + website/src/components/Features.astro | 59 + website/src/components/GettingStarted.astro | 77 + website/src/components/Hero.astro | 45 + website/src/components/SiteFooter.astro | 26 + website/src/components/SiteHeader.astro | 43 + website/src/layouts/BaseLayout.astro | 40 + website/src/pages/404.astro | 16 + .../assets/Material-Symbols-Apache-2.0.txt.ts | 7 + website/src/pages/assets/app-icon.svg.ts | 6 + website/src/pages/index.astro | 25 + website/src/scripts/preview-tabs.ts | 39 + website/src/scripts/theme.ts | 45 + .../style.css => src/styles/global.css} | 0 website/test/build.test.mjs | 61 + website/tsconfig.json | 5 + 33 files changed, 5706 insertions(+), 954 deletions(-) create mode 100644 website/astro.config.mjs create mode 100644 website/package-lock.json delete mode 100644 website/public/404.html delete mode 100644 website/public/app.js delete mode 100644 website/public/index.html delete mode 100644 website/scripts/build.mjs delete mode 100644 website/scripts/serve.mjs create mode 100644 website/src/components/Brand.astro create mode 100644 website/src/components/Closing.astro create mode 100644 website/src/components/ExperiencePreview.astro create mode 100644 website/src/components/FAQ.astro create mode 100644 website/src/components/Features.astro create mode 100644 website/src/components/GettingStarted.astro create mode 100644 website/src/components/Hero.astro create mode 100644 website/src/components/SiteFooter.astro create mode 100644 website/src/components/SiteHeader.astro create mode 100644 website/src/layouts/BaseLayout.astro create mode 100644 website/src/pages/404.astro create mode 100644 website/src/pages/assets/Material-Symbols-Apache-2.0.txt.ts create mode 100644 website/src/pages/assets/app-icon.svg.ts create mode 100644 website/src/pages/index.astro create mode 100644 website/src/scripts/preview-tabs.ts create mode 100644 website/src/scripts/theme.ts rename website/{public/style.css => src/styles/global.css} (100%) create mode 100644 website/test/build.test.mjs create mode 100644 website/tsconfig.json diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index 373b6dab..1c03fffd 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -28,9 +28,13 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version: '22' + node-version: '24' + cache: npm + cache-dependency-path: website/package-lock.json + - run: npm ci - run: npm run check - run: npm run build + - run: npm run test:build - uses: actions/upload-artifact@v4 with: name: wheelplay-website diff --git a/README.md b/README.md index 5182226b..768c2fec 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Install the app on an Android device and open the displayed address in your car' ## Product website -The product website lives in [`website/`](website/README.md), separately from the Android-hosted LAN client. With Node.js 22+, run `npm run site:dev` to preview or `npm run site:build` to generate `website/dist/`. No npm dependencies are required. See the [website guide](website/README.md) for Cloudflare Pages and Workers deployment. +The Astro product website lives in [`website/`](website/README.md), separately from the Android-hosted LAN client. With Node.js 24 LTS, run `npm ci --prefix website`, then `npm run site:dev` for live development or `npm run site:build` to generate `website/dist/`. See the [website guide](website/README.md) for Cloudflare Pages and Workers deployment. ## Features diff --git a/README.zh-CN.md b/README.zh-CN.md index 84aa3aed..519c14d4 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -8,7 +8,7 @@ WheelPlay 是一款 Android 局域网 CarPlay 服务端应用,可将 iPhone ## 项目官网 -介绍网站位于 [`website/`](website/README.md),与 Android 内置的局域网浏览器客户端独立。使用 Node.js 22+ 在仓库根目录运行 `npm run site:dev` 预览,运行 `npm run site:build` 生成 `website/dist/`。无需安装 npm 依赖;Cloudflare Pages 和 Workers 部署配置见[官网说明](website/README.md)。 +Astro 官网位于 [`website/`](website/README.md),与 Android 内置的局域网浏览器客户端独立。推荐 Node.js 24 LTS,在仓库根目录先运行 `npm ci --prefix website` 安装官网依赖,再运行 `npm run site:dev` 开发预览,或运行 `npm run site:build` 生成 `website/dist/`。Cloudflare Pages 和 Workers 部署配置见[官网说明](website/README.md)。 ## 功能 diff --git a/package.json b/package.json index d599a962..32140b83 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,10 @@ }, "scripts": { "site:dev": "npm run dev --prefix website", + "site:preview": "npm run preview --prefix website", "site:build": "npm run build --prefix website", "site:check": "npm run check --prefix website", + "site:test": "npm run test:build --prefix website", "dev": "node scripts/preview.mjs", "demo": "node scripts/preview.mjs --demo", "test": "node --test test/*.test.js", diff --git a/website/.gitignore b/website/.gitignore index 0faa798a..0fc6cf02 100644 --- a/website/.gitignore +++ b/website/.gitignore @@ -1,2 +1,3 @@ dist/ .wrangler/ +.astro/ diff --git a/website/README.md b/website/README.md index 40fe0038..ed7544f0 100644 --- a/website/README.md +++ b/website/README.md @@ -1,65 +1,88 @@ -# WheelPlay 官网 +# WheelPlay 官网(Astro) -独立于 Android 内置浏览器客户端的静态产品官网。采用原生 HTML、CSS 和 JavaScript,无运行时第三方依赖、远程字体、分析 SDK 或设备连接请求。只有深浅主题偏好会写入浏览器 localStorage;导航/音乐/配对面板均为明确标注的界面示意。 +独立于 Android 内置浏览器客户端的 Astro 静态产品官网。页面由 Astro 组件在构建时生成,浏览器仅加载全局 CSS 和少量 TypeScript 编译出的主题、标签页交互脚本,无需 React/Vue hydration 或服务端运行时。没有远程字体、分析 SDK 或设备连接请求;只有深浅主题偏好会写入 localStorage。 -参考 [Lovable JSON Formatter 模板](https://lovable.dev/templates/apps/developer-tools/json-formatter) 的蓝色强调、双栏工作区和标签式输出布局,重新设计为产品介绍网站。模板说明页可访问,交互预览未能访问;未复制模板源码或声称逐像素复刻。产品功能以本仓库 README 和文档为依据。 +设计参考 [Lovable JSON Formatter 模板](https://lovable.dev/templates/apps/developer-tools/json-formatter) 的蓝色强调、双栏工作区和标签页布局。保留 WheelPlay 的既有图标、产品文案、响应式样式和交互示意。 ## 本地开发 -需要 Node.js 22+,不需要运行 `npm install`,也不需要 Android SDK。 +推荐 Node.js 24 LTS(Astro 7.4.2 要求至少 Node.js 22.23.4)。官网依赖与仓库根目录的 Android 开发工具独立,不需要 Android SDK。 从仓库根目录运行: ```sh +npm ci --prefix website npm run site:dev -npm run site:check -npm run site:build ``` -预览地址为 `http://127.0.0.1:4173`。可通过 `PORT=4180 npm run site:dev` 修改端口。预览服务器启动时构建一次,修改文件后需重新运行构建或重启预览;不含自动刷新。构建只清理并重建 `website/dist/`,不会修改 Android 资源。 +开发地址为 `http://127.0.0.1:4173`,修改 Astro 组件、样式和脚本会自动更新。自定义端口可运行 `npm --prefix website run dev -- --port 4180`。 + +```sh +npm run site:check # Astro 模板和 TypeScript 检查 +npm run site:build # 输出 website/dist/ +npm run site:test # 检查已构建产物、CSP 兼容性和共享资源 +npm run site:preview # Astro 预览已构建产物 +``` + +`site:preview` 不会重新构建,请先运行 `site:build`。Astro 开发服务器和预览服务器不解释 Cloudflare 的 `_headers`;如需验证生产 CSP、响应头和路由,先构建,再运行: + +```sh +npx wrangler@4.152.0 pages dev --cwd website --port 4174 +``` + +## 项目结构 | 路径 | 用途 | | --- | --- | -| `public/index.html` | 官网结构、产品文案、GitHub 和文档链接 | -| `public/style.css` | 响应式样式、深浅主题、减少动态效果支持 | -| `public/app.js` | 主题切换、键盘可操作的预览标签页 | -| `public/_headers` | Cloudflare 静态资源响应头,本地预览也会应用 | -| `public/404.html` | 独立 404 页面,避免将未知路径当作 SPA 首页 | -| `scripts/build.mjs` | 拷贝静态文件及仓库现有 App 图标和图标许可证 | -| `wrangler.worker.jsonc` | Workers Static Assets 配置,通过 `--config` 显式选择 | -| `wrangler.jsonc` | Pages Git 集成和 CLI 的默认配置 | +| `astro.config.mjs` | 静态输出、开发端口、CSS/JS 外部文件策略 | +| `src/layouts/BaseLayout.astro` | HTML 外壳、SEO 元数据、全局样式 | +| `src/pages/index.astro` | 组合首页各功能区 | +| `src/pages/404.astro` | 独立 404 页面与 `noindex` 元数据 | +| `src/components/` | 品牌、导航、首屏、交互示意、功能、使用步骤、FAQ、页脚 | +| `src/scripts/` | 类型检查和打包后的主题/标签页交互 | +| `src/styles/global.css` | 既有响应式样式、深浅主题、减少动态效果支持 | +| `src/pages/assets/` | 构建时生成的图标和许可证静态资源路由 | +| `public/_headers` | 原样复制到构建目录的 Cloudflare 响应头 | +| `test/build.test.mjs` | 构建产物和 CSP 回归检查 | +| `wrangler.jsonc` | Pages 默认配置 | +| `wrangler.worker.jsonc` | Workers Static Assets 配置 | + +共享图标与许可证由静态资源路由直接导入 `docs/` 中的原文件,保留 `/assets/app-icon.svg` 和 `/assets/Material-Symbols-Apache-2.0.txt` 地址。构建后只输出静态文件,不需要 API 服务,也不维护重复素材或额外拷贝脚本。应保留完整仓库供构建使用。 + +Astro 组件中的 ` - - - - - -
-
- 为你的车机,打开一种新可能 -

让 CarPlay,
在浏览器里就位。

-

- 一部 Android,一块车机屏幕。
把 iPhone - 的熟悉体验,带到你的每一次出发。 -

- -
- Android 9+车机无需安装 App局域网直连 -
-
- -
-
-
- - WheelPlay / 浏览器里的驾驶搭档交互示意 -
-
- -
-
-
- -
- 体验预览 -
-
-
- -
- -
- -
- 前方 300 米右转,驶入新的旅程 -
-
-
- 12 分钟6.8 公里 · 一路向前 -
-
-
-
- - On the road你的随行歌单 - -
-
- -
- 下一站,回家熟悉的路,熟悉的体验 -
-
-
-
- - -
-
- 浏览器显示与触控NAVIGATION / PREVIEW -
-
-
-
-

- - 上方为交互示意,并非真实 CarPlay 截图或在线连接入口;实际界面由 iPhone - 与所用 App 决定。 -

-
- -
-
-
-

LESS SETUP. MORE POSSIBILITY.

-

屏幕之间,
不必有那么多距离。

-
-

让 Android 做好连接,
让车机浏览器专注于眼前的体验。

-
-
-
- 01 / DISPLAY -

打开浏览器,就是新视野。

-

- 显示、触控、全屏,一张网页就能完成。车机端无需安装额外客户端。 -

-
- 触摸操作全屏显示 -
-
-
- 02 / STREAM -

为不同的屏幕,留一条路。

-

- 支持 WebRTC - 视频直通,也提供图片兼容模式。按你的设备和网络,选择合适的串流方式。 -

-
- H.264 / HEVCJPEG / WebP -
-
-
- 03 / CONTROL -

合不合适,由你来调。

-

- 调整分辨率、帧率与安全区域,选择音频输出和定位来源,让设置适应你的使用习惯。 -

-
- 显示偏好音频路由 -
-
-
-
- -
-
-
-

READY WHEN YOU ARE.

-

从这里,
开始连接。

-

- 准备一部 iPhone、一台 Android 9+ 设备,
以及支持现代网页与触控的车机浏览器。 -

- 获取开发构建 -

- 前往 GitHub Actions,选择成功运行中的
wheelplay-debug-apk - 构建产物。
下载需要登录 GitHub,且产物可能过期。 -

- 也可以从源码构建 -
-
    -
  1. - 01 -
    -

    在 Android 上,准备好 WheelPlay

    -

    - 安装并打开应用。开源构建默认不含 CarPlay - 认证资源,请先在设置中导入有效资源,校验通过后启动服务。 -

    - 查看认证资源导入说明 -
    -
  2. -
  3. - 02 -
    -

    同一网络,打开同一个入口

    -

    - 让 Android 与车机接入同一局域网,在车机浏览器中打开 WheelPlay - 应用显示的访问地址。 -

    - 使用 App 中的实际地址,无需访问本官网连接。 -
    -
  4. -
  5. - 03 -
    -

    配对、连接,把 CarPlay 带上车

    -

    - 扫描网页二维码或输入配对码,启动显示。保持 Android - 应用在前台,按提示通过 USB 或无线连接 iPhone,并允许使用 - CarPlay。 -

    - 阅读完整使用步骤 -
    -
  6. -
-
-
- -
-
-

GOOD TO KNOW.

-

出发之前,
你可能想知道。

- 遇到问题?在 GitHub 反馈 -
-
-
- - 我的车机可以使用吗? - -

- 车机浏览器需要支持现代网页与触控,并能通过局域网访问 Android - 服务设备。不同品牌、系统版本和网络环境的兼容性不同,无法保证所有车型可用。建议先在车辆停稳后验证。 -

-
-
- - 使用 WheelPlay 需要 Root 吗? - -

- 普通局域网连接和 Web 服务无需 - Root。针对限制私有网段访问的浏览器,项目提供实验性的 Tesla - 兼容模式,包括免 Root VPN 与 Root - 热点路由两种方案,均需按设备实测。查看兼容模式说明 ↗ -

-
-
- - 声音和麦克风从哪里走? - -

- 默认由 Android - 处理音频和麦克风,可在设置中启用浏览器路由。浏览器麦克风需要可信的本地 - HTTPS 证书及相应浏览器能力;不支持时可继续使用 Android 麦克风。查看音频配置说明 ↗ -

-
-
- - 需要服务器或公网连接吗? - -

- CarPlay 串流由 Android - 在局域网内提供,无需额外云端服务器;导航、音乐等 App - 的在线内容仍可能需要互联网。服务仅用于可信局域网,请勿暴露到公网。本官网只提供介绍与使用指引,不承载设备连接。 -

-
-
- - 为什么安装后需要导入认证资源? - -

- 公开分发的开源构建默认不包含 CarPlay 认证资源。需要在「设置 → - CarPlay 认证资源」导入有效资源,通过校验后才能启动服务。导入在 - Android 本机完成。查看支持的导入方式 ↗ -

-
-
- 它是开源项目吗? -

- 是。WheelPlay 基于 DiPlay / xcertplay 开发,项目采用 GPL-3.0 - 许可证并保留上游及第三方声明。你可以阅读源码、提交问题或参与改进;第三方组件与素材遵循各自许可证。查看许可证 ↗ -

-
-
-
- -
-
-

OPEN SOURCE. OPEN POSSIBILITIES.

-

下一程,一起把体验变得更好。

-

从一次使用、一条反馈,到一份代码贡献。

-
- 在 GitHub 探索 WheelPlay -
-
-
- - -
- - diff --git a/website/scripts/build.mjs b/website/scripts/build.mjs deleted file mode 100644 index 04ac3956..00000000 --- a/website/scripts/build.mjs +++ /dev/null @@ -1,16 +0,0 @@ -import { cp, mkdir, rm } from "node:fs/promises"; - -const root = new URL("../", import.meta.url); -const output = new URL("dist/", root); -await rm(output, { recursive: true, force: true }); -await mkdir(new URL("assets/", output), { recursive: true }); -await cp(new URL("public/", root), output, { recursive: true }); -await cp( - new URL("../docs/assets/app-icon.svg", root), - new URL("assets/app-icon.svg", output), -); -await cp( - new URL("../docs/licenses/Material-Symbols-Apache-2.0.txt", root), - new URL("assets/Material-Symbols-Apache-2.0.txt", output), -); -console.log("WheelPlay website built → website/dist"); diff --git a/website/scripts/serve.mjs b/website/scripts/serve.mjs deleted file mode 100644 index b78b034e..00000000 --- a/website/scripts/serve.mjs +++ /dev/null @@ -1,69 +0,0 @@ -import { createServer } from "node:http"; -import { readFile } from "node:fs/promises"; -import { fileURLToPath } from "node:url"; -import { extname, resolve, sep } from "node:path"; -import "./build.mjs"; - -const root = fileURLToPath(new URL("../dist/", import.meta.url)); -const port = Number(process.env.PORT || 4173); -const types = { - ".html": "text/html; charset=utf-8", - ".css": "text/css; charset=utf-8", - ".js": "text/javascript; charset=utf-8", - ".svg": "image/svg+xml", - ".txt": "text/plain; charset=utf-8", -}; -const headers = Object.fromEntries( - (await readFile(resolve(root, "_headers"), "utf8")) - .split("\n") - .filter((line) => line.startsWith(" ")) - .map((line) => { - const colon = line.indexOf(":"); - return [line.slice(0, colon).trim(), line.slice(colon + 1).trim()]; - }), -); - -createServer(async (request, response) => { - if (!["GET", "HEAD"].includes(request.method)) { - response.writeHead(405, { ...headers, Allow: "GET, HEAD" }); - response.end(); - return; - } - try { - const pathname = decodeURIComponent( - new URL(request.url, "http://localhost").pathname, - ); - const path = resolve( - root, - `.${pathname === "/" ? "/index.html" : pathname}`, - ); - if ( - !path.startsWith(root.endsWith(sep) ? root : root + sep) || - ["_headers", "_redirects"].includes(pathname.slice(1)) - ) { - response.writeHead(404, headers); - response.end(); - return; - } - const body = await readFile(path); - response.writeHead(200, { - ...headers, - "Content-Type": types[extname(path)] || "application/octet-stream", - }); - response.end(request.method === "HEAD" ? undefined : body); - } catch { - response.writeHead(404, { - ...headers, - "Content-Type": "text/html; charset=utf-8", - }); - response.end( - request.method === "HEAD" - ? undefined - : await readFile(resolve(root, "404.html")), - ); - } -}).listen(port, "127.0.0.1", () => - console.log( - `WheelPlay website: http://127.0.0.1:${port} (rerun to rebuild after edits)`, - ), -); diff --git a/website/src/components/Brand.astro b/website/src/components/Brand.astro new file mode 100644 index 00000000..3b36f69d --- /dev/null +++ b/website/src/components/Brand.astro @@ -0,0 +1,13 @@ +--- +interface Props { + href?: string; + size?: number; + label?: boolean; +} +const { href = "/", size = 32, label = false } = Astro.props; +--- + + + + WheelPlay{label && 开源项目} + diff --git a/website/src/components/Closing.astro b/website/src/components/Closing.astro new file mode 100644 index 00000000..d3492445 --- /dev/null +++ b/website/src/components/Closing.astro @@ -0,0 +1,10 @@ +
+
+

OPEN SOURCE. OPEN POSSIBILITIES.

+

下一程,一起把体验变得更好。

+

从一次使用、一条反馈,到一份代码贡献。

+
+ 在 GitHub 探索 WheelPlay +
diff --git a/website/src/components/ExperiencePreview.astro b/website/src/components/ExperiencePreview.astro new file mode 100644 index 00000000..38c825a9 --- /dev/null +++ b/website/src/components/ExperiencePreview.astro @@ -0,0 +1,347 @@ +
+
+
+ + WheelPlay / 浏览器里的驾驶搭档交互示意 +
+
+ +
+
+
+ +
+ 体验预览 +
+
+
+ +
+ +
+ +
+ 前方 300 米右转,驶入新的旅程 +
+
+
+ 12 分钟6.8 公里 · 一路向前 +
+
+
+
+ + On the road你的随行歌单 + +
+
+ +
+ 下一站,回家熟悉的路,熟悉的体验 +
+
+
+
+ + +
+
+ 浏览器显示与触控NAVIGATION / PREVIEW +
+
+
+
+

+ + 上方为交互示意,并非真实 CarPlay 截图或在线连接入口;实际界面由 iPhone + 与所用 App 决定。 +

+
+ + diff --git a/website/src/components/FAQ.astro b/website/src/components/FAQ.astro new file mode 100644 index 00000000..45468799 --- /dev/null +++ b/website/src/components/FAQ.astro @@ -0,0 +1,84 @@ +
+
+

GOOD TO KNOW.

+

出发之前,
你可能想知道。

+ 遇到问题?在 GitHub 反馈 +
+
+
+ + 我的车机可以使用吗? + +

+ 车机浏览器需要支持现代网页与触控,并能通过局域网访问 Android + 服务设备。不同品牌、系统版本和网络环境的兼容性不同,无法保证所有车型可用。建议先在车辆停稳后验证。 +

+
+
+ + 使用 WheelPlay 需要 Root 吗? + +

+ 普通局域网连接和 Web 服务无需 + Root。针对限制私有网段访问的浏览器,项目提供实验性的 Tesla + 兼容模式,包括免 Root VPN 与 Root + 热点路由两种方案,均需按设备实测。查看兼容模式说明 ↗ +

+
+
+ + 声音和麦克风从哪里走? + +

+ 默认由 Android + 处理音频和麦克风,可在设置中启用浏览器路由。浏览器麦克风需要可信的本地 + HTTPS 证书及相应浏览器能力;不支持时可继续使用 Android 麦克风。查看音频配置说明 ↗ +

+
+
+ + 需要服务器或公网连接吗? + +

+ CarPlay 串流由 Android + 在局域网内提供,无需额外云端服务器;导航、音乐等 App + 的在线内容仍可能需要互联网。服务仅用于可信局域网,请勿暴露到公网。本官网只提供介绍与使用指引,不承载设备连接。 +

+
+
+ + 为什么安装后需要导入认证资源? + +

+ 公开分发的开源构建默认不包含 CarPlay 认证资源。需要在「设置 → + CarPlay 认证资源」导入有效资源,通过校验后才能启动服务。导入在 + Android 本机完成。查看支持的导入方式 ↗ +

+
+
+ 它是开源项目吗? +

+ 是。WheelPlay 基于 DiPlay / xcertplay 开发,项目采用 GPL-3.0 + 许可证并保留上游及第三方声明。你可以阅读源码、提交问题或参与改进;第三方组件与素材遵循各自许可证。查看许可证 ↗ +

+
+
+
diff --git a/website/src/components/Features.astro b/website/src/components/Features.astro new file mode 100644 index 00000000..81ec4c9c --- /dev/null +++ b/website/src/components/Features.astro @@ -0,0 +1,59 @@ +
+
+
+

LESS SETUP. MORE POSSIBILITY.

+

屏幕之间,
不必有那么多距离。

+
+

让 Android 做好连接,
让车机浏览器专注于眼前的体验。

+
+
+
+ 01 / DISPLAY +

打开浏览器,就是新视野。

+

+ 显示、触控、全屏,一张网页就能完成。车机端无需安装额外客户端。 +

+
+ 触摸操作全屏显示 +
+
+
+ 02 / STREAM +

为不同的屏幕,留一条路。

+

+ 支持 WebRTC + 视频直通,也提供图片兼容模式。按你的设备和网络,选择合适的串流方式。 +

+
+ H.264 / HEVCJPEG / WebP +
+
+
+ 03 / CONTROL +

合不合适,由你来调。

+

+ 调整分辨率、帧率与安全区域,选择音频输出和定位来源,让设置适应你的使用习惯。 +

+
+ 显示偏好音频路由 +
+
+
+
diff --git a/website/src/components/GettingStarted.astro b/website/src/components/GettingStarted.astro new file mode 100644 index 00000000..2ff08199 --- /dev/null +++ b/website/src/components/GettingStarted.astro @@ -0,0 +1,77 @@ +
+
+
+

READY WHEN YOU ARE.

+

从这里,
开始连接。

+

+ 准备一部 iPhone、一台 Android 9+ 设备,
以及支持现代网页与触控的车机浏览器。 +

+ 获取开发构建 +

+ 前往 GitHub Actions,选择成功运行中的
wheelplay-debug-apk + 构建产物。
下载需要登录 GitHub,且产物可能过期。 +

+ 也可以从源码构建 +
+
    +
  1. + 01 +
    +

    在 Android 上,准备好 WheelPlay

    +

    + 安装并打开应用。开源构建默认不含 CarPlay + 认证资源,请先在设置中导入有效资源,校验通过后启动服务。 +

    + 查看认证资源导入说明 +
    +
  2. +
  3. + 02 +
    +

    同一网络,打开同一个入口

    +

    + 让 Android 与车机接入同一局域网,在车机浏览器中打开 WheelPlay + 应用显示的访问地址。 +

    + 使用 App 中的实际地址,无需访问本官网连接。 +
    +
  4. +
  5. + 03 +
    +

    配对、连接,把 CarPlay 带上车

    +

    + 扫描网页二维码或输入配对码,启动显示。保持 Android + 应用在前台,按提示通过 USB 或无线连接 iPhone,并允许使用 + CarPlay。 +

    + 阅读完整使用步骤 +
    +
  6. +
+
+
diff --git a/website/src/components/Hero.astro b/website/src/components/Hero.astro new file mode 100644 index 00000000..22f9baaf --- /dev/null +++ b/website/src/components/Hero.astro @@ -0,0 +1,45 @@ +
+ 为你的车机,打开一种新可能 +

让 CarPlay,
在浏览器里就位。

+

+ 一部 Android,一块车机屏幕。
把 iPhone + 的熟悉体验,带到你的每一次出发。 +

+ +
+ Android 9+车机无需安装 App局域网直连 +
+
diff --git a/website/src/components/SiteFooter.astro b/website/src/components/SiteFooter.astro new file mode 100644 index 00000000..28c9f3a4 --- /dev/null +++ b/website/src/components/SiteFooter.astro @@ -0,0 +1,26 @@ +--- +import Brand from "./Brand.astro"; +--- + +
+ + +
diff --git a/website/src/components/SiteHeader.astro b/website/src/components/SiteHeader.astro new file mode 100644 index 00000000..d8357753 --- /dev/null +++ b/website/src/components/SiteHeader.astro @@ -0,0 +1,43 @@ +--- +import Brand from "./Brand.astro"; +--- + + + + diff --git a/website/src/layouts/BaseLayout.astro b/website/src/layouts/BaseLayout.astro new file mode 100644 index 00000000..debca62b --- /dev/null +++ b/website/src/layouts/BaseLayout.astro @@ -0,0 +1,40 @@ +--- +import "../styles/global.css"; + +interface Props { + title?: string; + description?: string; + socialDescription?: string; + noIndex?: boolean; + bodyClass?: string; +} +const { + title = "WheelPlay · 让 CarPlay,在浏览器里就位", + description = "WheelPlay 是开源的 Android 局域网 CarPlay 服务端。将 iPhone 的 CarPlay 带到车机浏览器,支持触控、USB 与无线连接,无需在车机安装客户端。", + socialDescription = "一部 Android,一块车机屏幕。通过局域网,在浏览器里显示和操作 iPhone 的 CarPlay。", + noIndex = false, + bodyClass, +} = Astro.props; +--- + + + + + + + + + + + + + + + {noIndex && } + {title} + + + + + + diff --git a/website/src/pages/404.astro b/website/src/pages/404.astro new file mode 100644 index 00000000..a475fb62 --- /dev/null +++ b/website/src/pages/404.astro @@ -0,0 +1,16 @@ +--- +import BaseLayout from "../layouts/BaseLayout.astro"; +import Brand from "../components/Brand.astro"; +--- + + +
+ +

404 / WRONG TURN

+

换条路,
回到出发点。

+

这个页面不存在,或已经移动。

+ 返回首页 +
+
diff --git a/website/src/pages/assets/Material-Symbols-Apache-2.0.txt.ts b/website/src/pages/assets/Material-Symbols-Apache-2.0.txt.ts new file mode 100644 index 00000000..aec9542e --- /dev/null +++ b/website/src/pages/assets/Material-Symbols-Apache-2.0.txt.ts @@ -0,0 +1,7 @@ +import type { APIRoute } from "astro"; +import license from "../../../../docs/licenses/Material-Symbols-Apache-2.0.txt?raw"; + +export const GET: APIRoute = () => + new Response(license, { + headers: { "Content-Type": "text/plain; charset=utf-8" }, + }); diff --git a/website/src/pages/assets/app-icon.svg.ts b/website/src/pages/assets/app-icon.svg.ts new file mode 100644 index 00000000..6f99baee --- /dev/null +++ b/website/src/pages/assets/app-icon.svg.ts @@ -0,0 +1,6 @@ +import type { APIRoute } from "astro"; +import icon from "../../../../docs/assets/app-icon.svg?raw"; + +// Pre-render the shared repository asset at its existing public URL. +export const GET: APIRoute = () => + new Response(icon, { headers: { "Content-Type": "image/svg+xml" } }); diff --git a/website/src/pages/index.astro b/website/src/pages/index.astro new file mode 100644 index 00000000..e97559ab --- /dev/null +++ b/website/src/pages/index.astro @@ -0,0 +1,25 @@ +--- +import BaseLayout from "../layouts/BaseLayout.astro"; +import SiteHeader from "../components/SiteHeader.astro"; +import Hero from "../components/Hero.astro"; +import ExperiencePreview from "../components/ExperiencePreview.astro"; +import Features from "../components/Features.astro"; +import GettingStarted from "../components/GettingStarted.astro"; +import FAQ from "../components/FAQ.astro"; +import Closing from "../components/Closing.astro"; +import SiteFooter from "../components/SiteFooter.astro"; +--- + + + + +
+ + + + + + +
+ +
diff --git a/website/src/scripts/preview-tabs.ts b/website/src/scripts/preview-tabs.ts new file mode 100644 index 00000000..d870b025 --- /dev/null +++ b/website/src/scripts/preview-tabs.ts @@ -0,0 +1,39 @@ +// These panels are illustrations; switching tabs never contacts a device. +const preview = document.querySelector(".preview-panel"); +const tabs = [ + ...(preview?.querySelectorAll('[role="tab"]') ?? []), +]; +const mode = preview?.querySelector("#preview-mode"); + +function selectTab(tab: HTMLButtonElement) { + for (const candidate of tabs) { + const selected = candidate === tab; + candidate.setAttribute("aria-selected", String(selected)); + candidate.tabIndex = selected ? 0 : -1; + const panelId = candidate.getAttribute("aria-controls"); + const panel = panelId ? document.getElementById(panelId) : null; + if (panel) panel.hidden = !selected; + } + if (mode) mode.textContent = `${tab.dataset.view?.toUpperCase()} / PREVIEW`; +} + +for (const [index, tab] of tabs.entries()) { + tab.addEventListener("click", () => selectTab(tab)); + tab.addEventListener("keydown", (event) => { + const targets: Record = { + ArrowRight: (index + 1) % tabs.length, + ArrowLeft: (index + tabs.length - 1) % tabs.length, + Home: 0, + End: tabs.length - 1, + }; + const targetIndex = targets[event.key]; + if (targetIndex === undefined) return; + const target = tabs[targetIndex]; + if (!target) return; + event.preventDefault(); + selectTab(target); + target.focus(); + }); +} + +export {}; diff --git a/website/src/scripts/theme.ts b/website/src/scripts/theme.ts new file mode 100644 index 00000000..67804169 --- /dev/null +++ b/website/src/scripts/theme.ts @@ -0,0 +1,45 @@ +type Theme = "light" | "dark"; + +const themeButton = document.querySelector(".theme-toggle"); +const themeColor = document.querySelector( + 'meta[name="theme-color"]', +); +const preference = window.matchMedia("(prefers-color-scheme: dark)"); +let chosenTheme: Theme | null = null; +try { + const savedTheme = localStorage.getItem("wheelplay-site-theme"); + if (savedTheme === "light" || savedTheme === "dark") chosenTheme = savedTheme; +} catch { + // Storage is optional; the toggle still works for this visit. +} + +function applyTheme(theme: Theme) { + document.documentElement.dataset.theme = theme; + const dark = theme === "dark"; + themeButton?.setAttribute("aria-pressed", String(dark)); + themeButton?.setAttribute( + "aria-label", + dark ? "切换到浅色主题" : "切换到深色主题", + ); + if (themeColor) themeColor.content = dark ? "#101720" : "#f8fafc"; +} + +applyTheme(chosenTheme || (preference.matches ? "dark" : "light")); +if (themeButton) { + themeButton.hidden = false; + themeButton.addEventListener("click", () => { + chosenTheme = + document.documentElement.dataset.theme === "dark" ? "light" : "dark"; + applyTheme(chosenTheme); + try { + localStorage.setItem("wheelplay-site-theme", chosenTheme); + } catch { + // Continue without persistence. + } + }); +} +preference.addEventListener("change", (event) => { + if (!chosenTheme) applyTheme(event.matches ? "dark" : "light"); +}); + +export {}; diff --git a/website/public/style.css b/website/src/styles/global.css similarity index 100% rename from website/public/style.css rename to website/src/styles/global.css diff --git a/website/test/build.test.mjs b/website/test/build.test.mjs new file mode 100644 index 00000000..0b90cadc --- /dev/null +++ b/website/test/build.test.mjs @@ -0,0 +1,61 @@ +import assert from "node:assert/strict"; +import { readFile, stat } from "node:fs/promises"; +import test from "node:test"; + +const dist = new URL("../dist/", import.meta.url); + +for (const page of ["index.html", "404.html"]) { + test(`${page} ships external assets compatible with the Cloudflare CSP`, async () => { + const html = await readFile(new URL(page, dist), "utf8"); + assert.doesNotMatch( + html, + /]*)>([\s\S]*?)<\/script>/gi), + ]; + if (page === "index.html") + assert.ok(scripts.length > 0, "Homepage must load its interactions"); + const sources = []; + for (const [, attributes, content] of scripts) { + assert.equal(content.trim(), "", "Astro must not inline small scripts"); + const source = attributes.match(/\bsrc="([^"]+)"/); + assert.ok(source, "Scripts must have an external source"); + sources.push(source[1]); + } + const styles = [...html.matchAll(/]*rel="stylesheet"[^>]*>/gi)]; + assert.ok( + styles.length > 0, + "Global styles must be emitted for both routes", + ); + sources.push(...styles.map(([tag]) => tag.match(/\bhref="([^"]+)"/)[1])); + for (const source of sources) { + assert.match( + source, + /^\/_astro\//, + "Only locally bundled assets may load", + ); + assert.ok((await stat(new URL(`.${source}`, dist))).isFile(), source); + } + if (page === "404.html") + assert.match(html, /name="robots" content="noindex"/); + }); +} + +test("static routes preserve the repository icon, license, and Cloudflare headers", async () => { + for (const [output, input] of [ + ["assets/app-icon.svg", "../docs/assets/app-icon.svg"], + [ + "assets/Material-Symbols-Apache-2.0.txt", + "../docs/licenses/Material-Symbols-Apache-2.0.txt", + ], + ["_headers", "public/_headers"], + ]) { + const expected = new URL(input, new URL("../", import.meta.url)); + assert.deepEqual( + await readFile(new URL(output, dist)), + await readFile(expected), + ); + } +}); diff --git a/website/tsconfig.json b/website/tsconfig.json new file mode 100644 index 00000000..adbbd073 --- /dev/null +++ b/website/tsconfig.json @@ -0,0 +1,5 @@ +{ + "extends": "astro/tsconfigs/strict", + "include": [".astro/types.d.ts", "**/*"], + "exclude": ["dist", "node_modules"] +} From e3259b7126139d50f3f0e3a0e9c649de90678aee Mon Sep 17 00:00:00 2001 From: Siubeng Date: Fri, 23 Oct 2026 20:59:25 +0800 Subject: [PATCH 3/4] feat: resolve latest debug download with cached Cloudflare Worker --- .github/workflows/website.yml | 1 + package.json | 2 +- website/.gitignore | 2 + website/README.md | 61 +++- website/functions/download.ts | 16 + website/package.json | 3 +- website/public/_routes.json | 5 + website/src/components/GettingStarted.astro | 10 +- website/test/build.test.mjs | 7 + website/test/download.test.mjs | 347 ++++++++++++++++++++ website/worker/download.ts | 245 ++++++++++++++ website/worker/index.ts | 28 ++ website/wrangler.worker.jsonc | 3 + 13 files changed, 713 insertions(+), 17 deletions(-) create mode 100644 website/functions/download.ts create mode 100644 website/public/_routes.json create mode 100644 website/test/download.test.mjs create mode 100644 website/worker/download.ts create mode 100644 website/worker/index.ts diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml index 1c03fffd..1efb6502 100644 --- a/.github/workflows/website.yml +++ b/.github/workflows/website.yml @@ -35,6 +35,7 @@ jobs: - run: npm run check - run: npm run build - run: npm run test:build + - run: npm run test:worker - uses: actions/upload-artifact@v4 with: name: wheelplay-website diff --git a/package.json b/package.json index 32140b83..664799cd 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "site:preview": "npm run preview --prefix website", "site:build": "npm run build --prefix website", "site:check": "npm run check --prefix website", - "site:test": "npm run test:build --prefix website", + "site:test": "npm run test:build --prefix website && npm run test:worker --prefix website", "dev": "node scripts/preview.mjs", "demo": "node scripts/preview.mjs --demo", "test": "node --test test/*.test.js", diff --git a/website/.gitignore b/website/.gitignore index 0fc6cf02..746cf851 100644 --- a/website/.gitignore +++ b/website/.gitignore @@ -1,3 +1,5 @@ dist/ .wrangler/ .astro/ +.dev.vars +.dev.vars.* diff --git a/website/README.md b/website/README.md index ed7544f0..68f81dab 100644 --- a/website/README.md +++ b/website/README.md @@ -1,6 +1,6 @@ # WheelPlay 官网(Astro) -独立于 Android 内置浏览器客户端的 Astro 静态产品官网。页面由 Astro 组件在构建时生成,浏览器仅加载全局 CSS 和少量 TypeScript 编译出的主题、标签页交互脚本,无需 React/Vue hydration 或服务端运行时。没有远程字体、分析 SDK 或设备连接请求;只有深浅主题偏好会写入 localStorage。 +独立于 Android 内置浏览器客户端的 Astro 静态产品官网。页面由 Astro 组件在构建时生成,浏览器仅加载全局 CSS 和少量 TypeScript 编译出的主题、标签页交互脚本,无需 React/Vue hydration 或服务端运行时。没有远程字体、分析 SDK 或设备连接请求;只有深浅主题偏好会写入 localStorage。下载按钮通过 `/download` 的 Cloudflare Worker 查询 GitHub Actions 元数据,再重定向到 GitHub 产物页面。 设计参考 [Lovable JSON Formatter 模板](https://lovable.dev/templates/apps/developer-tools/json-formatter) 的蓝色强调、双栏工作区和标签页布局。保留 WheelPlay 的既有图标、产品文案、响应式样式和交互示意。 @@ -20,14 +20,16 @@ npm run site:dev ```sh npm run site:check # Astro 模板和 TypeScript 检查 npm run site:build # 输出 website/dist/ -npm run site:test # 检查已构建产物、CSP 兼容性和共享资源 +npm run site:test # 构建产物、CSP、下载与缓存行为测试 npm run site:preview # Astro 预览已构建产物 ``` -`site:preview` 不会重新构建,请先运行 `site:build`。Astro 开发服务器和预览服务器不解释 Cloudflare 的 `_headers`;如需验证生产 CSP、响应头和路由,先构建,再运行: +`site:preview` 不会重新构建,请先运行 `site:build`。Astro 开发/预览服务器仅提供静态官网,不运行 `/download`,也不解释 Cloudflare 的 `_headers`。如需验证下载、CSP 和响应头,先构建,再选择一个 Cloudflare 本地运行器: ```sh npx wrangler@4.152.0 pages dev --cwd website --port 4174 +# 或独立 Worker +npx wrangler@4.152.0 dev --config website/wrangler.worker.jsonc --port 4174 ``` ## 项目结构 @@ -42,12 +44,17 @@ npx wrangler@4.152.0 pages dev --cwd website --port 4174 | `src/scripts/` | 类型检查和打包后的主题/标签页交互 | | `src/styles/global.css` | 既有响应式样式、深浅主题、减少动态效果支持 | | `src/pages/assets/` | 构建时生成的图标和许可证静态资源路由 | -| `public/_headers` | 原样复制到构建目录的 Cloudflare 响应头 | +| `public/_headers` | 原样复制到构建目录的静态资源响应头 | +| `public/_routes.json` | 只让 Pages 的下载路径进入 Functions | +| `worker/download.ts` | GitHub 构建解析、内存/边缘缓存、302 重定向 | +| `worker/index.ts` | Workers 下载入口和 ASSETS 静态资源绑定 | +| `functions/download.ts` | Pages Functions 入口,复用同一解析器 | +| `test/download.test.mjs` | 下载选择、缓存、并发、限流和错误回归测试 | | `test/build.test.mjs` | 构建产物和 CSP 回归检查 | | `wrangler.jsonc` | Pages 默认配置 | | `wrangler.worker.jsonc` | Workers Static Assets 配置 | -共享图标与许可证由静态资源路由直接导入 `docs/` 中的原文件,保留 `/assets/app-icon.svg` 和 `/assets/Material-Symbols-Apache-2.0.txt` 地址。构建后只输出静态文件,不需要 API 服务,也不维护重复素材或额外拷贝脚本。应保留完整仓库供构建使用。 +共享图标与许可证由静态资源路由直接导入 `docs/` 中的原文件,保留 `/assets/app-icon.svg` 和 `/assets/Material-Symbols-Apache-2.0.txt` 地址。这两条资源路由构建后是静态文件,不需要运行时 API,也不维护重复素材或额外拷贝脚本。下载解析则由独立 Worker/Pages Function 处理;应保留完整仓库供构建和部署使用。 Astro 组件中的 `