Return a Person instead of a Service

This commit is contained in:
Steffo 2024-10-19 04:36:47 +02:00
parent d8ac0284cb
commit 329b6cc629
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0

View file

@ -1,4 +1,4 @@
import { createFederation, Service, Application, Image } from "@fedify/fedify"
import { createFederation, Person, Application, Image, PropertyValue } from "@fedify/fedify"
import { kv } from "./redis.ts"
import { getLogger } from "https://jsr.io/@logtape/logtape/0.6.3/logtape/logger.ts"
import { doQueryPlayer } from "./graphql/stratz.ts"
@ -45,7 +45,7 @@ async function actorDispatcher(ctx: any, handle: string) {
return null
}
return new Service({
return new Person({
id,
preferredUsername: id.href,
// Akkoma expects URL to be equal to ID
@ -59,7 +59,25 @@ async function actorDispatcher(ctx: any, handle: string) {
icon: new Image({
url: new URL(player.avatar),
mediaType: "image/jpeg"
})
}),
attachments: [
new PropertyValue({
name: "Steam",
value: `<a href="https://steamcommunity.com/profiles/[U:1:${player.id}]">https://steamcommunity.com/profiles/[U:1:${player.id}]</a>`,
}),
new PropertyValue({
name: "Dota profile",
value: `<a href="https://stratz.com/players/${player.id}">https://stratz.com/players/${player.id}</a>`,
}),
new PropertyValue({
name: "OpenDota",
value: `<a href="https://www.opendota.com/players/${player.id}">https://www.opendota.com/players/${player.id}</a>`,
}),
new PropertyValue({
name: "DOTABUFF",
value: `<a href="https://www.dotabuff.com/players/${player.id}">https://www.dotabuff.com/players/${player.id}</a>`,
}),
]
})
}