This commit is contained in:
Madeline
2023-08-14 20:28:25 +10:00
parent 9d6a3dc2a7
commit a40dfcfaef
4 changed files with 111 additions and 53 deletions
+14 -1
View File
@@ -16,7 +16,7 @@
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import type { APNote } from "activitypub-types";
import type { APAnnounce, APNote } from "activitypub-types";
import {
Column,
CreateDateColumn,
@@ -243,6 +243,19 @@ export class Message extends BaseClass {
};
}
toAnnounceAP(): APAnnounce {
const { webDomain } = Config.get().federation;
return {
id: `https://${webDomain}/fed/channel/${this.channel_id}/messages/${this.id}`,
type: "Announce",
actor: `https://${webDomain}/fed/user/${this.author_id}`,
published: this.timestamp,
to: `https://${webDomain}/fed/channel/${this.channel_id}`,
object: this.toAP(),
};
}
toAP(): APNote {
const { webDomain } = Config.get().federation;