Fix appservice and EDU server API setup, update sytest-whitelist

This commit is contained in:
Neil Alexander 2020-05-26 12:45:48 +01:00
parent da20f270c6
commit e8706983bb
5 changed files with 10 additions and 13 deletions

View file

@ -82,9 +82,7 @@ func SetupAppServiceAPIComponent(
Cfg: base.Cfg, Cfg: base.Cfg,
} }
if base.EnableHTTPAPIs { appserviceQueryAPI.SetupHTTP(base.InternalAPIMux)
appserviceQueryAPI.SetupHTTP(http.DefaultServeMux)
}
consumer := consumers.NewOutputRoomEventConsumer( consumer := consumers.NewOutputRoomEventConsumer(
base.Cfg, base.KafkaConsumer, accountsDB, appserviceDB, base.Cfg, base.KafkaConsumer, accountsDB, appserviceDB,

View file

@ -23,6 +23,7 @@ import (
"net/url" "net/url"
"time" "time"
"github.com/gorilla/mux"
"github.com/matrix-org/dendrite/appservice/api" "github.com/matrix-org/dendrite/appservice/api"
"github.com/matrix-org/dendrite/internal" "github.com/matrix-org/dendrite/internal"
"github.com/matrix-org/dendrite/internal/config" "github.com/matrix-org/dendrite/internal/config"
@ -182,8 +183,8 @@ func makeHTTPClient() *http.Client {
// SetupHTTP adds the AppServiceQueryPAI handlers to the http.ServeMux. This // SetupHTTP adds the AppServiceQueryPAI handlers to the http.ServeMux. This
// handles and muxes incoming api requests the to internal AppServiceQueryAPI. // handles and muxes incoming api requests the to internal AppServiceQueryAPI.
func (a *AppServiceQueryAPI) SetupHTTP(servMux *http.ServeMux) { func (a *AppServiceQueryAPI) SetupHTTP(internalAPIMux *mux.Router) {
servMux.Handle( internalAPIMux.Handle(
api.AppServiceRoomAliasExistsPath, api.AppServiceRoomAliasExistsPath,
internal.MakeInternalAPI("appserviceRoomAliasExists", func(req *http.Request) util.JSONResponse { internal.MakeInternalAPI("appserviceRoomAliasExists", func(req *http.Request) util.JSONResponse {
var request api.RoomAliasExistsRequest var request api.RoomAliasExistsRequest
@ -197,7 +198,7 @@ func (a *AppServiceQueryAPI) SetupHTTP(servMux *http.ServeMux) {
return util.JSONResponse{Code: http.StatusOK, JSON: &response} return util.JSONResponse{Code: http.StatusOK, JSON: &response}
}), }),
) )
servMux.Handle( internalAPIMux.Handle(
api.AppServiceUserIDExistsPath, api.AppServiceUserIDExistsPath,
internal.MakeInternalAPI("appserviceUserIDExists", func(req *http.Request) util.JSONResponse { internal.MakeInternalAPI("appserviceUserIDExists", func(req *http.Request) util.JSONResponse {
var request api.UserIDExistsRequest var request api.UserIDExistsRequest

View file

@ -13,8 +13,6 @@
package eduserver package eduserver
import ( import (
"net/http"
"github.com/matrix-org/dendrite/eduserver/api" "github.com/matrix-org/dendrite/eduserver/api"
"github.com/matrix-org/dendrite/eduserver/cache" "github.com/matrix-org/dendrite/eduserver/cache"
"github.com/matrix-org/dendrite/eduserver/input" "github.com/matrix-org/dendrite/eduserver/input"
@ -35,9 +33,7 @@ func SetupEDUServerComponent(
OutputTypingEventTopic: string(base.Cfg.Kafka.Topics.OutputTypingEvent), OutputTypingEventTopic: string(base.Cfg.Kafka.Topics.OutputTypingEvent),
} }
if base.EnableHTTPAPIs { inputAPI.SetupHTTP(base.InternalAPIMux)
inputAPI.SetupHTTP(http.DefaultServeMux)
}
return inputAPI return inputAPI
} }

View file

@ -19,6 +19,7 @@ import (
"time" "time"
"github.com/Shopify/sarama" "github.com/Shopify/sarama"
"github.com/gorilla/mux"
"github.com/matrix-org/dendrite/eduserver/api" "github.com/matrix-org/dendrite/eduserver/api"
"github.com/matrix-org/dendrite/eduserver/cache" "github.com/matrix-org/dendrite/eduserver/cache"
"github.com/matrix-org/dendrite/internal" "github.com/matrix-org/dendrite/internal"
@ -90,8 +91,8 @@ func (t *EDUServerInputAPI) sendEvent(ite *api.InputTypingEvent) error {
} }
// SetupHTTP adds the EDUServerInputAPI handlers to the http.ServeMux. // SetupHTTP adds the EDUServerInputAPI handlers to the http.ServeMux.
func (t *EDUServerInputAPI) SetupHTTP(servMux *http.ServeMux) { func (t *EDUServerInputAPI) SetupHTTP(internalAPIMux *mux.Router) {
servMux.Handle(api.EDUServerInputTypingEventPath, internalAPIMux.Handle(api.EDUServerInputTypingEventPath,
internal.MakeInternalAPI("inputTypingEvents", func(req *http.Request) util.JSONResponse { internal.MakeInternalAPI("inputTypingEvents", func(req *http.Request) util.JSONResponse {
var request api.InputTypingEventRequest var request api.InputTypingEventRequest
var response api.InputTypingEventResponse var response api.InputTypingEventResponse

View file

@ -289,3 +289,4 @@ Existing members see new members' join events
Inbound federation can receive events Inbound federation can receive events
Inbound federation can receive redacted events Inbound federation can receive redacted events
Can logout current device Can logout current device
Guest users can accept invites to private rooms over federation