1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-25 11:43:07 +01:00
This commit is contained in:
Madeline 2023-08-14 19:51:07 +10:00
parent 7ab7c240a5
commit 9d6a3dc2a7
No known key found for this signature in database
GPG Key ID: 1958E017C36F2E47
4 changed files with 18 additions and 5 deletions

View File

@ -21,7 +21,7 @@ router.get("/", route({}), async (req: Request, res: Response) => {
type: "Announce",
actor: `https://${webDomain}/fed/user/${message.author_id}`,
published: message.timestamp,
to: `https://${webDomain}/fed/channel/${message.channel_id}`,
to: `https://${webDomain}/fed/channel/${message.channel_id}/followers`,
object: message.toAP(),
};

View File

@ -52,7 +52,6 @@ router.get("/", route({}), async (req, res) => {
// move this to like, Channel.createAPMessages or smth
const apMessages = messages.map((message) => ({
"@context": "https://www.w3.org/ns/activitystreams",
id: `https://${webDomain}/fed/channel/${message.channel_id}/messages/${message.id}`,
type: "Announce",
actor: `https://${webDomain}/fed/user/${message.author_id}`,

View File

@ -0,0 +1,14 @@
import { route } from "@spacebar/api";
import { Message } from "@spacebar/util";
import { Router } from "express";
const router = Router();
export default router;
router.get("/:message_id", route({}), async (req, res) => {
const id = req.params.message_id;
const message = await Message.findOneOrFail({ where: { id } });
return res.json(message.toAP());
});

View File

@ -247,12 +247,12 @@ export class Message extends BaseClass {
const { webDomain } = Config.get().federation;
return {
id: `https://${webDomain}/fed/channel/${this.channel_id}/messages/${this.id}`,
id: `https://${webDomain}/fed/messages/${this.id}`,
type: "Note",
published: this.timestamp,
url: `https://${webDomain}/fed/channel/${this.channel_id}/messages/${this.id}`,
url: `https://${webDomain}/fed/messages/${this.id}`,
attributedTo: `https://${webDomain}/fed/user/${this.author_id}`,
to: `https://${webDomain}/fed/channel/${this.channel_id}`,
to: `https://${webDomain}/fed/channel/${this.channel_id}/followers`,
content: this.content,
};
}