@@ -184,39 +184,32 @@ export class UpdateCommand {
184184 ) ;
185185 }
186186
187- const supportedPlatforms = new Set ( [ "linux" , "darwin" ] ) ;
188- const supportedArchs = new Set ( [ "x64" , "arm64" ] ) ;
189-
190- if (
191- ! supportedPlatforms . has ( process . platform ) ||
192- ! supportedArchs . has ( process . arch )
193- ) {
194- throw new Error (
195- `Unsupported platform: ${ process . platform } -${ process . arch } . ` +
196- "Supported: linux-x64, linux-arm64, darwin-x64, darwin-arm64"
197- ) ;
198- }
199-
200187 const assetName = `jup-${ process . platform } -${ process . arch } ` ;
201188 const baseUrl = `https://github.com/jup-ag/cli/releases/download/v${ version } ` ;
202189
203- const [ binary , checksums ] = await Promise . all ( [
204- ky . get ( `${ baseUrl } /${ assetName } ` ) . arrayBuffer ( ) ,
205- ky . get ( `${ baseUrl } /checksums.txt` ) . text ( ) ,
206- ] ) ;
207-
208- const buf = Buffer . from ( binary ) ;
209-
210- // Verify checksum — exact match on filename after the hash
190+ // Fetch checksums first to validate platform support before downloading
191+ const checksums = await ky . get ( `${ baseUrl } /checksums.txt` ) . text ( ) ;
211192 const checksumLine = checksums
212193 . split ( "\n" )
213194 . map ( ( line ) => line . trim ( ) . split ( / \s + / ) )
214195 . find ( ( parts ) => parts . length === 2 && parts [ 1 ] === assetName ) ;
215196
216197 if ( ! checksumLine ) {
217- throw new Error ( `Checksum not found for ${ assetName } ` ) ;
198+ const supported = checksums
199+ . split ( "\n" )
200+ . map ( ( line ) => line . trim ( ) . split ( / \s + / ) )
201+ . filter ( ( parts ) => parts . length === 2 )
202+ . map ( ( parts ) => parts [ 1 ] ! . replace ( "jup-" , "" ) )
203+ . join ( ", " ) ;
204+ throw new Error (
205+ `Unsupported platform: ${ process . platform } -${ process . arch } . ` +
206+ `Supported: ${ supported } `
207+ ) ;
218208 }
219209
210+ const binary = await ky . get ( `${ baseUrl } /${ assetName } ` ) . arrayBuffer ( ) ;
211+ const buf = Buffer . from ( binary ) ;
212+
220213 const expectedHash = checksumLine [ 0 ] ;
221214 const actualHash = createHash ( "sha256" ) . update ( buf ) . digest ( "hex" ) ;
222215
0 commit comments