Skip to content

Commit 08cb26b

Browse files
authored
Merge pull request #112 from BendingBender/feature/upgrade-dependencies
Upgrade swfobject, use mumurhash-js npm package
2 parents d7584e1 + a997e65 commit 08cb26b

41 files changed

Lines changed: 12811 additions & 3602 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.drone.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ build:
66
commands:
77
- export BUILD_NUMBER=$DRONE_BUILD_NUMBER
88
- npm install --quiet
9-
- npm install --quiet -g karma-cli
10-
- npm test
9+
- npm run test:drone
1110

1211
publish:
1312
coverage:

.eslintignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
src/vendor
2+
dist

.eslintrc.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
'use strict';
2+
module.exports = {
3+
root: true,
4+
parserOptions: {
5+
ecmaVersion: 2018,
6+
sourceType: 'script',
7+
},
8+
extends: ['eslint:recommended'],
9+
env: {
10+
node: true,
11+
},
12+
rules: {
13+
strict: 'error',
14+
'no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
15+
},
16+
};

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,3 +94,11 @@ $RECYCLE.BIN/
9494

9595
# Windows shortcuts
9696
*.lnk
97+
98+
##
99+
# Editors/IDEs
100+
##
101+
102+
# VSCode + Plugins
103+
.history
104+
.vscode

README.md

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ If you want to fingerprint browsers, you are **_probably_** also interested in o
1212

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

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

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

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

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

5151
```javascript
5252
// Create a new ClientJS object
53+
54+
// in a browser:
5355
var client = new ClientJS();
56+
// or in a CommonJS environment:
57+
var client = require('clientjs').ClientJS;
5458

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

84+
## Bundles
85+
For maximum flexibility, this library is distributed in 4 different pre-bundled variants for the browser:
86+
87+
- `dist/client.min.js` - full distribution bundle, contains Flash and Java detection mechanisms
88+
- `dist/client.flash.min.js` - contains Flash detection mechanism but misses Java detection (`getJavaVersion()` will throw an error when called)
89+
- `dist/client.java.min.js` - contains Java detection mechanism but misses Flash detection (`getFlashVersion()` will throw an error when called)
90+
- `dist/client.base.min.js` - misses both, Flash and Java detection mechanisms (`getFlashVersion()` and `getJavaVersion()` will throw an error when called)
91+
8092
## Available Methods
8193
Below is the current list of available methods to find information on a users browser/device.
8294

@@ -139,9 +151,9 @@ You can find documentation on each method at [clientjs.org](https://clientjs.org
139151
140152
client.getPlugins();
141153
client.isJava();
142-
client.getJavaVersion();
154+
client.getJavaVersion(); // functional only in java and full builds, throws an error otherwise
143155
client.isFlash();
144-
client.getFlashVersion();
156+
client.getFlashVersion(); // functional only in flash and full builds, throws an error otherwise
145157
client.isSilverlight();
146158
client.getSilverlightVersion();
147159
@@ -174,31 +186,28 @@ Built Upon:
174186
- detectmobilebrowsers.com
175187

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

179191
Dependencies Include:
180-
- ua-parser.js
181192
- fontdetect.js
182-
- swfobject.js
193+
- swfobject.js - included only in full and Flash builds (only `client.min.js` and `client.flash.min.js`)
183194
- murmurhash3.js
195+
- deployJava.js - included only in full and Java builds (only `client.min.js` and `client.java.min.js`)
184196

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

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

190202
```shell
191203
# Install dependencies
192204
$ npm install
193-
194-
# If you want tu run karma from the command line
195-
$ npm install -g karma-cli
196205
```
197206

198207
Run Karma and enjoy coding!
199208

200209
```shell
201-
$ karma start
210+
$ npm test
202211
```
203212

204213
Thanks for contributing to ClientJS! Please report any bug [here](https://github.com/jackspirou/clientjs/issues).

bower.json

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,18 @@
33
"version": "0.1.11",
44
"main": ["dist/client.min.js"],
55
"ignore": [
6-
".travis.yml",
6+
".drone.sec",
7+
".drone.yml",
78
".gitignore",
8-
"build",
9-
"grunt.js",
9+
".travis.yml",
10+
"justrelease.yml",
11+
"karma",
1012
"LICENSE",
1113
"node_modules",
12-
"package.json"
14+
"package-lock.json",
15+
"package.json",
16+
"scripts",
17+
"specs",
18+
"webpack.config.js"
1319
]
1420
}

dist/client.base.min.js

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/client.base.min.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/client.flash.min.js

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/client.flash.min.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)