提交记录修改packaging/windows/dependencies.json+1 −1看文件
修改scripts/bundle-qemu-sources.sh+10 −1看文件
修改www/scripts/check-site.mjs+3 −0看文件
修改www/scripts/sync-release.mjs+6 −2看文件
修改www/scripts/sync-release.test.mjs+31 −0看文件
修改www/src/components/CageHome.astro+1 −1看文件
| @@ -52,7 +52,7 @@ | ||
| 52 | 52 | "qemuKeycodemap": { |
| 53 | 53 | "version": "f5772a62ec52591ff6870b7e8ef32482371f22c6", |
| 54 | 54 | "file": "keycodemapdb.tar.gz", |
| 55 | 删除: "url": "https://gitlab.com/qemu-project/keycodemapdb/-/archive/f5772a62ec52591ff6870b7e8ef32482371f22c6/keycodemapdb-f5772a62ec52591ff6870b7e8ef32482371f22c6.tar.gz", | |
| 55 | 新增: "url": "https://github.com/qemu/keycodemapdb/archive/f5772a62ec52591ff6870b7e8ef32482371f22c6.tar.gz", | |
| 56 | 56 | "algorithm": "SHA256", |
| 57 | 57 | "hash": "d014b53382dbb17b8196ad12f50de7f20d0ef1b9f7d54b0be51a6cbb14209195" |
| 58 | 58 | } |
| @@ -15,7 +15,16 @@ git -c core.autocrlf=false -C "$stage/source/qemu" checkout -q --detach FETCH_HE | ||
| 15 | 15 | [[ $(git -C "$stage/source/qemu" rev-parse HEAD) == "$commit" ]] |
| 16 | 16 | # All shipped firmware comes from QEMU's pinned ROM submodules. Include nested |
| 17 | 17 | # submodules (EDK2 libraries etc.), not only the superproject's empty gitlinks. |
| 18 | 删除:git -c core.autocrlf=false -C "$stage/source/qemu" submodule update --init --recursive --depth=1 -- roms | |
| 18 | 新增:git_options=(-c core.autocrlf=false) | |
| 19 | 新增:for module in QemuMacDrivers edk2 ipxe opensbi qboot qemu-palcode seabios seabios-hppa skiboot u-boot vbootrom; do | |
| 20 | 新增: git_options+=(-c "url.https://github.com/qemu/$module.insteadOf=https://gitlab.com/qemu-project/$module") | |
| 21 | 新增:done | |
| 22 | 新增:git_options+=(-c url.https://github.com/openbios/openbios.insteadOf=https://gitlab.com/qemu-project/openbios) | |
| 23 | 新增:git_options+=(-c url.https://github.com/zbalaton/u-boot-sam460ex.insteadOf=https://gitlab.com/qemu-project/u-boot-sam460ex) | |
| 24 | 新增:git_options+=(-c url.https://github.com/tianocore/edk2-cmocka.git.insteadOf=https://gitlab.com/cmocka/cmocka.git) | |
| 25 | 新增:# SLOF has no current official GitHub mirror. Its GitLab smart-Git endpoint | |
| 26 | 新增:# remains usable even when archive downloads receive an HTML challenge. | |
| 27 | 新增:git "${git_options[@]}" -C "$stage/source/qemu" submodule update --init --recursive --depth=1 -- roms | |
| 19 | 28 | git -C "$stage/source/qemu" submodule status --recursive -- roms > "$stage/source/firmware-revisions.txt" |
| 20 | 29 | if grep -Eq '^[-+U]' "$stage/source/firmware-revisions.txt"; then echo 'Firmware source revisions are incomplete.' >&2; exit 1; fi |
| 21 | 30 | cp "$runtime/build-source-packages.txt" "$runtime/build-packages.txt" "$runtime/cage-build.json" "$stage/source/cage/" |
| @@ -33,6 +33,9 @@ for (const code of codes) { | ||
| 33 | 33 | } |
| 34 | 34 | assert.ok(!html.includes('/Users/'), `${code}: local developer path leaked`); |
| 35 | 35 | assert.ok(html.includes(`href="${published.downloadURL}"`), `${code}: macOS download is missing`); |
| 36 | 新增: const downloadSection = html.match(/<section\b[^>]*id="download"[^>]*>([\s\S]*?)<\/section>/)?.[1]; | |
| 37 | 新增: assert.ok(downloadSection?.includes(`CLAUDE CAGE · v${published.version}`), `${code}: download release label must follow published metadata`); | |
| 38 | 新增: assert.ok(!downloadSection?.includes('CLAUDE CAGE · ALPHA'), `${code}: stale release channel label`); | |
| 36 | 39 | assert.equal([...html.matchAll(/<a\b[^>]*\bdata-download-open(?:\s|>)/g)].length, 3, `${code}: all download entries must open the platform chooser`); |
| 37 | 40 | assert.ok(html.includes('aria-labelledby="platform-title"'), `${code}: platform dialog has no accessible title`); |
| 38 | 41 | for (const platform of ['macOS', 'Windows', 'Linux']) { |
| @@ -11,6 +11,9 @@ import { parseArgs } from 'node:util'; | ||
| 11 | 11 | const repository = 'Lee-xeo/Claude-Cage'; |
| 12 | 12 | const repoURL = `https://github.com/${repository}`; |
| 13 | 13 | const apiURL = `https://api.github.com/repos/${repository}/releases`; |
| 14 | 新增:const sourceArchive = name => /^mihomo-v[\d.]+-source\.tar\.gz$/.test(name) || | |
| 15 | 新增: /^qemu-[0-9a-f]{40}-source\.tar\.gz$/.test(name) || | |
| 16 | 新增: /^qemu-\d+\.\d+\.\d+-windows-full-source\.(?:tar\.)?(?:gz|xz|bz2|zst|zip|7z|tar)$/.test(name); | |
| 14 | 17 | |
| 15 | 18 | export async function request(url, timeout = 180_000, { fetchImpl = fetch } = {}) { |
| 16 | 19 | const target = new URL(url); |
| @@ -49,13 +52,14 @@ export async function publicManifestRelease(tag, fetchImpl = fetch) { | ||
| 49 | 52 | const allowed = name => [ |
| 50 | 53 | `Cage-${version}-macos-arm64.dmg`, `Cage-${version}-windows-amd64-setup.exe`, |
| 51 | 54 | `Cage-${version}-windows-amd64-setup-unsigned.exe`, `Cage-${version}-linux-amd64.deb`, |
| 52 | 删除: ].includes(name) || /^mihomo-v[\d.]+-source\.tar\.gz$/.test(name) || /^qemu-[0-9a-f]{40}-source\.tar\.gz$/.test(name); | |
| 55 | 新增: ].includes(name) || sourceArchive(name); | |
| 53 | 56 | if ([...names.keys()].some(name => !allowed(name))) throw new Error('Unexpected public release asset'); |
| 54 | 57 | const assets = [{ name: 'SHA256SUMS', state: 'uploaded', size: Buffer.byteLength(text), browser_download_url: `${base}SHA256SUMS` }]; |
| 55 | 58 | for (const [name, digest] of names) { |
| 56 | 59 | const response = await fetchImpl(`${base}${name}`, { method: 'HEAD', headers: { 'User-Agent': 'Cage-Release-Verification' }, signal: AbortSignal.timeout(180_000) }); |
| 57 | 60 | const size = Number(response.headers.get('content-length')); |
| 58 | 删除: if (!response.ok || !Number.isSafeInteger(size) || size <= 0 || size > 512 * 1024 * 1024) throw new Error(`Missing or incomplete public asset: ${name}`); | |
| 61 | 新增: const maximum = (sourceArchive(name) ? 2048 : 512) * 1024 * 1024; | |
| 62 | 新增: if (!response.ok || !Number.isSafeInteger(size) || size <= 0 || size > maximum) throw new Error(`Missing or incomplete public asset: ${name}`); | |
| 59 | 63 | assets.push({ name, state: 'uploaded', size, digest: `sha256:${digest}`, browser_download_url: `${base}${name}` }); |
| 60 | 64 | } |
| 61 | 65 | const release = { tag_name: tag, draft: false, prerelease: version.includes('-'), assets }; |
| @@ -195,3 +195,34 @@ test('macOS verification checks both owned archives without requiring other-plat | ||
| 195 | 195 | } |
| 196 | 196 | } finally { rmSync(directory, { recursive: true, force: true }); } |
| 197 | 197 | }); |
| 198 | 新增: | |
| 199 | 新增:test('explicit RC manifest exposes signed Windows and all platforms with complete QEMU sources', async () => { | |
| 200 | 新增: const tag = 'v0.1.7-rc.1', version = tag.slice(1); | |
| 201 | 新增: const names = [`Cage-${version}-macos-arm64.dmg`, `Cage-${version}-windows-amd64-setup.exe`, `Cage-${version}-linux-amd64.deb`, 'mihomo-v1.19.33-source.tar.gz', 'qemu-11.1.0-windows-full-source.tar.gz']; | |
| 202 | 新增: const manifest = names.map(name => `${hash} ${name}\n`).join(''); | |
| 203 | 新增: const release = await publicManifestRelease(tag, async (url, options = {}) => { | |
| 204 | 新增: assert.equal(options.headers?.Authorization, undefined); | |
| 205 | 新增: if (url.endsWith('/SHA256SUMS')) return new Response(manifest); | |
| 206 | 新增: assert.equal(options.method, 'HEAD'); | |
| 207 | 新增: return new Response('', { headers: { 'content-length': String(url.includes('full-source') ? 700 * 1024 * 1024 : 100) } }); | |
| 208 | 新增: }); | |
| 209 | 新增: assert.equal(release.prerelease, true); | |
| 210 | 新增: const metadata = releaseMetadata(release, manifest); | |
| 211 | 新增: assert.equal(metadata.version, version); | |
| 212 | 新增: assert.equal(metadata.windowsDownloadURL, release.assets.find(asset => asset.name === names[1]).browser_download_url); | |
| 213 | 新增: assert.equal(metadata.linuxDownloadURL, release.assets.find(asset => asset.name === names[2]).browser_download_url); | |
| 214 | 新增: assert.ok(!metadata.windowsPreview); | |
| 215 | 新增: assert.equal(metadata.releaseURL, `https://github.com/Lee-xeo/Claude-Cage/releases/tag/${tag}`); | |
| 216 | 新增:}); | |
| 217 | 新增: | |
| 218 | 新增:test('manifest source allowance keeps installer and source size bounds separate and names constrained', async () => { | |
| 219 | 新增: const names = ['Cage-0.1.7-rc.1-macos-arm64.dmg', 'mihomo-v1.19.33-source.tar.gz', 'qemu-11.1.0-windows-full-source.tar.gz']; | |
| 220 | 新增: for (const [oversized, size] of [[names[0], 512 * 1024 * 1024 + 1], [names[2], 2048 * 1024 * 1024 + 1]]) { | |
| 221 | 新增: await assert.rejects(publicManifestRelease('v0.1.7-rc.1', async url => url.endsWith('/SHA256SUMS') | |
| 222 | 新增: ? new Response(names.map(name => `${hash} ${name}\n`).join('')) | |
| 223 | 新增: : new Response('', { headers: { 'content-length': String(url.endsWith(oversized) ? size : 100) } })), /Missing or incomplete public asset/); | |
| 224 | 新增: } | |
| 225 | 新增: for (const invalid of ['qemu-11.1.0-windows-full-source.tar.gz.exe', 'qemu-latest-windows-full-source.tar.gz', 'qemu-11.1.0-windows-full-source/escape.tar.gz']) { | |
| 226 | 新增: await assert.rejects(publicManifestRelease('v0.1.7-rc.1', async () => new Response([...names, invalid].map(name => `${hash} ${name}\n`).join('')))); | |
| 227 | 新增: } | |
| 228 | 新增:}); | |
| @@ -81,7 +81,7 @@ const canonical = new URL(pathFor(locale), Astro.site); | ||
| 81 | 81 | <section class="evidence wrap"><h2>{c.evidenceTitle}</h2><div class="evidence-grid"><figure><a href={checks.src}><img src={checks.src} width={checks.width} height={checks.height} alt={c.checksLabel} loading="lazy" /></a><figcaption>{c.checksLabel}</figcaption></figure><figure><a href={communityCheck.src}><img src={communityCheck.src} width={communityCheck.width} height={communityCheck.height} alt={c.communityCheckLabel} loading="lazy" /></a><figcaption>{c.communityCheckLabel}</figcaption></figure></div><p class="small-note">{c.evidenceNote}</p></section> |
| 82 | 82 | <section id="how" class="start-section"><div class="wrap"><div class="quick-start"><h2>{c.quickTitle}</h2><p>{c.quickText}</p><pre><code>{c.prompt}</code></pre><p class="small-note">{c.quickNote}</p></div><div class="section-heading"><h2 class="steps-title">{c.stepsTitle}</h2></div><div class="steps">{c.steps.map(([title,text],i)=><article><span class="step-number" dir="ltr">0{i+1}</span><h3>{title}</h3><p>{text}</p></article>)}</div><details class="first-look"><summary>{c.firstLookLabel}<span aria-hidden="true">+</span></summary><img src={`${base}first-run-2026-11.jpg`} width="1440" height="900" alt={c.firstLookLabel} loading="lazy" /></details></div></section> |
| 83 | 83 | <section id="boundaries" class="boundaries wrap"><h2>{c.boundaryTitle}</h2><div class="boundary-list">{c.boundaries.map(([title,text])=><article><span aria-hidden="true">↔</span><div>{title && <h3>{title}</h3>}<p>{text}</p></div></article>)}</div></section> |
| 84 | 删除: <section id="download" class="download-section wrap"><div class="download-box"><img src={`${base}cage-icon.png`} width="84" height="84" alt="" /><span class="eyebrow">CLAUDE CAGE · ALPHA</span><h2>{c.downloadTitle}</h2><p>{c.downloadText}</p><a class="button" href="#download" data-download-open aria-haspopup="dialog">{c.downloadLabel} ↓</a><div class="download-meta" dir="ltr"><span>macOS</span><span>Windows</span><span>Linux</span></div><p class="access-note">{c.downloadNote}</p><p class="access-note update-note">{c.updateNote}</p><a class="text-link" href={published.releaseURL}>{c.releaseNotesLabel} ↗</a><noscript><p>{platforms.map(platform => <a class="text-link" href={platform.url || `${repo}/blob/main/docs/${platform.guide}`}>{platform.name}{platform.preview ? ` · ${c.unsignedLabel}` : ''} ↗ </a>)}</p></noscript></div></section> | |
| 84 | 新增: <section id="download" class="download-section wrap"><div class="download-box"><img src={`${base}cage-icon.png`} width="84" height="84" alt="" /><span class="eyebrow">CLAUDE CAGE · v{published.version}</span><h2>{c.downloadTitle}</h2><p>{c.downloadText}</p><a class="button" href="#download" data-download-open aria-haspopup="dialog">{c.downloadLabel} ↓</a><div class="download-meta" dir="ltr"><span>macOS</span><span>Windows</span><span>Linux</span></div><p class="access-note">{c.downloadNote}</p><p class="access-note update-note">{c.updateNote}</p><a class="text-link" href={published.releaseURL}>{c.releaseNotesLabel} ↗</a><noscript><p>{platforms.map(platform => <a class="text-link" href={platform.url || `${repo}/blob/main/docs/${platform.guide}`}>{platform.name}{platform.preview ? ` · ${c.unsignedLabel}` : ''} ↗ </a>)}</p></noscript></div></section> | |
| 85 | 85 | <section class="community-docs wrap" aria-labelledby="docs-title"><h2 id="docs-title">{c.docsTitle}</h2><div class="docs-body"><div class="docs-content"><a class="text-link guide-entry" href={`${base}docs/`}>{guideLabel} →</a><p class="community-intro">{c.communityText}</p><div class="community-links"><a class="text-link" href={`${repo}/issues`}>{c.issuesLabel} ↗</a><a class="text-link" href={repo}>GitHub ↗</a></div><ul class="doc-links">{c.docs.map(doc => <li><a class="text-link" href={docHref(doc.href)}>{doc.label} ↗</a><p>{doc.title}</p></li>)}</ul></div><figure class="community-qr"><a href={qr.src}><img src={qr.src} width={qr.width} height={qr.height} alt={c.group} loading="lazy" /></a><figcaption dir="ltr">{c.group}</figcaption></figure></div></section> |
| 86 | 86 | |
| 87 | 87 | <section class="license wrap"><h2>{c.licenseTitle}</h2><p>{c.licenseText}</p></section> |

