This commit is contained in:
parent
8d2e008125
commit
4b62c32247
4 changed files with 77 additions and 2 deletions
12
activitypub/translators/like.go
Normal file
12
activitypub/translators/like.go
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
package translators
|
||||||
|
|
||||||
|
type ActivityLikeOut struct {
|
||||||
|
Context any `json:"@context"`
|
||||||
|
Type string `json:"type"`
|
||||||
|
Id string `json:"id"`
|
||||||
|
Actor string `json:"actor"`
|
||||||
|
Object string `json:"object"`
|
||||||
|
Content *string `json:"content,omitempty"`
|
||||||
|
MkReaction *string `json:"_misskey_reaction,omitempty"`
|
||||||
|
Tags []Tag `json:"tag,omitempty"`
|
||||||
|
}
|
|
@ -13,8 +13,15 @@ import (
|
||||||
|
|
||||||
type Tag struct {
|
type Tag struct {
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
Href string `json:"href"`
|
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
|
|
||||||
|
// ---- Section Hashtag & Mention
|
||||||
|
Href *string `json:"href,omitempty"`
|
||||||
|
|
||||||
|
// Section Emote
|
||||||
|
Id *string `json:"id,omitempty"`
|
||||||
|
Updated *time.Time `json:"updated,omitempty"`
|
||||||
|
Icon *Media `json:"icon,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ObjectNote struct {
|
type ObjectNote struct {
|
||||||
|
|
53
samples/mkLikeDefaultEmote.json
Normal file
53
samples/mkLikeDefaultEmote.json
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
{
|
||||||
|
"@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",
|
||||||
|
"indexable": "toot:indexable",
|
||||||
|
"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",
|
||||||
|
"_misskey_followedMessage": "misskey:_misskey_followedMessage",
|
||||||
|
"_misskey_requireSigninToViewContents": "misskey:_misskey_requireSigninToViewContents",
|
||||||
|
"_misskey_makeNotesFollowersOnlyBefore": "misskey:_misskey_makeNotesFollowersOnlyBefore",
|
||||||
|
"_misskey_makeNotesHiddenBefore": "misskey:_misskey_makeNotesHiddenBefore",
|
||||||
|
"_misskey_license": "misskey:_misskey_license",
|
||||||
|
"freeText": {
|
||||||
|
"@id": "misskey:freeText",
|
||||||
|
"@type": "schema:text"
|
||||||
|
},
|
||||||
|
"isCat": "misskey:isCat",
|
||||||
|
"firefish": "https://joinfirefish.org/ns#",
|
||||||
|
"speakAsCat": "firefish:speakAsCat",
|
||||||
|
"sharkey": "https://joinsharkey.org/ns#",
|
||||||
|
"hideOnlineStatus": "sharkey:hideOnlineStatus",
|
||||||
|
"backgroundUrl": "sharkey:backgroundUrl",
|
||||||
|
"listenbrainz": "sharkey:listenbrainz",
|
||||||
|
"enableRss": "sharkey:enableRss",
|
||||||
|
"vcard": "http://www.w3.org/2006/vcard/ns#"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"type": "Like",
|
||||||
|
"id": "https://mk.absturztau.be/likes/a8ydcaw713im02nm",
|
||||||
|
"actor": "https://mk.absturztau.be/users/a1xy7910yc8401z8",
|
||||||
|
"object": "https://activitypub.academy/users/fabota_kovacul/statuses/114676133656288280",
|
||||||
|
"content": "👍",
|
||||||
|
"_misskey_reaction": "👍"
|
||||||
|
}
|
|
@ -6,7 +6,9 @@ import (
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
|
|
||||||
// A Reaction is a user liking a note using an emote
|
// A Reaction is a user liking a note (optionally using an emote)
|
||||||
|
// A reaction may contain some content text. If yes, this is the reaction.
|
||||||
|
// It also may contain a specifically linked emote (via tag). If yes, this is the reaction and takes precedence over the content
|
||||||
type Reaction struct {
|
type Reaction struct {
|
||||||
gorm.Model
|
gorm.Model
|
||||||
Note Note
|
Note Note
|
||||||
|
@ -15,4 +17,5 @@ type Reaction struct {
|
||||||
ReactorId string
|
ReactorId string
|
||||||
Emote *Emote // Emote is optional. If not set, use the default emote of the server
|
Emote *Emote // Emote is optional. If not set, use the default emote of the server
|
||||||
EmoteId sql.NullInt64
|
EmoteId sql.NullInt64
|
||||||
|
Content sql.NullString // Content/text of the reaction. Used for example in cases where a unicode character is sent as emote reaction
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue