Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

fix(site): serve download metadata from the website origin

yhhd72bd60a2c23
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index e15829ca8..db8a9df27 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -101,6 +101,19 @@ jobs:
echo 'estellaengine.com' > docs/dist/CNAME
touch docs/dist/.nojekyll
+ - name: Stage release metadata on the website origin
+ run: |
+ curl --fail --location --retry 3 https://dl.estella.games/latest.json --output docs/dist/latest.json
+ node --input-type=module <<'JS'
+ import {readFileSync} from 'node:fs';
+ const info=JSON.parse(readFileSync('docs/dist/latest.json','utf8'));
+ if(!/^\d+\.\d+\.\d+$/.test(info.version))throw Error('Invalid release version');
+ for(const platform of ['win','mac-arm64']){
+ const file=info.downloads?.[platform];
+ if(!file || new URL(file.url).origin!=='https://dl.estella.games' || !Number.isSafeInteger(file.size) || file.size<=0 || !file.name.includes(info.version))throw Error('Invalid release download: '+platform);
+ }
+ JS
+
- name: Stage a verified frame of the shipped game
env:
GH_TOKEN: ${{ github.token }}
diff --git a/docs/landing/index.html b/docs/landing/index.html
index 439c0bc2a..96c2fc2b4 100644
--- a/docs/landing/index.html
+++ b/docs/landing/index.html
@@ -620,7 +620,7 @@
// if the mirror can be asked. It cannot be, from a browser, until the bucket
// states a CORS rule; the page is written to not care either way.
(function () {
- var MIRROR = 'https://dl.estella.games/latest.json';
+ var RELEASE_METADATA = '/latest.json';
// Opened as a file rather than through the site build: show nothing rather
// than the placeholder the build would have replaced.
@@ -662,9 +662,9 @@
os === 'mac' ? 'Download for macOS' : 'Download for Windows';
}
- // Ask the mirror what the newest release is. A failure leaves the page as
- // shipped — links still work, the chips just stay unlabelled.
- fetch(MIRROR, { headers: { accept: 'application/json' } })
+ // Deployment snapshots the release metadata on this origin so labels do
+ // not depend on the mirror granting browser cross-origin access.
+ fetch(RELEASE_METADATA, { headers: { accept: 'application/json' } })
.then(function (r) { return r.ok ? r.json() : Promise.reject(r.status); })
.then(function (latest) {
if (latest.version) {