summary refs log tree commit diff
path: root/src/api
diff options
context:
space:
mode:
authorMathMan05 <mathmanrm@gmail.com>2026-03-06 15:07:49 -0600
committerRory& <root@rory.gay>2026-03-07 00:58:31 +0100
commite6cabb8705a7b6cf8f8c7eec88309c20fc57a6e2 (patch)
tree6531111df20e70072e6ffa37bfea9bb0c0e72ecf /src/api
parentmake some corrections (diff)
downloadserver-ts-compv2.tar.xz
merge the functions github/compv2 compv2
Diffstat (limited to 'src/api')
-rw-r--r--src/api/routes/channels/#channel_id/messages/#message_id/index.ts14
-rw-r--r--src/api/routes/channels/#channel_id/messages/index.ts13
2 files changed, 17 insertions, 10 deletions
diff --git a/src/api/routes/channels/#channel_id/messages/#message_id/index.ts b/src/api/routes/channels/#channel_id/messages/#message_id/index.ts

index ea2695ee..c0569124 100644 --- a/src/api/routes/channels/#channel_id/messages/#message_id/index.ts +++ b/src/api/routes/channels/#channel_id/messages/#message_id/index.ts
@@ -233,11 +233,15 @@ router.put( // no await as it shouldnt block the message send function and silently catch error postHandleMessage(message).catch((e) => console.error("[Message] post-message handler failed", e)); - const sign = new NewUrlUserSignatureData({ - ip: req.ip, - userAgent: req.headers["user-agent"] as string, - }); - return res.json(Message.prototype.withSignedComponents.call(message.withSignedAttachments(sign), sign)); + + return res.json( + message.withSignedAttachments( + new NewUrlUserSignatureData({ + ip: req.ip, + userAgent: req.headers["user-agent"] as string, + }), + ), + ); }, ); diff --git a/src/api/routes/channels/#channel_id/messages/index.ts b/src/api/routes/channels/#channel_id/messages/index.ts
index f11235bf..e7c9e17c 100644 --- a/src/api/routes/channels/#channel_id/messages/index.ts +++ b/src/api/routes/channels/#channel_id/messages/index.ts
@@ -514,11 +514,14 @@ router.post( // no await as it shouldnt block the message send function and silently catch error postHandleMessage(message).catch((e) => console.error("[Message] post-message handler failed", e)); - const sign = new NewUrlUserSignatureData({ - ip: req.ip, - userAgent: req.headers["user-agent"] as string, - }); - return res.json(Message.prototype.withSignedComponents.call(Message.prototype.withSignedAttachments.call(message.toJSON(), sign), sign)); + return res.json( + message.withSignedAttachments( + new NewUrlUserSignatureData({ + ip: req.ip, + userAgent: req.headers["user-agent"] as string, + }), + ), + ); }, );