Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let SteamUser = require('steam-user');
module.exports = SteamUser;
SteamUser.prototype.setWebSocket = function (webSocket) {
this.webSocket = webSocket;
};
/**
* overrides _steamGuardPrompt method to support WebSocket
* @param domain
* @param lastCodeWrong
* @param {steamGuardCallback} callback
*/
SteamUser.prototype._steamGuardPrompt = function (domain, lastCodeWrong, callback) {
if (this.options.promptSteamGuardCode) {
this.authCode = null;
try {
this.webSocket.send(JSON.stringify({action: 'authCode'}));
} catch (err) {
// TODO
}
this.once('inputAuthCode', code => callback(code));
} else {
this.emit('steamGuard', domain, callback, lastCodeWrong);
}
};
/**
* @callback steamGuardCallback
let SteamUser = require('steam-user');
module.exports = SteamUser;
SteamUser.prototype.setWebSocket = function (webSocket) {
this.webSocket = webSocket;
};
/**
* overrides _steamGuardPrompt method to support WebSocket
* @param domain
* @param lastCodeWrong
* @param {steamGuardCallback} callback
*/
SteamUser.prototype._steamGuardPrompt = function (domain, lastCodeWrong, callback) {
if (this.options.promptSteamGuardCode) {
this.authCode = null;
try {
this.webSocket.send(JSON.stringify({action: 'authCode'}));
} catch (err) {
const SteamUser = require('steam-user');
const log = require('lib/logger');
const generateAuthCode = require('utils/generateAuthCode');
const loginAttempts = require('app/login-attempts');
const handlerManager = require('app/handler-manager');
const client = new SteamUser();
const chatMessage = SteamUser.prototype.chatMessage;
let sessionReplaceCount = 0;
setInterval(function () {
sessionReplaceCount = 0;
}, 60 * 1000);
SteamUser.prototype.chatMessage = function (steamID, message) {
chatMessage.call(client, steamID, message);
const steamID64 = typeof steamID === 'string' ? steamID : steamID.getSteamID64();
const friend = require('handler/friends').getFriend(steamID);
if (friend === null) {
log.info('Message sent to ' + steamID64 + ': ' + message);
const generateAuthCode = require('utils/generateAuthCode');
const loginAttempts = require('app/login-attempts');
const handlerManager = require('app/handler-manager');
const client = new SteamUser();
const chatMessage = SteamUser.prototype.chatMessage;
let sessionReplaceCount = 0;
setInterval(function () {
sessionReplaceCount = 0;
}, 60 * 1000);
SteamUser.prototype.chatMessage = function (steamID, message) {
chatMessage.call(client, steamID, message);
const steamID64 = typeof steamID === 'string' ? steamID : steamID.getSteamID64();
const friend = require('handler/friends').getFriend(steamID);
if (friend === null) {
log.info('Message sent to ' + steamID64 + ': ' + message);
} else {
log.info('Message sent to ' + friend.player_name + ' (' + steamID64 + '): ' + message);
}
};
let hasCookies = false;
let consecutiveSteamGuardCodesWrong = 0;