revision last conflict

This commit is contained in:
terrill 2018-07-27 10:21:54 +08:00
parent 3ce007c3f8
commit 9d391f54f2
2 changed files with 7 additions and 7 deletions

View file

@ -37,13 +37,13 @@ func Setup(
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", nil, 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", nil, func(req *http.Request, device *authtypes.Device) util.JSONResponse {
return UploadPKeys(req, encryptionDB, device.UserID, device.ID)
}),
).Methods(http.MethodPost, http.MethodOptions)
@ -56,7 +56,7 @@ func Setup(
).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", nil, func(req *http.Request, device *authtypes.Device) util.JSONResponse {
return ClaimOneTimeKeys(req, encryptionDB)
}),
).Methods(http.MethodPost, http.MethodOptions)

View file

@ -34,21 +34,21 @@ func Setup(apiMux *mux.Router, srp *sync.RequestPool, syncDB *storage.SyncServer
r0mux := apiMux.PathPrefix(pathPrefixR0).Subrouter()
unstablemux := apiMux.PathPrefix(pathPrefixUnstable).Subrouter()
r0mux.Handle("/sync", common.MakeAuthAPI("sync", nil, func(req *http.Request, device *authtypes.Device) util.JSONResponse {
r0mux.Handle("/sync", common.MakeAuthAPI("sync", deviceDB, func(req *http.Request, device *authtypes.Device) util.JSONResponse {
return srp.OnIncomingSyncRequest(req, device)
})).Methods(http.MethodGet, http.MethodOptions)
r0mux.Handle("/rooms/{roomID}/state", common.MakeAuthAPI("room_state", nil, func(req *http.Request, device *authtypes.Device) util.JSONResponse {
r0mux.Handle("/rooms/{roomID}/state", common.MakeAuthAPI("room_state", deviceDB, func(req *http.Request, device *authtypes.Device) util.JSONResponse {
vars := mux.Vars(req)
return OnIncomingStateRequest(req, syncDB, vars["roomID"])
})).Methods(http.MethodGet, http.MethodOptions)
r0mux.Handle("/rooms/{roomID}/state/{type}", common.MakeAuthAPI("room_state", nil, func(req *http.Request, device *authtypes.Device) util.JSONResponse {
r0mux.Handle("/rooms/{roomID}/state/{type}", common.MakeAuthAPI("room_state", deviceDB, func(req *http.Request, device *authtypes.Device) util.JSONResponse {
vars := mux.Vars(req)
return OnIncomingStateTypeRequest(req, syncDB, vars["roomID"], vars["type"], "")
})).Methods(http.MethodGet, http.MethodOptions)
r0mux.Handle("/rooms/{roomID}/state/{type}/{stateKey}", common.MakeAuthAPI("room_state", nil, func(req *http.Request, device *authtypes.Device) util.JSONResponse {
r0mux.Handle("/rooms/{roomID}/state/{type}/{stateKey}", common.MakeAuthAPI("room_state", deviceDB, func(req *http.Request, device *authtypes.Device) util.JSONResponse {
vars := mux.Vars(req)
return OnIncomingStateTypeRequest(req, syncDB, vars["roomID"], vars["type"], vars["stateKey"])
})).Methods(http.MethodGet, http.MethodOptions)