Major update 2 / login

This commit is contained in:
2026-04-26 16:33:04 +03:00
parent 5bff9a287d
commit e8fd35105f
15 changed files with 999 additions and 96 deletions

View File

@@ -3,9 +3,12 @@
// Runs first; everything here is available to all other modules.
// ================================================================
const uw = typeof unsafeWindow !== 'undefined' ? unsafeWindow : window;
const uw = typeof unsafeWindow !== 'undefined' ? unsafeWindow : window;
const BASE_URL = 'https://grepo.haunter-pets.top';
// Read the clan key injected by the Loader before eval()
const CLAN_KEY = window.__GRC_CLAN_KEY || '';
// Returns a random integer between min and max (inclusive)
function randInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
@@ -29,3 +32,12 @@ function log(msg) {
function sleep(ms) {
return new Promise(r => setTimeout(r, ms));
}
// Wrapper around fetch() that automatically injects the X-Clan-Key header
// on every request. Use this instead of fetch() everywhere in the bot.
function apiFetch(url, options) {
options = options || {};
options.headers = options.headers || {};
options.headers['X-Clan-Key'] = CLAN_KEY;
return fetch(url, options);
}