Function call revert

This commit is contained in:
Abhorrent_Anger 2026-08-19 19:22:40 +03:00
parent 7980319f2d
commit c867d88c65

View File

@ -1,7 +1,7 @@
// ==UserScript==
// @name Mann Co. Store Giveaway Autojoiner
// @namespace http://tampermonkey.net/
// @version 2026-08-24
// @version 2026-08-25
// @description Tries to join giveaways on page load
// @author Abhorrent_Anger
// @include /^https?:\/\/mannco\.store\/giveaways.*?/
@ -23,15 +23,11 @@ waitForKeyElements('.giveaways__content', () => {
if ($(OPEN_GIVEAWAY_SELECTOR).len == 0) {
return true;
}
if (updateTokens() && bearerToken && csrfToken) {
joinGiveaways(bearerToken, csrfToken);
} else {
console.log('Couldn\'t fetch tokens for joining the giveaways!');
}
updateTokensAndJoin();
console.log('Done with giveaway join attempts');
});
function updateTokens() {
function updateTokensAndJoin() {
bearerToken = getTokenFromCookie('auth');
if (bearerToken) {
console.log('Fetched the Bearer token from cookies: ', bearerToken);
@ -42,6 +38,7 @@ function updateTokens() {
csrfToken = getTokenFromCookie('csrf');
if (csrfToken) {
console.log('Fetched the CSRF token from cookies: ', csrfToken)
joinGiveaways(bearerToken, csrfToken);
return true;
}
let xCSRF = new GM_xmlhttpRequest({
@ -59,6 +56,7 @@ function updateTokens() {
return false;
}
console.log('Successfully updated the CSRF token from API: ', csrfToken)
joinGiveaways(bearerToken, csrfToken);
return true;
} else {
console.log('Couldn\'t get a CSRF token!')
@ -103,6 +101,9 @@ function getCookie(name) {
function getTokenFromCookie(tokenName) {
let cookieArray = getCookie(tokenName);
if (cookieArray == undefined) {
return false;
}
let decodedTokenArray = decodeURIComponent(cookieArray);
if (typeof decodedTokenArray !== 'string' || !decodedTokenArray || decodedTokenArray == undefined) {