meow
This commit is contained in:
parent
7e0952d398
commit
47ab22ab50
3 changed files with 137 additions and 14 deletions
71
examples/raw/mk_note_create_dm.json
Normal file
71
examples/raw/mk_note_create_dm.json
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
{
|
||||||
|
"@context": [
|
||||||
|
"https://www.w3.org/ns/activitystreams",
|
||||||
|
"https://w3id.org/security/v1",
|
||||||
|
{
|
||||||
|
"Key": "sec:Key",
|
||||||
|
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
||||||
|
"sensitive": "as:sensitive",
|
||||||
|
"Hashtag": "as:Hashtag",
|
||||||
|
"quoteUrl": "as:quoteUrl",
|
||||||
|
"fedibird": "http://fedibird.com/ns#",
|
||||||
|
"quoteUri": "fedibird:quoteUri",
|
||||||
|
"toot": "http://joinmastodon.org/ns#",
|
||||||
|
"Emoji": "toot:Emoji",
|
||||||
|
"featured": "toot:featured",
|
||||||
|
"discoverable": "toot:discoverable",
|
||||||
|
"schema": "http://schema.org#",
|
||||||
|
"PropertyValue": "schema:PropertyValue",
|
||||||
|
"value": "schema:value",
|
||||||
|
"misskey": "https://misskey-hub.net/ns#",
|
||||||
|
"_misskey_content": "misskey:_misskey_content",
|
||||||
|
"_misskey_quote": "misskey:_misskey_quote",
|
||||||
|
"_misskey_reaction": "misskey:_misskey_reaction",
|
||||||
|
"_misskey_votes": "misskey:_misskey_votes",
|
||||||
|
"_misskey_summary": "misskey:_misskey_summary",
|
||||||
|
"isCat": "misskey:isCat",
|
||||||
|
"firefish": "https://joinfirefish.org/ns#",
|
||||||
|
"speakAsCat": "firefish:speakAsCat",
|
||||||
|
"sharkey": "https://joinsharkey.org/ns#",
|
||||||
|
"backgroundUrl": "sharkey:backgroundUrl",
|
||||||
|
"listenbrainz": "sharkey:listenbrainz",
|
||||||
|
"vcard": "http://www.w3.org/2006/vcard/ns#"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id": "https://woem.men/notes/9walk87geegt0051/activity",
|
||||||
|
"actor": "https://woem.men/users/9n39zo1rfckr00q5",
|
||||||
|
"type": "Create",
|
||||||
|
"published": "2024-07-29T13:36:29.068Z",
|
||||||
|
"object": {
|
||||||
|
"id": "https://woem.men/notes/9walk87geegt0051",
|
||||||
|
"type": "Note",
|
||||||
|
"attributedTo": "https://woem.men/users/9n39zo1rfckr00q5",
|
||||||
|
"content": "<p><a href=\"https://transgirl.cafe/@melody\" class=\"u-url mention\">@melody@transgirl.cafe</a> <a href=\"https://activitypub.academy/@dibona_tuladan\" class=\"u-url mention\">@dibona_tuladan@activitypub.academy</a> dm test</p>",
|
||||||
|
"published": "2024-07-29T13:36:29.068Z",
|
||||||
|
"to": [
|
||||||
|
"https://transgirl.cafe/users/9ujjey44qdrt01g2",
|
||||||
|
"https://activitypub.academy/users/dibona_tuladan"
|
||||||
|
],
|
||||||
|
"cc": [],
|
||||||
|
"inReplyTo": null,
|
||||||
|
"attachment": [],
|
||||||
|
"sensitive": false,
|
||||||
|
"tag": [
|
||||||
|
{
|
||||||
|
"type": "Mention",
|
||||||
|
"href": "https://transgirl.cafe/users/9ujjey44qdrt01g2",
|
||||||
|
"name": "@melody@transgirl.cafe"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "Mention",
|
||||||
|
"href": "https://activitypub.academy/users/dibona_tuladan",
|
||||||
|
"name": "@dibona_tuladan@activitypub.academy"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"to": [
|
||||||
|
"https://transgirl.cafe/users/9ujjey44qdrt01g2",
|
||||||
|
"https://activitypub.academy/users/dibona_tuladan"
|
||||||
|
],
|
||||||
|
"cc": []
|
||||||
|
}
|
60
examples/raw/mk_note_create_follower_only_with_ping.json
Normal file
60
examples/raw/mk_note_create_follower_only_with_ping.json
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
{
|
||||||
|
"@context": [
|
||||||
|
"https://www.w3.org/ns/activitystreams",
|
||||||
|
"https://w3id.org/security/v1",
|
||||||
|
{
|
||||||
|
"Key": "sec:Key",
|
||||||
|
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
||||||
|
"sensitive": "as:sensitive",
|
||||||
|
"Hashtag": "as:Hashtag",
|
||||||
|
"quoteUrl": "as:quoteUrl",
|
||||||
|
"fedibird": "http://fedibird.com/ns#",
|
||||||
|
"quoteUri": "fedibird:quoteUri",
|
||||||
|
"toot": "http://joinmastodon.org/ns#",
|
||||||
|
"Emoji": "toot:Emoji",
|
||||||
|
"featured": "toot:featured",
|
||||||
|
"discoverable": "toot:discoverable",
|
||||||
|
"schema": "http://schema.org#",
|
||||||
|
"PropertyValue": "schema:PropertyValue",
|
||||||
|
"value": "schema:value",
|
||||||
|
"misskey": "https://misskey-hub.net/ns#",
|
||||||
|
"_misskey_content": "misskey:_misskey_content",
|
||||||
|
"_misskey_quote": "misskey:_misskey_quote",
|
||||||
|
"_misskey_reaction": "misskey:_misskey_reaction",
|
||||||
|
"_misskey_votes": "misskey:_misskey_votes",
|
||||||
|
"_misskey_summary": "misskey:_misskey_summary",
|
||||||
|
"isCat": "misskey:isCat",
|
||||||
|
"firefish": "https://joinfirefish.org/ns#",
|
||||||
|
"speakAsCat": "firefish:speakAsCat",
|
||||||
|
"sharkey": "https://joinsharkey.org/ns#",
|
||||||
|
"backgroundUrl": "sharkey:backgroundUrl",
|
||||||
|
"listenbrainz": "sharkey:listenbrainz",
|
||||||
|
"vcard": "http://www.w3.org/2006/vcard/ns#"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"id": "https://woem.men/notes/9wallcddeegt0052/activity",
|
||||||
|
"actor": "https://woem.men/users/9n39zo1rfckr00q5",
|
||||||
|
"type": "Create",
|
||||||
|
"published": "2024-07-29T13:37:21.121Z",
|
||||||
|
"object": {
|
||||||
|
"id": "https://woem.men/notes/9wallcddeegt0052",
|
||||||
|
"type": "Note",
|
||||||
|
"attributedTo": "https://woem.men/users/9n39zo1rfckr00q5",
|
||||||
|
"content": "<p><a href=\"https://activitypub.academy/@dibona_tuladan\" class=\"u-url mention\">@dibona_tuladan@activitypub.academy</a> test message with ping</p>",
|
||||||
|
"published": "2024-07-29T13:37:21.121Z",
|
||||||
|
"to": ["https://woem.men/users/9n39zo1rfckr00q5/followers"],
|
||||||
|
"cc": ["https://activitypub.academy/users/dibona_tuladan"],
|
||||||
|
"inReplyTo": null,
|
||||||
|
"attachment": [],
|
||||||
|
"sensitive": false,
|
||||||
|
"tag": [
|
||||||
|
{
|
||||||
|
"type": "Mention",
|
||||||
|
"href": "https://activitypub.academy/users/dibona_tuladan",
|
||||||
|
"name": "@dibona_tuladan@activitypub.academy"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"to": ["https://woem.men/users/9n39zo1rfckr00q5/followers"],
|
||||||
|
"cc": ["https://activitypub.academy/users/dibona_tuladan"]
|
||||||
|
}
|
|
@ -7,35 +7,27 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type ActorData struct {
|
type ActorData struct {
|
||||||
Next BaseApChain
|
IdType
|
||||||
Actor string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (actor *ActorData) GetSelfOrBase() (BaseApChain, bool) {
|
func (actor *ActorData) GetSelfOrBase() (BaseApChain, bool) {
|
||||||
return actor.Next, true
|
return actor.IdType.GetSelfOrBase()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (actor *ActorData) MarshalToMap() map[string]any {
|
func (actor *ActorData) MarshalToMap() map[string]any {
|
||||||
prev := actor.Next.MarshalToMap()
|
return actor.IdType.MarshalToMapWithName(KEY_ACTIVITYSTREAMS_ACTOR)
|
||||||
prev[KEY_ACTIVITYSTREAMS_ACTOR] = strToId(actor.Actor)
|
|
||||||
return prev
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type ObjectData struct {
|
type ObjectData struct {
|
||||||
Next BaseApChain
|
IdType
|
||||||
ObjectUrl string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (object *ObjectData) GetSelfOrBase() (BaseApChain, bool) {
|
func (object *ObjectData) GetSelfOrBase() (BaseApChain, bool) {
|
||||||
return object.Next, true
|
return object.IdType.Next, true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (object *ObjectData) MarshalToMap() map[string]any {
|
func (object *ObjectData) MarshalToMap() map[string]any {
|
||||||
return appendWithKey(
|
return object.IdType.MarshalToMapWithName(KEY_ACTIVITYSTREAMS_OBJECT)
|
||||||
object.Next.MarshalToMap(),
|
|
||||||
KEY_ACTIVITYSTREAMS_OBJECT,
|
|
||||||
strToId(object.ObjectUrl),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type CCData struct {
|
type CCData struct {
|
||||||
|
|
Loading…
Reference in a new issue