forked from shadowfacts/shadowfacts.net
22 lines
624 B
TypeScript
22 lines
624 B
TypeScript
import express, { Router } from "express";
|
|
import {getConnection} from "typeorm";
|
|
import Actor from "../entity/Actor";
|
|
|
|
const domain = process.env.DOMAIN;
|
|
|
|
export default function followers(router: Router) {
|
|
router.get("/ap/actor/followers", async (req, res) => {
|
|
const followers = await getConnection().getRepository(Actor).find({where: {isFollower: true}});
|
|
res.json({
|
|
"@context": [
|
|
"https://www.w3.org/ns/activitystreams"
|
|
],
|
|
"type": "OrderedCollection",
|
|
"id": `https://${domain}/ap/actor/followers`,
|
|
"totalItems": followers.length,
|
|
"items": followers.map(it => it.id)
|
|
});
|
|
res.end();
|
|
});
|
|
}
|