mirror of
https://github.com/anomalyco/hex.git
synced 2026-11-28 13:02:21 +01:00
The site's download buttons and the README/docs links name /hex/download/<target>, which the site Worker redirects per request to the release service's stable alias once stable.json exists and to the dev alias until then, so nothing needs switching back. The page labels the build ("Dev build 0.0.0-dev-N", with a note that it updates from the Dev channel) and refreshes the version from the live manifests. The Linux button names the site's own install-linux.sh. The anomalyco/homebrew-tap cask now installs the dev alias (version :latest, sha256 :no_check, auto_updates); the Release workflow's stable Homebrew job replaces it with a versioned cask at the first stable release.
32 lines
1.4 KiB
TypeScript
32 lines
1.4 KiB
TypeScript
// The site lives under /hex on anoma.ly (production) and dev.anoma.ly (dev), and
|
|
// the release files under /hex/files. Pages keep root-relative paths internally;
|
|
// these helpers add and remove the prefix at the edges.
|
|
export const BASE_PATH = "/hex"
|
|
export const FILES_PATH = `${BASE_PATH}/files`
|
|
// The Anomaly release service. Its dev stage (dev.anoma.ly/release) is only for
|
|
// testing the service itself, so both site environments read production.
|
|
export const RELEASE_SERVICE = "https://anoma.ly/release"
|
|
// Redirects to the latest dev channel Mac download (worker.ts).
|
|
export const DEV_DOWNLOAD_PATH = `${BASE_PATH}/download/dev`
|
|
// Redirects to the current release's file for a target (worker.ts).
|
|
export const DOWNLOAD_PATH = `${BASE_PATH}/download`
|
|
|
|
// The build mode (`--mode dev`) picks the environment; every other mode builds production.
|
|
export function hostForMode(mode: string | undefined): string {
|
|
return mode === "dev" ? "dev.anoma.ly" : "anoma.ly"
|
|
}
|
|
|
|
export function originForMode(mode: string | undefined): string {
|
|
return `https://${hostForMode(mode)}${BASE_PATH}`
|
|
}
|
|
|
|
export function withBase(path: string): string {
|
|
return `${BASE_PATH}${path}`
|
|
}
|
|
|
|
// Returns the site path for a request path, or undefined when it is outside the base.
|
|
export function stripBase(pathname: string): string | undefined {
|
|
if (pathname === BASE_PATH) return "/"
|
|
if (!pathname.startsWith(`${BASE_PATH}/`)) return undefined
|
|
return pathname.slice(BASE_PATH.length)
|
|
}
|