mirror of
https://github.com/spacebarchat/server.git
synced 2026-05-26 01:04:51 +00:00
merge the functions
This commit is contained in:
@@ -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,
|
||||
}),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@@ -506,11 +506,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,
|
||||
}),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user