From 0c682d16aeed62b8e49e46e84bd26fc2384425ca Mon Sep 17 00:00:00 2001 From: terrill <314156936@qq.com> Date: Fri, 27 Jul 2018 11:04:09 +0800 Subject: [PATCH] linton --- .../matrix-org/dendrite/encryptoapi/routing/routing.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/github.com/matrix-org/dendrite/encryptoapi/routing/routing.go b/src/github.com/matrix-org/dendrite/encryptoapi/routing/routing.go index 4ec1b184d..9131345f0 100644 --- a/src/github.com/matrix-org/dendrite/encryptoapi/routing/routing.go +++ b/src/github.com/matrix-org/dendrite/encryptoapi/routing/routing.go @@ -24,6 +24,7 @@ import ( "github.com/matrix-org/dendrite/common" "github.com/matrix-org/dendrite/encryptoapi/storage" "github.com/matrix-org/util" + "github.com/matrix-org/dendrite/clientapi/auth" ) const pathPrefixUnstable = "/_matrix/client/unstable" @@ -34,29 +35,30 @@ func Setup( encryptionDB *storage.Database, deviceDB *devices.Database, ) { + dataDB := auth.DeviceDatabase(deviceDB) unstablemux := apiMux.PathPrefix(pathPrefixUnstable).Subrouter() unstablemux.Handle("/keys/upload/{deviceID}", - common.MakeAuthAPI("upload keys", deviceDB, func(req *http.Request, device *authtypes.Device) util.JSONResponse { + common.MakeAuthAPI("upload keys", dataDB, func(req *http.Request, device *authtypes.Device) util.JSONResponse { return UploadPKeys(req, encryptionDB, device.UserID, device.ID) }), ).Methods(http.MethodPost, http.MethodOptions) unstablemux.Handle("/keys/upload", - common.MakeAuthAPI("upload keys", deviceDB, func(req *http.Request, device *authtypes.Device) util.JSONResponse { + common.MakeAuthAPI("upload keys", dataDB, func(req *http.Request, device *authtypes.Device) util.JSONResponse { return UploadPKeys(req, encryptionDB, device.UserID, device.ID) }), ).Methods(http.MethodPost, http.MethodOptions) unstablemux.Handle("/keys/query", - common.MakeAuthAPI("query keys", deviceDB, func(req *http.Request, device *authtypes.Device) util.JSONResponse { + common.MakeAuthAPI("query keys", dataDB, func(req *http.Request, device *authtypes.Device) util.JSONResponse { //vars := mux.Vars(req) return QueryPKeys(req, encryptionDB, device.ID, deviceDB) }), ).Methods(http.MethodPost, http.MethodOptions) unstablemux.Handle("/keys/claim", - common.MakeAuthAPI("claim keys", deviceDB, func(req *http.Request, device *authtypes.Device) util.JSONResponse { + common.MakeAuthAPI("claim keys", dataDB, func(req *http.Request, device *authtypes.Device) util.JSONResponse { return ClaimOneTimeKeys(req, encryptionDB) }), ).Methods(http.MethodPost, http.MethodOptions)