🆙 Bump renderer to V8.18.1 and replace clientjs with a better solution

This commit is contained in:
duckietm
2026-04-28 09:14:49 +02:00
parent 455b75e41d
commit d34f82c716
4 changed files with 499 additions and 578 deletions
+2 -2
View File
@@ -30,12 +30,12 @@
}, },
"main": "./index", "main": "./index",
"dependencies": { "dependencies": {
"clientjs": "^0.2.1", "@thumbmarkjs/thumbmarkjs": "^1.8.1",
"gifuct-js": "^2.1.2", "gifuct-js": "^2.1.2",
"howler": "^2.2.4", "howler": "^2.2.4",
"pako": "^2.1.0", "pako": "^2.1.0",
"pixi-filters": "^6.1.5", "pixi-filters": "^6.1.5",
"pixi.js": "^8.17.1" "pixi.js": "^8.18.1"
}, },
"devDependencies": { "devDependencies": {
"@eslint/js": "^9.13.0", "@eslint/js": "^9.13.0",
+2 -1
View File
@@ -11,7 +11,8 @@
"dependencies": { "dependencies": {
"@nitrots/api": "1.0.0", "@nitrots/api": "1.0.0",
"@nitrots/events": "1.0.0", "@nitrots/events": "1.0.0",
"@nitrots/utils": "1.0.0" "@nitrots/utils": "1.0.0",
"@thumbmarkjs/thumbmarkjs": "^1.8.1"
}, },
"devDependencies": { "devDependencies": {
"typescript": "~5.8.2" "typescript": "~5.8.2"
@@ -5,7 +5,7 @@ import { GetTickerTime, NitroLogger } from '@nitrots/utils';
import { NitroMessages } from './NitroMessages'; import { NitroMessages } from './NitroMessages';
import { SocketConnection } from './SocketConnection'; import { SocketConnection } from './SocketConnection';
import { AuthenticatedEvent, ClientHelloMessageComposer, ClientPingEvent, InfoRetrieveMessageComposer, PongMessageComposer, SSOTicketMessageComposer, UniqueIDMessageComposer } from './messages'; import { AuthenticatedEvent, ClientHelloMessageComposer, ClientPingEvent, InfoRetrieveMessageComposer, PongMessageComposer, SSOTicketMessageComposer, UniqueIDMessageComposer } from './messages';
import { ClientJS } from 'clientjs'; import { Thumbmark } from '@thumbmarkjs/thumbmarkjs';
export class CommunicationManager implements ICommunicationManager export class CommunicationManager implements ICommunicationManager
{ {
@@ -19,84 +19,34 @@ export class CommunicationManager implements ICommunicationManager
private _socketErrorCallback: () => void = null; private _socketErrorCallback: () => void = null;
private _socketReconnectedCallback: () => void = null; private _socketReconnectedCallback: () => void = null;
private _machineId: string = null; private _machineIdPromise: Promise<string> = null;
private _initResolved: boolean = false; private _initResolved: boolean = false;
private getGpu(): string { private async generateMachineID(): Promise<string>
const e = document.createElement('canvas');
let t, s, i, r;
try {
if (
((t = e.getContext('webgl') || e.getContext('experimental-webgl')), (s = t.getExtension('WEBGL_debug_renderer_info')), null === t || null === s))
return '';
} catch (n) {
return '';
}
return ((i = t.getParameter(s.UNMASKED_VENDOR_WEBGL)), (r = t.getParameter(s.UNMASKED_RENDERER_WEBGL)), i + '|' + r);
}
private getMathResult(): string {
let e, t;
(e = '<mathroutines>Error</mathroutines>'), (t = '');
try {
return (
(t ='<mathroutines>' + (Math.exp(10) + 1 / Math.exp(10)) / 2 + '|' + Math.tan(-1e300) + '</mathroutines>'), t);
} catch (s) {
return '<mathroutines>Error</mathroutines>';
}
}
private getCanvas(): any {
const e = document.createElement('canvas'), t = e.getContext('2d'), userAgent = navigator.userAgent, screenInfo = '${window.screen.width}x${window.screen.height}', currentDate = new Date().toString(), s = 'ThiosIsVerrySeCuRe02938883721moreStuff! | ${userAgent} | ${screenInfo} | ${currentDate}';
t.textBaseline = 'top';
t.font = "16px 'Arial'";
t.textBaseline = 'alphabetic';
t.rotate(0.05);
t.fillStyle = '#f60';
t.fillRect(125, 1, 62, 20);
t.fillStyle = '#069';
t.fillText(s, 2, 15);
t.fillStyle = 'rgba(102, 200, 0, 0.7)';
t.fillText(s, 4, 17);
t.shadowBlur = 10;
t.shadowColor = 'blue';
t.fillRect(-20, 10, 234, 5);
const i = e.toDataURL();
e.width = 0;
e.height = 0;
let r = 0;
if (i.length === 0) return 'nothing!';
for (let n = 0; n < i.length; n++) {
r = (r << 5) - r + i.charCodeAt(n);
r &= r;
}
return r;
}
private generateMachineID(): string {
const fp = new ClientJS();
const uniqueId = fp.getCustomFingerprint(
fp.getAvailableResolution(),
fp.getOS(),
fp.getCPU(),
fp.getColorDepth(),
this.getGpu(),
fp.getSilverlightVersion(),
fp.getOSVersion(),
this.getMathResult(),
fp.getCanvasPrint(),
this.getCanvas()
);
return uniqueId == null ? 'FAILED' : `IID-${uniqueId}`;
}
private sendHandshake(): void
{ {
if(!this._machineId) this._machineId = this.generateMachineID(); try
{
const result = await new Thumbmark().get();
return result.thumbmark ? `IID-${result.thumbmark}` : 'FAILED';
}
catch(error)
{
NitroLogger.warn('[CommunicationManager] Failed to generate machine ID', error);
return 'FAILED';
}
}
private async sendHandshake(): Promise<void>
{
if(!this._machineIdPromise) this._machineIdPromise = this.generateMachineID();
const machineId = await this._machineIdPromise;
this._connection.send(new ClientHelloMessageComposer(null, null, null, null)); this._connection.send(new ClientHelloMessageComposer(null, null, null, null));
this._connection.send(new SSOTicketMessageComposer(GetConfiguration().getValue('sso.ticket', null), GetTickerTime())); this._connection.send(new SSOTicketMessageComposer(GetConfiguration().getValue('sso.ticket', null), GetTickerTime()));
this._connection.send(new UniqueIDMessageComposer(this._machineId, '', '')); this._connection.send(new UniqueIDMessageComposer(machineId, '', ''));
} }
constructor() constructor()
@@ -120,7 +70,7 @@ export class CommunicationManager implements ICommunicationManager
if(GetConfiguration().getValue<boolean>('system.pong.manually', false)) this.startPong(); if(GetConfiguration().getValue<boolean>('system.pong.manually', false)) this.startPong();
this.sendHandshake(); void this.sendHandshake();
}; };
GetEventDispatcher().addEventListener(NitroEventType.SOCKET_RECONNECTED, this._socketReconnectedCallback); GetEventDispatcher().addEventListener(NitroEventType.SOCKET_RECONNECTED, this._socketReconnectedCallback);
@@ -131,7 +81,7 @@ export class CommunicationManager implements ICommunicationManager
{ {
if(GetConfiguration().getValue<boolean>('system.pong.manually', false)) this.startPong(); if(GetConfiguration().getValue<boolean>('system.pong.manually', false)) this.startPong();
this.sendHandshake(); void this.sendHandshake();
}; };
GetEventDispatcher().addEventListener(NitroEventType.SOCKET_OPENED, this._socketOpenedCallback); GetEventDispatcher().addEventListener(NitroEventType.SOCKET_OPENED, this._socketOpenedCallback);
+470 -500
View File
File diff suppressed because it is too large Load Diff