44 "crypto/ed25519"
55 "encoding/json"
66 "fmt"
7- "io/ioutil"
87 "log"
98 "net/http"
109 "time"
@@ -98,7 +97,7 @@ func SendJoinRequestsHandler(s *Server, w http.ResponseWriter, req *http.Request
9897 w .Write ([]byte ("complement: HandleMakeSendJoinRequests send_join cannot parse event JSON: " + err .Error ()))
9998 }
10099 // insert the join event into the room state
101- room .AddEvent (& event )
100+ room .AddEvent (event )
102101
103102 // return current state and auth chain
104103 b , err := json .Marshal (gomatrixserverlib.RespSendJoin {
@@ -204,12 +203,6 @@ func HandleEventRequests() func(*Server) {
204203func HandleKeyRequests () func (* Server ) {
205204 return func (srv * Server ) {
206205 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-
213206 keyFn := http .HandlerFunc (func (w http.ResponseWriter , req * http.Request ) {
214207 k := gomatrixserverlib.ServerKeys {}
215208 k .ServerName = gomatrixserverlib .ServerName (srv .ServerName )
@@ -220,7 +213,6 @@ func HandleKeyRequests() func(*Server) {
220213 },
221214 }
222215 k .OldVerifyKeys = map [gomatrixserverlib.KeyID ]gomatrixserverlib.OldVerifyKey {}
223- k .TLSFingerprints = fingerprintPEM (certData )
224216 k .ValidUntilTS = gomatrixserverlib .AsTimestamp (time .Now ().Add (24 * time .Hour ))
225217 toSign , err := json .Marshal (k .ServerKeyFields )
226218 if err != nil {
@@ -282,7 +274,7 @@ func HandleMediaRequests(mediaIds map[string]func(w http.ResponseWriter)) func(*
282274
283275// HandleTransactionRequests is an option which will process GET /_matrix/federation/v1/send/{transactionID} requests universally when requested.
284276// 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 ) {
286278 return func (srv * Server ) {
287279 srv .mux .Handle ("/_matrix/federation/v1/send/{transactionID}" , http .HandlerFunc (func (w http.ResponseWriter , req * http.Request ) {
288280 // Extract the transaction ID from the request vars
@@ -361,7 +353,7 @@ func HandleTransactionRequests(pduCallback func(gomatrixserverlib.Event), eduCal
361353 }
362354 roomVersion := gomatrixserverlib .RoomVersion (room .Version )
363355
364- var event gomatrixserverlib.Event
356+ var event * gomatrixserverlib.Event
365357 event , err = gomatrixserverlib .NewEventFromUntrustedJSON (pdu , roomVersion )
366358 if err != nil {
367359 // We were unable to verify or process this event.
@@ -375,7 +367,7 @@ func HandleTransactionRequests(pduCallback func(gomatrixserverlib.Event), eduCal
375367 }
376368
377369 // Store this PDU in the room's timeline
378- room .AddEvent (& event )
370+ room .AddEvent (event )
379371
380372 // Add this PDU as a success to the response
381373 response .PDUs [event .EventID ()] = gomatrixserverlib.PDUResult {}
0 commit comments