Implement GET /rooms/{roomAlias} (#494)
* Query whether a room alias exists on app services Signed-off-by: Andrew Morgan <andrewm@matrix.org> * URL encode room alias before sending to AS * Add /room/ to path * Query AS /alias/ API at a lower level * Don't verify self-signed AS certificates * Don't skip cert validation on appservices, fix logging * Separate req.WithContext * Linting * Do not warn when an AS room alias does not exist
This commit is contained in:
parent
e05a31f4c2
commit
609646c19b
13 changed files with 247 additions and 105 deletions
|
|
@ -21,7 +21,7 @@ import (
|
|||
"github.com/matrix-org/dendrite/clientapi/httputil"
|
||||
"github.com/matrix-org/dendrite/clientapi/jsonerror"
|
||||
"github.com/matrix-org/dendrite/common/config"
|
||||
"github.com/matrix-org/dendrite/roomserver/api"
|
||||
roomserverAPI "github.com/matrix-org/dendrite/roomserver/api"
|
||||
"github.com/matrix-org/gomatrix"
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
"github.com/matrix-org/util"
|
||||
|
|
@ -32,7 +32,7 @@ func RoomAliasToID(
|
|||
httpReq *http.Request,
|
||||
federation *gomatrixserverlib.FederationClient,
|
||||
cfg config.Dendrite,
|
||||
aliasAPI api.RoomserverAliasAPI,
|
||||
aliasAPI roomserverAPI.RoomserverAliasAPI,
|
||||
) util.JSONResponse {
|
||||
roomAlias := httpReq.FormValue("room_alias")
|
||||
if roomAlias == "" {
|
||||
|
|
@ -52,8 +52,8 @@ func RoomAliasToID(
|
|||
var resp gomatrixserverlib.RespDirectory
|
||||
|
||||
if domain == cfg.Matrix.ServerName {
|
||||
queryReq := api.GetRoomIDForAliasRequest{Alias: roomAlias}
|
||||
var queryRes api.GetRoomIDForAliasResponse
|
||||
queryReq := roomserverAPI.GetRoomIDForAliasRequest{Alias: roomAlias}
|
||||
var queryRes roomserverAPI.GetRoomIDForAliasResponse
|
||||
if err = aliasAPI.GetRoomIDForAlias(httpReq.Context(), &queryReq, &queryRes); err != nil {
|
||||
return httputil.LogThenError(httpReq, err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue