diff --git a/src/api/Server.ts b/src/api/Server.ts
index a2e63f46..1d9fe2ab 100644
--- a/src/api/Server.ts
+++ b/src/api/Server.ts
@@ -157,14 +157,6 @@ export class SpacebarServer extends Server {
// new well-known location
app.get("/.well-known/spacebar/client", (req, res) => {
- let erlpackSupported = false;
- try {
- require("@yukikaze-bot/erlpack");
- erlpackSupported = true;
- } catch (e) {
- // empty
- }
-
res.json({
api: {
baseUrl: Config.get().api.endpointPublic?.split("/api/")[0],
@@ -178,7 +170,7 @@ export class SpacebarServer extends Server {
},
gateway: {
baseUrl: Config.get().gateway.endpointPublic,
- encoding: [...(erlpackSupported ? ["etf"] : []), "json"],
+ encoding: ["etf", "json"],
compression: ["zstd-stream", "zlib-stream", null],
},
admin:
diff --git a/src/gateway/events/Connection.ts b/src/gateway/events/Connection.ts
index e3e6d2f0..5876c3e1 100644
--- a/src/gateway/events/Connection.ts
+++ b/src/gateway/events/Connection.ts
@@ -27,16 +27,9 @@ import { Close } from "./Close";
import { Message } from "./Message";
import { Deflate, Inflate } from "fast-zlib";
import { URL } from "node:url";
-import { Config, ErlpackType } from "@spacebar/util";
+import { Config } from "@spacebar/util";
import { Decoder, Encoder } from "@toondepauw/node-zstd";
-let erlpack: ErlpackType | null = null;
-try {
- erlpack = require("@yukikaze-bot/erlpack") as ErlpackType;
-} catch (e) {
- console.log("Failed to import @yukikaze-bot/erlpack: ", e);
-}
-
// TODO: check rate limit
// TODO: specify rate limit in config
// TODO: check msg max size
@@ -108,8 +101,6 @@ export async function Connection(this: WS.Server, socket: WebSocket, request: In
return socket.close(CLOSECODES.Decode_error);
}
- if (socket.encoding === "etf" && !erlpack) throw new Error("Erlpack is not installed: 'npm i @yukikaze-bot/erlpack'");
-
socket.version = Number(searchParams.get("version")) || 8;
if (socket.version != 8) {
console.error(`[Gateway/${socket.ipAddress}] Invalid API version: ${socket.version}`);
diff --git a/src/gateway/events/Message.ts b/src/gateway/events/Message.ts
index 043b7376..7a2e49d3 100644
--- a/src/gateway/events/Message.ts
+++ b/src/gateway/events/Message.ts
@@ -17,7 +17,6 @@
*/
import { CLOSECODES, Payload, WebSocket } from "@spacebar/gateway";
-// import { ErlpackType } from "@spacebar/util";
import * as erlpack from "harmony-erlpack";
import fs from "node:fs/promises";
import BigIntJson from "json-bigint";
@@ -29,13 +28,6 @@ import { PayloadSchema } from "@spacebar/schemas";
const bigIntJson = BigIntJson({ storeAsString: true });
-// let erlpack: ErlpackType | null = null;
-// try {
-// erlpack = require("@yukikaze-bot/erlpack") as ErlpackType;
-// } catch (e) {
-// console.log("Failed to import @yukikaze-bot/erlpack: ", e);
-// }
-
export async function Message(this: WebSocket, buffer: WS.Data) {
// TODO: compression
let data: Payload;
diff --git a/src/gateway/util/Send.ts b/src/gateway/util/Send.ts
index 6a9c639d..f857a400 100644
--- a/src/gateway/util/Send.ts
+++ b/src/gateway/util/Send.ts
@@ -20,16 +20,9 @@ import { Payload, WebSocket } from "@spacebar/gateway";
import fs from "node:fs/promises";
import path from "node:path";
-import { ErlpackType, JSONReplacer } from "@spacebar/util";
+import { JSONReplacer } from "@spacebar/util";
import * as erlpack from "harmony-erlpack";
-// let erlpack: ErlpackType | null = null;
-// try {
-// erlpack = require("@yukikaze-bot/erlpack") as ErlpackType;
-// } catch (e) {
-// console.log("Failed to import @yukikaze-bot/erlpack: ", e);
-// }
-
// don't care
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const recurseJsonReplace = (json: any) => {
diff --git a/src/util/imports/Erlpack.ts b/src/util/imports/Erlpack.ts
deleted file mode 100644
index 46431f0a..00000000
--- a/src/util/imports/Erlpack.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- https://github.com/discord/erlpack/blob/master/js/index.d.ts
- MIT License
- Copyright (c) 2017 Discord
-*/
-/* eslint-disable @typescript-eslint/no-explicit-any */
-// @fc-license-skip
-
-export type ErlpackType = {
- pack: (data: any) => Buffer;
- unpack: <T = any>(data: Buffer) => T;
-};
diff --git a/src/util/imports/index.ts b/src/util/imports/index.ts
index d9477646..5e690d4a 100644
--- a/src/util/imports/index.ts
+++ b/src/util/imports/index.ts
@@ -17,6 +17,5 @@
*/
export * from "./OrmUtils";
-export * from "./Erlpack";
export * from "./Jimp";
export * from "./Interactions";
|