Created
August 2, 2020 21:17
-
-
Save rymdolle/c062f79262d733bc11b1cb3547a6ba99 to your computer and use it in GitHub Desktop.
handler for .well-known/matrix/server
This file contains 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
from well_known.handler import matrix | |
__all__ = ["matrix"] |
This file contains 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
from twisted.web.resource import Resource | |
from twisted.web.server import Request | |
import synapse.module_api | |
def matrix(config, module_api: synapse.module_api.ModuleApi) -> Resource: | |
res = Resource() | |
res.putChild(b"server", MyResource(module_api)) | |
return res | |
def parse_config(config: dict): | |
return None | |
matrix.parse_config = parse_config | |
class MyResource(Resource): | |
def __init__(self, module_api: synapse.module_api.ModuleApi): | |
super().__init__() | |
self._module_api = module_api | |
def render_GET(self, request): | |
request.setHeader(b"Content-Type", b"application/json") | |
return b"""{"m.server": "rymdis.com:443"}""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment