Update browser versions + add fix for Firefox user agent (#1388)

This commit is contained in:
Adam Weeden 2022-04-18 18:42:25 -04:00 committed by GitHub
parent f6a1e30085
commit f6852d5208
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 4 deletions

View File

@ -10,12 +10,12 @@ export const DEFAULT_CHROME_VERSION = '100.0.4896.75';
// Update each of these periodically
// https://product-details.mozilla.org/1.0/firefox_versions.json
export const DEFAULT_FIREFOX_VERSION = '99.0';
export const DEFAULT_FIREFOX_VERSION = '99.0.1';
// https://en.wikipedia.org/wiki/Safari_version_history
export const DEFAULT_SAFARI_VERSION = {
majorVersion: 15,
version: '15.0',
version: '15.4',
webkitVersion: '605.1.15',
};

View File

@ -2,7 +2,7 @@ import axios from 'axios';
import * as log from 'loglevel';
const USER_AGENT =
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.1 Safari/537.36';
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Safari/605.1.15';
export async function inferTitle(url: string): Promise<string> {
const { data } = await axios.get<string>(url, {

View File

@ -81,7 +81,10 @@ async function edgeUserAgent(
async function firefoxUserAgent(platform: string): Promise<string> {
const firefoxVersion = await getLatestFirefoxVersion();
return `Mozilla/5.0 (${platform}; rv:${firefoxVersion}) Gecko/20100101 Firefox/${firefoxVersion}`;
return `Mozilla/5.0 (${platform}; rv:${firefoxVersion}) Gecko/20100101 Firefox/${firefoxVersion}`.replace(
'10_15_7',
'10.15',
);
}
async function safariUserAgent(platform: string): Promise<string> {