summary refs log tree commit diff
path: root/src/api
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2026-03-14 03:59:28 +0100
committerRory& <root@rory.gay>2026-03-14 03:59:28 +0100
commita451f92e67ee51136d4841fdda6befe8629a298b (patch)
tree822c6a6f1e5338ea013b92fae5e149163760ec97 /src/api
parentlambert-server: remove unused code (diff)
downloadserver-ts-a451f92e67ee51136d4841fdda6befe8629a298b.tar.xz
properly mark unused params
Diffstat (limited to 'src/api')
-rw-r--r--src/api/middlewares/Authentication.ts2
-rw-r--r--src/api/routes/channels/#channel_id/thread-members.ts14
-rw-r--r--src/api/routes/channels/#channel_id/threads.ts1
-rw-r--r--src/api/routes/guilds/automations/email-domain-lookup.ts1
-rw-r--r--src/api/routes/reporting/index.ts1
-rw-r--r--src/api/routes/webhooks/#webhook_id/#token/index.ts1
-rw-r--r--src/api/util/handlers/Message.ts3
7 files changed, 15 insertions, 8 deletions
diff --git a/src/api/middlewares/Authentication.ts b/src/api/middlewares/Authentication.ts

index ad949b25..a35c5fbc 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 281ed2f9..83b1b293 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 22b29e52..e81c8d79 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<string, string | undefined>; const tags = tag ? tag.split(",") : []; const { channel_id } = req.params as Record<string, string>; diff --git a/src/api/routes/guilds/automations/email-domain-lookup.ts b/src/api/routes/guilds/automations/email-domain-lookup.ts
index 943097f8..63ec39d4 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 a04f76de..7f8e539e 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 556ee489..1dd2dac4 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 5ec13dd6..c21a47b4 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<Message> { } } 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<Message> { 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;