mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-25 11:43:07 +01:00
aaaaaaaa
This commit is contained in:
parent
7ab7c240a5
commit
9d6a3dc2a7
@ -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(),
|
||||
};
|
||||
|
||||
|
@ -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}`,
|
||||
|
14
src/activitypub/routes/messages/index.ts
Normal file
14
src/activitypub/routes/messages/index.ts
Normal 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());
|
||||
});
|
@ -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,
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user