You've already forked Nitro_Render_V3
mirror of
https://github.com/duckietm/Nitro_Render_V3.git
synced 2026-06-19 15:06:20 +00:00
+2
-2
@@ -30,12 +30,12 @@
|
||||
},
|
||||
"main": "./index",
|
||||
"dependencies": {
|
||||
"clientjs": "^0.2.1",
|
||||
"@thumbmarkjs/thumbmarkjs": "^1.8.1",
|
||||
"gifuct-js": "^2.1.2",
|
||||
"howler": "^2.2.4",
|
||||
"pako": "^2.1.0",
|
||||
"pixi-filters": "^6.1.5",
|
||||
"pixi.js": "^8.17.1"
|
||||
"pixi.js": "^8.18.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@eslint/js": "^9.13.0",
|
||||
|
||||
@@ -11,7 +11,8 @@
|
||||
"dependencies": {
|
||||
"@nitrots/api": "1.0.0",
|
||||
"@nitrots/events": "1.0.0",
|
||||
"@nitrots/utils": "1.0.0"
|
||||
"@nitrots/utils": "1.0.0",
|
||||
"@thumbmarkjs/thumbmarkjs": "^1.8.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "~5.8.2"
|
||||
|
||||
@@ -5,7 +5,7 @@ import { GetTickerTime, NitroLogger } from '@nitrots/utils';
|
||||
import { NitroMessages } from './NitroMessages';
|
||||
import { SocketConnection } from './SocketConnection';
|
||||
import { AuthenticatedEvent, ClientHelloMessageComposer, ClientPingEvent, InfoRetrieveMessageComposer, PongMessageComposer, SSOTicketMessageComposer, UniqueIDMessageComposer } from './messages';
|
||||
import { ClientJS } from 'clientjs';
|
||||
import { Thumbmark } from '@thumbmarkjs/thumbmarkjs';
|
||||
|
||||
export class CommunicationManager implements ICommunicationManager
|
||||
{
|
||||
@@ -19,84 +19,34 @@ export class CommunicationManager implements ICommunicationManager
|
||||
private _socketErrorCallback: () => void = null;
|
||||
private _socketReconnectedCallback: () => void = null;
|
||||
|
||||
private _machineId: string = null;
|
||||
private _machineIdPromise: Promise<string> = null;
|
||||
private _initResolved: boolean = false;
|
||||
|
||||
private getGpu(): 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
|
||||
private async generateMachineID(): Promise<string>
|
||||
{
|
||||
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 SSOTicketMessageComposer(GetConfiguration().getValue('sso.ticket', null), GetTickerTime()));
|
||||
this._connection.send(new UniqueIDMessageComposer(this._machineId, '', ''));
|
||||
this._connection.send(new UniqueIDMessageComposer(machineId, '', ''));
|
||||
}
|
||||
|
||||
constructor()
|
||||
@@ -120,7 +70,7 @@ export class CommunicationManager implements ICommunicationManager
|
||||
|
||||
if(GetConfiguration().getValue<boolean>('system.pong.manually', false)) this.startPong();
|
||||
|
||||
this.sendHandshake();
|
||||
void this.sendHandshake();
|
||||
};
|
||||
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();
|
||||
|
||||
this.sendHandshake();
|
||||
void this.sendHandshake();
|
||||
};
|
||||
GetEventDispatcher().addEventListener(NitroEventType.SOCKET_OPENED, this._socketOpenedCallback);
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ export class RoomSessionManager implements IRoomSessionManager, IRoomHandlerList
|
||||
|
||||
public async init(): Promise<void>
|
||||
{
|
||||
console.log('[RoomSessionManager] init() called');
|
||||
this.createHandlers();
|
||||
this.processPendingSession();
|
||||
this.setupReconnectListener();
|
||||
|
||||
Reference in New Issue
Block a user