mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2025-02-13 16:28:41 +00:00
Improve automatic retrieval of app name by faking a user agent to make the request
This commit is contained in:
parent
12c85af1a2
commit
4a8ab13622
@ -101,7 +101,15 @@ function detectArch() {
|
||||
}
|
||||
|
||||
function getTitle(url, callback) {
|
||||
request(url, (error, response, body) => {
|
||||
const options = {
|
||||
url: url,
|
||||
headers: {
|
||||
// fake a user agent because pages like http://messenger.com will throw 404 error
|
||||
'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'
|
||||
}
|
||||
};
|
||||
|
||||
request(options, (error, response, body) => {
|
||||
if (error || response.statusCode !== 200) {
|
||||
callback(`Request Error: ${error}, Status Code ${response ? response.statusCode : 'No Response'}`);
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user