🔊 opcode logger

This commit is contained in:
Flam3rboy 2021-08-18 11:56:30 +02:00
parent 0721484a93
commit 9d305c335b
2 changed files with 8 additions and 5 deletions

View File

@ -29,17 +29,20 @@
NETWORKING_ENDPOINT: "//router.discordapp.net", NETWORKING_ENDPOINT: "//router.discordapp.net",
RTC_LATENCY_ENDPOINT: "//latency.discord.media/rtc", RTC_LATENCY_ENDPOINT: "//latency.discord.media/rtc",
PROJECT_ENV: "production", PROJECT_ENV: "production",
REMOTE_AUTH_ENDPOINT: "//remote-auth-gateway.discord.gg", REMOTE_AUTH_ENDPOINT: "//localhost:3020",
SENTRY_TAGS: { buildId: "75e36d9", buildType: "normal" }, SENTRY_TAGS: { buildId: "75e36d9", buildType: "normal" },
MIGRATION_SOURCE_ORIGIN: "https://discordapp.com", MIGRATION_SOURCE_ORIGIN: "https://discordapp.com",
MIGRATION_DESTINATION_ORIGIN: "https://discord.com", MIGRATION_DESTINATION_ORIGIN: "https://discord.com",
HTML_TIMESTAMP: Date.now(), HTML_TIMESTAMP: Date.now(),
ALGOLIA_KEY: "aca0d7082e4e63af5ba5917d5e96bed0" ALGOLIA_KEY: "aca0d7082e4e63af5ba5917d5e96bed0"
}; };
// TODO: remote auth
// window.GLOBAL_ENV.REMOTE_AUTH_ENDPOINT = window.GLOBAL_ENV.GATEWAY_ENDPOINT.replace(/wss?:/, "");
localStorage.removeItem("gatewayURL"); localStorage.removeItem("gatewayURL");
localStorage.setItem( localStorage.setItem(
"DeveloperOptionsStore", "DeveloperOptionsStore",
`{"trace":false,"canary":false,"logGatewayEvents":true,"logOverlayEvents":false,"logAnalyticsEvents":false,"sourceMapsEnabled":false,"axeEnabled":false}` `{"trace":false,"canary":false,"logGatewayEvents":true,"logOverlayEvents":true,"logAnalyticsEvents":true,"sourceMapsEnabled":false,"axeEnabled":false}`
); );
</script> </script>
<script src="/assets/042023d8ee73c0c3fd74.js"></script> <script src="/assets/042023d8ee73c0c3fd74.js"></script>

View File

@ -4,7 +4,7 @@ try {
erlpack = require("erlpack"); erlpack = require("erlpack");
} catch (error) {} } catch (error) {}
import OPCodeHandlers from "../opcodes"; import OPCodeHandlers from "../opcodes";
import { Payload, CLOSECODES } from "../util/Constants"; import { Payload, CLOSECODES, OPCODES } from "../util/Constants";
import { instanceOf, Tuple } from "lambert-server"; import { instanceOf, Tuple } from "lambert-server";
import { check } from "../opcodes/instanceOf"; import { check } from "../opcodes/instanceOf";
import WS from "ws"; import WS from "ws";
@ -29,13 +29,13 @@ export async function Message(this: WebSocket, buffer: WS.Data) {
// @ts-ignore // @ts-ignore
const OPCodeHandler = OPCodeHandlers[data.op]; const OPCodeHandler = OPCodeHandlers[data.op];
if (!OPCodeHandler) { if (!OPCodeHandler) {
console.error("Unknown_opcode: " + data.op); console.error("[Gateway] Unkown opcode " + data.op);
// TODO: if all opcodes are implemented comment this out: // TODO: if all opcodes are implemented comment this out:
// this.close(CLOSECODES.Unknown_opcode); // this.close(CLOSECODES.Unknown_opcode);
return; return;
} }
console.log("got: " + OPCodeHandler.name); console.log("[Gateway] Opcode " + OPCODES[data.op]);
try { try {
return await OPCodeHandler.call(this, data); return await OPCodeHandler.call(this, data);