- 
                Notifications
    You must be signed in to change notification settings 
- Fork 414
MSC4367: via routes in the published room directory #4367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Open
      
      
            Johennes
  wants to merge
  1
  commit into
  matrix-org:main
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
Johennes:johannes/public-rooms-via
  
      
      
   
  
    
  
  
  
 
  
      
    base: main
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
  
     Open
                    Changes from all commits
      Commits
    
    
  File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| # MSC4367: `via` routes in the published room directory | ||
|  | ||
| The [published room directory] allows clients to discover rooms on their own or other homeservers. | ||
| Naturally, clients will want to join rooms found in the directory which requires knowledge of a | ||
| resident server to facilitate the join. The spec doesn't make it clear how to find such a server, | ||
| however. | ||
|  | ||
| To begin with, it is unclear whether the endpoints for listing a server's directory may return rooms | ||
| that the server is not joined to. Additionally, there is no recommendation on what `via` parameter | ||
| clients should use when attempting to join rooms found in the directory. As a result, clients can | ||
| end up browsing published rooms without being able to join them.[^1] | ||
|  | ||
| This proposal addresses the situation by adding `via` values in the room directory responses. | ||
|  | ||
| ## Proposal | ||
|  | ||
| A new required property `via` is added on the `PublishedRoomsChunk` returned by | ||
|  | ||
| - [`GET /_matrix/client/v3/publicRooms`] | ||
| - [`POST /_matrix/client/v3/publicRooms`] | ||
| - [`GET /_matrix/federation/v1/publicRooms`] | ||
| - [`POST /_matrix/federation/v1/publicRooms`] | ||
|  | ||
| ``` json5 | ||
| { | ||
| "chunk": [ | ||
| { | ||
| "avatar_url": "mxc://bleecker.street/CHEDDARandBRIE", | ||
| "room_id": "!ol19s:bleecker.street", | ||
| "via": [ "bleecker.street" ], | ||
| ... | ||
| } | ||
| ] | ||
| } | ||
| ``` | ||
|  | ||
| Servers MUST populate `via` with at least one resident server of the room or, if they cannot | ||
| determine any, omit the room from their response. | ||
|  | ||
| Clients SHOULD include the values provided in `via` when subsequently joining rooms with | ||
| [`POST /_matrix/client/v3/join/{roomIdOrAlias}`]. | ||
|  | ||
| Together, the changes above increase the chances that clients can actually join rooms found in the | ||
| directory. | ||
|  | ||
| ## Potential issues | ||
|  | ||
| None. | ||
|  | ||
| ## Alternatives | ||
|  | ||
| [MSC4366] deals with the same problem by forbidding unroutable rooms from the local directory. This | ||
| is only a partial solution, however. | ||
|  | ||
| ## Security considerations | ||
|  | ||
| None. | ||
|  | ||
| ## Unstable prefix | ||
|  | ||
| While this MSC is not considered stable, `via` should be referred to as `org.matrix.msc4367.via`. | ||
|  | ||
| ## Dependencies | ||
|  | ||
| None. | ||
|  | ||
| [^1]: These issues were initially raised in <https://github.com/matrix-org/matrix-spec/issues/1375>. | ||
|  | ||
| [published room directory]: https://spec.matrix.org/v1.16/client-server-api/#published-room-directory | ||
| [`GET /_matrix/client/v3/publicRooms`]: https://spec.matrix.org/v1.16/client-server-api/#get_matrixclientv3publicrooms | ||
| [`POST /_matrix/client/v3/publicRooms`]: https://spec.matrix.org/v1.16/client-server-api/#post_matrixclientv3publicrooms | ||
| [`GET /_matrix/federation/v1/publicRooms`]: https://spec.matrix.org/v1.16/server-server-api/#get_matrixfederationv1publicrooms | ||
| [`POST /_matrix/federation/v1/publicRooms`]: https://spec.matrix.org/v1.16/server-server-api/#post_matrixfederationv1publicrooms | ||
| [`POST /_matrix/client/v3/join/{roomIdOrAlias}`]: https://spec.matrix.org/v1.16/client-server-api/#post_matrixclientv3joinroomidoralias | ||
| [MSC4366]: https://github.com/matrix-org/matrix-spec-proposals/pull/4366 | 
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implementation requirements:
viain both APIs, and passes it through in the C-S API when querying a remote serverviafor/joincallsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Implemented into Vona: https://foundry.fsky.io/vel/matrix-vona/src/branch/master/vona/globals/__init__.py#L258-L272