Last active
March 1, 2025 08:28
-
-
Save jkmartindale/c2a2cb83e6a2e889c7e3aa7b37b5fedc to your computer and use it in GitHub Desktop.
Paste this into your browser console to hopefully start earning rewards. Forum thread: https://web.archive.org/web/20230922092451/https%3A%2F%2Fna.alienwarearena.com%2Fucf%2Fshow%2F2167631
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Twitch Quest Fixer v3.1 */ | |
const extensionID = "ehc5ey5g9hoehi8ys54lr6eknomqgr"; | |
const channel = location.pathname.slice(1).toLowerCase(); | |
const channelId = __APOLLO_CLIENT__.cache.data.data.ROOT_QUERY["channel({\"name\":\""+channel+"\"})"].__ref.split(":")[1]; | |
const pollDuration = 60000; | |
let authToken = __APOLLO_CLIENT__.cache.data.data["Channel:" + channelId].selfInstalledExtensions.filter(x => x.helixToken.extensionID == extensionID)[0].token.jwt; | |
grantPermission = async () => { | |
console.log("Attempting to grant permission automatically..."); | |
const integrityResponse = await (await fetch("https://gql.twitch.tv/integrity", { method: "post", headers: commonOptions.headers })).json(); | |
const integrity = integrityResponse.token; | |
const permissionResponse = await (await fetch("https://gql.twitch.tv/gql", { | |
method: "post", | |
headers: { | |
...commonOptions.headers, ...{ | |
"Client-Integrity": integrity | |
} | |
}, | |
body: JSON.stringify([{ | |
"operationName": "LinkUserMutation", | |
"variables": { | |
"channelID": channelId, | |
"extensionID": extensionID, | |
"token": authToken, | |
"showUser": true | |
}, | |
"extensions": { "persistedQuery": { "version": 1, "sha256Hash": "b5dfec96759d42ac5a24f79beec27bcdf90e936e0fac4f727b7ab36dadb6a22a" } } | |
}]) | |
})).json(); | |
console.log(permissionResponse); | |
newAuthToken = permissionResponse[0].data.extensionLinkUser.token.jwt; | |
if (newAuthToken) { | |
authToken = newAuthToken; | |
console.log("Looks like permission was successfully granted. You should see another message saying that you're earning ARP about 60 seconds from now."); | |
}; | |
} | |
handlePolling = () => { | |
fetch("https://alienware.jkmartindale.dev/?url=https://www.alienwarearena.com/twitch/extensions/track", { | |
method: 'GET', | |
headers: { | |
'x-extension-jwt': authToken, | |
'x-extension-channel': channelId | |
} | |
}) | |
.then(response => response.json()) | |
.then(async data => { | |
console.log(data); | |
/* Attempt to authorize extension if not authorized */ | |
if (data.state === "grant_permission") { | |
await grantPermission(); | |
}; | |
}) | |
.catch((err) => { | |
console.log(err); | |
}) | |
.finally(() => { | |
setTimeout(handlePolling, pollDuration); | |
}); | |
}; | |
handlePolling() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uncaught ReferenceError: APOLLO_CLIENT is not defined
at :4:19