hexo/node_modules/cuid/lib/fingerprint.browser.js

13 lines
398 B
JavaScript
Raw Normal View History

2023-10-03 11:14:36 +08:00
var pad = require('./pad.js');
var env = typeof window === 'object' ? window : self;
var globalCount = Object.keys(env).length;
var mimeTypesLength = navigator.mimeTypes ? navigator.mimeTypes.length : 0;
var clientId = pad((mimeTypesLength +
navigator.userAgent.length).toString(36) +
globalCount.toString(36), 4);
module.exports = function fingerprint () {
return clientId;
};