routing

package
v0.13.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 63 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidCaptcha  = errors.New("invalid captcha response")
	ErrMissingResponse = errors.New("captcha response is required")
	ErrCaptchaDisabled = errors.New("captcha registration is disabled")
)

Functions

func AdminCreateNewRegistrationToken added in v0.13.0

func AdminCreateNewRegistrationToken(req *http.Request, cfg *config.ClientAPI, userAPI userapi.ClientUserAPI) util.JSONResponse

func AdminDeleteRegistrationToken added in v0.13.0

func AdminDeleteRegistrationToken(req *http.Request, cfg *config.ClientAPI, userAPI userapi.ClientUserAPI) util.JSONResponse

func AdminDownloadState added in v0.10.5

func AdminDownloadState(req *http.Request, device *api.Device, rsAPI roomserverAPI.ClientRoomserverAPI) util.JSONResponse

func AdminEvacuateRoom added in v0.8.3

func AdminEvacuateRoom(req *http.Request, rsAPI roomserverAPI.ClientRoomserverAPI) util.JSONResponse

func AdminEvacuateUser added in v0.8.9

func AdminEvacuateUser(req *http.Request, rsAPI roomserverAPI.ClientRoomserverAPI) util.JSONResponse

func AdminGetRegistrationToken added in v0.13.0

func AdminGetRegistrationToken(req *http.Request, cfg *config.ClientAPI, userAPI userapi.ClientUserAPI) util.JSONResponse

func AdminListRegistrationTokens added in v0.13.0

func AdminListRegistrationTokens(req *http.Request, cfg *config.ClientAPI, userAPI userapi.ClientUserAPI) util.JSONResponse

func AdminMarkAsStale added in v0.10.0

func AdminMarkAsStale(req *http.Request, cfg *config.ClientAPI, keyAPI api.ClientKeyAPI) util.JSONResponse

func AdminPurgeRoom added in v0.11.0

func AdminPurgeRoom(req *http.Request, rsAPI roomserverAPI.ClientRoomserverAPI) util.JSONResponse

func AdminReindex added in v0.10.0

func AdminReindex(req *http.Request, cfg *config.ClientAPI, device *api.Device, natsClient *nats.Conn) util.JSONResponse

func AdminResetPassword added in v0.9.2

func AdminResetPassword(req *http.Request, cfg *config.ClientAPI, device *api.Device, userAPI api.ClientUserAPI) util.JSONResponse

func AdminUpdateRegistrationToken added in v0.13.0

func AdminUpdateRegistrationToken(req *http.Request, cfg *config.ClientAPI, userAPI userapi.ClientUserAPI) util.JSONResponse

func AuthFallback

func AuthFallback(
	w http.ResponseWriter, req *http.Request, authType string,
	cfg *config.ClientAPI,
)

AuthFallback implements GET and POST /auth/{authType}/fallback/web?session={sessionID}

func CheckAndSave3PIDAssociation

func CheckAndSave3PIDAssociation(
	req *http.Request, threePIDAPI api.ClientUserAPI, device *api.Device,
	cfg *config.ClientAPI, client *fclient.Client,
) util.JSONResponse

CheckAndSave3PIDAssociation implements POST /account/3pid

func ClaimKeys

func ClaimKeys(req *http.Request, keyAPI api.ClientKeyAPI) util.JSONResponse

func CreateKeyBackupVersion added in v0.5.0

func CreateKeyBackupVersion(req *http.Request, userAPI userapi.ClientUserAPI, device *userapi.Device) util.JSONResponse

Create a new key backup. Request must contain a `keyBackupVersion`. Returns a `keyBackupVersionCreateResponse`. Implements POST /_matrix/client/r0/room_keys/version

func CreateOpenIDToken added in v0.4.0

func CreateOpenIDToken(
	req *http.Request,
	userAPI api.ClientUserAPI,
	device *api.Device,
	userID string,
	cfg *config.ClientAPI,
) util.JSONResponse

CreateOpenIDToken creates a new OpenID Connect (OIDC) token that a Matrix user can supply to an OpenID Relying Party to verify their identity

func CreateRoom

CreateRoom implements /createRoom

func Deactivate

