2020-06-15 03:54:11 -05:00
|
|
|
// Copyright 2020 The Matrix.org Foundation C.I.C.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
package inthttp
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/gorilla/mux"
|
|
|
|
"github.com/matrix-org/dendrite/internal/httputil"
|
|
|
|
"github.com/matrix-org/dendrite/userapi/api"
|
|
|
|
)
|
|
|
|
|
2020-07-22 11:04:57 -05:00
|
|
|
// nolint: gocyclo
|
2020-06-15 03:54:11 -05:00
|
|
|
func AddRoutes(internalAPIMux *mux.Router, s api.UserInternalAPI) {
|
2022-02-10 04:27:26 -06:00
|
|
|
addRoutesLoginToken(internalAPIMux, s)
|
|
|
|
|
2022-08-11 09:29:33 -05:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
PerformAccountCreationPath,
|
|
|
|
httputil.MakeInternalRPCAPI("UserAPIPerformAccountCreation", s.PerformAccountCreation),
|
2020-06-16 11:39:56 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
PerformPasswordUpdatePath,
|
|
|
|
httputil.MakeInternalRPCAPI("UserAPIPerformPasswordUpdate", s.PerformPasswordUpdate),
|
2020-09-04 09:16:13 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
PerformDeviceCreationPath,
|
|
|
|
httputil.MakeInternalRPCAPI("UserAPIPerformDeviceCreation", s.PerformDeviceCreation),
|
2020-07-31 08:40:45 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
PerformLastSeenUpdatePath,
|
|
|
|
httputil.MakeInternalRPCAPI("UserAPIPerformLastSeenUpdate", s.PerformLastSeenUpdate),
|
2020-11-20 05:29:02 -06:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
PerformDeviceUpdatePath,
|
|
|
|
httputil.MakeInternalRPCAPI("UserAPIPerformDeviceUpdate", s.PerformDeviceUpdate),
|
2020-06-16 11:39:56 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
PerformDeviceDeletionPath,
|
|
|
|
httputil.MakeInternalRPCAPI("UserAPIPerformDeviceDeletion", s.PerformDeviceDeletion),
|
2020-07-30 12:00:56 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
PerformAccountDeactivationPath,
|
|
|
|
httputil.MakeInternalRPCAPI("UserAPIPerformAccountDeactivation", s.PerformAccountDeactivation),
|
2020-10-02 11:18:20 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
PerformOpenIDTokenCreationPath,
|
|
|
|
httputil.MakeInternalRPCAPI("UserAPIPerformOpenIDTokenCreation", s.PerformOpenIDTokenCreation),
|
2021-04-07 07:26:20 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
QueryProfilePath,
|
|
|
|
httputil.MakeInternalRPCAPI("UserAPIQueryProfile", s.QueryProfile),
|
2020-06-15 03:54:11 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
QueryAccessTokenPath,
|
|
|
|
httputil.MakeInternalRPCAPI("UserAPIQueryAccessToken", s.QueryAccessToken),
|
2020-06-16 08:10:55 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
QueryDevicesPath,
|
|
|
|
httputil.MakeInternalRPCAPI("UserAPIQueryDevices", s.QueryDevices),
|
2020-06-16 08:53:19 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
QueryAccountDataPath,
|
|
|
|
httputil.MakeInternalRPCAPI("UserAPIQueryAccountData", s.QueryAccountData),
|
2020-06-16 11:05:38 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
QueryDeviceInfosPath,
|
|
|
|
httputil.MakeInternalRPCAPI("UserAPIQueryDeviceInfos", s.QueryDeviceInfos),
|
2020-07-22 11:04:57 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
QuerySearchProfilesPath,
|
|
|
|
httputil.MakeInternalRPCAPI("UserAPIQuerySearchProfiles", s.QuerySearchProfiles),
|
2020-07-28 04:53:17 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
QueryOpenIDTokenPath,
|
|
|
|
httputil.MakeInternalRPCAPI("UserAPIQueryOpenIDToken", s.QueryOpenIDToken),
|
2021-04-07 07:26:20 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
InputAccountDataPath,
|
|
|
|
httputil.MakeInternalRPCAPI("UserAPIInputAccountData", s.InputAccountData),
|
2020-10-19 03:38:10 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
QueryKeyBackupPath,
|
|
|
|
httputil.MakeInternalRPCAPI("UserAPIQueryKeyBackup", s.QueryKeyBackup),
|
2021-12-03 11:18:35 -06:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
PerformKeyBackupPath,
|
|
|
|
httputil.MakeInternalRPCAPI("UserAPIPerformKeyBackup", s.PerformKeyBackup),
|
2021-12-03 11:18:35 -06:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
QueryNotificationsPath,
|
|
|
|
httputil.MakeInternalRPCAPI("UserAPIQueryNotifications", s.QueryNotifications),
|
2022-03-03 05:40:53 -06:00
|
|
|
)
|
|
|
|
|
2022-08-11 09:29:33 -05:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
PerformPusherSetPath,
|
|
|
|
httputil.MakeInternalRPCAPI("UserAPIPerformPusherSet", s.PerformPusherSet),
|
2022-03-03 05:40:53 -06:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
PerformPusherDeletionPath,
|
|
|
|
httputil.MakeInternalRPCAPI("UserAPIPerformPusherDeletion", s.PerformPusherDeletion),
|
2022-03-03 05:40:53 -06:00
|
|
|
)
|
|
|
|
|
2022-08-11 09:29:33 -05:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
QueryPushersPath,
|
|
|
|
httputil.MakeInternalRPCAPI("UserAPIQueryPushers", s.QueryPushers),
|
2022-03-03 05:40:53 -06:00
|
|
|
)
|
|
|
|
|
2022-08-11 09:29:33 -05:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
PerformPushRulesPutPath,
|
|
|
|
httputil.MakeInternalRPCAPI("UserAPIPerformPushRulesPut", s.PerformPushRulesPut),
|
2022-03-03 05:40:53 -06:00
|
|
|
)
|
|
|
|
|
2022-08-11 09:29:33 -05:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
QueryPushRulesPath,
|
|
|
|
httputil.MakeInternalRPCAPI("UserAPIQueryPushRules", s.QueryPushRules),
|
2022-03-03 05:40:53 -06:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
PerformSetAvatarURLPath,
|
|
|
|
httputil.MakeInternalRPCAPI("UserAPIPerformSetAvatarURL", s.SetAvatarURL),
|
2022-03-24 16:45:44 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
2022-11-11 10:41:37 -06:00
|
|
|
internalAPIMux.Handle(
|
|
|
|
QueryNumericLocalpartPath,
|
|
|
|
httputil.MakeInternalRPCAPI("UserAPIQueryNumericLocalpart", s.QueryNumericLocalpart),
|
2022-03-24 16:45:44 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
QueryAccountAvailabilityPath,
|
|
|
|
httputil.MakeInternalRPCAPI("UserAPIQueryAccountAvailability", s.QueryAccountAvailability),
|
2022-04-08 04:18:27 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
QueryAccountByPasswordPath,
|
|
|
|
httputil.MakeInternalRPCAPI("UserAPIQueryAccountByPassword", s.QueryAccountByPassword),
|
2022-03-24 16:45:44 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
PerformSetDisplayNamePath,
|
|
|
|
httputil.MakeInternalRPCAPI("UserAPISetDisplayName", s.SetDisplayName),
|
2022-03-24 16:45:44 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
QueryLocalpartForThreePIDPath,
|
|
|
|
httputil.MakeInternalRPCAPI("UserAPIQueryLocalpartForThreePID", s.QueryLocalpartForThreePID),
|
2022-03-24 16:45:44 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
QueryThreePIDsForLocalpartPath,
|
|
|
|
httputil.MakeInternalRPCAPI("UserAPIQueryThreePIDsForLocalpart", s.QueryThreePIDsForLocalpart),
|
2022-03-24 16:45:44 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
PerformForgetThreePIDPath,
|
|
|
|
httputil.MakeInternalRPCAPI("UserAPIPerformForgetThreePID", s.PerformForgetThreePID),
|
2022-03-24 16:45:44 -05:00
|
|
|
)
|
2022-08-11 09:29:33 -05:00
|
|
|
|
|
|
|
internalAPIMux.Handle(
|
|
|
|
PerformSaveThreePIDAssociationPath,
|
|
|
|
httputil.MakeInternalRPCAPI("UserAPIPerformSaveThreePIDAssociation", s.PerformSaveThreePIDAssociation),
|
2022-03-24 16:45:44 -05:00
|
|
|
)
|
2020-06-15 03:54:11 -05:00
|
|
|
}
|