diff --git a/src/api/middlewares/TestClient.ts b/src/api/middlewares/TestClient.ts
index 765059c7..e68abf98 100644
--- a/src/api/middlewares/TestClient.ts
+++ b/src/api/middlewares/TestClient.ts
@@ -7,6 +7,8 @@ import { Config } from "@fosscord/util";
const ASSET_FOLDER_PATH = path.join(__dirname, "..", "..", "..", "assets");
+let hasWarnedAboutCache = false;
+
export default function TestClient(app: Application) {
const agent = new ProxyAgent();
const assetCache = new Map<string, { response: FetchResponse; buffer: Buffer; }>();
@@ -44,8 +46,15 @@ export default function TestClient(app: Application) {
app.use("/assets", express.static(path.join(ASSET_FOLDER_PATH, "public")));
+ app.use("/assets", express.static(path.join(ASSET_FOLDER_PATH, "cache")));
app.get("/assets/:file", async (req: Request, res: Response) => {
+ if (!hasWarnedAboutCache) {
+ hasWarnedAboutCache = true;
+ if (req.params.file.includes(".js"))
+ console.warn(`[TestClient] Cache miss for file ${req.params.file}! Use 'npm run generate:client' to cache and patch.`);
+ }
+
delete req.headers.host;
var response: FetchResponse;
var buffer: Buffer;
diff --git a/src/gateway/events/Close.ts b/src/gateway/events/Close.ts
index 40d9a6f7..82d16234 100644
--- a/src/gateway/events/Close.ts
+++ b/src/gateway/events/Close.ts
@@ -9,7 +9,7 @@ import {
} from "@fosscord/util";
export async function Close(this: WebSocket, code: number, reason: string) {
- console.log("[WebSocket] closed", code, reason);
+ console.log("[WebSocket] closed", code, reason.toString());
if (this.heartbeatTimeout) clearTimeout(this.heartbeatTimeout);
if (this.readyTimeout) clearTimeout(this.readyTimeout);
this.deflate?.close();
|