Skip to content

Commit

Permalink
alt manager captcha + easycss variable fix
Browse files Browse the repository at this point in the history
  • Loading branch information
z3db0y committed Nov 4, 2024
1 parent d0abe81 commit 43c63fd
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
12 changes: 11 additions & 1 deletion src/modules/altmanager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/easycss.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down
6 changes: 4 additions & 2 deletions src/util.ts
Original file line number Diff line number Diff line change
@@ -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);
}
Expand Down

0 comments on commit 43c63fd

Please sign in to comment.