mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-04-10 13:53:40 +00:00
Add missing performKeyBackup endpoint
This commit is contained in:
parent
f3e46af0d6
commit
f8d481f25a
1 changed files with 14 additions and 0 deletions
|
@ -249,4 +249,18 @@ func AddRoutes(internalAPIMux *mux.Router, s api.UserInternalAPI) {
|
||||||
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
|
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
internalAPIMux.Handle(PerformKeyBackupPath,
|
||||||
|
httputil.MakeInternalAPI("performKeyBackup", func(req *http.Request) util.JSONResponse {
|
||||||
|
request := api.PerformKeyBackupRequest{}
|
||||||
|
response := api.PerformKeyBackupResponse{}
|
||||||
|
if err := json.NewDecoder(req.Body).Decode(&request); err != nil {
|
||||||
|
return util.MessageResponse(http.StatusBadRequest, err.Error())
|
||||||
|
}
|
||||||
|
s.PerformKeyBackup(req.Context(), &request, &response)
|
||||||
|
if response.Error != "" {
|
||||||
|
return util.ErrorResponse(fmt.Errorf("PerformKeyBackup: %s", response.Error))
|
||||||
|
}
|
||||||
|
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
|
||||||
|
}),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue