Skip to content

Instantly share code, notes, and snippets.

@quyendang
Forked from kewldan/sources.js
Last active January 19, 2024 08:25
Show Gist options
  • Save quyendang/7e42b4a4eb9ba9bb1934898cbf0ed881 to your computer and use it in GitHub Desktop.
Save quyendang/7e42b4a4eb9ba9bb1934898cbf0ed881 to your computer and use it in GitHub Desktop.
Notcoin abuse
var countClick = 0;
function STOP() {
clearInterval(window.__interval); // Stop the loop
console.log('STOPPED')
}
function __SEND(endpoint, data) {
return new Promise(accept => {
fetch('https://clicker-api.joincommunity.xyz' + endpoint, { //API endpoint
method: 'POST',
body: JSON.stringify(data),
headers: {
Authorization: 'Bearer ' + JSON.parse(localStorage.getItem('access-token')), // Auth header from localstorage
'Content-Type': 'application/json' // Required header
}
}).then(req => {
req.json().then(res => {
accept(res);
});
});
});
}
function CLICK(count) {
countClick++;
__SEND('/clicker/core/click', { //API endpoint
count, // Click count
hash: window.__ok ? eval(window.__payload.hash.map(t => atob(t)).join("+")) : 0, // Calculated hash
webAppData: window.Telegram.WebApp.initData // Web app data from Telegram SDK
}).then(res => {
if (res.ok) {
window.__payload = res.data[0]; // Save payload
window.__ok = true; // Previous request was OK and i have hash
console.log(`Clicked: ${count}`);
console.log(`Balance: ${window.__payload.balanceCoins}`);
console.log(`Energy left: ${window.__payload.availableCoins}`)
} else {
console.error(res.data);
}
});
if (countClick == 30) {
__SEND('/auth/webapp-session', {
hash: window.__ok ? eval(window.__payload.hash.map(t => atob(t)).join("+")) : 0, // Calculated hash
webAppData: window.Telegram.WebApp.initData // Web app data from Telegram SDK
}).then(res => {
if (res.ok) {
console.log("Refreshed!");
countClick = 0;
} else {
console.error(res.data);
}
});
}
}
function START(count) {
countClick = 0;
window.__interval = setInterval(() => CLICK(count + Math.floor((Math.random() * 2 - 1) * count * 0.1)), 5000); // Start the loop
console.log('STARTED')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment