This commit is contained in:
Laura Hausmann 2024-07-28 20:21:31 +02:00
parent d7aff92870
commit 55f0acf32f
No known key found for this signature in database
GPG Key ID: D044E84C5BE01605

View File

@ -269,23 +269,37 @@ export async function createPerson(
const isBot = getApType(object) === "Service";
console.log('createPerson 6.1');
const bday = person["vcard:bday"]?.match(/^\d{4}-\d{2}-\d{2}/);
console.log('createPerson 6.2');
const url = getOneApHrefNullable(person.url);
console.log('createPerson 6.3');
if (url && !url.startsWith("https://")) {
throw new Error(`unexpected schema of person url: ${url}`);
}
console.log('createPerson 6.4');
let followersCount: number | undefined;
console.log('createPerson 6.5');
if (typeof person.followers === "string") {
try {
console.log('createPerson 6.6');
let data = await fetch(person.followers, {
headers: { Accept: "application/json" },
});
console.log('createPerson 6.7');
let json_data = JSON.parse(await data.text());
console.log('createPerson 6.8');
followersCount = json_data.totalItems;
} catch {
followersCount = undefined;