Skip to content

Commit af07bd3

Browse files
author
Dan Kyung
committed
Lint & fixed sentry directory issues
1 parent 28fb280 commit af07bd3

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

app.js

+13-9
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ const steamId = new SteamId(readline.question('SteamID64: '));
1212
const opt = readline.keyInSelect(['Report', 'Commend']);
1313

1414
let matchId;
15-
if (opt == 0)
15+
if (opt === 0)
1616
matchId = readline.question('Match ID: ');
1717

1818
if (steamId.isValid() && opt >= 0) {
1919
accounts.forEach(account => {
20-
if(!account) {
20+
if (!account) {
2121
return;
2222
}
2323

@@ -29,14 +29,14 @@ if (steamId.isValid() && opt >= 0) {
2929
const param = account.split(':');
3030
let login = {
3131
account_name: param[0],
32-
password: param[1].replace(/[\n\t\r]/g,"")
32+
password: param[1].replace(/[\n\t\r]/g, '')
3333
};
3434

3535
let keepAlive;
36-
fs.access(`/sentry/${param[0]}`, fs.F_OK, err => {
36+
fs.access(`./sentry/${param[0]}`, fs.F_OK, err => {
3737
if (!err) {
3838
console.info(`[${param[0]}] Sentryfile found!`);
39-
login.sha_sentryfile = fs.readFileSync(`/sentry/${param[0]}`);
39+
login.sha_sentryfile = fs.readFileSync(`./sentry/${param[0]}`);
4040
}
4141
});
4242

@@ -86,6 +86,10 @@ if (steamId.isValid() && opt >= 0) {
8686
return shasum.read();
8787
}
8888

89+
if (!fs.existsSync('./sentry')) {
90+
fs.mkdirSync('./sentry');
91+
}
92+
8993
fs.writeFileSync(`./sentry/${param[0]}`, SHA1(data.bytes));
9094
next({sha_file: SHA1(data.bytes)});
9195
});
@@ -95,13 +99,13 @@ if (steamId.isValid() && opt >= 0) {
9599
client.disconnect();
96100
});
97101

98-
gc.on('message', (header, buffer, next) => {
102+
gc.on('message', (header, buffer) => {
99103
switch (header.msg) {
100104
case 4004:
101105
clearInterval(keepAlive);
102-
if (opt == 0) {
106+
if (opt === 0) {
103107
report(gc, steamId, matchId, param[0]);
104-
} else if (opt == 1) {
108+
} else if (opt === 1) {
105109
commend(gc, steamId, param[0]);
106110
} else {
107111
console.error('idk');
@@ -134,7 +138,7 @@ function report(gc, sid, matchid, user) {
134138
let accountId = sid.accountid;
135139
if (matchid === null)
136140
matchid = 8;
137-
141+
138142
gc.send({
139143
msg: Protos.ECsgoGCMsg.k_EMsgGCCStrike15_v2_ClientReportPlayer,
140144
proto: {}

0 commit comments

Comments
 (0)