func Deactivate(
	req *http.Request,
	userInteractiveAuth *auth.UserInteractive,
	accountAPI api.ClientUserAPI,
	deviceAPI *api.Device,
) util.JSONResponse

Deactivate handles POST requests to /account/deactivate

func DeleteDeviceById

func DeleteDeviceById(
	req *http.Request, userInteractiveAuth *auth.UserInteractive, userAPI api.ClientUserAPI, device *api.Device,
	deviceID string,
) util.JSONResponse

DeleteDeviceById handles DELETE requests to /devices/{deviceId}

func DeleteDevices

func DeleteDevices(
	req *http.Request, userInteractiveAuth *auth.UserInteractive, userAPI api.ClientUserAPI, device *api.Device,
) util.JSONResponse

DeleteDevices handles POST requests to /delete_devices

func DeleteEventReport added in v0.13.7

func DeleteEventReport(req *http.Request, rsAPI roomserverAPI.ClientRoomserverAPI, reportID string) util.JSONResponse

func DeleteKeyBackupVersion added in v0.5.0

func DeleteKeyBackupVersion(req *http.Request, userAPI userapi.ClientUserAPI, device *userapi.Device, version string) util.JSONResponse

Delete a version of key backup. Version must not be empty. If the key backup was previously deleted, will return 200 OK. Implements DELETE /_matrix/client/r0/room_keys/version/{version}

func DeletePushRuleByRuleID added in v0.6.5

func DeletePushRuleByRuleID(ctx context.Context, scope, kind, ruleID string, device *userapi.Device, userAPI userapi.ClientUserAPI) util.JSONResponse

func DeleteTag

func DeleteTag(
	req *http.Request,
	userAPI api.ClientUserAPI,
	device *api.Device,
	userID string,
	roomID string,
	tag string,
	syncProducer *producers.SyncAPIProducer,
) util.JSONResponse

DeleteTag implements DELETE /_matrix/client/r0/user/{userID}/rooms/{roomID}/tags/{tag} Delete functionality works by obtaining the saved tags, removing the intended tag from the "map" and then saving the new "map" in the DB

func DirectoryRoom

func DirectoryRoom(
	req *http.Request,
	roomAlias string,
	federation fclient.FederationClient,
	cfg *config.ClientAPI,
	rsAPI roomserverAPI.ClientRoomserverAPI,
	fedSenderAPI federationAPI.ClientFederationAPI,
) util.JSONResponse

DirectoryRoom looks up a room alias

func Forget3PID

func Forget3PID(req *http.Request, threepidAPI api.ClientUserAPI) util.JSONResponse

Forget3PID implements POST /account/3pid/delete

func GetAccountData

func GetAccountData(
	req *http.Request, userAPI api.ClientUserAPI, device *api.Device,
	userID string, roomID string, dataType string,
) util.JSONResponse

GetAccountData implements GET /user/{userId}/[rooms/{roomid}/]account_data/{type}

func GetAdminWhois added in v0.3.1

func GetAdminWhois(
	req *http.Request, userAPI api.ClientUserAPI, device *api.Device,
	userID string,
) util.JSONResponse

GetAdminWhois implements GET /admin/whois/{userId}

func GetAliases added in v0.4.1

func GetAliases(
	req *http.Request, rsAPI api.ClientRoomserverAPI, device *userapi.Device, roomID string,
) util.JSONResponse

GetAliases implements GET /_matrix/client/r0/rooms/{roomId}/aliases

func GetAllPushRules added in v0.6.5

func GetAllPushRules(ctx context.Context, device *userapi.Device, userAPI userapi.ClientUserAPI) util.JSONResponse

func GetAssociated3PIDs

func GetAssociated3PIDs(
	req *http.Request, threepidAPI api.ClientUserAPI, device *api.Device,
) util.JSONResponse

GetAssociated3PIDs implements GET /account/3pid

func GetAvatarURL

func GetAvatarURL(
	req *http.Request, profileAPI userapi.ProfileAPI, cfg *config.ClientAPI,
	userID string, asAPI appserviceAPI.AppServiceInternalAPI,
	federation fclient.FederationClient,
) util.JSONResponse

GetAvatarURL implements GET /profile/{userID}/avatar_url

func GetBackupKeys added in v0.5.0

func GetBackupKeys(
	req *http.Request, userAPI userapi.ClientUserAPI, device *userapi.Device, version, roomID, sessionID string,
) util.JSONResponse

Get keys from a given backup version. Response returned varies depending on if roomID and sessionID are set.

func GetCapabilities

func GetCapabilities(rsAPI roomserverAPI.ClientRoomserverAPI) util.JSONResponse

GetCapabilities returns information about the server's supported feature set and other relevant capabilities to an authenticated user.

func GetDeviceByID

func GetDeviceByID(
	req *http.Request, userAPI api.ClientUserAPI, device *api.Device,
	deviceID string,
) util.JSONResponse

GetDeviceByID handles /devices/{deviceID}

func GetDevicesByLocalpart

func GetDevicesByLocalpart(
	req *http.Request, userAPI api.ClientUserAPI, device *api.Device,
) util.JSONResponse

GetDevicesByLocalpart handles /devices

func GetDisplayName

func GetDisplayName(
	req *http.Request, profileAPI userapi.ProfileAPI, cfg *config.ClientAPI,
	userID string, asAPI appserviceAPI.AppServiceInternalAPI,
	federation fclient.FederationClient,
) util.JSONResponse

GetDisplayName implements GET /profile/{userID}/displayname

func GetEventReport added in v0.13.7

func GetEventReport(req *http.Request, rsAPI roomserverAPI.ClientRoomserverAPI, reportID string) util.JSONResponse

func GetEventReports added in v0.13.7

func GetEventReports(
	req *http.Request,
	rsAPI roomserverAPI.ClientRoomserverAPI,
	from, limit uint64,
	backwards bool,
	userID, roomID string,
) util.JSONResponse

GetEventReports returns reported events for a given user/room.

func GetJoinedMembers added in v0.13.6

func GetJoinedMembers(
	req *http.Request, device *userapi.Device, roomID string,
	rsAPI api.ClientRoomserverAPI,
) util.JSONResponse

GetJoinedMembers implements

GET /rooms/{roomId}/joined_members

func GetJoinedRooms

func GetJoinedRooms(
	req *http.Request,
	device *userapi.Device,
	rsAPI api.ClientRoomserverAPI,
) util.JSONResponse

func GetNotifications added in v0.6.5

func GetNotifications(
	req *http.Request, device *userapi.Device,
	userAPI userapi.ClientUserAPI,
) util.JSONResponse

GetNotifications handles /_matrix/client/r0/notifications

func GetPostPublicRooms

func GetPostPublicRooms(
	req *http.Request, rsAPI roomserverAPI.ClientRoomserverAPI,
	extRoomsProvider api.ExtraPublicRoomsProvider,
	federation fclient.FederationClient,
	cfg *config.ClientAPI,
) util.JSONResponse

GetPostPublicRooms implements GET and POST /publicRooms

func GetPresence added in v0.8.0

func GetPresence(
	req *http.Request,
	device *api.Device,
	natsClient *nats.Conn,
	presenceTopic string,
	userID string,
) util.JSONResponse

func GetProfile

func GetProfile(
	req *http.Request, profileAPI userapi.ProfileAPI, cfg *config.ClientAPI,
	userID string,
	asAPI appserviceAPI.AppServiceInternalAPI,
	federation fclient.FederationClient,
) util.JSONResponse

GetProfile implements GET /profile/{userID}

func GetPushRuleAttrByRuleID added in v0.6.5

func GetPushRuleAttrByRuleID(ctx context.Context, scope, kind, ruleID, attr string, device *userapi.Device, userAPI userapi.ClientUserAPI) util.JSONResponse

func GetPushRuleByRuleID added in v0.6.5

func GetPushRuleByRuleID(ctx context.Context, scope, kind, ruleID string, device *userapi.Device, userAPI userapi.ClientUserAPI) util.JSONResponse

func GetPushRulesByKind added in v0.6.5

func GetPushRulesByKind(ctx context.Context, scope, kind string, device *userapi.Device, userAPI userapi.ClientUserAPI) util.JSONResponse

func GetPushRulesByScope added in v0.6.5

func GetPushRulesByScope(ctx context.Context, scope string, device *userapi.Device, userAPI userapi.ClientUserAPI) util.JSONResponse

