@@ -14,7 +14,7 @@ import { HttpsProxyAgent } from 'https-proxy-agent'
14
14
import { HttpProxyAgent } from 'http-proxy-agent'
15
15
import unzipper , { type Entry } from 'unzipper'
16
16
17
- import { BINARY_FILE , MOZ_CENTRAL_CARGO_TOML } from './constants.js'
17
+ import { BINARY_FILE , GECKODRIVER_RELEASES } from './constants.js'
18
18
import { hasAccess , getDownloadUrl , retryFetch } from './utils.js'
19
19
20
20
const log = logger ( 'geckodriver' )
@@ -40,13 +40,12 @@ export async function download (
40
40
* get latest version of Geckodriver
41
41
*/
42
42
if ( ! geckodriverVersion ) {
43
- const res = await retryFetch ( MOZ_CENTRAL_CARGO_TOML , fetchOpts )
44
- const toml = await res . text ( )
45
- const version = toml . split ( '\n' ) . find ( ( l ) => l . startsWith ( 'version = ' ) )
46
- if ( ! version ) {
47
- throw new Error ( `Couldn't find version property in Cargo.toml file : ${ toml } ` )
43
+ const res = await retryFetch ( GECKODRIVER_RELEASES , fetchOpts )
44
+ const releases = await res . json ( ) as { name : string }
45
+ geckodriverVersion = releases . name
46
+ if ( ! geckodriverVersion ) {
47
+ throw new Error ( `Couldn't find version name in releases : ${ JSON . stringify ( releases ) } ` )
48
48
}
49
- geckodriverVersion = version . split ( ' = ' ) . pop ( ) . slice ( 1 , - 1 )
50
49
log . info ( `Detected Geckodriver v${ geckodriverVersion } to be latest` )
51
50
}
52
51
0 commit comments