mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-28 10:50:34 +00:00
WebFinger: Add CORS header and fix Href -> Template for remote interactions
The CORS header is needed due to https://datatracker.ietf.org/doc/html/rfc7033#section-5 and fixes some Peertube <-> Gitea federation issues
This commit is contained in:
parent
a5b00ec4a5
commit
b6b7fe27b6
1 changed files with 3 additions and 1 deletions
|
@ -29,6 +29,7 @@ type webfingerLink struct {
|
||||||
Rel string `json:"rel,omitempty"`
|
Rel string `json:"rel,omitempty"`
|
||||||
Type string `json:"type,omitempty"`
|
Type string `json:"type,omitempty"`
|
||||||
Href string `json:"href,omitempty"`
|
Href string `json:"href,omitempty"`
|
||||||
|
Template string `json:"template,omitempty"`
|
||||||
Titles map[string]string `json:"titles,omitempty"`
|
Titles map[string]string `json:"titles,omitempty"`
|
||||||
Properties map[string]interface{} `json:"properties,omitempty"`
|
Properties map[string]interface{} `json:"properties,omitempty"`
|
||||||
}
|
}
|
||||||
|
@ -109,10 +110,11 @@ func WebfingerQuery(ctx *context.Context) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Rel: "http://ostatus.org/schema/1.0/subscribe",
|
Rel: "http://ostatus.org/schema/1.0/subscribe",
|
||||||
Href: appURL.String() + "api/v1/authorize_interaction?uri={uri}",
|
Template: appURL.String() + "api/v1/authorize_interaction?uri={uri}",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctx.Resp.Header().Add("Access-Control-Allow-Origin", "*")
|
||||||
ctx.JSON(http.StatusOK, &webfingerJRD{
|
ctx.JSON(http.StatusOK, &webfingerJRD{
|
||||||
Subject: fmt.Sprintf("acct:%s@%s", url.QueryEscape(u.Name), appURL.Host),
|
Subject: fmt.Sprintf("acct:%s@%s", url.QueryEscape(u.Name), appURL.Host),
|
||||||
Aliases: aliases,
|
Aliases: aliases,
|
||||||
|
|
Loading…
Reference in a new issue