mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-17 20:03:10 -06:00
Use hs_token when talking to appservice
This commit is contained in:
parent
0352f250b8
commit
ca1cb8fa9c
|
|
@ -180,10 +180,10 @@ func makeHTTPClient() *http.Client {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetupHTTP adds the AppServiceQueryPAI handlers to the http.ServeMux. This
|
// SetupHTTP adds the AppServiceQueryAPI 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(serveMux *http.ServeMux) {
|
||||||
servMux.Handle(
|
serveMux.Handle(
|
||||||
api.AppServiceRoomAliasExistsPath,
|
api.AppServiceRoomAliasExistsPath,
|
||||||
common.MakeInternalAPI("appserviceRoomAliasExists", func(req *http.Request) util.JSONResponse {
|
common.MakeInternalAPI("appserviceRoomAliasExists", func(req *http.Request) util.JSONResponse {
|
||||||
var request api.RoomAliasExistsRequest
|
var request api.RoomAliasExistsRequest
|
||||||
|
|
@ -197,7 +197,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(
|
serveMux.Handle(
|
||||||
api.AppServiceUserIDExistsPath,
|
api.AppServiceUserIDExistsPath,
|
||||||
common.MakeInternalAPI("appserviceUserIDExists", func(req *http.Request) util.JSONResponse {
|
common.MakeInternalAPI("appserviceUserIDExists", func(req *http.Request) util.JSONResponse {
|
||||||
var request api.UserIDExistsRequest
|
var request api.UserIDExistsRequest
|
||||||
|
|
|
||||||
|
|
@ -203,7 +203,7 @@ func send(
|
||||||
transaction []byte,
|
transaction []byte,
|
||||||
) error {
|
) error {
|
||||||
// POST a transaction to our AS
|
// POST a transaction to our AS
|
||||||
address := fmt.Sprintf("%s/transactions/%d", appservice.URL, txnID)
|
address := fmt.Sprintf("%s/transactions/%d?access_token=%s", appservice.URL, txnID, appservice.HSToken)
|
||||||
resp, err := client.Post(address, "application/json", bytes.NewBuffer(transaction))
|
resp, err := client.Post(address, "application/json", bytes.NewBuffer(transaction))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
||||||
2
go.mod
2
go.mod
|
|
@ -19,6 +19,8 @@ require (
|
||||||
github.com/matrix-org/util v0.0.0-20171127121716-2e2df66af2f5
|
github.com/matrix-org/util v0.0.0-20171127121716-2e2df66af2f5
|
||||||
github.com/mattn/go-sqlite3 v2.0.2+incompatible
|
github.com/mattn/go-sqlite3 v2.0.2+incompatible
|
||||||
github.com/miekg/dns v1.1.12 // indirect
|
github.com/miekg/dns v1.1.12 // indirect
|
||||||
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||||
|
github.com/modern-go/reflect2 v1.0.1 // indirect
|
||||||
github.com/nfnt/resize v0.0.0-20160724205520-891127d8d1b5
|
github.com/nfnt/resize v0.0.0-20160724205520-891127d8d1b5
|
||||||
github.com/opentracing/opentracing-go v1.0.2
|
github.com/opentracing/opentracing-go v1.0.2
|
||||||
github.com/pierrec/lz4 v2.4.1+incompatible // indirect
|
github.com/pierrec/lz4 v2.4.1+incompatible // indirect
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue