Extending webfinger response (issue:2851) (#3053)

* Extending webfinger response #2851
1. Added Logo
 - rel: avatar as there wasn't any appropriate value in [Link relations registry](https://www.iana.org/assignments/link-relations/)
 - type: default value image/png or else it is determined file type extension
2. Added Stream
 - rel: stream as there wasn't appropriate value in [Link relations registry](https://www.iana.org/assignments/link-relations/)
 - type: video/H264 based on [IANA media types](https://www.iana.org/assignments/media-types/media-types.xhtml#video)

Changes after review:

1. Updated the rel type for avatar based on webfinger rel.
2. Updated the rel type for stream link and href value that closely associates to it.

* adding period after comments

* updating typo
This commit is contained in:
Jerin Thomas
2023-06-01 00:06:41 +05:30
committed by GitHub
parent c295e4f215
commit 1ed51859b0
2 changed files with 61 additions and 1 deletions

View File

@@ -26,7 +26,9 @@ type Link struct {
// MakeWebfingerResponse will create a new Webfinger response.
func MakeWebfingerResponse(account string, inbox string, host string) WebfingerResponse {
accountIRI := MakeLocalIRIForAccount(account)
streamIRI := MakeLocalIRIForStreamURL()
logoIRI := MakeLocalIRIforLogo()
logoType := GetLogoType()
return WebfingerResponse{
Subject: fmt.Sprintf("acct:%s@%s", account, host),
Aliases: []string{
@@ -43,6 +45,16 @@ func MakeWebfingerResponse(account string, inbox string, host string) WebfingerR
Type: "text/html",
Href: accountIRI.String(),
},
{
Rel: "http://webfinger.net/rel/avatar",
Type: logoType,
Href: logoIRI.String(),
},
{
Rel: "alternate",
Type: "application/x-mpegURL",
Href: streamIRI.String(),
},
},
}
}