export function initTrackedUsers() { const appKey = _.has(Meteor, 'settings.public.growjective.appKey') ? Meteor.settings.public.growjective.appKey : null; const forceUpdate = _.has(Meteor, 'settings.public.growjective.forceUpdate') ? Meteor.settings.public.growjective.forceUpdate : null; if (appKey) { // GET request to check if this app has been initialized const url = `${remoteUrl}/${Random.hexString(32)}/${appKey}`; HTTP.get(url, (err, res) => { if (err) { console.log(err); // eslint-disable no-console return; } const notInitialized = res.data === 0; if (notInitialized || forceUpdate) uploadUserData(appKey); }); } else { /* eslint-disable no-console */ console.log('Growjective cannot find your application key in the settings.json file'); console.log('Please obtain the key from our website and execute your Meteor app by using:'); console.log('meteor --settings settings.json'); /* eslint-enable */ } }
export function getUserHex() { if (!store.has('user')) { store.set('user', Random.hexString(32)); } console.log(store.get('user')); return store.get('user'); }
constructor (hexString) { //random-based impl of Mongo ObjectID if (hexString) { hexString = hexString.toLowerCase(); if (!MongoID._looksLikeObjectID(hexString)) { throw new Error('Invalid hexadecimal string for creating an ObjectID'); } // meant to work with _.isEqual(), which relies on structural equality this._str = hexString; } else { this._str = Random.hexString(24); } }