Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function getUserAgent() {
try {
return `Node.js/${process.version.substr(1)} (${osName()}; ${process.arch})`;
}
catch (error) {
if (/wmic os get Caption/.test(error.message)) {
return "Windows ";
}
throw error;
}
}
export function getUserAgent() {
try {
return `Node.js/${process.version.substr(1)} (${osName()}; ${process.arch})`;
}
catch (error) {
if (/wmic os get Caption/.test(error.message)) {
return "Windows ";
}
return "";
}
}
export function getUserAgent() {
try {
return `Node.js/${process.version.substr(1)} (${osName()}; ${process.arch})`;
}
catch (error) {
if (/wmic os get Caption/.test(error.message)) {
return "Windows ";
}
throw error;
}
}
async _createToken(callback) {
this.props.displayLoader()
let tokenReqBody = {}
if (this._inputs.dntm.checked === true) {
tokenReqBody = {
locale: remote.app.getLocale(),
os: osName()
}
if (os.platform() === 'linux') {
const os = await promisify(getos)()
tokenReqBody = { ...tokenReqBody, os: `${os.dist} ${os.release}` }
}
} else {
this.props.dntm()
tokenReqBody = {
dntm: true
}
}
const res = await fetch('http://alduin.stouder.io:4000/api/token', {
method: 'POST',
mode: 'cors',
return new Promise((resolve, reject) => {
var qs = querystring.stringify({userId: pingData.id, os: osName(), beakerVersion: app.getVersion()})
debug('Sending ping to %s: %s', ANALYTICS_SERVER, qs)
var req = https.request({
method: 'POST',
hostname: ANALYTICS_SERVER,
path: '/ping?' + qs
}, (res) => {
if (res.statusCode === 204) {
debug('Ping succeeded')
resolve()
} else {
res.setEncoding('utf8')
res.pipe(concat(body => debug('Ping failed', res.statusCode, body)))
reject()
}
})