mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[feature] Allow delivery to sharedInboxes where possible (#847)
* update Activity * add instance-deliver-to-shared-inboxes setting * update activity version again * add SharedInboxURI field to accounts * serdes for endpoints/sharedInbox * deliver to sharedInbox if one is available * update tests * only assign shared inbox if shared domain * look for shared inbox if currently nil * go fmt * finger to get params.RemoteAccountID if necessary * make comments clearer * compare dns more consistently
This commit is contained in:
@@ -702,3 +702,33 @@ func ExtractSensitive(withSensitive WithSensitive) bool {
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// ExtractSharedInbox extracts the sharedInbox URI properly from an Actor.
|
||||
// Returns nil if this property is not set.
|
||||
func ExtractSharedInbox(withEndpoints WithEndpoints) *url.URL {
|
||||
endpointsProp := withEndpoints.GetActivityStreamsEndpoints()
|
||||
if endpointsProp == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
for iter := endpointsProp.Begin(); iter != endpointsProp.End(); iter = iter.Next() {
|
||||
if iter.IsActivityStreamsEndpoints() {
|
||||
endpoints := iter.Get()
|
||||
if endpoints == nil {
|
||||
return nil
|
||||
}
|
||||
sharedInboxProp := endpoints.GetActivityStreamsSharedInbox()
|
||||
if sharedInboxProp == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
if !sharedInboxProp.IsIRI() {
|
||||
return nil
|
||||
}
|
||||
|
||||
return sharedInboxProp.GetIRI()
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user