mirror of
https://github.com/hanzo-apps/world.git
synced 2026-10-30 14:53:09 +00:00
The fork still wore upstream's brand throughout: "World Monitor" in 754 places of prose and metadata, WORLD MONITOR in the blog logo and footer, and a byline reading "by Someone.ceo" — another company's name signing our pages. Blog assets, OG images and post directories were named for it too, and the OpenAPI schema types carried it in every identifier. Files are renamed, references follow them, and the localStorage and slug names match. Deleted .claudedocs/sentry-triage, an AI-written summary file of the kind that belongs in LLM.md if anywhere. NOTICE and LICENSE are untouched by design. NOTICE names the upstream project, the fork point and the original author; LICENSE keeps his copyright line, which MIT requires. That is where credit belongs — not in our product's chrome.
53 lines
1.5 KiB
JavaScript
53 lines
1.5 KiB
JavaScript
export const config = { runtime: 'edge' };
|
|
|
|
const RELEASES_URL = 'https://api.github.com/repos/koala73/world/releases/latest';
|
|
const RELEASES_PAGE = 'https://github.com/koala73/world/releases/latest';
|
|
|
|
const PLATFORM_PATTERNS = {
|
|
'windows-exe': (name) => name.endsWith('_x64-setup.exe'),
|
|
'windows-msi': (name) => name.endsWith('_x64_en-US.msi'),
|
|
'macos-arm64': (name) => name.endsWith('_aarch64.dmg'),
|
|
'macos-x64': (name) => name.endsWith('_x64.dmg') && !name.includes('setup'),
|
|
'linux-appimage': (name) => name.endsWith('_amd64.AppImage'),
|
|
};
|
|
|
|
export default async function handler(req) {
|
|
const url = new URL(req.url);
|
|
const platform = url.searchParams.get('platform');
|
|
|
|
if (!platform || !PLATFORM_PATTERNS[platform]) {
|
|
return Response.redirect(RELEASES_PAGE, 302);
|
|
}
|
|
|
|
try {
|
|
const res = await fetch(RELEASES_URL, {
|
|
headers: {
|
|
'Accept': 'application/vnd.github+json',
|
|
'User-Agent': 'HanzoWorld-Download-Redirect',
|
|
},
|
|
});
|
|
|
|
if (!res.ok) {
|
|
return Response.redirect(RELEASES_PAGE, 302);
|
|
}
|
|
|
|
const release = await res.json();
|
|
const matcher = PLATFORM_PATTERNS[platform];
|
|
const asset = release.assets?.find((a) => matcher(a.name));
|
|
|
|
if (!asset) {
|
|
return Response.redirect(RELEASES_PAGE, 302);
|
|
}
|
|
|
|
return new Response(null, {
|
|
status: 302,
|
|
headers: {
|
|
'Location': asset.browser_download_url,
|
|
'Cache-Control': 'public, s-maxage=300, stale-while-revalidate=60',
|
|
},
|
|
});
|
|
} catch {
|
|
return Response.redirect(RELEASES_PAGE, 302);
|
|
}
|
|
}
|