mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-31 13:22:46 +00:00
Fix rooms v3 url paths for good - with tests (#1130)
* Fix rooms v3 url paths for good - with tests - Add a test rig around `federationapi` to test routing. - Use `JSONVerifier` over `KeyRing` so we can stub things out more easily. - Add `test.NopJSONVerifier` which verifies nothing. - Add `base.BaseMux` which is the original `mux.Router` used to spawn public/internal routers. - Listen on `base.BaseMux` and not the default serve mux as it cleans paths which we don't want. - Factor out `ListenAndServe` to `test.ListenAndServe` and add flag for listening on TLS. * Fix comments * Linting
This commit is contained in:
parent
1aac317341
commit
7c36fb78a7
19 changed files with 228 additions and 76 deletions
|
@ -28,7 +28,7 @@ import (
|
|||
// JSServer exposes an HTTP-like server interface which allows JS to 'send' requests to it.
|
||||
type JSServer struct {
|
||||
// The router which will service requests
|
||||
Mux *http.ServeMux
|
||||
Mux http.Handler
|
||||
}
|
||||
|
||||
// OnRequestFromJS is the function that JS will invoke when there is a new request.
|
||||
|
|
|
@ -19,7 +19,6 @@ package main
|
|||
import (
|
||||
"crypto/ed25519"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"syscall/js"
|
||||
|
||||
"github.com/matrix-org/dendrite/appservice"
|
||||
|
@ -233,7 +232,7 @@ func main() {
|
|||
monolith.AddAllPublicRoutes(base.PublicAPIMux)
|
||||
|
||||
httputil.SetupHTTPAPI(
|
||||
http.DefaultServeMux,
|
||||
base.BaseMux,
|
||||
base.PublicAPIMux,
|
||||
base.InternalAPIMux,
|
||||
cfg,
|
||||
|
@ -245,7 +244,7 @@ func main() {
|
|||
go func() {
|
||||
logrus.Info("Listening on libp2p-js host ID ", node.Id)
|
||||
s := JSServer{
|
||||
Mux: http.DefaultServeMux,
|
||||
Mux: base.BaseMux,
|
||||
}
|
||||
s.ListenAndServe("p2p")
|
||||
}()
|
||||
|
@ -255,7 +254,7 @@ func main() {
|
|||
go func() {
|
||||
logrus.Info("Listening for service-worker fetch traffic")
|
||||
s := JSServer{
|
||||
Mux: http.DefaultServeMux,
|
||||
Mux: base.BaseMux,
|
||||
}
|
||||
s.ListenAndServe("fetch")
|
||||
}()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue