Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (this._logOnDetails.login_key) {
// Steam doesn't send a new loginkey all the time if you're using a persistent one (remember password). Let's manually emit it on a timer to handle any edge cases.
this._loginKeyTimer = setTimeout(() => {
this.emit('loginKey', this._logOnDetails.login_key);
}, 5000);
}
this._saveFile('cellid-' + Helpers.getInternalMachineID() + '.txt', body.cell_id);
let parental = body.parental_settings ? Messages.decodeProto(Schema.ParentalSettings, body.parental_settings) : null;
if (parental && parental.salt && parental.passwordhash) {
let sid = new SteamID();
sid.universe = this.steamID.universe;
sid.type = SteamID.Type.INDIVIDUAL;
sid.instance = SteamID.Instance.DESKTOP;
sid.accountid = parental.steamid.low;
parental.steamid = sid;
}
if (!this.steamID && body.client_supplied_steamid) {
// This should ordinarily not happen. this.steamID is supposed to be set in messages.js according to
// the SteamID in the message header. But apparently, sometimes Steam doesn't set that SteamID
// appropriately in the log on response message. ¯\_(ツ)_/¯
this.steamID = new SteamID(body.client_supplied_steamid);
}
this.emit('loggedOn', body, parental);
this.emit('contentServersReady');
this._getChangelistUpdate();
var users = $item.find('.whiteLink[data-miniprofile]');
var sid;
if(users[0]) {
sid = new SteamID();
sid.universe = SteamID.Universe.PUBLIC;
sid.type = SteamID.Type.INDIVIDUAL;
sid.instance = SteamID.Instance.DESKTOP;
sid.accountid = $(users[0]).data('miniprofile');
data.user = sid;
}
if(users[1]) {
sid = new SteamID();
sid.universe = SteamID.Universe.PUBLIC;
sid.type = SteamID.Type.INDIVIDUAL;
sid.instance = SteamID.Instance.DESKTOP;
sid.accountid = $(users[1]).data('miniprofile');
data.actor = sid;
}
// Figure out the date. Of course there's no year, because Valve
var dateParts = $item.find('.historyDate').text().split('@');
var date = dateParts[0].trim().replace(/(st|nd|th)$/, '').trim() + ', ' + currentYear;
var time = dateParts[1].trim().replace(/(am|pm)/, ' $1');
date = new Date(date + ' ' + time + ' UTC');
// If this date is in the future, or it's later than the previous one, decrement the year
if(date.getTime() > lastDate) {
date.setFullYear(date.getFullYear() - 1);
}
this._logOnDetails.machine_id = this._getMachineID(machineID);
}
// Do the login
if (this._logOnDetails._steamid) {
let sid = this._logOnDetails._steamid;
if (typeof sid == 'string') {
sid = new SteamID(sid);
}
this._tempSteamID = sid;
} else {
let sid = new SteamID();
sid.universe = SteamID.Universe.PUBLIC;
sid.type = anonLogin ? SteamID.Type.ANON_USER : SteamID.Type.INDIVIDUAL;
sid.instance = anonLogin ? SteamID.Instance.ALL : SteamID.Instance.DESKTOP;
sid.accountid = 0;
this._tempSteamID = sid;
}
if (anonLogin && this._logOnDetails.password) {
process.stderr.write("[steam-user] Warning: Logging into anonymous Steam account but a password was specified... did you specify your accountName improperly?\n");
}
this._doConnection();
});
};
return StdLib.Promises.callbackPromise(null, callback, (resolve, reject) => {
clanSteamID = Helpers.steamID(clanSteamID);
if (clanSteamID.type != SteamID.Type.CLAN) {
return reject(new Error("SteamID is not for a clan"));
}
// just set these to what they should be
clanSteamID.universe = SteamID.Universe.PUBLIC;
clanSteamID.instance = SteamID.Instance.ALL;
this.user._sendUnified("ClanChatRooms.GetClanChatRoomInfo#1", {
"steamid": clanSteamID.toString(),
"autocreate": true
}, (body, hdr) => {
if (hdr.proto.eresult == EResult.Busy) {
// Why "Busy"? Because Valve.
let err = new Error("Invalid clan ID");
err.eresult = hdr.proto.eresult;
return reject(err);
}
let err = Helpers.eresultError(hdr.proto);
if (err) {
return reject(err);
}
this.emit('offlineMessages', body.offline_messages, (body.friends_with_offline_messages || []).map(function(accountid) {
var sid = new SteamID();
sid.universe = self.steamID.universe;
sid.type = SteamID.Type.INDIVIDUAL;
sid.instance = SteamID.Instance.DESKTOP;
sid.accountid = accountid;
return sid.toString();
}));
};
(body.messages || []).forEach(function(message) {
var sender = new SteamID();
sender.universe = SteamID.Universe.PUBLIC;
sender.type = SteamID.Type.INDIVIDUAL;
sender.instance = SteamID.Instance.DESKTOP;
sender.accountid = message.accountid_from;
switch(message.type) {
case 'personastate':
self._chatUpdatePersona(sender);
break;
case 'saytext':
self.emit('chatMessage', sender, message.text);
break;
case 'typing':
self.emit('chatTyping', sender);
break;
default:
GlobalOffensive.prototype.requestPlayersProfile = function(steamid, callback) {
if (typeof steamid == 'string') {
steamid = new SteamID(steamid);
}
if (!steamid.isValid() || steamid.universe != SteamID.Universe.PUBLIC || steamid.type != SteamID.Type.INDIVIDUAL || steamid.instance != SteamID.Instance.DESKTOP) {
return false;
}
this._send(Language.ClientRequestPlayersProfile, Protos.CMsgGCCStrike15_v2_ClientRequestPlayersProfile, {
account_id: steamid.accountid,
request_level: 32
});
if (callback) {
this.once('playersProfile#' + steamid.getSteamID64(), callback);
}
};
if (ticket.authTicket) {
authTicket = ticket.authTicket;
} else {
ticket = SteamUser.parseAppTicket(ticket);
if (!ticket) {
return reject(new Error("Ticket " + idx + " is invalid"));
}
authTicket = ticket.authTicket;
}
let sid = new SteamID();
sid.universe = this.steamID.universe;
sid.type = SteamID.Type.INDIVIDUAL;
sid.instance = SteamID.Instance.DESKTOP;
sid.accountid = authTicket.readUInt32LE(12);
sid = sid.getSteamID64();
let isOurTicket = (sid == this.steamID.getSteamID64());
obj.tickets.push({
"estate": isOurTicket ? 0 : 1,
"steamid": isOurTicket ? 0 : sid,
"gameid": appid,
"h_steam_pipe": this._hSteamPipe,
"ticket_crc": CRC32.unsigned(authTicket),
"ticket": authTicket
});
obj.app_ids.push(appid);
});
this._send(SteamUser.EMsg.ClientFSGetFriendsSteamLevels, {"accountids": accountids}, (body) => {
let output = {};
let sid = new SteamID();
sid.universe = SteamID.Universe.PUBLIC;
sid.type = SteamID.Type.INDIVIDUAL;
sid.instance = SteamID.Instance.DESKTOP;
(body.friends || []).forEach((user) => {
sid.accountid = user.accountid;
output[sid.getSteamID64()] = user.level;
});
accept({"users": output});
});
});