create initial redlight_server_module.py script

This commit is contained in:
PC-Admin 2023-08-11 02:27:33 +08:00
parent 4e1dc12038
commit bc43794e40

View File

@ -1,27 +1,27 @@
import logging
from synapse.module_api import ModuleApi
from twisted.web.http import OK, NO_CONTENT
import json
from synapse.module_api import ModuleApi
from twisted.web import http
from twisted.internet import defer
from twisted.internet.defer import inlineCallbacks
from twisted.web.server import NOT_DONE_YET
from twisted.web.http import OK, NO_CONTENT
logger = logging.getLogger(__name__)
class AbuseLookupModule:
class RedlightServerModule:
def __init__(self, config: dict, api: ModuleApi):
self._api = api
# Register the abuse_lookup endpoint
api.register_web_resource(
"/_matrix/loj/v1/abuse_lookup",
AbuseLookupResource(self)
RedlightServerResource(self)
)
logger.info("AbuseLookupModule initialized.")
logger.info("RedlightServerModule initialized.")
class AbuseLookupResource:
class RedlightServerResource:
isLeaf = True
@ -97,5 +97,5 @@ class AbuseLookupResource:
def parse_config(config: dict) -> dict:
return config
def create_module(api: ModuleApi, config: dict) -> AbuseLookupModule:
return AbuseLookupModule(config, api)
def create_module(api: ModuleApi, config: dict) -> RedlightServerModule:
return RedlightServerModule(config, api)