DonutBot/hashed_profiles.js
ZareMate 24c5debffc feat: implement AFK Bot Control UI and server functionality
- Updated index.html to reflect new title and layout for AFK Bot Control.
- Enhanced styling for better user experience with new color scheme and responsive design.
- Added WebSocket server in server.js to handle communication between browser clients and the parent process.
- Implemented bot management features including start, stop, and chat functionalities.
- Introduced logging mechanism to relay server and bot logs to the UI.
- Exported functions from hashed_profiles.js for better modularity.
- Added ws package to package.json for WebSocket support.
2026-04-02 15:28:41 +02:00

52 lines
1.2 KiB
JavaScript

const crypto = require("crypto");
const fs = require("fs");
// Add all bot usernames here.
const USERNAMES = [
"ZareMate",
"Tomek",
"Cytrus",
"Qawe",
"Bot",
"Skybloczek",
"Bronkol",
];
const homedir = require("os").homedir();
const HASHED_PROFILES_FOLDER = `${homedir}/.minecraft/nmp-cache`;
function createHash(input) {
return crypto
.createHash("sha1")
.update(input ?? "", "binary")
.digest("hex")
.substr(0, 6);
}
function checkIfHashedPresent(username) {
const hash = createHash(username);
const xblPath = `${HASHED_PROFILES_FOLDER}/${hash}_xbl-cache.json`;
const mcaPath = `${HASHED_PROFILES_FOLDER}/${hash}_mca-cache.json`;
const livePath = `${HASHED_PROFILES_FOLDER}/${hash}_live-cache.json`;
const exists =
fs.existsSync(xblPath) || fs.existsSync(mcaPath) || fs.existsSync(livePath);
return { exists, hash };
}
function checkAllHashedProfiles() {
const results = {};
for (const username of USERNAMES) {
const { exists, hash } = checkIfHashedPresent(username);
results[username] = { hash, exists };
}
return results;
}
console.log(checkAllHashedProfiles());
module.exports = {
checkIfHashedPresent,
checkAllHashedProfiles,
};