mirror of
https://github.com/FlareSolverr/FlareSolverr.git
synced 2026-04-23 16:35:36 +02:00
Install Firefox 94 instead of the latest Nightly
This commit is contained in:
40
install.js
Normal file
40
install.js
Normal file
@@ -0,0 +1,40 @@
|
||||
const fs = require('fs');
|
||||
const puppeteer = require('puppeteer');
|
||||
|
||||
(async () => {
|
||||
|
||||
// Puppeteer does not allow to download Firefox revisions, just the last Nightly
|
||||
// We this script we can download any version
|
||||
const revision = '94.0a1';
|
||||
const downloadHost = 'https://archive.mozilla.org/pub/firefox/nightly/2021/10/2021-10-01-09-33-23-mozilla-central';
|
||||
|
||||
// skip installation (for Dockerfile)
|
||||
if (process.env.PUPPETEER_EXECUTABLE_PATH) {
|
||||
console.log('Skipping Firefox installation because the environment variable "PUPPETEER_EXECUTABLE_PATH" is set.');
|
||||
return;
|
||||
}
|
||||
|
||||
// check if Firefox is already installed
|
||||
const f = puppeteer.createBrowserFetcher({
|
||||
product: 'firefox',
|
||||
host: downloadHost
|
||||
})
|
||||
if (fs.existsSync(f._getFolderPath(revision))) {
|
||||
console.log(`Firefox ${revision} already installed...`)
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(`Installing firefox ${revision} ...`)
|
||||
const downloadPath = f._downloadsFolder;
|
||||
console.log(`Download path: ${downloadPath}`)
|
||||
if (fs.existsSync(downloadPath)) {
|
||||
console.log(`Removing previous downloads...`)
|
||||
fs.rmSync(downloadPath, { recursive: true })
|
||||
}
|
||||
|
||||
console.log(`Downloading firefox ${revision} ...`)
|
||||
await f.download(revision)
|
||||
|
||||
console.log('Installation complete...')
|
||||
|
||||
})()
|
||||
Reference in New Issue
Block a user