diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 11f4ea4..f2c77ce 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 6039847..171abb5 100644
--- a/scripts/schema.js
+++ b/scripts/schema.js
@@ -210,11 +210,11 @@
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 @@
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 5c4c0af..69be334 100644
--- a/scripts/util/getRouteDescriptions.js
+++ b/scripts/util/getRouteDescriptions.js
@@ -2,7 +2,7 @@
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 ad949b2..a35c5fb 100644
--- a/src/api/middlewares/Authentication.ts
+++ b/src/api/middlewares/Authentication.ts
@@ -120,7 +120,7 @@
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/\043channel_id/thread-members.ts" "b/src/api/routes/channels/\043channel_id/thread-members.ts"
index 281ed2f..83b1b29 100644
--- "a/src/api/routes/channels/\043channel_id/thread-members.ts"
+++ "b/src/api/routes/channels/\043channel_id/thread-members.ts"
@@ -50,12 +50,14 @@
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/\043channel_id/threads.ts" "b/src/api/routes/channels/\043channel_id/threads.ts"
index 22b29e5..e81c8d7 100644
--- "a/src/api/routes/channels/\043channel_id/threads.ts"
+++ "b/src/api/routes/channels/\043channel_id/threads.ts"
@@ -217,6 +217,7 @@
},
}),
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 943097f..63ec39d 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 @@
},
);
+// 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 a04f76d..7f8e539 100644
--- a/src/api/routes/reporting/index.ts
+++ b/src/api/routes/reporting/index.ts
@@ -66,6 +66,7 @@
},
);
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/\043webhook_id/\043token/index.ts" "b/src/api/routes/webhooks/\043webhook_id/\043token/index.ts"
index 556ee48..1dd2dac 100644
--- "a/src/api/routes/webhooks/\043webhook_id/\043token/index.ts"
+++ "b/src/api/routes/webhooks/\043webhook_id/\043token/index.ts"
@@ -149,6 +149,7 @@
},
}),
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 5ec13dd..c21a47b 100644
--- a/src/api/util/handlers/Message.ts
+++ b/src/api/util/handlers/Message.ts
@@ -228,6 +228,7 @@
}
} 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 @@
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 d43f67b..7d3ac90 100644
--- a/src/apply-migrations.ts
+++ b/src/apply-migrations.ts
@@ -28,4 +28,4 @@
}
}
-main().then((r) => console.log("meow"));
+main().then(() => console.log("meow"));
diff --git a/src/gateway/Server.ts b/src/gateway/Server.ts
index 7fea1a2..c6419cf 100644
--- a/src/gateway/Server.ts
+++ b/src/gateway/Server.ts
@@ -38,9 +38,9 @@
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 65c54ae..7dd2165 100644
--- a/src/gateway/opcodes/Identify.ts
+++ b/src/gateway/opcodes/Identify.ts
@@ -64,11 +64,6 @@
// 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 0e63a7d..cb465cf 100644
--- a/src/gateway/opcodes/LazyRequest.ts
+++ b/src/gateway/opcodes/LazyRequest.ts
@@ -158,6 +158,7 @@
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 c5d8bec..6135e1f 100644
--- a/src/gateway/opcodes/StreamDelete.ts
+++ b/src/gateway/opcodes/StreamDelete.ts
@@ -21,6 +21,7 @@
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 ec0f411..1ca45ee 100644
--- a/src/gateway/util/Utils.ts
+++ b/src/gateway/util/Utils.ts
@@ -58,7 +58,7 @@
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 26daf80..24f3c20 100644
--- a/src/util/Signing.ts
+++ b/src/util/Signing.ts
@@ -114,7 +114,7 @@
}
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 c08b98f..a3c1e4f 100644
--- a/src/util/entities/UserSettingsProtos.ts
+++ b/src/util/entities/UserSettingsProtos.ts
@@ -99,7 +99,7 @@
}
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 20a747c..b158ba2 100644
--- a/src/util/migration/postgres-initial.ts
+++ b/src/util/migration/postgres-initial.ts
@@ -719,7 +719,7 @@
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 cf770af..d8e13fd 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 @@
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 805a9c1..0a3e693 100644
--- a/src/util/util/Database.ts
+++ b/src/util/util/Database.ts
@@ -59,7 +59,8 @@
);
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 9f118a9..722dd6c 100644
--- a/src/util/util/email/clients/IEmailClient.ts
+++ b/src/util/util/email/clients/IEmailClient.ts
@@ -33,6 +33,8 @@
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 c88e4a2..5d4b807 100644
--- a/src/util/util/json/JsonSerializer.ts
+++ b/src/util/util/json/JsonSerializer.ts
@@ -23,6 +23,7 @@
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 461d76e..dfcc061 100644
--- a/src/webrtc/events/Message.ts
+++ b/src/webrtc/events/Message.ts
@@ -21,13 +21,6 @@
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 d9172a7..7e6673e 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 d61d4bb..e62fc7a 100644
--- a/src/webrtc/opcodes/Identify.ts
+++ b/src/webrtc/opcodes/Identify.ts
@@ -25,6 +25,7 @@
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 a742619..38eb419 100644
--- a/src/webrtc/opcodes/Video.ts
+++ b/src/webrtc/opcodes/Video.ts
@@ -53,7 +53,7 @@
if (wantsToProduceAudio) {
try {
await Promise.race([
- new Promise((resolve, reject) => {
+ new Promise((resolve, _) => {
this.webRtcClient?.emitter.once("connected", () => resolve());
}),
new Promise((resolve, reject) => {