mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-21 02:03:57 +00:00
feat!: big feature changes
BREAKING CHANGES: - Heartbeating removed - `config.consoleLogLevel` -> `config.logLevel` NEW FEATURES: - Training messages - Sequence number system - WebSocket close codes used instead of disconnect packets FIXES: - Improved error handling - Some performance improvements - Made code more clean - Updated dependencies
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { ClientOperation, Operation, ServerOperation } from '../constants/Operation'
|
||||
import { Packet } from '../schemas/Packet'
|
||||
import { ClientOperation, type Operation, ServerOperation } from '../constants/Operation'
|
||||
import type { Packet } from '../schemas/Packet'
|
||||
|
||||
/**
|
||||
* Checks whether a packet is trying to do the given operation
|
||||
@@ -21,7 +21,7 @@ export function isClientPacket(packet: Packet): packet is Packet<ClientOperation
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether this packet is a server packet **(this does NOT validate the data)**
|
||||
* Checks whether this packet is a server packet **(this does NOT validate the data or the sequence number)**
|
||||
* @param packet A packet
|
||||
* @returns Whether this packet is a server packet
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Chalk, supportsColor, supportsColorStderr } from 'chalk'
|
||||
import { console as uncoloredConsole, Tracer, colorConsole } from 'tracer'
|
||||
import { type Tracer, colorConsole, console as uncoloredConsole } from 'tracer'
|
||||
|
||||
const chalk = new Chalk()
|
||||
const DefaultConfig = {
|
||||
@@ -8,19 +8,16 @@ const DefaultConfig = {
|
||||
'{{message}}',
|
||||
{
|
||||
error: `${chalk.bgRedBright.whiteBright(' ERROR ')} {{message}}\n${chalk.gray('{{stack}}')}`,
|
||||
debug: chalk.gray('DEBUG: {{message}}\n{{stack}}'),
|
||||
warn: `${chalk.bgYellowBright.whiteBright(' WARN ')} ${chalk.yellowBright('{{message}}')}\n${chalk.gray(
|
||||
'{{stack}}',
|
||||
)}`,
|
||||
debug: chalk.gray('DEBUG: {{message}}'),
|
||||
warn: `${chalk.bgYellowBright.whiteBright(' WARN ')} ${chalk.yellowBright('{{message}}')}`,
|
||||
info: `${chalk.bgBlueBright.whiteBright(' INFO ')} ${chalk.cyanBright('{{message}}')}`,
|
||||
fatal: `${chalk.bgRedBright.whiteBright(' FATAL ')} ${chalk.redBright('{{message}}')}\n${chalk.white(
|
||||
'{{stack}}',
|
||||
)}`,
|
||||
log: '{{message}}',
|
||||
trace: chalk.gray('[{{timestamp}}] TRACE: {{message}}\n{{stack}}'),
|
||||
},
|
||||
],
|
||||
methods: ['debug', 'trace', 'log', 'info', 'warn', 'error', 'fatal'],
|
||||
methods: ['debug', 'log', 'info', 'warn', 'error', 'fatal'],
|
||||
filters: [],
|
||||
} satisfies Tracer.LoggerConfig
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as BSON from 'bson'
|
||||
import { parse } from 'valibot'
|
||||
import { Operation } from '../constants/index'
|
||||
import { Packet, PacketSchema } from '../schemas/index'
|
||||
import type { Operation } from '../constants'
|
||||
import { type Packet, PacketSchema } from '../schemas'
|
||||
|
||||
/**
|
||||
* Compresses a packet into a buffer
|
||||
|
||||
Reference in New Issue
Block a user