Add the scan once api.

This commit is contained in:
lishuang 2021-01-02 16:15:50 +08:00
parent a2751deac6
commit e1e46457e7

View File

@ -51,6 +51,7 @@ func (this *PreferenceController) RegisterRoutes() map[string]func(writer http.R
routeMap["/api/preference/edit"] = this.Wrap(this.Edit, USER_ROLE_ADMINISTRATOR)
routeMap["/api/preference/edit/preview/config"] = this.Wrap(this.EditPreviewConfig, USER_ROLE_ADMINISTRATOR)
routeMap["/api/preference/edit/scan/config"] = this.Wrap(this.EditScanConfig, USER_ROLE_ADMINISTRATOR)
routeMap["/api/preference/scan/once"] = this.Wrap(this.ScanOnce, USER_ROLE_ADMINISTRATOR)
routeMap["/api/preference/system/cleanup"] = this.Wrap(this.SystemCleanup, USER_ROLE_ADMINISTRATOR)
return routeMap
@ -207,6 +208,13 @@ func (this *PreferenceController) EditScanConfig(writer http.ResponseWriter, req
return this.Success(preference)
}
//scan immediately according the current config.
func (this *PreferenceController) ScanOnce(writer http.ResponseWriter, request *http.Request) *result.WebResult {
this.taskService.doScanTask()
return this.Success("OK")
}
//cleanup system data.
func (this *PreferenceController) SystemCleanup(writer http.ResponseWriter, request *http.Request) *result.WebResult {