4
4
"crypto/ed25519"
5
5
"encoding/json"
6
6
"fmt"
7
- "io/ioutil"
8
7
"log"
9
8
"net/http"
10
9
"time"
@@ -98,7 +97,7 @@ func SendJoinRequestsHandler(s *Server, w http.ResponseWriter, req *http.Request
98
97
w .Write ([]byte ("complement: HandleMakeSendJoinRequests send_join cannot parse event JSON: " + err .Error ()))
99
98
}
100
99
// insert the join event into the room state
101
- room .AddEvent (& event )
100
+ room .AddEvent (event )
102
101
103
102
// return current state and auth chain
104
103
b , err := json .Marshal (gomatrixserverlib.RespSendJoin {
@@ -204,12 +203,6 @@ func HandleEventRequests() func(*Server) {
204
203
func HandleKeyRequests () func (* Server ) {
205
204
return func (srv * Server ) {
206
205
keymux := srv .mux .PathPrefix ("/_matrix/key/v2" ).Subrouter ()
207
-
208
- certData , err := ioutil .ReadFile (srv .certPath )
209
- if err != nil {
210
- panic ("failed to read cert file: " + err .Error ())
211
- }
212
-
213
206
keyFn := http .HandlerFunc (func (w http.ResponseWriter , req * http.Request ) {
214
207
k := gomatrixserverlib.ServerKeys {}
215
208
k .ServerName = gomatrixserverlib .ServerName (srv .ServerName )
@@ -220,7 +213,6 @@ func HandleKeyRequests() func(*Server) {
220
213
},
221
214
}
222
215
k .OldVerifyKeys = map [gomatrixserverlib.KeyID ]gomatrixserverlib.OldVerifyKey {}
223
- k .TLSFingerprints = fingerprintPEM (certData )
224
216
k .ValidUntilTS = gomatrixserverlib .AsTimestamp (time .Now ().Add (24 * time .Hour ))
225
217
toSign , err := json .Marshal (k .ServerKeyFields )
226
218
if err != nil {
@@ -282,7 +274,7 @@ func HandleMediaRequests(mediaIds map[string]func(w http.ResponseWriter)) func(*
282
274
283
275
// HandleTransactionRequests is an option which will process GET /_matrix/federation/v1/send/{transactionID} requests universally when requested.
284
276
// pduCallback and eduCallback are functions that if non-nil will be called and passed each PDU or EDU event received in the transaction
285
- func HandleTransactionRequests (pduCallback func (gomatrixserverlib.Event ), eduCallback func (gomatrixserverlib.EDU )) func (* Server ) {
277
+ func HandleTransactionRequests (pduCallback func (* gomatrixserverlib.Event ), eduCallback func (gomatrixserverlib.EDU )) func (* Server ) {
286
278
return func (srv * Server ) {
287
279
srv .mux .Handle ("/_matrix/federation/v1/send/{transactionID}" , http .HandlerFunc (func (w http.ResponseWriter , req * http.Request ) {
288
280
// Extract the transaction ID from the request vars
@@ -361,7 +353,7 @@ func HandleTransactionRequests(pduCallback func(gomatrixserverlib.Event), eduCal
361
353
}
362
354
roomVersion := gomatrixserverlib .RoomVersion (room .Version )
363
355
364
- var event gomatrixserverlib.Event
356
+ var event * gomatrixserverlib.Event
365
357
event , err = gomatrixserverlib .NewEventFromUntrustedJSON (pdu , roomVersion )
366
358
if err != nil {
367
359
// We were unable to verify or process this event.
@@ -375,7 +367,7 @@ func HandleTransactionRequests(pduCallback func(gomatrixserverlib.Event), eduCal
375
367
}
376
368
377
369
// Store this PDU in the room's timeline
378
- room .AddEvent (& event )
370
+ room .AddEvent (event )
379
371
380
372
// Add this PDU as a success to the response
381
373
response .PDUs [event .EventID ()] = gomatrixserverlib.PDUResult {}
0 commit comments