How to use the node-machine-id.machineIdSync function in node-machine-id

To help you get started, we’ve selected a few node-machine-id examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SelfKeyFoundation / Identity-Wallet / src / main / preload.js View on Github external
/* istanbul ignore file */
/* eslint-env node */ /* global window */
// eslint-disable-next-line
const nodeMachineId = require('node-machine-id');
const common = require('../common/utils/common');
const appPackage = require(`${__dirname}'/../../package.json`);
const config = require('../common/config');
const defaultWindowOpen = window.open;
const electron = require('electron');
const PDFWindow = require('electron-pdf-window');

window.electron = electron;
window.appName = appPackage.productName;
window.appVersion = appPackage.version;
window.isTestMode = common.isTestMode();
window.machineId = nodeMachineId.machineIdSync();

window.open = function(url, ...args) {
	for (let i in config.common.allowedUrls) {
		if (url.startsWith(config.common.allowedUrls[i])) {
			return defaultWindowOpen(url, ...args);
		}
	}
	return null;
};

// quit app
window.quit = event => {
	electron.remote.app.quit();
};

window.openDirectorySelectDialog = event => {
github codex-team / codex.notes / src / codex-notes.js View on Github external
});

  hawkCatcher.initGlobalCatcher();
  global.catchException = hawkCatcher.catchException;
}

/**
 * Enable logger
 * @example global.logger.info('Hey yo');
 */
global.logger = require('./utils/logger');
global.utils = require('./utils/utils');

/** Get deviceId */
const machineIdSync = require('node-machine-id').machineIdSync;
global.deviceId = machineIdSync({original: true});



/**
 * Enable Pug
 */
const locals = process.env;
const pug = require('electron-pug')({
  cache: false,
  // debug: true,
  // compileDebug: true
}, locals);

/**
 * Enable autoupdates
 */
github strapi / strapi / packages / strapi-generate-new / lib / index.js View on Github external
`strapi${crypto.randomBytes(6).toString('hex')}`
  );

  const useNpm = cliArguments.useNpm !== undefined;

  const scope = {
    rootPath,
    name: basename(rootPath),
    // disable quickstart run app after creation
    runQuickstartApp: cliArguments.run === false ? false : true,
    // use pacakge version as strapiVersion (all packages have the same version);
    strapiVersion: require('../package.json').version,
    debug: cliArguments.debug !== undefined,
    quick: cliArguments.quickstart !== undefined,
    uuid: uuid(),
    deviceId: machineIdSync(),
    tmpPath,
    // use yarn if available and --use-npm isn't true
    useYarn: !useNpm && hasYarn(),
    installDependencies: true,
    strapiDependencies: [
      'strapi',
      'strapi-admin',
      'strapi-utils',
      'strapi-plugin-content-type-builder',
      'strapi-plugin-content-manager',
      'strapi-plugin-users-permissions',
      'strapi-plugin-email',
      'strapi-plugin-upload',
    ],
    additionalsDependencies: {},
  };
github txthinking / mr2.js / index.js View on Github external
a.serverDomain = '';
  }
  if (a.server.indexOf('mr2.dev') !== -1) {
    a.serverPort = 0;
  }
  if (a.server.indexOf('mr2.dev') === -1) {
    if (!a.serverPort) {
      a.outputHelp();
      return;
    }
  }
  if (a.server.indexOf('mr2.dev') !== -1) {
    if (!a.serverDomain) {
      var {machineIdSync} = require('node-machine-id');
      var md5 = require('md5');
      a.serverDomain = md5(machineIdSync());
    }
  }
  if (!a.clientServer && !a.clientDirectory) {
    a.outputHelp();
    process.exit(0);
  }

  var bin = 'mr2';
  if (process.platform === 'linux') {
    bin = path.join(__dirname, 'binary/mr2');
  }
  if (process.platform === 'darwin') {
    bin = path.join(__dirname, 'binary/mr2_darwin_amd64');
  }
  if (process.platform === 'windows') {
    bin = path.join(__dirname, 'binary\\mr2_windows_amd64.exe');
github supunlakmal / thismypc / thisMyPCApp / assets / js / home.js View on Github external
const {
    ipcRenderer
} = require('electron');
const os = require('os');
let remote = require('electron').remote;
const fse = require('fs-extra');
let fs = require('fs');
const path = require('path');
/*const splitFile = requi;re('split-file')*/
const ioStream = require('socket.io-stream');
const $ = window.jQuery = require("jquery");
let hddSpace = require('hdd-space');
const {machineId, machineIdSync} = require('node-machine-id');
var FileAPI = require('file-api'), File = FileAPI.File, FileList = FileAPI.FileList, FileReader = FileAPI.FileReader;
const pcID = machineIdSync({original: true});
const pcID2 = machineIdSync();
//console.log(pcID2);
const pcKey = pcID2 + pcID;
let ioSocketID = '';
let id = '';
let auth = '';
let appKey = '';
let incomingFileInfo;
let incomingFileData;
let bytesReceived;
let downloadInProgress = false;
//folder created    mode
const desiredMode = 0o2775;
const homedir = os.homedir();
let userInfo = {};
let dir = homedir + '\/.thisMyPC';
fs.readFile(dir + '\/thisMyPC.json', 'utf8', function readFileCallback(err, data) {
github supunlakmal / thismypc / thisMyPCApp / assets / js / home.js View on Github external
//var socket = io.connect('http://127.0.0.1:3000');
const {
    ipcRenderer
} = require('electron');
const os = require('os');
let remote = require('electron').remote;
const fse = require('fs-extra');
let fs = require('fs');
const path = require('path');
/*const splitFile = requi;re('split-file')*/
const ioStream = require('socket.io-stream');
const $ = window.jQuery = require("jquery");
let hddSpace = require('hdd-space');
const {machineId, machineIdSync} = require('node-machine-id');
var FileAPI = require('file-api'), File = FileAPI.File, FileList = FileAPI.FileList, FileReader = FileAPI.FileReader;
const pcID = machineIdSync({original: true});
const pcID2 = machineIdSync();
//console.log(pcID2);
const pcKey = pcID2 + pcID;
let ioSocketID = '';
let id = '';
let auth = '';
let appKey = '';
let incomingFileInfo;
let incomingFileData;
let bytesReceived;
let downloadInProgress = false;
//folder created    mode
const desiredMode = 0o2775;
const homedir = os.homedir();
let userInfo = {};
let dir = homedir + '\/.thisMyPC';
github RedpointGames / pkgsign / src / lib / telemetry.ts View on Github external
import { machineIdSync } from 'node-machine-id';
import fetch from 'node-fetch';
import * as path from 'path';
import { readFileSync, writeFileSync } from 'fs';
import * as tmp from 'tmp';
import * as spawn from 'silent-spawn';

const enableTelemetry = process.env.DISABLE_PKGSIGN_TELEMETRY !== "true";
const currentMachineId = machineIdSync();
const pkgsignVersion = JSON.parse(readFileSync(path.join(__dirname, '../../package.json'), 'utf8')).version;

export interface TelemetryData {
  action: string;
  packageName: string;
  packageVersion: string;
  packageIsSigned: boolean;
  signingIdentity: string;
  identityIsTrusted: boolean;
}

let telemetryCache = [];

export async function queueTelemetry(data: TelemetryData) {
  if (enableTelemetry) {
    telemetryCache.push({
github strapi / strapi / packages / strapi / lib / commands / new.js View on Github external
const logError = error => {
  fetch('https://analytics.strapi.io/track', {
    method: 'POST',
    body: JSON.stringify({
      event: 'didNotStartAutomatically',
      deviceId: machineIdSync(),
      properties: {
        error,
        os: os.type(),
      },
    }),
    headers: { 'Content-Type': 'application/json' },
  }).catch(() => {});
};
github olymp / olymp / packages / electron / main.es6 View on Github external
Menu,
  app,
  BrowserWindow,
  crashReporter,
  dialog,
  shell,
} = require('electron');
require('electron-debug')({ enabled: true });
const log = require('electron-log');
const { machineIdSync } = require('node-machine-id');
const os = require('os');
const elecApp = require('@electron');

log.transports.file.level = 'info';
global.MACHINE_ID_ORIGINAL = machineIdSync({ original: true });
global.MACHINE_ID = machineIdSync({ original: false });
global.MACHINE_NAME = os.hostname();

if (process.env.CRASHREPORT_URL) {
  crashReporter.start({
    productName: 'App',
    companyName: 'cool.app',
    submitURL: process.env.CRASHREPORT_URL,
    uploadToServer: true,
  });
}

log.transports.file.level = 'info';
log.info('Starting');

const path = require('path');
const url = require('url');
github hello-efficiency-inc / ridereceipts / src / renderer / components / Main.vue View on Github external
checkLicenseKey () {
      const self = this
      const licenseKey = store.get('license_key')
      let machine = machineIdSync({ original: true })
      let machineId = crypto.createHash('sha512').update(machine).digest('hex')
      const testLicenseKey = TEST_LICENSE_KEY
      this.loading = true
      if (licenseKey === testLicenseKey) {
        this.licenseKey = licenseKey
        self.loading = false
      } else {
        request.post(`https://api.gumroad.com/v2/licenses/verify`, {
          form: {
            product_permalink: GUMROAD_PRODUCT_ID,
            increment_uses_count: false,
            license_key: licenseKey
          } }, async function (err, res, body) {
          if (err) {}
          var data = JSON.parse(body)
          if (data.purchase) {

node-machine-id

Unique machine (desktop) id (no admin privileges required).

MIT
Latest version published 5 years ago

Package Health Score

67 / 100
Full package analysis