This commit is contained in:
Liang Ding 2022-06-18 09:55:52 +08:00
parent 8ba7cd3aa3
commit b885773a7e
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
7 changed files with 49 additions and 4 deletions

View file

@ -116,3 +116,18 @@ func initRepoKey(c *gin.Context) {
"key": hex.EncodeToString(model.Conf.Repo.Key),
}
}
func resetRepo(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
if err := model.ResetRepo(); nil != err {
ret.Code = -1
ret.Msg = fmt.Sprintf(model.Conf.Language(146), err.Error())
return
}
ret.Data = map[string]interface{}{
"key": hex.EncodeToString(model.Conf.Repo.Key),
}
}

View file

@ -248,6 +248,7 @@ func ServeAPI(ginServer *gin.Engine) {
ginServer.Handle("POST", "/api/bazaar/getBazaarPackageREAME", model.CheckAuth, getBazaarPackageREAME)
ginServer.Handle("POST", "/api/repo/initRepoKey", model.CheckAuth, initRepoKey)
ginServer.Handle("POST", "/api/repo/resetRepo", model.CheckAuth, resetRepo)
ginServer.Handle("POST", "/api/repo/importRepoKey", model.CheckAuth, importRepoKey)
ginServer.Handle("POST", "/api/repo/indexRepo", model.CheckAuth, indexRepo)
ginServer.Handle("POST", "/api/repo/checkoutRepo", model.CheckAuth, checkoutRepo)