This repository was archived by the owner on Apr 12, 2024. It is now read-only.
  
  
  
  
    
    
    
      
    
  
  
    
File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 2525)
2626from  synapse .push  import  PusherConfigException 
2727from  synapse .rest .client .v2_alpha ._base  import  client_patterns 
28+ from  synapse .util  import  json_decoder , json_encoder 
2829
2930logger  =  logging .getLogger (__name__ )
3031
@@ -107,6 +108,18 @@ async def on_POST(self, request):
107108        logger .debug ("set pushkey %s to kind %s" , content ["pushkey" ], content ["kind" ])
108109        logger .debug ("Got pushers request with body: %r" , content )
109110
111+         # rewrite push url from m.org sygnal to Tchap sygnal 
112+         good_sygnal_url  =  None 
113+         if  content ["app_id" ].start_with ("fr.gouv.btchap" ):
114+             good_sygnal_url  =  "https://sygnal.preprod.tchap.gouv.fr" 
115+         if  content ["app_id" ].start_with ("fr.gouv.tchap" ):
116+             good_sygnal_url  =  "https://sygnal.tchap.gouv.fr" 
117+ 
118+         if  good_sygnal_url :
119+             parsed_data  =  json_decoder .decode (content ["data" ])
120+             parsed_data ["url" ] =  parsed_data ["url" ].replace ("https://matrix.org" , good_sygnal_url )
121+             content ["data" ] =  json_encoder .encode (parsed_data )
122+ 
110123        append  =  False 
111124        if  "append"  in  content :
112125            append  =  content ["append" ]
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments