fingerprintjs-rails 0.3.0 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  /*
2
- * fingerprintJS 0.3 - Fast browser fingerprint library
2
+ * fingerprintJS 0.3.2 - Fast browser fingerprint library
3
3
  * https://github.com/Valve/fingerprintjs
4
4
  * Copyright (c) 2013 Valentin Vasilyev (iamvalentin@gmail.com)
5
5
  * Licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) license.
@@ -29,6 +29,8 @@
29
29
  };
30
30
  this.map = function(obj, iterator, context) {
31
31
  var results = [];
32
+ // Not using strict equality so that this acts as a
33
+ // shortcut to checking for `null` and `undefined`.
32
34
  if (obj == null) return results;
33
35
  if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context);
34
36
  this.each(obj, function(value, index, list) {
@@ -40,7 +42,7 @@
40
42
  if(hasher){
41
43
  this.hasher = hasher;
42
44
  }
43
- }
45
+ };
44
46
 
45
47
  Fingerprint.prototype = {
46
48
 
@@ -50,8 +52,14 @@
50
52
  keys.push(navigator.language);
51
53
  keys.push(screen.colorDepth);
52
54
  keys.push(new Date().getTimezoneOffset());
53
- keys.push(!!window.sessionStorage);
54
- keys.push(!!window.localStorage);
55
+ keys.push(!!scope.sessionStorage);
56
+ keys.push(this.hasLocalStorage());
57
+ keys.push(!!window.indexedDB);
58
+ keys.push(typeof(document.body.addBehavior));
59
+ keys.push(typeof(window.openDatabase));
60
+ keys.push(navigator.cpuClass);
61
+ keys.push(navigator.platform);
62
+ keys.push(navigator.doNotTrack);
55
63
  var pluginsString = this.map(navigator.plugins, function(p){
56
64
  var mimeTypes = this.map(p, function(mt){
57
65
  return [mt.type, mt.suffixes].join('~');
@@ -129,8 +137,17 @@
129
137
  h1 ^= h1 >>> 16;
130
138
 
131
139
  return h1 >>> 0;
140
+ },
141
+
142
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=781447
143
+ hasLocalStorage: function(){
144
+ try{
145
+ return !!scope.localStorage;
146
+ } catch(e) {
147
+ return true; // SecurityError when referencing it means it exists
148
+ }
132
149
  }
133
- }
150
+ };
134
151
 
135
152
  scope.Fingerprint = Fingerprint;
136
153
  })(window);
@@ -1 +1 @@
1
- !function(r){"use strict";var t=function(r){var t=Array.prototype.forEach,e=Array.prototype.map;this.each=function(r,e,n){if(null!==r)if(t&&r.forEach===t)r.forEach(e,n);else if(r.length===+r.length){for(var a=0,h=r.length;h>a;a++)if(e.call(n,r[a],a,r)==={})return}else for(var o in r)if(r.hasOwnProperty(o)&&e.call(n,r[o],o,r)==={})return},this.map=function(r,t,n){var a=[];return null==r?a:e&&r.map===e?r.map(t,n):(this.each(r,function(r,e,h){a[a.length]=t.call(n,r,e,h)}),a)},r&&(this.hasher=r)};t.prototype={get:function(){var r=[];r.push(navigator.userAgent),r.push(navigator.language),r.push(screen.colorDepth),r.push((new Date).getTimezoneOffset()),r.push(!!window.sessionStorage),r.push(!!window.localStorage);var t=this.map(navigator.plugins,function(r){var t=this.map(r,function(r){return[r.type,r.suffixes].join("~")}).join(",");return[r.name,r.description,t].join("::")},this).join(";");return r.push(t),this.hasher?this.hasher(r.join("###"),31):this.murmurhash3_32_gc(r.join("###"),31)},murmurhash3_32_gc:function(r,t){var e,n,a,h,o,i,s,c;for(e=3&r.length,n=r.length-e,a=t,o=3432918353,i=461845907,c=0;n>c;)s=255&r.charCodeAt(c)|(255&r.charCodeAt(++c))<<8|(255&r.charCodeAt(++c))<<16|(255&r.charCodeAt(++c))<<24,++c,s=4294967295&(65535&s)*o+((65535&(s>>>16)*o)<<16),s=s<<15|s>>>17,s=4294967295&(65535&s)*i+((65535&(s>>>16)*i)<<16),a^=s,a=a<<13|a>>>19,h=4294967295&5*(65535&a)+((65535&5*(a>>>16))<<16),a=(65535&h)+27492+((65535&(h>>>16)+58964)<<16);switch(s=0,e){case 3:s^=(255&r.charCodeAt(c+2))<<16;case 2:s^=(255&r.charCodeAt(c+1))<<8;case 1:s^=255&r.charCodeAt(c),s=4294967295&(65535&s)*o+((65535&(s>>>16)*o)<<16),s=s<<15|s>>>17,s=4294967295&(65535&s)*i+((65535&(s>>>16)*i)<<16),a^=s}return a^=r.length,a^=a>>>16,a=4294967295&2246822507*(65535&a)+((65535&2246822507*(a>>>16))<<16),a^=a>>>13,a=4294967295&3266489909*(65535&a)+((65535&3266489909*(a>>>16))<<16),a^=a>>>16,a>>>0}},r.Fingerprint=t}(window);
1
+ !function(t){"use strict";var r=function(t){var r=Array.prototype.forEach,a=Array.prototype.map;this.each=function(t,a,e){if(null!==t)if(r&&t.forEach===r)t.forEach(a,e);else if(t.length===+t.length){for(var n=0,o=t.length;o>n;n++)if(a.call(e,t[n],n,t)==={})return}else for(var h in t)if(t.hasOwnProperty(h)&&a.call(e,t[h],h,t)==={})return},this.map=function(t,r,e){var n=[];return null==t?n:a&&t.map===a?t.map(r,e):(this.each(t,function(t,a,o){n[n.length]=r.call(e,t,a,o)}),n)},t&&(this.hasher=t)};r.prototype={get:function(){var r=[];r.push(navigator.userAgent),r.push(navigator.language),r.push(screen.colorDepth),r.push((new Date).getTimezoneOffset()),r.push(!!t.sessionStorage),r.push(this.hasLocalStorage()),r.push(!!window.indexedDB),r.push(typeof document.body.addBehavior),r.push(typeof window.openDatabase),r.push(navigator.cpuClass),r.push(navigator.platform),r.push(navigator.doNotTrack);var a=this.map(navigator.plugins,function(t){var r=this.map(t,function(t){return[t.type,t.suffixes].join("~")}).join(",");return[t.name,t.description,r].join("::")},this).join(";");return r.push(a),this.hasher?this.hasher(r.join("###"),31):this.murmurhash3_32_gc(r.join("###"),31)},murmurhash3_32_gc:function(t,r){var a,e,n,o,h,i,s,u;for(a=3&t.length,e=t.length-a,n=r,h=3432918353,i=461845907,u=0;e>u;)s=255&t.charCodeAt(u)|(255&t.charCodeAt(++u))<<8|(255&t.charCodeAt(++u))<<16|(255&t.charCodeAt(++u))<<24,++u,s=4294967295&(65535&s)*h+((65535&(s>>>16)*h)<<16),s=s<<15|s>>>17,s=4294967295&(65535&s)*i+((65535&(s>>>16)*i)<<16),n^=s,n=n<<13|n>>>19,o=4294967295&5*(65535&n)+((65535&5*(n>>>16))<<16),n=(65535&o)+27492+((65535&(o>>>16)+58964)<<16);switch(s=0,a){case 3:s^=(255&t.charCodeAt(u+2))<<16;case 2:s^=(255&t.charCodeAt(u+1))<<8;case 1:s^=255&t.charCodeAt(u),s=4294967295&(65535&s)*h+((65535&(s>>>16)*h)<<16),s=s<<15|s>>>17,s=4294967295&(65535&s)*i+((65535&(s>>>16)*i)<<16),n^=s}return n^=t.length,n^=n>>>16,n=4294967295&2246822507*(65535&n)+((65535&2246822507*(n>>>16))<<16),n^=n>>>13,n=4294967295&3266489909*(65535&n)+((65535&3266489909*(n>>>16))<<16),n^=n>>>16,n>>>0},hasLocalStorage:function(){try{return!!t.localStorage}catch(r){return!0}}},t.Fingerprint=r}(window);
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
6
  gem.name = "fingerprintjs-rails"
7
- gem.version = "0.3.0"
7
+ gem.version = "0.3.2"
8
8
  gem.authors = ["Valentin Vasilyev"]
9
9
  gem.email = ["iamvalentin@gmail.com"]
10
10
  gem.description = "fingerprintjs for rails asset pipeline"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fingerprintjs-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-06-04 00:00:00.000000000 Z
12
+ date: 2013-08-11 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: fingerprintjs for rails asset pipeline
15
15
  email:
@@ -52,4 +52,3 @@ signing_key:
52
52
  specification_version: 3
53
53
  summary: FingerprintJS JavaScript library, packaged for Ruby-on-Rails asset pipeline
54
54
  test_files: []
55
- has_rdoc: