mirror of
https://github.com/public-transport/db-vendo-client.git
synced 2025-02-23 15:19:35 +02:00
client ID: install-unique -> process-unique
This commit is contained in:
parent
f783ef0793
commit
2e88e964bb
3 changed files with 3 additions and 18 deletions
|
@ -1,6 +0,0 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
const {randomBytes} = require('crypto')
|
||||
|
||||
const id = randomBytes(6).toString('hex')
|
||||
process.stdout.write(JSON.stringify(id) + '\n')
|
|
@ -3,7 +3,7 @@
|
|||
const DEV = process.env.NODE_ENV === 'dev'
|
||||
const DEBUG = process.env.DEBUG === 'hafas-client'
|
||||
|
||||
const {join} = require('path')
|
||||
const {randomBytes} = require('crypto')
|
||||
const createHash = require('create-hash')
|
||||
const captureStackTrace = DEV ? require('capture-stack-trace') : () => {}
|
||||
const {stringify} = require('qs')
|
||||
|
@ -11,15 +11,7 @@ const Promise = require('pinkie-promise')
|
|||
const {fetch} = require('fetch-ponyfill')({Promise})
|
||||
const {byErrorCode} = require('./errors')
|
||||
|
||||
let id
|
||||
try {
|
||||
id = require('../id.json')
|
||||
} catch (err) {
|
||||
const p = join(__dirname, '..', 'id.json')
|
||||
console.error(`Failed to load the install-unique ID from ${p}.`)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
const id = randomBytes(6).toString('hex')
|
||||
const randomizeUserAgent = (userAgent) => {
|
||||
const i = Math.round(Math.random() * userAgent.length)
|
||||
return userAgent.slice(0, i) + id + userAgent.slice(i)
|
||||
|
|
|
@ -64,7 +64,6 @@
|
|||
},
|
||||
"scripts": {
|
||||
"test": "env NODE_ENV=dev node test/index.js",
|
||||
"prepublishOnly": "npm test | tap-spec",
|
||||
"install": "node lib/generate-install-id.js >id.json"
|
||||
"prepublishOnly": "npm test | tap-spec"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue