Files
grepo-remote/GrepoRemoteLoader.user.js

52 lines
1.9 KiB
JavaScript

// ==UserScript==
// @name Grepolis Remote Loader
// @namespace http://tampermonkey.net/
// @version 4.0.0
// @description Dynamically loads the Grepolis Remote Control bot from the server
// @author Dimitrios
// @match https://*.grepolis.com/game/*
// @grant unsafeWindow
// @grant GM_xmlhttpRequest
// @connect grepo.haunter-pets.top
// @updateURL https://git.haunter-pets.top/haunter/grepo-remote/raw/branch/main/GrepoRemoteLoader.user.js
// @downloadURL https://git.haunter-pets.top/haunter/grepo-remote/raw/branch/main/GrepoRemoteLoader.user.js
// ==/UserScript==
(function() {
'use strict';
// Set to your VPS domain
const BASE_URL = 'https://grepo.haunter-pets.top';
function loadBot() {
console.log('[Loader] Fetching bot code from server...');
GM_xmlhttpRequest({
method: 'GET',
url: `${BASE_URL}/api/bot?t=${Date.now()}`,
onload: function(response) {
if (response.status === 200) {
console.log('[Loader] Bot code downloaded successfully! Executing...');
try {
eval(response.responseText);
} catch (e) {
console.error('[Loader] Error executing bot code:', e);
}
} else {
console.error('[Loader] Failed to download bot. Server returned:', response.status);
}
},
onerror: function(err) {
console.error('[Loader] Connection error while trying to reach the server.', err);
}
});
}
// Wait for page to be ready before loading the heavy bot logic
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', loadBot);
} else {
loadBot();
}
})();