logging
parent
f07d155d96
commit
fb3ec73898
|
@ -57,7 +57,6 @@ export default class CSCLI {
|
||||||
}
|
}
|
||||||
|
|
||||||
public async unixHandle(socket: net.Socket, data: Buffer) {
|
public async unixHandle(socket: net.Socket, data: Buffer) {
|
||||||
console.log(data.toString());
|
|
||||||
const args = data.toString().trim().split('$');
|
const args = data.toString().trim().split('$');
|
||||||
const parsed: { Username: string, Type: string, Message?: string, Data?: any, HMAC: string } = JSON.parse(args[0]);
|
const parsed: { Username: string, Type: string, Message?: string, Data?: any, HMAC: string } = JSON.parse(args[0]);
|
||||||
// FINISH VERIFICATION CHECKS
|
// FINISH VERIFICATION CHECKS
|
||||||
|
@ -81,9 +80,11 @@ export default class CSCLI {
|
||||||
const parsed: { Username: string, Type: string, Message?: string, Data?: any, HMAC: string } = JSON.parse(args[0]);
|
const parsed: { Username: string, Type: string, Message?: string, Data?: any, HMAC: string } = JSON.parse(args[0]);
|
||||||
// FINISH VERIFICATION CHECKS
|
// FINISH VERIFICATION CHECKS
|
||||||
const handler: Handler = this.handlers.get(parsed.Type);
|
const handler: Handler = this.handlers.get(parsed.Type);
|
||||||
|
console.log(handler);
|
||||||
if (!handler) return socket.destroy();
|
if (!handler) return socket.destroy();
|
||||||
|
|
||||||
const context = new Context(socket, args[0], this.client);
|
const context = new Context(socket, args[0], this.client);
|
||||||
|
console.log(context);
|
||||||
await handler.handle(context);
|
await handler.handle(context);
|
||||||
if (!context.socket.destroyed) {
|
if (!context.socket.destroyed) {
|
||||||
socket.destroy();
|
socket.destroy();
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
import { Handler, Context } from '../class';
|
import { Handler, Context } from '../class';
|
||||||
import { dataConversion } from '../functions';
|
import { dataConversion } from '../functions';
|
||||||
|
|
||||||
export default class RAM extends Handler {
|
export default class RAM extends Handler {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
this.endpoint = 'ram';
|
this.endpoint = 'ram';
|
||||||
}
|
}
|
||||||
|
|
||||||
public async handle(ctx: Context) {
|
public async handle(ctx: Context) {
|
||||||
const memoryConversion = dataConversion(Number(await ctx.client.util.exec(`memory ${ctx.data.username}`)) * 1000);
|
console.log('1');
|
||||||
return ctx.send(memoryConversion);
|
const memoryConversion = dataConversion(Number(await ctx.client.util.exec(`memory ${ctx.data.username}`)) * 1000);
|
||||||
}
|
console.log(memoryConversion);
|
||||||
}
|
return ctx.send(memoryConversion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue