Skip to content

Commit 7828886

Browse files
committed
fix: re-add core retrieval
1 parent 6ed438e commit 7828886

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

kahoot-antibot.user.js

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// @name:ja Kーアンチボット
44
// @namespace http://tampermonkey.net/
55
// @homepage https://theusaf.org
6-
// @version 3.5.2
6+
// @version 3.5.3
77
// @icon https://cdn.discordapp.com/icons/641133408205930506/31c023710d468520708d6defb32a89bc.png
88
// @description Remove all bots from a kahoot game.
99
// @description:es eliminar todos los bots de un Kahoot! juego.
@@ -55,7 +55,7 @@ if (window.localStorage.kahootThemeScript) {
5555
}
5656

5757
let patchMessageCompletion = new Promise(() => {});
58-
const antibotVersion = "3.5.2";
58+
const antibotVersion = "3.5.3";
5959

6060
// Should allow for default behavior and reload page
6161
if (location.pathname.includes("/oauth2/")) {
@@ -125,7 +125,6 @@ const PATCHES = {
125125
* @returns {string}
126126
*/
127127
globalFunctions(code) {
128-
// Access global functions. Also gains direct access to the controllers?
129128
const globalFuncRegex =
130129
/\({[^"`]*?quiz[^"`]*?startQuiz:([$\w]+).*?}\)=>{(?=var)/,
131130
[globalFuncMatch, globalFuncLetter] = code.match(globalFuncRegex);
@@ -160,6 +159,25 @@ const PATCHES = {
160159
})()})`
161160
);
162161
},
162+
/**
163+
* Accesses core data.
164+
*
165+
* @param {string} code The code to patch
166+
* @returns {string}
167+
*/
168+
gameCore(code) {
169+
const coreDataRegex = /([$\w]+)\.game\.core/,
170+
[, coreDataLetter] = code.match(coreDataRegex);
171+
return code.replace(
172+
coreDataRegex,
173+
`(()=>{
174+
if(typeof windw !== "undefined"){
175+
windw.antibotData.kahootInternals.kahootCore = ${coreDataLetter};
176+
}
177+
return ${coreDataLetter}.game.core;
178+
})()`
179+
);
180+
},
163181
/**
164182
* Access game settings
165183
* 3.2.8 --> added back to core data
@@ -247,6 +265,7 @@ function patcher(code, url) {
247265
code = PATCHES.questionTime(code);
248266
code = PATCHES.globalFunctions(code);
249267
code = PATCHES.quizInformation(code);
268+
code = PATCHES.gameCore(code);
250269
code = PATCHES.gameSettingsOld(code);
251270
code = PATCHES.twoFactor(code);
252271
code = patchMainScript(code);

0 commit comments

Comments
 (0)