Add simple update checker to Gitea (#17212)
* Add simple update checker to Gitea * update struct and remove comments * fix lint * Update custom/conf/app.example.ini * Update docs/content/doc/advanced/config-cheat-sheet.en-us.md Co-authored-by: delvh <[email protected]> * Update custom/conf/app.example.ini Co-authored-by: delvh <[email protected]> * Update docs/content/doc/advanced/config-cheat-sheet.en-us.md Co-authored-by: delvh <[email protected]> * Update docs/content/doc/advanced/config-cheat-sheet.en-us.md Co-authored-by: Steven <[email protected]> * Update docs/content/doc/advanced/config-cheat-sheet.en-us.md * Update modules/cron/tasks_extended.go Co-authored-by: wxiaoguang <[email protected]> * Update custom/conf/app.example.ini Co-authored-by: wxiaoguang <[email protected]> * take PR feedback into account and display banner on admin dashboard for alerts * Add more detailed message * placate lint * update per feedback Co-authored-by: delvh <[email protected]> Co-authored-by: Steven <[email protected]> Co-authored-by: 6543 <[email protected]> Co-authored-by: wxiaoguang <[email protected]>
This commit is contained in:
co-authored by
delvh
Steven
6543
wxiaoguang
parent
e18ea9e349
commit
8edda8b446
@@ -131,6 +131,24 @@ func registerDeleteOldActions() {
|
||||
})
|
||||
}
|
||||
|
||||
func registerUpdateGiteaChecker() {
|
||||
type UpdateCheckerConfig struct {
|
||||
BaseConfig
|
||||
HTTPEndpoint string
|
||||
}
|
||||
RegisterTaskFatal("update_checker", &UpdateCheckerConfig{
|
||||
BaseConfig: BaseConfig{
|
||||
Enabled: true,
|
||||
RunAtStart: false,
|
||||
Schedule: "@every 168h",
|
||||
},
|
||||
HTTPEndpoint: "https://dl.gitea.io/gitea/version.json",
|
||||
}, func(ctx context.Context, _ *models.User, config Config) error {
|
||||
updateCheckerConfig := config.(*UpdateCheckerConfig)
|
||||
return models.GiteaUpdateChecker(updateCheckerConfig.HTTPEndpoint)
|
||||
})
|
||||
}
|
||||
|
||||
func initExtendedTasks() {
|
||||
registerDeleteInactiveUsers()
|
||||
registerDeleteRepositoryArchives()
|
||||
@@ -142,4 +160,5 @@ func initExtendedTasks() {
|
||||
registerDeleteMissingRepositories()
|
||||
registerRemoveRandomAvatars()
|
||||
registerDeleteOldActions()
|
||||
registerUpdateGiteaChecker()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user