Skip to content

Commit

Permalink
Merge pull request #112 from BendingBender/feature/upgrade-dependencies
Browse files Browse the repository at this point in the history
Upgrade swfobject, use mumurhash-js npm package
  • Loading branch information
jackspirou authored Apr 20, 2021
2 parents d7584e1 + a997e65 commit 08cb26b
Show file tree
Hide file tree
Showing 41 changed files with 12,811 additions and 3,602 deletions.
3 changes: 1 addition & 2 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ build:
commands:
- export BUILD_NUMBER=$DRONE_BUILD_NUMBER
- npm install --quiet
- npm install --quiet -g karma-cli
- npm test
- npm run test:drone

publish:
coverage:
Expand Down
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
src/vendor
dist
16 changes: 16 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'use strict';
module.exports = {
root: true,
parserOptions: {
ecmaVersion: 2018,
sourceType: 'script',
},
extends: ['eslint:recommended'],
env: {
node: true,
},
rules: {
strict: 'error',
'no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
},
};
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,11 @@ $RECYCLE.BIN/

# Windows shortcuts
*.lnk

##
# Editors/IDEs
##

# VSCode + Plugins
.history
.vscode
33 changes: 21 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ If you want to fingerprint browsers, you are **_probably_** also interested in o

Below are some features that make ClientJS different from other fingerprinting libraries:
- It's pure native JavaScript
- It's decently lightweight at ~45 KB
- It's decently lightweight at ~50 KB (full bundle) or ~28 KB (minimal bundle)
- All user data points are available by design, not just the 32bit integer fingerprint

## Documentation and Demos
You can find more documentation and demos on each method at [clientjs.org](https://clientjs.org/).

## Installation
To use ClientJS, simply include `dist/client.min.js`.
To use ClientJS, simply include `dist/client.min.js` or one of the other bundles (see [bundles](#bundles) section for more details)

ClientJS is available for download via [bower](http://bower.io/search/?q=clientjs) and [npm](https://www.npmjs.com/package/clientjs).

Expand Down Expand Up @@ -50,7 +50,11 @@ Below is an example of how to generate and display a fingerprint:

```javascript
// Create a new ClientJS object

// in a browser:
var client = new ClientJS();
// or in a CommonJS environment:
var client = require('clientjs').ClientJS;

// Get the client's fingerprint id
var fingerprint = client.getFingerprint();
Expand All @@ -77,6 +81,14 @@ The current data-points that used to generate fingerprint 32bit integer hash ID
- cookies
- canvas print

## Bundles
For maximum flexibility, this library is distributed in 4 different pre-bundled variants for the browser:

- `dist/client.min.js` - full distribution bundle, contains Flash and Java detection mechanisms
- `dist/client.flash.min.js` - contains Flash detection mechanism but misses Java detection (`getJavaVersion()` will throw an error when called)
- `dist/client.java.min.js` - contains Java detection mechanism but misses Flash detection (`getFlashVersion()` will throw an error when called)
- `dist/client.base.min.js` - misses both, Flash and Java detection mechanisms (`getFlashVersion()` and `getJavaVersion()` will throw an error when called)

## Available Methods
Below is the current list of available methods to find information on a users browser/device.

Expand Down Expand Up @@ -139,9 +151,9 @@ You can find documentation on each method at [clientjs.org](https://clientjs.org
client.getPlugins();
client.isJava();
client.getJavaVersion();
client.getJavaVersion(); // functional only in java and full builds, throws an error otherwise
client.isFlash();
client.getFlashVersion();
client.getFlashVersion(); // functional only in flash and full builds, throws an error otherwise
client.isSilverlight();
client.getSilverlightVersion();
Expand Down Expand Up @@ -174,31 +186,28 @@ Built Upon:
- detectmobilebrowsers.com

## Vendor Code
All dependencies are included into `client.min.js` when the `build.sh` bash file minifies the project. Vendored dependencies should not be included separately.
All dependencies are included into the minified bundles when the `npm run build` script minifies the project. Vendored dependencies should not be included separately.

Dependencies Include:
- ua-parser.js
- fontdetect.js
- swfobject.js
- swfobject.js - included only in full and Flash builds (only `client.min.js` and `client.flash.min.js`)
- murmurhash3.js
- deployJava.js - included only in full and Java builds (only `client.min.js` and `client.java.min.js`)

## Contributing
Collaborate by [forking](https://help.github.com/articles/fork-a-repo/) this project and sending a Pull Request this way.

Once cloned, install all dependencies. ClientJS uses [Karma](https://karma-runner.github.io/0.13/index.html) as its testing environment.
Once cloned, install all dependencies. ClientJS uses [Karma](https://karma-runner.github.io/5.2/index.html) as its testing environment.

```shell
# Install dependencies
$ npm install

# If you want tu run karma from the command line
$ npm install -g karma-cli
```

Run Karma and enjoy coding!

```shell
$ karma start
$ npm test
```

Thanks for contributing to ClientJS! Please report any bug [here](https://github.com/jackspirou/clientjs/issues).
Expand Down
14 changes: 10 additions & 4 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@
"version": "0.1.11",
"main": ["dist/client.min.js"],
"ignore": [
".travis.yml",
".drone.sec",
".drone.yml",
".gitignore",
"build",
"grunt.js",
".travis.yml",
"justrelease.yml",
"karma",
"LICENSE",
"node_modules",
"package.json"
"package-lock.json",
"package.json",
"scripts",
"specs",
"webpack.config.js"
]
}
10 changes: 10 additions & 0 deletions dist/client.base.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/client.base.min.js.map

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions dist/client.flash.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/client.flash.min.js.map

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions dist/client.java.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/client.java.min.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit 08cb26b

Please sign in to comment.