func GetPushers added in v0.6.5

func GetPushers(
	req *http.Request, device *userapi.Device,
	userAPI userapi.ClientUserAPI,
) util.JSONResponse

GetPushers handles /_matrix/client/r0/pushers

func GetTags

func GetTags(
	req *http.Request,
	userAPI api.ClientUserAPI,
	device *api.Device,
	userID string,
	roomID string,
	syncProducer *producers.SyncAPIProducer,
) util.JSONResponse

GetTags implements GET /_matrix/client/r0/user/{userID}/rooms/{roomID}/tags

func GetVisibility

func GetVisibility(
	req *http.Request, rsAPI roomserverAPI.ClientRoomserverAPI,
	roomID string,
) util.JSONResponse

GetVisibility implements GET /directory/list/room/{roomID}

func JoinRoomByIDOrAlias

func JoinRoomByIDOrAlias(
	req *http.Request,
	device *api.Device,
	rsAPI roomserverAPI.ClientRoomserverAPI,
	profileAPI api.ClientUserAPI,
	roomIDOrAlias string,
) util.JSONResponse

func KeyBackupVersion added in v0.5.0

func KeyBackupVersion(req *http.Request, userAPI userapi.ClientUserAPI, device *userapi.Device, version string) util.JSONResponse

KeyBackupVersion returns the key backup version specified. If `version` is empty, the latest `keyBackupVersionResponse` is returned. Implements GET /_matrix/client/r0/room_keys/version and GET /_matrix/client/r0/room_keys/version/{version}

func LeaveRoomByID

func LeaveRoomByID(
	req *http.Request,
	device *api.Device,
	rsAPI roomserverAPI.ClientRoomserverAPI,
	roomID string,
) util.JSONResponse

func Location added in v0.10.7

func Location(req *http.Request, asAPI appserviceAPI.AppServiceInternalAPI, device *api.Device, protocol string, params url.Values) util.JSONResponse

Location implements

GET /_matrix/client/v3/thirdparty/location
GET /_matrix/client/v3/thirdparty/location/{protocol}

func Login

func Login(
	req *http.Request, userAPI userapi.ClientUserAPI,
	cfg *config.ClientAPI,
) util.JSONResponse

Login implements GET and POST /login

func Logout

func Logout(
	req *http.Request, userAPI api.ClientUserAPI, device *api.Device,
) util.JSONResponse

Logout handles POST /logout

func LogoutAll

func LogoutAll(
	req *http.Request, userAPI api.ClientUserAPI, device *api.Device,
) util.JSONResponse

LogoutAll handles POST /logout/all

func ModifyKeyBackupVersionAuthData added in v0.5.0

func ModifyKeyBackupVersionAuthData(req *http.Request, userAPI userapi.ClientUserAPI, device *userapi.Device, version string) util.JSONResponse

Modify the auth data of a key backup. Version must not be empty. Request must contain a `keyBackupVersion` Implements PUT /_matrix/client/r0/room_keys/version/{version}

func OnIncomingStateRequest

func OnIncomingStateRequest(ctx context.Context, device *userapi.Device, rsAPI api.ClientRoomserverAPI, roomID string) util.JSONResponse

OnIncomingStateRequest is called when a client makes a /rooms/{roomID}/state request. It will fetch all the state events from the specified room and will append the necessary keys to them if applicable before returning them. Returns an error if something went wrong in the process. TODO: Check if the user is in the room. If not, check if the room's history is publicly visible. Current behaviour is returning an empty array if the user cannot see the room's history.

func OnIncomingStateTypeRequest

func OnIncomingStateTypeRequest(
	ctx context.Context, device *userapi.Device, rsAPI api.ClientRoomserverAPI,
	roomID, evType, stateKey string, eventFormat bool,
) util.JSONResponse

OnIncomingStateTypeRequest is called when a client makes a /rooms/{roomID}/state/{type}/{statekey} request. It will look in current state to see if there is an event with that type and state key, if there is then (by default) we return the content, otherwise a 404. If eventFormat=true, sends the whole event else just the content.

func Password

func Password(
	req *http.Request,
	userAPI api.ClientUserAPI,
	device *api.Device,
	cfg *config.ClientAPI,
) util.JSONResponse

