-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
setup announcement actor, add endpoint for actor #42
Conversation
b940323
to
d0507f8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good start. The AP stuff looks correct. we just need the inbox now so we can accept and track followers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also need to implement the webfinger
protocol. Specifically we need to resolve /.well-known/webfinger
to a json file with the mime type application/jrd+json
.
example: https://github.com/RangerMauve/staticpub.mauve.moe/blob/default/.well-known/webfinger
This is necessary to enable AP instances to resolve the actor. We should use announcements@{hostname of the server}
as the account others would follow. e.g. @[email protected]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent progress, just some minor bits left.
this will probably be removed later
because announcements is a separate ActorStore outside the actorCache, we bypass the actorCache when trying to act on the announcements actor. this should make the generic `/:actor/inbox` endpoint work for announcements.. but not tested
Co-authored-by: Mauve Signweaver <[email protected]>
mauve said it's fine it's from Mastodon
* announce to announcements actor, not to newly created actor * only update required parts of announcements actor info
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe a new API should be made to check if the actor is existing, then set info, then announce if it was new. Place the logic outside of announcements and outside of the http API. Like server/creation.ts
?
src/server/announcements.ts
Outdated
if (!existedAlready && info.announce) { | ||
const activity = { | ||
'@context': 'https://www.w3.org/ns/activitystreams', | ||
type: 'Note', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ActivityStreams hold activities, not Notes. This should be wrapped in a Create activity with the Note being the object
.
e.g. here's how we link to notes in the staticpub example: https://github.com/RangerMauve/staticpub.mauve.moe/blob/default/outbox.jsonld#L13
We may need to store the notes in a separate store and add a new /:actor/note/:id
URL to resolve them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see a requirement in the spec that states that OrderedCollections must hold Activitys. Actually, I was mostly copying off of Sutty's Jekyll implementation, which has plain Updates inside the outbox:
- https://sutty.nl/outbox.jsonld -> https://sutty.nl/lanzamiento-de-publicaciones-distribuidas-en-el-fediverso-a-trav%C3%A9s-de-sutty/update/1701726785.jsonld
Am I getting something wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, notice how the update you linked wraps the note in an Update activity. We should do the same here, but with a Create.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OH lol i thought Update was similar to a Note. But the ID there is just a link to the post, so do we need an endpoint for the individual Note?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might, lets see if just wrapping is enough for now though.
otherwise .announce will never announce as it will exist beforehand
the same bug fixed in 0676758 applied to the test :)
src/server/announcements.ts
Outdated
object: { | ||
'@context': 'https://www.w3.org/ns/activitystreams', | ||
type: 'Note', | ||
id: `${this.outboxUrl}/${nanoid()}/note`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can change this to be #note
then the json-ld magic will resolve it? I'll test like this first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know nothing about json-ld 🤷 but sounds good to me
src/server/announcements.ts
Outdated
type APActorNonStandard = APActor & { | ||
publicKey: { | ||
id: string | ||
owner: string | ||
publicKeyPem: string | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should probably be moved elsewhere but i'm not sure where. maybe src/schemas.ts? either way it can be moved later if it's used elsewhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah mind moving it to schemas? Also maybe we could PR the field into the module? They accepted my orderedItems one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm looking into doing the PR but I can't find the spec that defines keypair in APActor
src/server/announcements.ts
Outdated
object: { | ||
'@context': 'https://www.w3.org/ns/activitystreams', | ||
type: 'Note', | ||
id: `${this.outboxUrl}/${nanoid()}/note`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know nothing about json-ld 🤷 but sounds good to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good!
Leaving this here so it can be reviewed as I go
ref