Use hs_token when talking to appservice

This commit is contained in:
Prateek Sachan 2020-02-24 02:09:29 +05:30
parent 0352f250b8
commit ca1cb8fa9c
3 changed files with 7 additions and 5 deletions

View file

@ -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.
func (a *AppServiceQueryAPI) SetupHTTP(servMux *http.ServeMux) {
servMux.Handle(
func (a *AppServiceQueryAPI) SetupHTTP(serveMux *http.ServeMux) {
serveMux.Handle(
api.AppServiceRoomAliasExistsPath,
common.MakeInternalAPI("appserviceRoomAliasExists", func(req *http.Request) util.JSONResponse {
var request api.RoomAliasExistsRequest
@ -197,7 +197,7 @@ func (a *AppServiceQueryAPI) SetupHTTP(servMux *http.ServeMux) {
return util.JSONResponse{Code: http.StatusOK, JSON: &response}
}),
)
servMux.Handle(
serveMux.Handle(
api.AppServiceUserIDExistsPath,
common.MakeInternalAPI("appserviceUserIDExists", func(req *http.Request) util.JSONResponse {
var request api.UserIDExistsRequest

View file

@ -203,7 +203,7 @@ func send(
transaction []byte,
) error {
// 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))
if err != nil {
return err

2
go.mod
View file

@ -19,6 +19,8 @@ require (
github.com/matrix-org/util v0.0.0-20171127121716-2e2df66af2f5
github.com/mattn/go-sqlite3 v2.0.2+incompatible
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/opentracing/opentracing-go v1.0.2
github.com/pierrec/lz4 v2.4.1+incompatible // indirect