func PeekRoomByIDOrAlias

func PeekRoomByIDOrAlias(
	req *http.Request,
	device *api.Device,
	rsAPI roomserverAPI.ClientRoomserverAPI,
	roomIDOrAlias string,
) util.JSONResponse

func Protocols added in v0.10.7

func Protocols(req *http.Request, asAPI appserviceAPI.AppServiceInternalAPI, device *api.Device, protocol string) util.JSONResponse

Protocols implements

GET /_matrix/client/v3/thirdparty/protocols/{protocol}
GET /_matrix/client/v3/thirdparty/protocols

func PutPushRuleAttrByRuleID added in v0.6.5

func PutPushRuleAttrByRuleID(ctx context.Context, scope, kind, ruleID, attr string, body io.Reader, device *userapi.Device, userAPI userapi.ClientUserAPI) util.JSONResponse

func PutPushRuleByRuleID added in v0.6.5

func PutPushRuleByRuleID(ctx context.Context, scope, kind, ruleID, afterRuleID, beforeRuleID string, body io.Reader, device *userapi.Device, userAPI userapi.ClientUserAPI) util.JSONResponse

func PutTag

func PutTag(
	req *http.Request,
	userAPI api.ClientUserAPI,
	device *api.Device,
	userID string,
	roomID string,
	tag string,
	syncProducer *producers.SyncAPIProducer,
) util.JSONResponse

PutTag implements PUT /_matrix/client/r0/user/{userID}/rooms/{roomID}/tags/{tag} Put functionality works by getting existing data from the DB (if any), adding the tag to the "map" and saving the new "map" to the DB

func QueryKeys

func QueryKeys(req *http.Request, keyAPI api.ClientKeyAPI, device *api.Device) util.JSONResponse

func QueryRoomHierarchy added in v0.13.2

func QueryRoomHierarchy(req *http.Request, device *userapi.Device, roomIDStr string, rsAPI roomserverAPI.ClientRoomserverAPI, paginationCache *RoomHierarchyPaginationCache) util.JSONResponse

Query the hierarchy of a room/space

Implements /_matrix/client/v1/rooms/{roomID}/hierarchy

func RegisterAvailable

func RegisterAvailable(
	req *http.Request,
	cfg *config.ClientAPI,
	registerAPI userapi.ClientUserAPI,
) util.JSONResponse

RegisterAvailable checks if the username is already taken or invalid.

func RemoveLocalAlias

func RemoveLocalAlias(
	req *http.Request,
	device *userapi.Device,
	alias string,
	rsAPI roomserverAPI.ClientRoomserverAPI,
) util.JSONResponse

RemoveLocalAlias implements DELETE /directory/room/{roomAlias}

func ReportEvent added in v0.13.7

func ReportEvent(
	req *http.Request,
	device *userAPI.Device,
	roomID, eventID string,
	rsAPI api.ClientRoomserverAPI,
) util.JSONResponse

func RequestEmailToken

func RequestEmailToken(req *http.Request, threePIDAPI api.ClientUserAPI, cfg *config.ClientAPI, client *fclient.Client) util.JSONResponse

RequestEmailToken implements:

POST /account/3pid/email/requestToken
POST /register/email/requestToken

func RequestTurnServer

func RequestTurnServer(req *http.Request, device *api.Device, cfg *config.ClientAPI) util.JSONResponse

RequestTurnServer implements:

GET /voip/turnServer

func SaveAccountData

func SaveAccountData(
	req *http.Request, userAPI api.ClientUserAPI, device *api.Device,
	userID string, roomID string, dataType string, syncProducer *producers.SyncAPIProducer,
) util.JSONResponse

SaveAccountData implements PUT /user/{userId}/[rooms/{roomId}/]account_data/{type}

func SaveReadMarker added in v0.2.0

func SaveReadMarker(
	req *http.Request,
	userAPI api.ClientUserAPI, rsAPI roomserverAPI.ClientRoomserverAPI,
	syncProducer *producers.SyncAPIProducer, device *api.Device, roomID string,
) util.JSONResponse

SaveReadMarker implements POST /rooms/{roomId}/read_markers

func SearchUserDirectory

func SearchUserDirectory(
	ctx context.Context,
	device *userapi.Device,
	rsAPI api.ClientRoomserverAPI,
	provider userapi.QuerySearchProfilesAPI,
	searchString string,
	limit int,
	federation fclient.FederationClient,
	localServerName spec.ServerName,
) util.JSONResponse

func SendEvent

func SendEvent(
	req *http.Request,
	device *userapi.Device,
	roomID, eventType string, txnID, stateKey *string,
	cfg *config.ClientAPI,
	rsAPI api.ClientRoomserverAPI,
	txnCache *transactions.Cache,
) util.JSONResponse

SendEvent implements:

/rooms/{roomID}/send/{eventType}
/rooms/{roomID}/send/{eventType}/{txnID}
/rooms/{roomID}/state/{eventType}/{stateKey}

nolint: gocyclo

func SendForget added in v0.3.0

func SendForget(
	req *http.Request, device *userapi.Device,
	roomID string, rsAPI roomserverAPI.ClientRoomserverAPI,
) util.JSONResponse

func SendRedaction

func SendRedaction(
	req *http.Request, device *userapi.Device, roomID, eventID string, cfg *config.ClientAPI,
	rsAPI roomserverAPI.ClientRoomserverAPI,
	txnID *string,
	txnCache *transactions.Cache,
) util.JSONResponse

func SendServerNotice added in v0.6.4

func SendServerNotice(
	req *http.Request,
	cfgNotices *config.ServerNotices,
	cfgClient *config.ClientAPI,
	userAPI userapi.ClientUserAPI,
	rsAPI api.ClientRoomserverAPI,
	asAPI appserviceAPI.AppServiceInternalAPI,
	device *userapi.Device,
	senderDevice *userapi.Device,
	txnID *string,
	txnCache *transactions.Cache,
) util.JSONResponse

nolint:gocyclo SendServerNotice sends a message to a specific user. It can only be invoked by an admin.

func SendToDevice

func SendToDevice(
	req *http.Request, device *userapi.Device,
	syncProducer *producers.SyncAPIProducer,
	txnCache *transactions.Cache,
	eventType string, txnID *string,
) util.JSONResponse

SendToDevice handles PUT /_matrix/client/r0/sendToDevice/{eventType}/{txnId} sends the device events to the syncapi & federationsender

func SendTyping

func SendTyping(
	req *http.Request, device *userapi.Device, roomID string,
	userID string, rsAPI roomserverAPI.ClientRoomserverAPI,
	syncProducer *producers.SyncAPIProducer,
) util.JSONResponse

SendTyping handles PUT /rooms/{roomID}/typing/{userID} sends the typing events to client API typingProducer

func SetAvatarURL

func SetAvatarURL(
	req *http.Request, profileAPI userapi.ProfileAPI,
	device *userapi.Device, userID string, cfg *config.ClientAPI, rsAPI api.ClientRoomserverAPI,
) util.JSONResponse

SetAvatarURL implements PUT /profile/{userID}/avatar_url

func SetDisplayName

func SetDisplayName(
	req *http.Request, profileAPI userapi.ProfileAPI,
	device *userapi.Device, userID string, cfg *config.ClientAPI, rsAPI api.ClientRoomserverAPI,
) util.JSONResponse

SetDisplayName implements PUT /profile/{userID}/displayname

func SetLocalAlias

func SetLocalAlias(
	req *http.Request,
	device *userapi.Device,
	alias string,
	cfg *config.ClientAPI,
	rsAPI roomserverAPI.ClientRoomserverAPI,
) util.JSONResponse

SetLocalAlias implements PUT /directory/room/{roomAlias}

func SetPresence added in v0.8.0

func SetPresence(
	req *http.Request,
	cfg *config.ClientAPI,
	device *api.Device,
	producer *producers.SyncAPIProducer,
	userID string,
) util.JSONResponse

func SetPusher added in v0.6.5

func SetPusher(
	req *http.Request, device *userapi.Device,
	userAPI userapi.ClientUserAPI,
) util.JSONResponse

SetPusher handles /_matrix/client/r0/pushers/set This endpoint allows the creation, modification and deletion of pushers for this user ID. The behaviour of this endpoint varies depending on the values in the JSON body.

func SetReceipt added in v0.3.0

func SetReceipt(req *http.Request, userAPI userapi.ClientUserAPI, syncProducer *producers.SyncAPIProducer, device *userapi.Device, roomID, receiptType, eventID string) util.JSONResponse

func SetVisibility

func SetVisibility(
	req *http.Request, rsAPI roomserverAPI.ClientRoomserverAPI, dev *userapi.Device,
	roomID string,
) util.JSONResponse

SetVisibility implements PUT /directory/list/room/{roomID} TODO: Allow admin users to edit the room visibility

func SetVisibilityAS added in v0.10.5

func SetVisibilityAS(
	req *http.Request, rsAPI roomserverAPI.ClientRoomserverAPI, dev *userapi.Device,
	networkID, roomID string,
) util.JSONResponse

func Setup

func Setup(
	routers httputil.Routers,
	dendriteCfg *config.Dendrite,
	rsAPI roomserverAPI.ClientRoomserverAPI,
	asAPI appserviceAPI.AppServiceInternalAPI,
	userAPI userapi.ClientUserAPI,
	userDirectoryProvider userapi.QuerySearchProfilesAPI,
	federation fclient.FederationClient,
	syncProducer *producers.SyncAPIProducer,
	transactionsCache *transactions.Cache,
	federationSender federationAPI.ClientFederationAPI,
	extRoomsProvider api.ExtraPublicRoomsProvider,
	natsClient *nats.Conn, enableMetrics bool,
)

Setup registers HTTP handlers with the given ServeMux. It also supplies the given http.Client to clients which need to make outbound HTTP requests.

Due to Setup being used to call many other functions, a gocyclo nolint is applied: nolint: gocyclo

func UnpeekRoomByID added in v0.3.3

func UnpeekRoomByID(
	req *http.Request,
	device *api.Device,
	rsAPI roomserverAPI.ClientRoomserverAPI,
	roomID string,
) util.JSONResponse

func UpdateDeviceByID

func UpdateDeviceByID(
	req *http.Request, userAPI api.ClientUserAPI, device *api.Device,
	deviceID string,
) util.JSONResponse

UpdateDeviceByID handles PUT on /devices/{deviceID}

func UpgradeRoom added in v0.8.0

UpgradeRoom implements /upgrade

func UploadBackupKeys added in v0.5.0

func UploadBackupKeys(
	req *http.Request, userAPI userapi.ClientUserAPI, device *userapi.Device, version string, keys *keyBackupSessionRequest,
) util.JSONResponse

Upload a bunch of session keys for a given `version`.

func UploadCrossSigningDeviceKeys added in v0.5.0

func UploadCrossSigningDeviceKeys(
	req *http.Request, userInteractiveAuth *auth.UserInteractive,
	keyserverAPI api.ClientKeyAPI, device *api.Device,
	accountAPI api.ClientUserAPI, cfg *config.ClientAPI,
) util.JSONResponse

func UploadCrossSigningDeviceSignatures added in v0.5.0

func UploadCrossSigningDeviceSignatures(req *http.Request, keyserverAPI api.ClientKeyAPI, device *api.Device) util.JSONResponse

func UploadKeys

func UploadKeys(req *http.Request, keyAPI api.ClientKeyAPI, device *api.Device) util.JSONResponse

func User added in v0.10.7

func User(req *http.Request, asAPI appserviceAPI.AppServiceInternalAPI, device *api.Device, protocol string, params url.Values) util.JSONResponse

User implements

GET /_matrix/client/v3/thirdparty/user
GET /_matrix/client/v3/thirdparty/user/{protocol}

func UserIDIsWithinApplicationServiceNamespace

func UserIDIsWithinApplicationServiceNamespace(
	cfg *config.ClientAPI,
	userID string,
	appservice *config.ApplicationService,
) bool

UserIDIsWithinApplicationServiceNamespace checks to see if a given userID falls within any of the namespaces of a given Application Service. If no Application Service is given, it will check to see if it matches any Application Service's namespace.

func UsernameMatchesExclusiveNamespaces

func UsernameMatchesExclusiveNamespaces(
	cfg *config.ClientAPI,
	username string,
) bool

UsernameMatchesExclusiveNamespaces will check if a given username matches any application service's exclusive users namespace

func UsernameMatchesMultipleExclusiveNamespaces

func UsernameMatchesMultipleExclusiveNamespaces(
	cfg *config.ClientAPI,
	username string,
) bool

UsernameMatchesMultipleExclusiveNamespaces will check if a given username matches more than one exclusive namespace. More than one is not allowed

func Whoami

func Whoami(req *http.Request, device *api.Device) util.JSONResponse

Whoami implements `/account/whoami` which enables client to query their account user id. https://matrix.org/docs/spec/client_server/r0.3.0.html#get-matrix-client-r0-account-whoami

Types

type PublicRoomReq

type PublicRoomReq struct {
	Since              string `json:"since,omitempty"`
	Limit              int64  `json:"limit,omitempty"`
	Filter             filter `json:"filter,omitempty"`
	Server             string `json:"server,omitempty"`
	IncludeAllNetworks bool   `json:"include_all_networks,omitempty"`
	NetworkID          string `json:"third_party_instance_id,omitempty"`
}

type RoomHierarchyClientResponse added in v0.13.2

type RoomHierarchyClientResponse struct {
	Rooms     []fclient.RoomHierarchyRoom `json:"rooms"`
	NextBatch string                      `json:"next_batch,omitempty"`
}

Success response for /_matrix/client/v1/rooms/{roomID}/hierarchy

type RoomHierarchyPaginationCache added in v0.13.2

type RoomHierarchyPaginationCache struct {
	// contains filtered or unexported fields
}

For storing pagination information for room hierarchies

func NewRoomHierarchyPaginationCache added in v0.13.2

func NewRoomHierarchyPaginationCache() RoomHierarchyPaginationCache

Create a new, empty, pagination cache.

func (*RoomHierarchyPaginationCache) AddLine added in v0.13.2

Add a cache line to the pagination cache.

func (*RoomHierarchyPaginationCache) Get added in v0.13.2

Get a cached page, or nil if there is no associated page in the cache.

type SharedSecretRegistration added in v0.4.0

type SharedSecretRegistration struct {
	// contains filtered or unexported fields
}

func NewSharedSecretRegistration added in v0.4.0

func NewSharedSecretRegistration(sharedSecret string) *SharedSecretRegistration

func (*SharedSecretRegistration) GenerateNonce added in v0.4.0

func (r *SharedSecretRegistration) GenerateNonce() string

func (*SharedSecretRegistration) IsValidMacLogin added in v0.4.0

func (r *SharedSecretRegistration) IsValidMacLogin(
	nonce, username, password string,
	isAdmin bool,
	givenMac []byte,
) (bool, error)

type SharedSecretRegistrationRequest added in v0.4.0

type SharedSecretRegistrationRequest struct {
	User        string `json:"username"`
	Password    string `json:"password"`
	Nonce       string `json:"nonce"`
	MacBytes    []byte
	MacStr      string `json:"mac"`
	Admin       bool   `json:"admin"`
	DisplayName string `json:"displayname,omitempty"`
}

func NewSharedSecretRegistrationRequest added in v0.4.0

func NewSharedSecretRegistrationRequest(reader io.ReadCloser) (*SharedSecretRegistrationRequest, error)

type ThreePIDsResponse added in v0.13.0

type ThreePIDsResponse struct {
	ThreePIDs []authtypes.ThreePID `json:"threepids"`
}

type UserDirectoryResponse

type UserDirectoryResponse struct {
	Results []authtypes.FullyQualifiedProfile `json:"results"`
	Limited bool                              `json:"limited"`
}

type WellKnownClientHomeserver added in v0.13.3

type WellKnownClientHomeserver struct {
	BaseUrl string `json:"base_url"`
}

type WellKnownClientResponse added in v0.13.3

type WellKnownClientResponse struct {
	Homeserver       WellKnownClientHomeserver  `json:"m.homeserver"`
	SlidingSyncProxy *WellKnownSlidingSyncProxy `json:"org.matrix.msc3575.proxy,omitempty"`
}

type WellKnownSlidingSyncProxy added in v0.13.3

type WellKnownSlidingSyncProxy struct {
	Url string `json:"url"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL