dankgrinder 8.343.0 → 8.651.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/grinder.js +15 -15
- package/package.json +1 -1
package/lib/grinder.js
CHANGED
|
@@ -352,7 +352,7 @@ async function sendLog(accountName, command, response, status) {
|
|
|
352
352
|
const safeResponse = stripAnsi(String(response || '')).replace(/\s+/g, ' ').trim();
|
|
353
353
|
await fetch(`${API_URL}/api/grinder/log`, {
|
|
354
354
|
method: 'POST',
|
|
355
|
-
headers: { Authorization: `Bearer ${
|
|
355
|
+
headers: { Authorization: `Bearer ${API_KEY}`, 'Content-Type': 'application/json' },
|
|
356
356
|
body: JSON.stringify({ account_name: accountName, command: safeCommand, response: safeResponse, status }),
|
|
357
357
|
});
|
|
358
358
|
} catch { /* silent */ }
|
|
@@ -366,7 +366,7 @@ const earningsBatch = new AsyncBatchQueue(async (batch) => {
|
|
|
366
366
|
try {
|
|
367
367
|
await fetch(`${API_URL}/api/grinder/earnings-batch`, {
|
|
368
368
|
method: 'POST',
|
|
369
|
-
headers: { Authorization: `Bearer ${
|
|
369
|
+
headers: { Authorization: `Bearer ${API_KEY}`, 'Content-Type': 'application/json' },
|
|
370
370
|
body: JSON.stringify({ items: batch }),
|
|
371
371
|
});
|
|
372
372
|
} catch {
|
|
@@ -375,7 +375,7 @@ const earningsBatch = new AsyncBatchQueue(async (batch) => {
|
|
|
375
375
|
try {
|
|
376
376
|
await fetch(`${API_URL}/api/grinder/earnings`, {
|
|
377
377
|
method: 'POST',
|
|
378
|
-
headers: { Authorization: `Bearer ${
|
|
378
|
+
headers: { Authorization: `Bearer ${API_KEY}`, 'Content-Type': 'application/json' },
|
|
379
379
|
body: JSON.stringify(item),
|
|
380
380
|
});
|
|
381
381
|
} catch {}
|
|
@@ -398,7 +398,7 @@ async function reportCommandFeed(accountId, accountName, data) {
|
|
|
398
398
|
try {
|
|
399
399
|
await fetch(`${API_URL}/api/grinder/command-feed`, {
|
|
400
400
|
method: 'POST',
|
|
401
|
-
headers: { Authorization: `Bearer ${
|
|
401
|
+
headers: { Authorization: `Bearer ${API_KEY}`, 'Content-Type': 'application/json' },
|
|
402
402
|
body: JSON.stringify({ account_id: accountId, account_name: accountName, ...normalized }),
|
|
403
403
|
});
|
|
404
404
|
} catch { /* silent — dashboard just won't see this update */ }
|
|
@@ -964,7 +964,7 @@ class AccountWorker {
|
|
|
964
964
|
try {
|
|
965
965
|
await fetch(`${API_URL}/api/grinder/inventory`, {
|
|
966
966
|
method: 'POST',
|
|
967
|
-
headers: { Authorization: `Bearer ${
|
|
967
|
+
headers: { Authorization: `Bearer ${API_KEY}`, 'Content-Type': 'application/json' },
|
|
968
968
|
body: JSON.stringify({
|
|
969
969
|
account_id: this.account.id,
|
|
970
970
|
items: result.items || [],
|
|
@@ -1028,7 +1028,7 @@ class AccountWorker {
|
|
|
1028
1028
|
try {
|
|
1029
1029
|
await fetch(`${API_URL}/api/grinder/profile`, {
|
|
1030
1030
|
method: 'POST',
|
|
1031
|
-
headers: { Authorization: `Bearer ${
|
|
1031
|
+
headers: { Authorization: `Bearer ${API_KEY}`, 'Content-Type': 'application/json' },
|
|
1032
1032
|
body: JSON.stringify({
|
|
1033
1033
|
account_id: this.account.id,
|
|
1034
1034
|
level: result.level,
|
|
@@ -1203,7 +1203,7 @@ class AccountWorker {
|
|
|
1203
1203
|
try {
|
|
1204
1204
|
await fetch(`${API_URL}/api/grinder/status`, {
|
|
1205
1205
|
method: 'POST',
|
|
1206
|
-
headers: { Authorization: `Bearer ${
|
|
1206
|
+
headers: { Authorization: `Bearer ${API_KEY}`, 'Content-Type': 'application/json' },
|
|
1207
1207
|
body: JSON.stringify({
|
|
1208
1208
|
account_id: this.account.id,
|
|
1209
1209
|
balance: wallet,
|
|
@@ -1530,7 +1530,7 @@ class AccountWorker {
|
|
|
1530
1530
|
try {
|
|
1531
1531
|
await fetch(`${API_URL}/api/grinder/status`, {
|
|
1532
1532
|
method: 'POST',
|
|
1533
|
-
headers: { Authorization: `Bearer ${
|
|
1533
|
+
headers: { Authorization: `Bearer ${API_KEY}`, 'Content-Type': 'application/json' },
|
|
1534
1534
|
body: JSON.stringify({ account_id: this.account.id, active: false, userId: this.account.userId }),
|
|
1535
1535
|
});
|
|
1536
1536
|
} catch {}
|
|
@@ -2954,7 +2954,7 @@ class AccountWorker {
|
|
|
2954
2954
|
try {
|
|
2955
2955
|
await fetch(`${API_URL}/api/grinder/actions`, {
|
|
2956
2956
|
method: 'DELETE',
|
|
2957
|
-
headers: { Authorization: `Bearer ${
|
|
2957
|
+
headers: { Authorization: `Bearer ${API_KEY}`, 'Content-Type': 'application/json' },
|
|
2958
2958
|
body: JSON.stringify({ action_id: action.id }),
|
|
2959
2959
|
});
|
|
2960
2960
|
} catch {}
|
|
@@ -2965,7 +2965,7 @@ class AccountWorker {
|
|
|
2965
2965
|
try {
|
|
2966
2966
|
await fetch(`${API_URL}/api/grinder/actions`, {
|
|
2967
2967
|
method: 'DELETE',
|
|
2968
|
-
headers: { Authorization: `Bearer ${
|
|
2968
|
+
headers: { Authorization: `Bearer ${API_KEY}`, 'Content-Type': 'application/json' },
|
|
2969
2969
|
body: JSON.stringify({ action_id: action.id }),
|
|
2970
2970
|
});
|
|
2971
2971
|
} catch {}
|
|
@@ -2977,7 +2977,7 @@ class AccountWorker {
|
|
|
2977
2977
|
try {
|
|
2978
2978
|
await fetch(`${API_URL}/api/grinder/actions`, {
|
|
2979
2979
|
method: 'DELETE',
|
|
2980
|
-
headers: { Authorization: `Bearer ${
|
|
2980
|
+
headers: { Authorization: `Bearer ${API_KEY}`, 'Content-Type': 'application/json' },
|
|
2981
2981
|
body: JSON.stringify({ action_id: action.id }),
|
|
2982
2982
|
});
|
|
2983
2983
|
} catch {}
|
|
@@ -2988,7 +2988,7 @@ class AccountWorker {
|
|
|
2988
2988
|
try {
|
|
2989
2989
|
await fetch(`${API_URL}/api/grinder/actions`, {
|
|
2990
2990
|
method: 'DELETE',
|
|
2991
|
-
headers: { Authorization: `Bearer ${
|
|
2991
|
+
headers: { Authorization: `Bearer ${API_KEY}`, 'Content-Type': 'application/json' },
|
|
2992
2992
|
body: JSON.stringify({ action_id: action.id }),
|
|
2993
2993
|
});
|
|
2994
2994
|
} catch {}
|
|
@@ -3042,7 +3042,7 @@ class AccountWorker {
|
|
|
3042
3042
|
// Report status non-blocking
|
|
3043
3043
|
fetch(`${API_URL}/api/grinder/status`, {
|
|
3044
3044
|
method: 'POST',
|
|
3045
|
-
headers: { Authorization: `Bearer ${
|
|
3045
|
+
headers: { Authorization: `Bearer ${API_KEY}`, 'Content-Type': 'application/json' },
|
|
3046
3046
|
body: JSON.stringify({ account_id: this.account.id, discord_username: this.username, avatar_url: this.avatarUrl, userId: this.account.userId }),
|
|
3047
3047
|
}).catch(() => {});
|
|
3048
3048
|
|
|
@@ -3121,7 +3121,7 @@ class AccountWorker {
|
|
|
3121
3121
|
// Report invalid status to API
|
|
3122
3122
|
fetch(`${API_URL}/api/grinder/status`, {
|
|
3123
3123
|
method: 'POST',
|
|
3124
|
-
headers: { Authorization: `Bearer ${
|
|
3124
|
+
headers: { Authorization: `Bearer ${API_KEY}`, 'Content-Type': 'application/json' },
|
|
3125
3125
|
body: JSON.stringify({ account_id: this.account.id, active: false, status: 'token_invalid', userId: this.account.userId }),
|
|
3126
3126
|
}).catch(() => {});
|
|
3127
3127
|
sendWebhook('Token Invalid', `**${this.account.label || this.account.id}** has an invalid Discord token.`, 0xef4444);
|
|
@@ -3158,7 +3158,7 @@ class AccountWorker {
|
|
|
3158
3158
|
this.stats.bankBalance = bank;
|
|
3159
3159
|
await fetch(`${API_URL}/api/grinder/status`, {
|
|
3160
3160
|
method: 'POST',
|
|
3161
|
-
headers: { Authorization: `Bearer ${
|
|
3161
|
+
headers: { Authorization: `Bearer ${API_KEY}`, 'Content-Type': 'application/json' },
|
|
3162
3162
|
body: JSON.stringify({ account_id: this.account.id, balance: wallet, bank_balance: bank, total_balance: wallet + bank, userId: this.account.userId }),
|
|
3163
3163
|
}).catch(() => {});
|
|
3164
3164
|
}
|