File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,10 +6,9 @@ nteract Linux installer.
66The endpoint intentionally stays separate from the marketing site. It serves
77plain shell, not HTML, and it does not install agent-specific integrations.
88
9- The bootstrap currently downloads the merged desktop installer from
10- ` raw.githubusercontent.com/nteract/desktop/main/scripts/install-linux-release ` .
11- If desktop releases later publish the installer as a release asset, switch the
12- bootstrap URL to that immutable release asset.
9+ The bootstrap dynamically fetches the latest stable release's
10+ ` install-linux-release ` asset from GitHub releases. Falls back to the main
11+ branch version if the API call fails.
1312
1413## Local development
1514
Original file line number Diff line number Diff line change 1- import { installerScript } from "../lib/script.js" ;
1+ import { installerScript , getLatestStableInstallerUrl } from "../lib/script.js" ;
22
3- export default function handler ( request , response ) {
3+ export default async function handler ( request , response ) {
44 response . setHeader ( "Content-Type" , "text/x-shellscript; charset=utf-8" ) ;
55 response . setHeader ( "Cache-Control" , "public, max-age=300, s-maxage=300" ) ;
66 response . setHeader ( "X-Content-Type-Options" , "nosniff" ) ;
7- response . status ( 200 ) . send ( installerScript ( ) ) ;
7+
8+ const installerUrl = await getLatestStableInstallerUrl ( ) ;
9+ response . status ( 200 ) . send ( installerScript ( installerUrl ) ) ;
810}
Original file line number Diff line number Diff line change 1- const DEFAULT_INSTALLER_URL =
1+ const FALLBACK_INSTALLER_URL =
22 "https://raw.githubusercontent.com/nteract/desktop/main/scripts/install-linux-release" ;
33
4- export function installerScript ( installerUrl = DEFAULT_INSTALLER_URL ) {
4+ /**
5+ * Fetch the latest stable release's install-linux-release asset URL.
6+ * Returns fallback URL on error.
7+ */
8+ export async function getLatestStableInstallerUrl ( ) {
9+ try {
10+ const res = await fetch (
11+ "https://api.github.com/repos/nteract/desktop/releases/latest" ,
12+ {
13+ headers : { Accept : "application/vnd.github.v3+json" } ,
14+ }
15+ ) ;
16+ if ( ! res . ok ) return FALLBACK_INSTALLER_URL ;
17+
18+ const release = await res . json ( ) ;
19+ const asset = release . assets ?. find ( ( a ) => a . name === "install-linux-release" ) ;
20+ return asset ?. browser_download_url || FALLBACK_INSTALLER_URL ;
21+ } catch {
22+ return FALLBACK_INSTALLER_URL ;
23+ }
24+ }
25+
26+ export function installerScript ( installerUrl ) {
527 return `#!/bin/sh
628set -eu
729
You can’t perform that action at this time.
0 commit comments