fix race condition + rewrite injection + update dist

master
Drake 2 years ago
parent b986c20a62
commit 57099156ff

BIN
dist/Demoncord.asar vendored

Binary file not shown.

@ -1,22 +1,26 @@
export default {
timeout: undefined,
noWebpack() {
if (!window.webpackChunkdiscord_app) {
return true
} else if (window.webpackChunkdiscord_app.length < 62) {
} else if (window.webpackChunkdiscord_app?.length < 56) {
return true
}
return false
},
async start() {
const text = await (await fetch("https://git.ruthenic.com/Demon/demoncord-rewrite/raw/branch/master/dist/build.js", {cache: "no-store"})).text()
await this.inject(text);
console.log("Starting attempts to load Demoncord...")
const text = await (await fetch("https://cors.ruthenic.com/https://git.ruthenic.com/Demon/demoncord-rewrite/raw/branch/master/dist/build.js", {cache: "no-store"})).text()
this.timeout = setInterval(() => this.inject(text), 1e3)
},
async inject(code) {
inject(code) {
if (this.noWebpack()) {
return setTimeout(()=>this.inject(code), 1e3)
console.log(`Failed to start Demoncord: ${window.webpackChunkdiscord_app?.length}`)
return
}
console.log("Starting Demoncord!")
eval(code)
clearInterval(this.timeout)
},
stop() {
console.log("Uninjecting is overrated.")

Loading…
Cancel
Save