Support displaying players' and guilds' data' #2

Merged
steffo merged 7 commits from feature/user into main 2024-10-19 03:32:10 +00:00
Showing only changes of commit 329b6cc629 - Show all commits

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>`,
}),
]
})
}