diff --git a/src/util/entities/Channel.ts b/src/util/entities/Channel.ts
index 19952bc2..93265d07 100644
--- a/src/util/entities/Channel.ts
+++ b/src/util/entities/Channel.ts
@@ -16,6 +16,7 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
+import { APActor } from "activitypub-types";
import { HTTPError } from "lambert-server";
import {
Column,
@@ -28,6 +29,7 @@ import {
import { DmChannelDTO } from "../dtos";
import { ChannelCreateEvent, ChannelRecipientRemoveEvent } from "../interfaces";
import {
+ Config,
InvisibleCharacters,
Snowflake,
containsAll,
@@ -482,6 +484,26 @@ export class Channel extends BaseClass {
owner_id: this.owner_id || undefined,
};
}
+
+ toAP(): APActor {
+ const { webDomain } = Config.get().federation;
+
+ return {
+ "@context": "https://www.w3.org/ns/activitystreams",
+ type: "Group",
+ id: `https://${webDomain}/fed/channel/${this.id}`,
+ name: this.name,
+ preferredUsername: this.name,
+ summary: this.topic,
+ icon: undefined,
+
+ inbox: `https://${webDomain}/fed/channel/${this.id}/inbox`,
+ outbox: `https://${webDomain}/fed/channel/${this.id}/outbox`,
+ followers: `https://${webDomain}/fed/channel/${this.id}/followers`,
+ following: `https://${webDomain}/fed/channel/${this.id}/following`,
+ liked: `https://${webDomain}/fed/channel/${this.id}/likeds`,
+ };
+ }
}
export interface ChannelPermissionOverwrite {
|