Make endpoints bigger

This commit is contained in:
Jesse Wierzbinski 2023-09-12 12:56:37 -10:00
parent 6d77c8edc7
commit 8e7f08678b
No known key found for this signature in database
GPG key ID: F9A1E418934E40B0
2 changed files with 125 additions and 22 deletions

View file

@ -24,20 +24,103 @@ export default async (
"@context": [ "@context": [
"https://www.w3.org/ns/activitystreams", "https://www.w3.org/ns/activitystreams",
"https://w3id.org/security/v1", "https://w3id.org/security/v1",
{
manuallyApprovesFollowers: "as:manuallyApprovesFollowers",
toot: "http://joinmastodon.org/ns#",
featured: {
"@id": "toot:featured",
"@type": "@id",
},
featuredTags: {
"@id": "toot:featuredTags",
"@type": "@id",
},
alsoKnownAs: {
"@id": "as:alsoKnownAs",
"@type": "@id",
},
movedTo: {
"@id": "as:movedTo",
"@type": "@id",
},
schema: "http://schema.org#",
PropertyValue: "schema:PropertyValue",
value: "schema:value",
discoverable: "toot:discoverable",
Device: "toot:Device",
Ed25519Signature: "toot:Ed25519Signature",
Ed25519Key: "toot:Ed25519Key",
Curve25519Key: "toot:Curve25519Key",
EncryptedMessage: "toot:EncryptedMessage",
publicKeyBase64: "toot:publicKeyBase64",
deviceId: "toot:deviceId",
claim: {
"@type": "@id",
"@id": "toot:claim",
},
fingerprintKey: {
"@type": "@id",
"@id": "toot:fingerprintKey",
},
identityKey: {
"@type": "@id",
"@id": "toot:identityKey",
},
devices: {
"@type": "@id",
"@id": "toot:devices",
},
messageFranking: "toot:messageFranking",
messageType: "toot:messageType",
cipherText: "toot:cipherText",
suspended: "toot:suspended",
Emoji: "toot:Emoji",
focalPoint: {
"@container": "@list",
"@id": "toot:focalPoint",
},
Hashtag: "as:Hashtag",
},
], ],
id: `${getHost()}/@${user.username}/actor`, id: `${getHost()}/@${user.username}/actor`,
type: "Person", type: "Person",
preferredUsername: user.username, // TODO: Add user display name preferredUsername: user.username, // TODO: Add user display name
name: user.username, name: user.username,
summary: user.bio, summary: user.bio,
icon: [ icon: /*{
// TODO: Add user avatar type: "Image",
], url: user.avatar,
mediaType: mimetype
}*/ undefined, // TODO: Add avatar
image: /*{
type: "Image",
url: user.avatar,
mediaType: mimetype
}*/ undefined, // TODO: Add banner
inbox: `${getHost()}/@${user.username}/inbox`, inbox: `${getHost()}/@${user.username}/inbox`,
outbox: `${getHost()}/@${user.username}/outbox`, outbox: `${getHost()}/@${user.username}/outbox`,
followers: `${getHost()}/@${user.username}/followers`, followers: `${getHost()}/@${user.username}/followers`,
following: `${getHost()}/@${user.username}/following`, following: `${getHost()}/@${user.username}/following`,
liked: `${getHost()}/@${user.username}/liked`, liked: `${getHost()}/@${user.username}/liked`,
discoverable: true,
alsoKnownAs: [
// TODO: Add accounts from which the user migrated
],
manuallyApprovesFollowers: false, // TODO: Change
publicKey: {
id: `${getHost()}/@${user.username}/actor#main-key`,
owner: `${getHost()}/@${user.username}/actor`,
// TODO: Add user public key
},
tag: [
// TODO: Add emojis here, and hashtags
],
attachment: [
// TODO: Add user attachments (I.E. profile metadata)
],
endpoints: {
sharedInbox: `${getHost()}/inbox`,
},
}) })
); );
}; };

View file

@ -109,24 +109,44 @@ export default async (
return jsonResponse(await compact({ return jsonResponse(
"@context": [ await compact({
"https://www.w3.org/ns/activitystreams", "@context": [
"https://w3id.org/security/v1", "https://www.w3.org/ns/activitystreams",
], {
id: `${getHost()}/@${user.username}/inbox`, ostatus: "http://ostatus.org#",
type: "OrderedCollectionPage", atomUri: "ostatus:atomUri",
totalItems: count, inReplyToAtomUri: "ostatus:inReplyToAtomUri",
partOf: `${getHost()}/@${user.username}/inbox`, conversation: "ostatus:conversation",
// Next is less recent posts chronologically, uses min_id sensitive: "as:sensitive",
next: `${getHost()}/@${user.username}/outbox?min_id=${ toot: "http://joinmastodon.org/ns#",
posts[posts.length - 1].id votersCount: "toot:votersCount",
}&page=true`, litepub: "http://litepub.social/ns#",
// Prev is more recent posts chronologically, uses max_id directMessage: "litepub:directMessage",
prev: `${getHost()}/@${user.username}/outbox?max_id=${ Emoji: "toot:Emoji",
posts[0].id focalPoint: {
}&page=true`, "@container": "@list",
orderedItems: posts.slice(0, 10).map(post => post.data) as NodeObject[] "@id": "toot:focalPoint",
})); },
blurhash: "toot:blurhash",
},
],
id: `${getHost()}/@${user.username}/inbox`,
type: "OrderedCollectionPage",
totalItems: count,
partOf: `${getHost()}/@${user.username}/inbox`,
// Next is less recent posts chronologically, uses min_id
next: `${getHost()}/@${user.username}/outbox?min_id=${
posts[posts.length - 1].id
}&page=true`,
// Prev is more recent posts chronologically, uses max_id
prev: `${getHost()}/@${user.username}/outbox?max_id=${
posts[0].id
}&page=true`,
orderedItems: posts
.slice(0, 10)
.map((post) => post.data) as NodeObject[],
})
);
} }
}; };