mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-21 22:03:10 -06:00
Fix builds
This commit is contained in:
parent
96287ef5fd
commit
1492b08974
|
|
@ -18,7 +18,6 @@ import (
|
|||
"github.com/matrix-org/dendrite/federationsender"
|
||||
"github.com/matrix-org/dendrite/federationsender/api"
|
||||
"github.com/matrix-org/dendrite/internal/config"
|
||||
"github.com/matrix-org/dendrite/internal/httputil"
|
||||
"github.com/matrix-org/dendrite/internal/setup"
|
||||
"github.com/matrix-org/dendrite/keyserver"
|
||||
"github.com/matrix-org/dendrite/roomserver"
|
||||
|
|
@ -172,14 +171,6 @@ func (m *DendriteMonolith) Start() {
|
|||
}
|
||||
monolith.AddAllPublicRoutes(base.PublicAPIMux)
|
||||
|
||||
httputil.SetupHTTPAPI(
|
||||
base.BaseMux,
|
||||
base.PublicAPIMux,
|
||||
base.InternalAPIMux,
|
||||
&cfg.Global,
|
||||
base.UseHTTPAPIs,
|
||||
)
|
||||
|
||||
// Build both ends of a HTTP multiplex.
|
||||
m.httpServer = &http.Server{
|
||||
Addr: ":0",
|
||||
|
|
@ -190,7 +181,7 @@ func (m *DendriteMonolith) Start() {
|
|||
BaseContext: func(_ net.Listener) context.Context {
|
||||
return context.Background()
|
||||
},
|
||||
Handler: base.BaseMux,
|
||||
Handler: base.PublicAPIMux,
|
||||
}
|
||||
|
||||
go func() {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ import (
|
|||
"github.com/matrix-org/dendrite/eduserver"
|
||||
"github.com/matrix-org/dendrite/federationsender"
|
||||
"github.com/matrix-org/dendrite/internal/config"
|
||||
"github.com/matrix-org/dendrite/internal/httputil"
|
||||
"github.com/matrix-org/dendrite/internal/setup"
|
||||
"github.com/matrix-org/dendrite/keyserver"
|
||||
"github.com/matrix-org/dendrite/roomserver"
|
||||
|
|
@ -192,19 +191,11 @@ func main() {
|
|||
}
|
||||
monolith.AddAllPublicRoutes(base.Base.PublicAPIMux)
|
||||
|
||||
httputil.SetupHTTPAPI(
|
||||
base.Base.BaseMux,
|
||||
base.Base.PublicAPIMux,
|
||||
base.Base.InternalAPIMux,
|
||||
&cfg.Global,
|
||||
base.Base.UseHTTPAPIs,
|
||||
)
|
||||
|
||||
// Expose the matrix APIs directly rather than putting them under a /api path.
|
||||
go func() {
|
||||
httpBindAddr := fmt.Sprintf(":%d", *instancePort)
|
||||
logrus.Info("Listening on ", httpBindAddr)
|
||||
logrus.Fatal(http.ListenAndServe(httpBindAddr, base.Base.BaseMux))
|
||||
logrus.Fatal(http.ListenAndServe(httpBindAddr, base.Base.PublicAPIMux))
|
||||
}()
|
||||
// Expose the matrix APIs also via libp2p
|
||||
if base.LibP2P != nil {
|
||||
|
|
@ -217,7 +208,7 @@ func main() {
|
|||
defer func() {
|
||||
logrus.Fatal(listener.Close())
|
||||
}()
|
||||
logrus.Fatal(http.Serve(listener, base.Base.BaseMux))
|
||||
logrus.Fatal(http.Serve(listener, base.Base.PublicAPIMux))
|
||||
}()
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ import (
|
|||
"github.com/matrix-org/dendrite/federationsender/api"
|
||||
"github.com/matrix-org/dendrite/internal"
|
||||
"github.com/matrix-org/dendrite/internal/config"
|
||||
"github.com/matrix-org/dendrite/internal/httputil"
|
||||
"github.com/matrix-org/dendrite/internal/setup"
|
||||
"github.com/matrix-org/dendrite/keyserver"
|
||||
"github.com/matrix-org/dendrite/roomserver"
|
||||
|
|
@ -132,7 +131,7 @@ func main() {
|
|||
|
||||
rsComponent.SetFederationSenderAPI(fsAPI)
|
||||
|
||||
embed.Embed(base.BaseMux, *instancePort, "Yggdrasil Demo")
|
||||
embed.Embed(base.PublicAPIMux, *instancePort, "Yggdrasil Demo")
|
||||
|
||||
monolith := setup.Monolith{
|
||||
Config: base.Cfg,
|
||||
|
|
@ -157,14 +156,6 @@ func main() {
|
|||
}
|
||||
monolith.AddAllPublicRoutes(base.PublicAPIMux)
|
||||
|
||||
httputil.SetupHTTPAPI(
|
||||
base.BaseMux,
|
||||
base.PublicAPIMux,
|
||||
base.InternalAPIMux,
|
||||
&cfg.Global,
|
||||
base.UseHTTPAPIs,
|
||||
)
|
||||
|
||||
// Build both ends of a HTTP multiplex.
|
||||
httpServer := &http.Server{
|
||||
Addr: ":0",
|
||||
|
|
@ -175,7 +166,7 @@ func main() {
|
|||
BaseContext: func(_ net.Listener) context.Context {
|
||||
return context.Background()
|
||||
},
|
||||
Handler: base.BaseMux,
|
||||
Handler: base.PublicAPIMux,
|
||||
}
|
||||
|
||||
go func() {
|
||||
|
|
@ -185,7 +176,7 @@ func main() {
|
|||
go func() {
|
||||
httpBindAddr := fmt.Sprintf(":%d", *instancePort)
|
||||
logrus.Info("Listening on ", httpBindAddr)
|
||||
logrus.Fatal(http.ListenAndServe(httpBindAddr, base.BaseMux))
|
||||
logrus.Fatal(http.ListenAndServe(httpBindAddr, base.PublicAPIMux))
|
||||
}()
|
||||
go func() {
|
||||
logrus.Info("Sending wake-up message to known nodes")
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import (
|
|||
"fmt"
|
||||
"syscall/js"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/matrix-org/dendrite/appservice"
|
||||
"github.com/matrix-org/dendrite/currentstateserver"
|
||||
"github.com/matrix-org/dendrite/eduserver"
|
||||
|
|
@ -236,20 +237,16 @@ func main() {
|
|||
}
|
||||
monolith.AddAllPublicRoutes(base.PublicAPIMux)
|
||||
|
||||
httputil.SetupHTTPAPI(
|
||||
base.BaseMux,
|
||||
base.PublicAPIMux,
|
||||
base.InternalAPIMux,
|
||||
&cfg.Global,
|
||||
base.UseHTTPAPIs,
|
||||
)
|
||||
router := mux.NewRouter()
|
||||
router.PathPrefix(httputil.InternalPathPrefix).Handler(base.InternalAPIMux)
|
||||
router.PathPrefix(httputil.PublicPathPrefix).Handler(base.PublicAPIMux)
|
||||
|
||||
// Expose the matrix APIs via libp2p-js - for federation traffic
|
||||
if node != nil {
|
||||
go func() {
|
||||
logrus.Info("Listening on libp2p-js host ID ", node.Id)
|
||||
s := JSServer{
|
||||
Mux: base.BaseMux,
|
||||
Mux: base.PublicAPIMux,
|
||||
}
|
||||
s.ListenAndServe("p2p")
|
||||
}()
|
||||
|
|
@ -259,7 +256,7 @@ func main() {
|
|||
go func() {
|
||||
logrus.Info("Listening for service-worker fetch traffic")
|
||||
s := JSServer{
|
||||
Mux: base.BaseMux,
|
||||
Mux: router,
|
||||
}
|
||||
s.ListenAndServe("fetch")
|
||||
}()
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import (
|
|||
|
||||
"github.com/matrix-org/dendrite/federationapi"
|
||||
"github.com/matrix-org/dendrite/internal/config"
|
||||
"github.com/matrix-org/dendrite/internal/httputil"
|
||||
"github.com/matrix-org/dendrite/internal/setup"
|
||||
"github.com/matrix-org/dendrite/internal/test"
|
||||
"github.com/matrix-org/gomatrix"
|
||||
|
|
@ -33,14 +32,7 @@ func TestRoomsV3URLEscapeDoNot404(t *testing.T) {
|
|||
// TODO: This is pretty fragile, as if anything calls anything on these nils this test will break.
|
||||
// Unfortunately, it makes little sense to instantiate these dependencies when we just want to test routing.
|
||||
federationapi.AddPublicRoutes(base.PublicAPIMux, &cfg.FederationAPI, nil, nil, keyRing, nil, fsAPI, nil, nil, nil)
|
||||
httputil.SetupHTTPAPI(
|
||||
base.BaseMux,
|
||||
base.PublicAPIMux,
|
||||
base.InternalAPIMux,
|
||||
&cfg.Global,
|
||||
base.UseHTTPAPIs,
|
||||
)
|
||||
baseURL, cancel := test.ListenAndServe(t, base.BaseMux, true)
|
||||
baseURL, cancel := test.ListenAndServe(t, base.PublicAPIMux, true)
|
||||
defer cancel()
|
||||
serverName := gomatrixserverlib.ServerName(strings.TrimPrefix(baseURL, "https://"))
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,6 @@
|
|||
package httputil
|
||||
|
||||
const (
|
||||
PublicPathPrefix = "/_matrix"
|
||||
InternalPathPrefix = "/api"
|
||||
PublicPathPrefix = "/_matrix/"
|
||||
InternalPathPrefix = "/api/"
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue