Site update changes

This commit is contained in:
Abhorrent_Anger 2026-08-16 20:29:25 +03:00
parent 4dc49f6e43
commit 48a40b8058

View File

@ -1,12 +1,12 @@
// ==UserScript== // ==UserScript==
// @name Mann Co. Store Giveaway Autojoiner // @name Mann Co. Store Giveaway Autojoiner
// @namespace https://pube.tk // @namespace http://tampermonkey.net/
// @version 2025-02-15 // @version 2026-08-16
// @description Tries to join giveaways on page load // @description Tries to join giveaways on page load
// @author Abhorrent_Anger // @author Abhorrent_Anger
// @include /^https?:\/\/mannco\.store\/giveaways.?$/ // @include /^https?:\/\/mannco\.store\/giveaways.?$/
// @icon https://www.google.com/s2/favicons?sz=64&domain=mannco.store // @icon https://www.google.com/s2/favicons?sz=64&domain=mannco.store
// @grant none // @grant GM_xmlhttpRequest
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js // @require https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js
// @require https://cdn.jsdelivr.net/gh/CoeJoder/waitForKeyElements.js@v1.3/waitForKeyElements.js // @require https://cdn.jsdelivr.net/gh/CoeJoder/waitForKeyElements.js@v1.3/waitForKeyElements.js
// @run-at document-end // @run-at document-end
@ -14,22 +14,39 @@
setTimeout(function () { location.reload(); }, 90 * 60 * 1000); setTimeout(function () { location.reload(); }, 90 * 60 * 1000);
waitForKeyElements('a.raffle-list__item.list-group-item.list-group-item-action.raffleitem.isv.first', () => { waitForKeyElements('.giveaways__content', () => {
setTimeout(function () { setTimeout(function () {
$('span[data-bs-title="Joined"][style*="display: none"]').each(function () { $('.giveaways-list-item:not(.giveaways-list-item--joined)').each(function () {
let raffle = $(this).attr('url'); let giveawayURL = $(this).attr('href');
let raffleJoinURL = 'https://mannco.store/requests/raffle.php?mode=join&url=' + raffle; let giveaway = /[^/]*$/.exec(giveawayURL)[0];
$.ajax({ let giveawayJoinURL = 'https://api.mannco.store/giveaways/join/' + giveaway;
method: "GET",
xhrFields: { let bearerToken = getToken('auth');
withCredentials: true let csrfToken = getToken('csrf');
},
url: raffleJoinURL, let xJoin = new GM_xmlhttpRequest({
success: function (data) { method: 'POST',
console.log('Tried to join ' + raffle + ' raffle, output: ' + data); url: giveawayJoinURL,
headers: { 'Authorization': 'Bearer ' + bearerToken, 'X-Csrf-Token': csrfToken },
onreadystatechange: function (response) {
if (response.readyState == 4 && response.status == 200) {
console.log('Successfully joined ' + giveaway, response.response);
} else {
console.log("Couldn't join " + giveaway, response);
}
} }
}); });
}); });
console.log('Done with raffle join attempts'); console.log('Done with giveaway join attempts');
}, 2000); }, 2000);
}); });
const getCookieValue = (name) => (
document.cookie.match('(^|;)\\s*' + name + '\\s*=\\s*([^;]+)')?.pop() || ''
)
function getToken(tokenName) {
let authArray = getCookieValue(tokenName);
let decodedAuthArray = decodeURIComponent(authArray);
return JSON.parse(decodedAuthArray)['token'];
}