1
0
Fork 0
forked from forgejo/forgejo

[PRIVACY] Add a DNS method to fetch new updates

- Use TXT records in order to determine the latest available version.
- This addresses a valid privacy issue, as with HTTP requests the server
can keep track(estimated) of how many instances are using Forgejo, with
DNS that's basically not possible as the server will never receive any
data, as the only ones receiving data are DNS resolvers.

(cherry picked from commit e68aaa0c16)
This commit is contained in:
Gusted 2023-01-27 01:07:33 +01:00 committed by Loïc Dachary
parent e4061e1010
commit 70cf3e76b8
No known key found for this signature in database
GPG key ID: 992D23B392F9E4F2
5 changed files with 76 additions and 10 deletions

View file

@ -147,7 +147,8 @@ func registerDeleteOldActions() {
func registerUpdateGiteaChecker() {
type UpdateCheckerConfig struct {
BaseConfig
HTTPEndpoint string
HTTPEndpoint string
DomainEndpoint string
}
RegisterTaskFatal("update_checker", &UpdateCheckerConfig{
BaseConfig: BaseConfig{
@ -155,10 +156,11 @@ func registerUpdateGiteaChecker() {
RunAtStart: false,
Schedule: "@every 168h",
},
HTTPEndpoint: "https://dl.gitea.io/gitea/version.json",
HTTPEndpoint: "https://dl.gitea.io/gitea/version.json",
DomainEndpoint: "release.forgejo.org",
}, func(ctx context.Context, _ *user_model.User, config Config) error {
updateCheckerConfig := config.(*UpdateCheckerConfig)
return updatechecker.GiteaUpdateChecker(updateCheckerConfig.HTTPEndpoint)
return updatechecker.GiteaUpdateChecker(updateCheckerConfig.HTTPEndpoint, updateCheckerConfig.DomainEndpoint)
})
}