diff options
author | Anthony Wang | 2022-06-18 13:08:00 -0500 |
---|---|---|
committer | Anthony Wang | 2022-06-18 13:08:00 -0500 |
commit | 7c10ab9fde6b2b2360e5968aa0172b1565bca161 (patch) | |
tree | 4cbaebe20e7bdece959a1dcc0ba21420c8a23188 | |
parent | 37d2d01f8f3273e169e771ade6a843c68e5f7d16 (diff) |
Change Gitea user agent from the default to Gitea/Version
-rw-r--r-- | modules/activitypub/client.go | 1 | ||||
-rw-r--r-- | routers/api/v1/activitypub/reqsignature.go | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/modules/activitypub/client.go b/modules/activitypub/client.go index 923bc4ea4..738b1e473 100644 --- a/modules/activitypub/client.go +++ b/modules/activitypub/client.go @@ -104,6 +104,7 @@ func (c *Client) NewRequest(b []byte, to string) (req *http.Request, err error) } req.Header.Add("Content-Type", ActivityStreamsContentType) req.Header.Add("Date", CurrentTime()) + req.Header.Add("User-Agent", "Gitea/"+setting.AppVer) signer, _, err := httpsig.NewSigner(c.algs, c.digestAlg, c.postHeaders, httpsig.Signature, httpsigExpirationTime) if err != nil { return diff --git a/routers/api/v1/activitypub/reqsignature.go b/routers/api/v1/activitypub/reqsignature.go index 08e6b57e2..460368552 100644 --- a/routers/api/v1/activitypub/reqsignature.go +++ b/routers/api/v1/activitypub/reqsignature.go @@ -47,6 +47,7 @@ func getPublicKeyFromResponse(b []byte, keyID *url.URL) (p crypto.PublicKey, err func fetch(iri *url.URL) (b []byte, err error) { req := httplib.NewRequest(iri.String(), http.MethodGet) req.Header("Accept", activitypub.ActivityStreamsContentType) + req.Header("User-Agent", "Gitea/"+setting.AppVer) resp, err := req.Response() if err != nil { return |