Pass Gitea API token to requests

This allows to display repos that aren't fully public. Some users seem
to be very interested in not having their pages viewable, and it might
make even sense to avoid e.g. search engines to read them.
If set to some random user string, this could allow to set the
visibility at least to limited (so only logged users see the repo), and
should allow to view private repos in the future with another API token.
This commit is contained in:
fnetx 2021-11-26 04:06:17 +01:00
parent 418dbb7315
commit 772c17e214
No known key found for this signature in database
GPG key ID: 03870C95EE9F2661
4 changed files with 9 additions and 6 deletions

View file

@ -81,7 +81,7 @@ func checkCanonicalDomain(targetOwner, targetRepo, targetBranch, actualDomain st
}
} else {
req := fasthttp.AcquireRequest()
req.SetRequestURI(string(GiteaRoot) + "/api/v1/repos/" + targetOwner + "/" + targetRepo + "/raw/" + targetBranch + "/.domains")
req.SetRequestURI(string(GiteaRoot) + "/api/v1/repos/" + targetOwner + "/" + targetRepo + "/raw/" + targetBranch + "/.domains" + "?access_token=" + string(GiteaApiToken))
res := fasthttp.AcquireResponse()
err := upstreamClient.Do(req, res)