Make sure HTTP request Date in GMT
This commit is contained in:
parent
d749f8ff4f
commit
08eebffb0e
|
@ -11,6 +11,7 @@ import (
|
|||
"encoding/pem"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
|
@ -106,7 +107,7 @@ func (c *Client) NewRequest(b []byte, to string) (req *http.Request, err error)
|
|||
}
|
||||
req.Header.Add("Content-Type", ActivityStreamsContentType)
|
||||
req.Header.Add("Accept-Charset", "utf-8")
|
||||
req.Header.Add("Date", fmt.Sprintf("%s UTC", time.Now().UTC().Format(time.RFC1123)))
|
||||
req.Header.Add("Date", strings.ReplaceAll(time.Now().UTC().Format(time.RFC1123), "UTC", "GMT"))
|
||||
|
||||
signer, _, err := httpsig.NewSigner(c.algs, c.digestAlg, c.postHeaders, httpsig.Signature, httpsigExpirationTime)
|
||||
if err != nil {
|
||||
|
|
|
@ -56,13 +56,13 @@ func Person(ctx *context.APIContext) {
|
|||
ctx.Error(http.StatusInternalServerError, "Set PreferredUsername", err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
person.URL = ap.IRI(setting.AppURL + username)
|
||||
|
||||
person.Icon = ap.Image{
|
||||
Type: ap.ImageType,
|
||||
Type: ap.ImageType,
|
||||
MediaType: "image/png",
|
||||
URL: ap.IRI(user.AvatarLink()),
|
||||
URL: ap.IRI(user.AvatarLink()),
|
||||
}
|
||||
|
||||
person.Inbox = nil
|
||||
|
@ -91,12 +91,12 @@ func Person(ctx *context.APIContext) {
|
|||
ctx.Error(http.StatusInternalServerError, "Unmarshall", err)
|
||||
}
|
||||
|
||||
jsonmap["@context"] = []string{"https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"}
|
||||
jsonmap["@context"] = []string{"https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"}
|
||||
|
||||
ctx.Resp.Header().Add("Content-Type", "application/activity+json")
|
||||
ctx.Resp.WriteHeader(http.StatusOK)
|
||||
binary, _ = json.Marshal(jsonmap)
|
||||
ctx.Resp.Write(binary)
|
||||
_, _ = ctx.Resp.Write(binary)
|
||||
}
|
||||
|
||||
// PersonInbox function
|
||||
|
|
|
@ -13,6 +13,7 @@ import (
|
|||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"code.gitea.io/gitea/modules/activitypub"
|
||||
|
@ -50,7 +51,7 @@ func fetch(iri *url.URL) (b []byte, err error) {
|
|||
req := httplib.NewRequest(iri.String(), http.MethodGet)
|
||||
req.Header("Accept", activitypub.ActivityStreamsContentType)
|
||||
req.Header("Accept-Charset", "utf-8")
|
||||
req.Header("Date", fmt.Sprintf("%s UTC", time.Now().UTC().Format(time.RFC1123)))
|
||||
req.Header("Date", strings.ReplaceAll(time.Now().UTC().Format(time.RFC1123), "UTC", "GMT"))
|
||||
resp, err := req.Response()
|
||||
if err != nil {
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue