aboutsummaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2021-06-24 16:04:41 -0500
committermat <github@matdoes.dev>2021-06-24 16:04:41 -0500
commitd5445483f1dbbeb4048da5e3ff4a606ce7355bc1 (patch)
tree9b8f64bcf2902c6b64028b04b2c32a2c728eaba2 /build
parent84291991d685dbc83942f226406cf7c09a700189 (diff)
downloadskyblock-api-d5445483f1dbbeb4048da5e3ff4a606ce7355bc1.tar.gz
skyblock-api-d5445483f1dbbeb4048da5e3ff4a606ce7355bc1.tar.bz2
skyblock-api-d5445483f1dbbeb4048da5e3ff4a606ce7355bc1.zip
log api keys
Diffstat (limited to 'build')
-rw-r--r--build/hypixelApi.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/build/hypixelApi.js b/build/hypixelApi.js
index 5009506..d6ad066 100644
--- a/build/hypixelApi.js
+++ b/build/hypixelApi.js
@@ -20,6 +20,7 @@ const httpsAgent = new https_1.Agent({
});
/** This array should only ever contain one item because using multiple hypixel api keys isn't allowed :) */
const apiKeys = (_c = (_b = (_a = process.env) === null || _a === void 0 ? void 0 : _a.hypixel_keys) === null || _b === void 0 ? void 0 : _b.split(' ')) !== null && _c !== void 0 ? _c : [];
+console.log(apiKeys);
const apiKeyUsage = {};
const baseHypixelAPI = 'https://api.hypixel.net';
/** Choose the best current API key */
@@ -27,7 +28,7 @@ function chooseApiKey() {
// find the api key with the lowest amount of uses
let bestKeyUsage = null;
let bestKey = null;
- for (let key of util_1.shuffle(apiKeys)) {
+ for (let key of util_1.shuffle(apiKeys.slice())) {
const keyUsage = apiKeyUsage[key];
// if the key has never been used before, use it
if (!keyUsage)
@@ -70,7 +71,6 @@ async function sendApiRequest({ path, key, args }) {
try {
fetchResponse = await node_fetch_1.default(fetchUrl, { agent: () => httpsAgent });
fetchJsonParsed = await fetchResponse.json();
- console.log('gotten api response', fetchJsonParsed, key);
}
catch {
// if there's an error, wait a second and try again