Added ping endpoints to listener and added server bootstrap
This commit is contained in:
@@ -5,6 +5,13 @@ from core.execution.operation import buildOperation
|
||||
|
||||
def buildListener(listener, self):
|
||||
|
||||
if self.path == "/_matrix/app/v1/ping":
|
||||
self.send_response(200)
|
||||
self.send_header("Content-Type", "application/json")
|
||||
self.end_headers()
|
||||
self.wfile.write(b"{}")
|
||||
return
|
||||
|
||||
if self.path.startswith(listener.acceptpath):
|
||||
|
||||
#Prints can used buildlog for listener runtime
|
||||
@@ -25,27 +32,14 @@ def buildListener(listener, self):
|
||||
|
||||
|
||||
for item in outputs[listener.recursive["source"]]:
|
||||
#outputs[listener.recursive["label"]] = item
|
||||
|
||||
#print("DEBUG item selection")
|
||||
#print(listener.recursive["label"])
|
||||
#print(item)
|
||||
#print(outputs["event"])
|
||||
|
||||
if applyConditions(listener, item):
|
||||
continue
|
||||
|
||||
#if "state_key" in event:
|
||||
#continue
|
||||
#if event.get("sender") != "@lyncoln:loxthelion.com":
|
||||
#continue
|
||||
#if "com.loxthelion.rmass_message_id" in event.get("content", {}):
|
||||
#continue
|
||||
#if event.get("type") == "m.room.message":
|
||||
continue
|
||||
# Process and forward to RMASS
|
||||
|
||||
#outputs = buildOperation(listener.execute, outputs)
|
||||
#print(event)
|
||||
outputs, responses = buildOperation(listener.execute, outputs)
|
||||
|
||||
|
||||
|
||||
self.send_response(200)
|
||||
self.send_header("Content-Type", "application/json")
|
||||
|
||||
@@ -8,8 +8,9 @@ from core.runtime.outputs import buildOutput
|
||||
from core.runtime.resolver import resolveItem
|
||||
from plugins.rmass.listeners import synapselistener
|
||||
from plugins.rmass.operations import rmassmessagepush
|
||||
from core.execution.operation import buildOperation
|
||||
from core.execution.action import buildAction
|
||||
from core.server.createlistener import buildListener
|
||||
from plugins.rmass.actions import pingsynapse
|
||||
|
||||
port = int(os.environ.get("SERVER_PORT", 19001))
|
||||
|
||||
@@ -104,5 +105,7 @@ def startServer():
|
||||
server = HTTPServer(("0.0.0.0", port), RequestHandler)
|
||||
|
||||
print(f"Server listening on port {port}")
|
||||
#outputs = {}
|
||||
#outputs, response = buildAction(pingsynapse, outputs)
|
||||
|
||||
server.serve_forever()
|
||||
Reference in New Issue
Block a user