diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 11f4ea469..f2c77cea1 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -12,6 +12,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
-
+
{
"customColor": "",
@@ -99,6 +111,24 @@
]
}
}
+
+
+
+
+
+
+
+
+
+
+
+
@@ -130,8 +160,6 @@
-
-
@@ -194,6 +222,7 @@
+
@@ -232,4 +261,12 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/scripts/schema.js b/scripts/schema.js
index 60398472e..171abb5a8 100644
--- a/scripts/schema.js
+++ b/scripts/schema.js
@@ -210,11 +210,11 @@ async function main() {
for (const defKey in schema.definitions) {
if (definitions[defKey] && deepEqual(definitions[defKey], schema.definitions[defKey])) {
// console.log("Definition", defKey, "from schema", schemaName, "is identical to existing definition, skipping.");
- schema.definitions = Object.fromEntries(Object.entries(schema.definitions).filter(([k, v]) => k !== defKey));
+ schema.definitions = Object.fromEntries(Object.entries(schema.definitions).filter(([k, _]) => k !== defKey));
process.stdout.write(greenBright("T"));
} else if (!nestedDefinitions[defKey]) {
nestedDefinitions[defKey] = schema.definitions[defKey];
- schema.definitions = Object.fromEntries(Object.entries(schema.definitions).filter(([k, v]) => k !== defKey));
+ schema.definitions = Object.fromEntries(Object.entries(schema.definitions).filter(([k, _]) => k !== defKey));
// console.log("Tracking sub-definition", defKey, "from schema", schemaName);
process.stdout.write(green("N"));
} else if (!deepEqual(nestedDefinitions[defKey], schema.definitions[defKey])) {
@@ -222,7 +222,7 @@ async function main() {
console.log(columnizedObjectDiff(nestedDefinitions[defKey], schema.definitions[defKey], true));
} else {
// console.log("Definition", defKey, "from schema", schemaName, "is identical to existing definition, skipping.");
- schema.definitions = Object.fromEntries(Object.entries(schema.definitions).filter(([k, v]) => k !== defKey));
+ schema.definitions = Object.fromEntries(Object.entries(schema.definitions).filter(([k, _]) => k !== defKey));
process.stdout.write(greenBright("M"));
}
}
diff --git a/scripts/util/getRouteDescriptions.js b/scripts/util/getRouteDescriptions.js
index 5c4c0aff1..69be334aa 100644
--- a/scripts/util/getRouteDescriptions.js
+++ b/scripts/util/getRouteDescriptions.js
@@ -2,7 +2,7 @@ const express = require("express");
const path = require("path");
const { traverseDirectory } = require("lambert-server");
const RouteUtility = require("../../dist/api/util/handlers/route.js");
-const { bgRedBright, greenBright, yellowBright, blueBright, redBright, underline, bold, bgYellow, black } = require("picocolors");
+const { greenBright, yellowBright, blueBright, redBright, underline, bgYellow, black } = require("picocolors");
const methods = ["get", "post", "put", "delete", "patch"];
const routes = new Map();
diff --git a/src/api/middlewares/Authentication.ts b/src/api/middlewares/Authentication.ts
index ad949b25a..a35c5fbca 100644
--- a/src/api/middlewares/Authentication.ts
+++ b/src/api/middlewares/Authentication.ts
@@ -120,7 +120,7 @@ export async function Authentication(req: Request, res: Response, next: NextFunc
if (!req.headers.authorization) return next(new HTTPError("Missing Authorization Header", 401));
try {
- const { decoded, user, session, tokenVersion } = (req.tokenData = await checkToken(req.headers.authorization, {
+ const { decoded, user, session } = (req.tokenData = await checkToken(req.headers.authorization, {
ipAddress: req.ip,
fingerprint: req.fingerprint,
}));
diff --git a/src/api/routes/channels/#channel_id/thread-members.ts b/src/api/routes/channels/#channel_id/thread-members.ts
index 281ed2f90..83b1b2930 100644
--- a/src/api/routes/channels/#channel_id/thread-members.ts
+++ b/src/api/routes/channels/#channel_id/thread-members.ts
@@ -50,12 +50,14 @@ router.get(
limit = undefined;
}
- return await ThreadMember.find({
- where: { channel: { id: channel_id }, ...(after ? { user_id: MoreThan(after) } : {}) },
- take: limit ? parseInt(limit) : 50,
- order: { member_idx: "ASC" },
- relations: { ...(with_member ? { member: true } : {}) },
- });
+ return res.send(
+ await ThreadMember.find({
+ where: { channel: { id: channel_id }, ...(after ? { user_id: MoreThan(after) } : {}) },
+ take: limit ? parseInt(limit) : 50,
+ order: { member_idx: "ASC" },
+ relations: { ...(with_member ? { member: true } : {}) },
+ }),
+ );
},
);
router.post(
diff --git a/src/api/routes/channels/#channel_id/threads.ts b/src/api/routes/channels/#channel_id/threads.ts
index 22b29e527..e81c8d791 100644
--- a/src/api/routes/channels/#channel_id/threads.ts
+++ b/src/api/routes/channels/#channel_id/threads.ts
@@ -217,6 +217,7 @@ router.get(
},
}),
async (req: Request, res: Response) => {
+ // noinspection JSUnusedLocalSymbols - ???
const { name, slop, tag, tag_setting, archived, sort_by, sort_order, limit, offset, max_id, min_id } = req.query as Record;
const tags = tag ? tag.split(",") : [];
const { channel_id } = req.params as Record;
diff --git a/src/api/routes/guilds/automations/email-domain-lookup.ts b/src/api/routes/guilds/automations/email-domain-lookup.ts
index 943097f8f..63ec39d43 100644
--- a/src/api/routes/guilds/automations/email-domain-lookup.ts
+++ b/src/api/routes/guilds/automations/email-domain-lookup.ts
@@ -59,6 +59,7 @@ router.post(
},
);
+// noinspection JSUnusedLocalSymbols - TODO: implement
router.post(
"/verify-code",
route({
diff --git a/src/api/routes/reporting/index.ts b/src/api/routes/reporting/index.ts
index a04f76de2..7f8e539e9 100644
--- a/src/api/routes/reporting/index.ts
+++ b/src/api/routes/reporting/index.ts
@@ -66,6 +66,7 @@ for (const type of Object.values(ReportMenuTypeNames)) {
},
);
if (process.env.LOG_ROUTES !== "false") console.log(`[Server] Route /reporting/menu/${type} registered (reports).`);
+ // noinspection JSUnusedLocalSymbols - TODO: implement
router.post(
`/${type}`,
route({
diff --git a/src/api/routes/webhooks/#webhook_id/#token/index.ts b/src/api/routes/webhooks/#webhook_id/#token/index.ts
index 556ee489f..1dd2dac43 100644
--- a/src/api/routes/webhooks/#webhook_id/#token/index.ts
+++ b/src/api/routes/webhooks/#webhook_id/#token/index.ts
@@ -149,6 +149,7 @@ router.patch(
},
}),
async (req: Request, res: Response) => {
+ // noinspection JSUnusedLocalSymbols - TODO: shouldnt token be checked?
const { webhook_id, token } = req.params as { [key: string]: string };
const body = req.body as WebhookUpdateSchema;
diff --git a/src/api/util/handlers/Message.ts b/src/api/util/handlers/Message.ts
index 5ec13dd6b..c21a47b43 100644
--- a/src/api/util/handlers/Message.ts
+++ b/src/api/util/handlers/Message.ts
@@ -228,6 +228,7 @@ export async function handleMessage(opts: MessageOptions): Promise {
}
} else {
permission ||= await getPermission(opts.author_id, channel.guild_id, channel);
+ if (permission === null) throw new HTTPError("permission was null after getPermission", 500);
permission.hasThrow("SEND_MESSAGES");
if (permission.cache.member) {
message.member = permission.cache.member;
@@ -238,7 +239,7 @@ export async function handleMessage(opts: MessageOptions): Promise {
permission.hasThrow("READ_MESSAGE_HISTORY");
// code below has to be redone when we add custom message routing
if (message.guild_id !== null) {
- const guild = await Guild.findOneOrFail({
+ await Guild.findOneOrFail({
where: { id: channel.guild_id },
});
if (!opts.message_reference.guild_id) opts.message_reference.guild_id = channel.guild_id;
diff --git a/src/apply-migrations.ts b/src/apply-migrations.ts
index d43f67bf4..7d3ac90af 100644
--- a/src/apply-migrations.ts
+++ b/src/apply-migrations.ts
@@ -28,4 +28,4 @@ async function main() {
}
}
-main().then((r) => console.log("meow"));
+main().then(() => console.log("meow"));
diff --git a/src/gateway/Server.ts b/src/gateway/Server.ts
index 7fea1a279..c6419cfa8 100644
--- a/src/gateway/Server.ts
+++ b/src/gateway/Server.ts
@@ -38,9 +38,9 @@ export class Server {
if (server) this.server = server;
else {
- const elu = [1, 5, 15].map((x) => performance.eventLoopUtilization());
- const eluP = [1, 5, 15].map((x) => performance.eventLoopUtilization());
- const cpu = [1, 5, 15].map((x) => process.cpuUsage());
+ const elu = [1, 5, 15].map(() => performance.eventLoopUtilization());
+ const eluP = [1, 5, 15].map(() => performance.eventLoopUtilization());
+ const cpu = [1, 5, 15].map(() => process.cpuUsage());
let sec = 0;
setInterval(() => {
sec += 1;
diff --git a/src/gateway/opcodes/Identify.ts b/src/gateway/opcodes/Identify.ts
index 65c54ae0c..7dd21658f 100644
--- a/src/gateway/opcodes/Identify.ts
+++ b/src/gateway/opcodes/Identify.ts
@@ -64,11 +64,6 @@ import { ChannelType, DefaultUserGuildSettings, DMChannel, IdentifySchema, Priva
// TODO: user sharding
// TODO: check privileged intents, if defined in the config
-function logAuth(message: string) {
- if (process.env.LOG_AUTH != "true") return;
- console.log(`[Gateway/Auth] ${message}`);
-}
-
export async function onIdentify(this: WebSocket, data: Payload) {
const totalSw = Stopwatch.startNew();
const taskSw = Stopwatch.startNew();
diff --git a/src/gateway/opcodes/LazyRequest.ts b/src/gateway/opcodes/LazyRequest.ts
index 0e63a7d2d..cb465cf07 100644
--- a/src/gateway/opcodes/LazyRequest.ts
+++ b/src/gateway/opcodes/LazyRequest.ts
@@ -158,6 +158,7 @@ export async function onLazyRequest(this: WebSocket, { d }: Payload) {
const startTime = Date.now();
// TODO: check data
check.call(this, LazyRequestSchema, d);
+ // noinspection JSUnusedLocalSymbols - TODO: implement typing/activities subscriptions
const { guild_id, typing, channels, activities, members } = d as LazyRequestSchema;
if (members) {
diff --git a/src/gateway/opcodes/StreamDelete.ts b/src/gateway/opcodes/StreamDelete.ts
index c5d8bec38..6135e1f35 100644
--- a/src/gateway/opcodes/StreamDelete.ts
+++ b/src/gateway/opcodes/StreamDelete.ts
@@ -21,6 +21,7 @@ export async function onStreamDelete(this: WebSocket, data: Payload) {
return this.close(4000, "Invalid stream key");
}
+ // noinspection JSUnusedLocalSymbols - TODO: what is type here?
const { userId, channelId, guildId, type } = parsedKey;
// when a user selects to stop watching another user stream, this event gets triggered
diff --git a/src/gateway/util/Utils.ts b/src/gateway/util/Utils.ts
index ec0f411c7..1ca45ee44 100644
--- a/src/gateway/util/Utils.ts
+++ b/src/gateway/util/Utils.ts
@@ -58,7 +58,7 @@ export async function cleanupOnStartup(): Promise {
console.log("[Gateway] Starting async voice state wipe...");
VoiceState.clear()
- .then((e) => console.log("[Gateway] Successfully cleaned voice states"))
+ .then(() => console.log("[Gateway] Successfully cleaned voice states"))
.catch((e) => console.error("[Gateway] Error cleaning voice states on startup:", e));
}
diff --git a/src/util/Signing.ts b/src/util/Signing.ts
index 26daf808a..24f3c2061 100644
--- a/src/util/Signing.ts
+++ b/src/util/Signing.ts
@@ -114,7 +114,7 @@ export class UrlSignResult {
}
export const getUrlSignature = (data: NewUrlSignatureData): UrlSignResult => {
- const { cdnSignatureKey, cdnSignatureDuration } = Config.get().security;
+ const { cdnSignatureDuration } = Config.get().security;
// calculate the expiration time
const now = Date.now();
diff --git a/src/util/entities/UserSettingsProtos.ts b/src/util/entities/UserSettingsProtos.ts
index c08b98ff6..a3c1e4fbf 100644
--- a/src/util/entities/UserSettingsProtos.ts
+++ b/src/util/entities/UserSettingsProtos.ts
@@ -99,7 +99,7 @@ export class UserSettingsProtos extends BaseClassWithoutId {
}
static async getOrDefault(user_id: string, save: boolean = false): Promise {
- const user = await User.findOneOrFail({
+ await User.findOneOrFail({
where: { id: user_id },
select: { settings: true },
});
diff --git a/src/util/migration/postgres-initial.ts b/src/util/migration/postgres-initial.ts
index 20a747c2d..b158ba2ad 100644
--- a/src/util/migration/postgres-initial.ts
+++ b/src/util/migration/postgres-initial.ts
@@ -719,7 +719,7 @@ export class initial0 implements MigrationInterface {
await queryRunner.query(`ALTER TABLE ONLY public.team_members ADD CONSTRAINT "FK_fdad7d5768277e60c40e01cdcea" FOREIGN KEY (team_id) REFERENCES public.teams(id) ON DELETE CASCADE;`);
}
- public async down(queryRunner: QueryRunner): Promise {
+ public async down(_: QueryRunner): Promise {
throw new Error("Can't revert this: just throw away your database lol");
}
}
diff --git a/src/util/migration/postgres/1761113394664-delete-bot-users-without-an-application.ts b/src/util/migration/postgres/1761113394664-delete-bot-users-without-an-application.ts
index cf770afca..d8e13fdc6 100644
--- a/src/util/migration/postgres/1761113394664-delete-bot-users-without-an-application.ts
+++ b/src/util/migration/postgres/1761113394664-delete-bot-users-without-an-application.ts
@@ -6,5 +6,5 @@ export class DeleteBotUsersWithoutAnApplication1761113394664 implements Migratio
await queryRunner.query(`DELETE FROM users WHERE bot = true AND id NOT IN (SELECT bot_user_id FROM applications);`);
}
- public async down(queryRunner: QueryRunner): Promise {}
+ public async down(_: QueryRunner): Promise {}
}
diff --git a/src/util/util/Database.ts b/src/util/util/Database.ts
index 805a9c18c..0a3e69375 100644
--- a/src/util/util/Database.ts
+++ b/src/util/util/Database.ts
@@ -59,7 +59,8 @@ if (!isHeadlessProcess) {
);
console.log(`[Database] ${red(`If you would like to try *anyways*, see the error below:`)}`);
try {
- const _ = require("sqlite3");
+ // TODO: fully remove sqlite3
+ require("sqlite3");
} catch (e) {
console.log(`[Database] ${red(`Failed to load sqlite3 package. Please install it with 'npm install --no-save sqlite3', or switch to a real database like Postgres.`)}`);
process.exit(1);
diff --git a/src/util/util/email/clients/IEmailClient.ts b/src/util/util/email/clients/IEmailClient.ts
index 9f118a968..722dd6c47 100644
--- a/src/util/util/email/clients/IEmailClient.ts
+++ b/src/util/util/email/clients/IEmailClient.ts
@@ -33,6 +33,8 @@ export class BaseEmailClient implements IEmailClient {
return;
}
sendMail(email: IEmail): Promise {
+ // noinspection JSUnusedLocalSymbols - parameter exists for public API reasons
+ const _ = email;
throw new Error("Method not implemented.");
}
}
diff --git a/src/util/util/json/JsonSerializer.ts b/src/util/util/json/JsonSerializer.ts
index c88e4a2f9..5d4b80755 100644
--- a/src/util/util/json/JsonSerializer.ts
+++ b/src/util/util/json/JsonSerializer.ts
@@ -23,6 +23,7 @@ function getNextWorker(): Worker {
return worker;
}
+// noinspection JSUnusedLocalSymbols - TODO: implement options
export class JsonSerializer {
public static Serialize(value: T, opts?: JsonSerializerOptions): string {
return JSON.stringify(value);
diff --git a/src/webrtc/events/Message.ts b/src/webrtc/events/Message.ts
index 461d76e5c..dfcc06107 100644
--- a/src/webrtc/events/Message.ts
+++ b/src/webrtc/events/Message.ts
@@ -21,13 +21,6 @@ import { Tuple } from "lambert-server";
import OPCodeHandlers from "../opcodes";
import { VoiceOPCodes, VoicePayload, WebRtcWebSocket } from "../util";
-const PayloadSchema = {
- op: Number,
- $d: new Tuple(Object, Number), // or number for heartbeat sequence
- $s: Number,
- $t: String,
-};
-
export async function onMessage(this: WebRtcWebSocket, buffer: Buffer) {
try {
const data: VoicePayload = JSON.parse(buffer.toString());
diff --git a/src/webrtc/opcodes/BackendVersion.ts b/src/webrtc/opcodes/BackendVersion.ts
index d9172a7f2..7e6673e72 100644
--- a/src/webrtc/opcodes/BackendVersion.ts
+++ b/src/webrtc/opcodes/BackendVersion.ts
@@ -18,7 +18,7 @@
import { VoiceOPCodes, VoicePayload, WebRtcWebSocket, Send } from "../util";
-export async function onBackendVersion(this: WebRtcWebSocket, data: VoicePayload) {
+export async function onBackendVersion(this: WebRtcWebSocket, _: VoicePayload) {
await Send(this, {
op: VoiceOPCodes.VOICE_BACKEND_VERSION,
d: { voice: "0.8.43", rtc_worker: "0.3.26" },
diff --git a/src/webrtc/opcodes/Identify.ts b/src/webrtc/opcodes/Identify.ts
index d61d4bbbc..e62fc7afc 100644
--- a/src/webrtc/opcodes/Identify.ts
+++ b/src/webrtc/opcodes/Identify.ts
@@ -25,6 +25,7 @@ import { subscribeToProducers } from "./Video";
export async function onIdentify(this: WebRtcWebSocket, data: VoicePayload) {
clearTimeout(this.readyTimeout);
+ // noinspection JSUnusedLocalSymbols - TODO: use video?
const { server_id, user_id, session_id, token, streams, video } = validateSchema("VoiceIdentifySchema", data.d) as VoiceIdentifySchema;
// server_id can be one of the following: a unique id for a GO Live stream, a channel id for a DM voice call, or a guild id for a guild voice channel
diff --git a/src/webrtc/opcodes/Video.ts b/src/webrtc/opcodes/Video.ts
index a7426198f..38eb419ba 100644
--- a/src/webrtc/opcodes/Video.ts
+++ b/src/webrtc/opcodes/Video.ts
@@ -53,7 +53,7 @@ export async function onVideo(this: WebRtcWebSocket, payload: VoicePayload) {
if (wantsToProduceAudio) {
try {
await Promise.race([
- new Promise((resolve, reject) => {
+ new Promise((resolve, _) => {
this.webRtcClient?.emitter.once("connected", () => resolve());
}),
new Promise((resolve, reject) => {