diff --git a/ManncoStoreGiveawayAutojoiner.user.js b/ManncoStoreGiveawayAutojoiner.user.js index ffa4fd5..9d65201 100644 --- a/ManncoStoreGiveawayAutojoiner.user.js +++ b/ManncoStoreGiveawayAutojoiner.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Mann Co. Store Giveaway Autojoiner // @namespace http://tampermonkey.net/ -// @version 2026-08-16 +// @version 2026-08-17 // @description Tries to join giveaways on page load // @author Abhorrent_Anger // @include /^https?:\/\/mannco\.store\/giveaways.?$/ @@ -21,8 +21,8 @@ waitForKeyElements('.giveaways__content', () => { let giveaway = /[^/]*$/.exec(giveawayURL)[0]; let giveawayJoinURL = 'https://api.mannco.store/giveaways/join/' + giveaway; - let bearerToken = getToken('auth'); - let csrfToken = getToken('csrf'); + let bearerToken = getTokenFromCookie('auth'); + let csrfToken = getTokenFromCookie('csrf'); let xJoin = new GM_xmlhttpRequest({ method: 'POST', @@ -45,8 +45,12 @@ const getCookieValue = (name) => ( document.cookie.match('(^|;)\\s*' + name + '\\s*=\\s*([^;]+)')?.pop() || '' ) -function getToken(tokenName) { +function getTokenFromCookie(tokenName) { let authArray = getCookieValue(tokenName); let decodedAuthArray = decodeURIComponent(authArray); - return JSON.parse(decodedAuthArray)['token']; + let array = JSON.parse(decodedAuthArray) + if (array.isArray()) { + return array['token']; + } + return false; } \ No newline at end of file