From 43c63fdd2ffd590d10141bfced45047dbba1c1b5 Mon Sep 17 00:00:00 2001 From: z3db0y Date: Mon, 4 Nov 2024 19:44:01 +0200 Subject: [PATCH] alt manager captcha + easycss variable fix --- package.json | 2 +- src/modules/altmanager.ts | 12 +++++++++++- src/modules/easycss.ts | 2 +- src/util.ts | 6 ++++-- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 056abcb..72e42ac 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rays_nova", - "version": "3.0.0-alpha.7", + "version": "3.0.0-alpha.8", "main": "js/launch.js", "devDependencies": { "@types/node": "^20.10.7", diff --git a/src/modules/altmanager.ts b/src/modules/altmanager.ts index 94d2b7c..3b6e7f4 100644 --- a/src/modules/altmanager.ts +++ b/src/modules/altmanager.ts @@ -4,6 +4,7 @@ import UI from '../ui'; import AltManagerUI from '../ui/altmanager'; import Button from '../options/button'; import TextInput from '../options/textinput'; +import { waitFor } from '../util'; let encryptionKey = 'a5de16da0bb09720a7a917736c3be0beddc4418816c5f469a31419f1f6d5e592'; @@ -167,7 +168,16 @@ export default class AltManager extends Module { (usernameInput as HTMLInputElement).value = alt.username; (passwordInput as HTMLInputElement).value = encrypt(alt.password); - setTimeout(() => window.loginAcc(), 100); + setTimeout(async () => { + window.loginAcc(); + + let captcha = await waitFor( + () => document.getElementById('altcha_checkbox'), + 1000 + ) as HTMLElement | undefined; + + if (captcha) captcha.click(); + }, 100); } editAlt(username?: string) { diff --git a/src/modules/easycss.ts b/src/modules/easycss.ts index f7768a2..469ef7f 100644 --- a/src/modules/easycss.ts +++ b/src/modules/easycss.ts @@ -144,7 +144,7 @@ export default class EasyCSS extends Module { if(!css || !css.name || !css.path || !existsSync(css.path)) return; this.element.onload = () => { - this.applyVariables.bind(this); + this.applyVariables(); this.lastChange = Date.now(); this.watcher = watch(css.path, (event) => { diff --git a/src/util.ts b/src/util.ts index 51d096a..b7072af 100644 --- a/src/util.ts +++ b/src/util.ts @@ -1,8 +1,10 @@ -export function waitFor(func: Function) { +export function waitFor(func: Function, maxTime?: number) { return new Promise(resolve => { + let start = Date.now(); + let interval = setInterval(() => { let r = func(); - if(r) { + if(r || (maxTime && Date.now() - start > maxTime)) { clearInterval(interval); resolve(r); }