Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 6 additions & 23 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,10 @@
dist: trusty
sudo: required
dist: focal
language: node_js
node_js:
- "6"
- "8"
- "9"
- 'lts/*'
install:
- npm install --legacy-peer-deps

addons:
firefox: latest
apt:
sources:
- google-chrome
packages:
- google-chrome-stable fluxbox

before_script:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- sleep 3
- fluxbox >/dev/null 2>&1 &

env:
global:
- secure: ZaVxQhRv9HYXTCqeS9T4XXGO1cGayL11os8jDZ6wqNkQAwkOw3QSL70iloN5DMzg4WXv8Pwp5I4EUDIcUwiu4UCbDgfn1vYoTfVEmDMBDni4xw3CRG7IT8gEijJItCaOdEzC+IBmpAFuVI8xcuic7WBYPKRnShWkZ1xwmHDSenc=
- secure: lh7gaH4G4RUvdjrocupakeFbx4JtF7AyLGXGfsJl+/PJFjvrB+Ahatb8sTcb5hDHTr+Ucunzawx1HBNE+k+7CyykKBQpsQNWT/q6vlL/PAjRpt501O46NEdfTm/RSTqHgIo9WINYIa/ZpCh2L0vAevduaT0GGFCaP9W7fpJaVhM=
- CHROME_BIN=/usr/bin/google-chrome-stable
firefox: latest
chrome: stable
41 changes: 29 additions & 12 deletions lib/fingerprint.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,34 @@
var pad = require('./pad.js');
var os = require('os');

var os = require('os'),
padding = 2,
pid = pad(process.pid.toString(36), padding),
hostname = os.hostname(),
length = hostname.length,
hostId = pad(hostname
.split('')
.reduce(function (prev, char) {
return +prev + char.charCodeAt(0);
}, +length + 36)
.toString(36),
padding);
function getHostname () {
try {
return os.hostname();
} catch (e) {
/**
* This is most likely Windows 7 which is known to cause os.hostname() to break
* @see https://github.com/nodejs/node/issues/41297
* @see https://github.com/libuv/libuv/issues/3260
*
* Fallback to take hostname from environment variables
* @see https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/hostname#notes
*/
// eslint-disable-next-line no-underscore-dangle
return process.env._CLUSTER_NETWORK_NAME_ || process.env.COMPUTERNAME || 'hostname';
}
}

var padding = 2,
pid = pad(process.pid.toString(36), padding),
hostname = getHostname(),
length = hostname.length,
hostId = pad(hostname
.split('')
.reduce(function (prev, char) {
return +prev + char.charCodeAt(0);
}, +length + 36)
.toString(36),
padding);

module.exports = function fingerprint () {
return pid + hostId;
Expand Down