mirror of
https://github.com/spacebarchat/server.git
synced 2026-10-23 06:32:34 +00:00
aaaaaaaa
This commit is contained in:
4 files changed
+18
-5
No files matched your search
@@ -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}`,
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user