Fixed HTML message formatting, Extended resolver for get, construct and transform functions, Added entire message history with aliasing for personal matrix account
This commit is contained in:
Binary file not shown.
@@ -7,7 +7,7 @@ def buildAction (action, outputs):
|
||||
|
||||
if hasattr(action, "recursive"):
|
||||
items = outputs[action.recursive["source"]]
|
||||
reverse = action.recursive.get("reversed", False)
|
||||
reverse = action.recursive.get("reverse", False)
|
||||
|
||||
if reverse:
|
||||
items = reversed(items)
|
||||
|
||||
Binary file not shown.
@@ -1,11 +1,29 @@
|
||||
def resolveItem(action, item):
|
||||
resolved = {}
|
||||
if hasattr(action, "resolve"):
|
||||
for label, keys in action.resolve.items():
|
||||
for label, keys in action.resolve["get"].items():
|
||||
target = item
|
||||
|
||||
for key in keys:
|
||||
target = target[key]
|
||||
|
||||
resolved[label] = target
|
||||
if "construct" in action.resolve:
|
||||
for label2, piece in action.resolve["construct"].items():
|
||||
constructed = ""
|
||||
|
||||
for item in piece:
|
||||
if isinstance(item, dict):
|
||||
for key, value in item.items():
|
||||
item = resolved[value]
|
||||
|
||||
constructed += str(item)
|
||||
|
||||
resolved[label2] = constructed
|
||||
if "transform" in action.resolve:
|
||||
for source, mutation in action.resolve["transform"].items():
|
||||
for key, value in mutation.items():
|
||||
if resolved[source] == key:
|
||||
resolved[source] = value
|
||||
|
||||
return resolved
|
||||
|
||||
Binary file not shown.
+21
-4
@@ -8,7 +8,28 @@ from .createresponse import buildResponse
|
||||
|
||||
port = int(os.environ.get("SERVER_PORT", 19001))
|
||||
|
||||
from http.server import HTTPServer, BaseHTTPRequestHandler
|
||||
|
||||
class RequestHandler(BaseHTTPRequestHandler):
|
||||
def do_POST(self):
|
||||
print("POST request received")
|
||||
|
||||
self.send_response(200)
|
||||
self.send_header("Content-Type", "application/json")
|
||||
self.end_headers()
|
||||
|
||||
self.wfile.write(b'{"status": "ok"}')
|
||||
|
||||
def startServer():
|
||||
server = HTTPServer(("127.0.0.1", port), RequestHandler)
|
||||
|
||||
print(f"Server listening on port {port}")
|
||||
|
||||
server.serve_forever()
|
||||
|
||||
|
||||
|
||||
def startServer2():
|
||||
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
|
||||
server.bind(("0.0.0.0", port))
|
||||
@@ -22,10 +43,6 @@ def startServer():
|
||||
print("Accepting connections")
|
||||
connection.settimeout(30)
|
||||
|
||||
class RequestHandler(BaseHTTPRequestHandler):
|
||||
def do_POST(self):
|
||||
print("POST request received")
|
||||
|
||||
try:
|
||||
while True:
|
||||
data = connection.recv(4096)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -8,18 +8,15 @@ method = "GET"
|
||||
|
||||
#Used to resolve path for recursive handling. Path location must match the location of the recursiveset data from pullmessage operation
|
||||
resolve = {
|
||||
"get": {
|
||||
"path": ["messageheaders", "id"],
|
||||
}
|
||||
}
|
||||
|
||||
#To add resolution suffix, second item must be a dictionary. References the "path" library under resolved
|
||||
path = [
|
||||
"https://rentmasseur.com/api/v1/mailbox/",
|
||||
{"resolved": "path"},
|
||||
#{
|
||||
# "output": "id",
|
||||
# #"keys": [0, "id"]
|
||||
# "keys": "id"
|
||||
#}
|
||||
]
|
||||
|
||||
headers = {
|
||||
@@ -41,8 +38,8 @@ select = {
|
||||
"value": False,
|
||||
},
|
||||
"exclude": {
|
||||
"key": "senderId",
|
||||
"value": 238302,
|
||||
"key": {},
|
||||
"value": {},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,8 +18,6 @@ headers = {
|
||||
},
|
||||
}
|
||||
|
||||
#domainname="rentmasseur.com"
|
||||
|
||||
cookies = {
|
||||
"accessToken": {
|
||||
"output": "access_token",
|
||||
|
||||
@@ -7,11 +7,14 @@ kind = "action"
|
||||
showstatus = True
|
||||
|
||||
resolve = {
|
||||
"get": {
|
||||
"sender": ["messages", 0, "senderId"],
|
||||
"space_id": ["space_id"],
|
||||
"username": ["profile", "username"],
|
||||
"room_id": ["dmroom_id"],
|
||||
},
|
||||
}
|
||||
|
||||
keys = [
|
||||
{
|
||||
"keytitle": "via",
|
||||
|
||||
@@ -9,9 +9,19 @@ showstatus = True
|
||||
astoken = os.environ["AS_TOKEN"]
|
||||
|
||||
resolve = {
|
||||
"get": {
|
||||
"sender": ["messages", 0, "senderId"],
|
||||
"username": ["profile", "username"],
|
||||
},
|
||||
"construct": {
|
||||
"matrixuser": [
|
||||
"@rmass_",
|
||||
{"resolved": "sender"},
|
||||
":loxthelion.com",
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
keys = [
|
||||
{
|
||||
"keytitle": "displayname",
|
||||
@@ -24,11 +34,10 @@ keys = [
|
||||
method = "PUT"
|
||||
|
||||
path = [
|
||||
"https://loxthelion.com/_matrix/client/v3/profile/@rmass_",
|
||||
{"resolved": "sender"},
|
||||
":loxthelion.com/displayname?user_id=@rmass_",
|
||||
{"resolved": "sender"},
|
||||
":loxthelion.com"
|
||||
"https://loxthelion.com/_matrix/client/v3/profile/",
|
||||
{"resolved": "matrixuser"},
|
||||
"/displayname?user_id=",
|
||||
{"resolved": "matrixuser"},
|
||||
]
|
||||
|
||||
headers = {
|
||||
|
||||
@@ -7,8 +7,21 @@ kind = "action"
|
||||
showstatus = True
|
||||
|
||||
resolve = {
|
||||
"get": {
|
||||
"sender": ["messages", 0, "senderId"],
|
||||
"username": ["profile", "username"],
|
||||
},
|
||||
"construct": {
|
||||
"matrixuser": [
|
||||
"@rmass_",
|
||||
{"resolved": "sender"},
|
||||
":loxthelion.com",
|
||||
],
|
||||
"matrixdm": [
|
||||
"rmass_dm_",
|
||||
{"resolved": "sender"},
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
keys = [
|
||||
@@ -21,8 +34,7 @@ keys = [
|
||||
{
|
||||
"keytitle": "room_alias_name",
|
||||
"keyvalue": {
|
||||
"resolved": "sender",
|
||||
"prefix": "rmass_dm_",
|
||||
"resolved": "matrixdm",
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -55,9 +67,9 @@ keys = [
|
||||
method = "POST"
|
||||
|
||||
path = [
|
||||
"https://loxthelion.com/_matrix/client/v3/createRoom?user_id=@rmass_",
|
||||
{"resolved": "sender"},
|
||||
":loxthelion.com",
|
||||
"https://loxthelion.com/_matrix/client/v3/createRoom?user_id=",
|
||||
{"resolved": "matrixuser"},
|
||||
#":loxthelion.com",
|
||||
]
|
||||
|
||||
headers = {
|
||||
|
||||
@@ -7,11 +7,19 @@ kind = "action"
|
||||
showstatus = True
|
||||
|
||||
resolve = {
|
||||
"sender": ["messages", 0, "senderId"],
|
||||
#"messageid": ["message", "id"],
|
||||
"username": ["profile", "username"],
|
||||
"get": {
|
||||
#"sender": ["messages", 0, "senderId"],
|
||||
#"username": ["profile", "username"],
|
||||
"locationname": ["profile", "location"],
|
||||
"locationcode": ["profile", "searchCity"],
|
||||
},
|
||||
"construct": {
|
||||
"matrixspacealias": [
|
||||
"rmass_space_",
|
||||
{"resolved": "locationcode"},
|
||||
#"%3Aloxthelion.com",
|
||||
],
|
||||
},
|
||||
}
|
||||
keys = [
|
||||
{
|
||||
@@ -23,8 +31,8 @@ keys = [
|
||||
{
|
||||
"keytitle": "room_alias_name",
|
||||
"keyvalue": {
|
||||
"resolved": "locationcode",
|
||||
"prefix": "rmass_space_",
|
||||
"resolved": "matrixspacealias",
|
||||
#"prefix": "rmass_space_",
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -46,7 +54,7 @@ keys = [
|
||||
#"keyvalue": {
|
||||
#"users": {
|
||||
#"@lyncoln:loxthelion.com": 100,
|
||||
#"@rmass_:loxthelion.com": 100,
|
||||
#"@rmass_*:loxthelion.com": 100,
|
||||
#},
|
||||
#},
|
||||
#}
|
||||
@@ -55,9 +63,6 @@ keys = [
|
||||
method = "POST"
|
||||
|
||||
path = [
|
||||
#"https://loxthelion.com/_matrix/client/v3/createRoom?user_id=@rmass_",
|
||||
#{"resolved": "sender"},
|
||||
#":loxthelion.com",
|
||||
"https://loxthelion.com/_matrix/client/v3/createRoom?user_id=@rmass_bridge:loxthelion.com"
|
||||
]
|
||||
|
||||
|
||||
@@ -7,15 +7,23 @@ kind = "action"
|
||||
showstatus = True
|
||||
|
||||
resolve = {
|
||||
"get": {
|
||||
"sender": ["messages", 0, "senderId"],
|
||||
},
|
||||
"construct": {
|
||||
"matrixdm": [
|
||||
"%23rmass_dm_",
|
||||
{"resolved": "sender"},
|
||||
"%3Aloxthelion.com",
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
method = "GET"
|
||||
|
||||
path = [
|
||||
"https://loxthelion.com/_matrix/client/v3/directory/room/%23rmass_dm_",
|
||||
{"resolved": "sender"},
|
||||
"%3Aloxthelion.com",
|
||||
"https://loxthelion.com/_matrix/client/v3/directory/room/",
|
||||
{"resolved": "matrixdm"},
|
||||
]
|
||||
|
||||
headers = {
|
||||
|
||||
@@ -7,16 +7,23 @@ kind = "action"
|
||||
showstatus = True
|
||||
|
||||
resolve = {
|
||||
"sender": ["messages", 0, "senderId"],
|
||||
"get": {
|
||||
"locationcode": ["profile", "searchCity"],
|
||||
},
|
||||
"construct": {
|
||||
"matrixspace": [
|
||||
"%23rmass_space_",
|
||||
{"resolved": "locationcode"},
|
||||
"%3Aloxthelion.com",
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
method = "GET"
|
||||
|
||||
path = [
|
||||
"https://loxthelion.com/_matrix/client/v3/directory/room/%23rmass_space_",
|
||||
{"resolved": "locationcode"},
|
||||
"%3Aloxthelion.com",
|
||||
"https://loxthelion.com/_matrix/client/v3/directory/room/",
|
||||
{"resolved": "matrixspace"},
|
||||
]
|
||||
|
||||
headers = {
|
||||
|
||||
@@ -13,12 +13,27 @@ recursive = {
|
||||
}
|
||||
|
||||
resolve = {
|
||||
"get": {
|
||||
"sender": ["messageitem", "senderId"],
|
||||
"message_id": ["messageitem", "id"],
|
||||
"message_body": ["messageitem", "text"],
|
||||
"room_id": ["dmroom_id"],
|
||||
"timestamp": ["messageitem", "createdAt"],
|
||||
},
|
||||
"construct": {
|
||||
"matrixuser": [
|
||||
"@rmass_",
|
||||
{"resolved": "sender"},
|
||||
":loxthelion.com",
|
||||
],
|
||||
},
|
||||
"transform": {
|
||||
"matrixuser": {
|
||||
"@rmass_238302:loxthelion.com": "@lyncoln:loxthelion.com",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
keys = [
|
||||
{
|
||||
"keytitle": "msgtype",
|
||||
@@ -30,6 +45,17 @@ keys = [
|
||||
"resolved": "message_body",
|
||||
},
|
||||
},
|
||||
{
|
||||
"keytitle": "format",
|
||||
"keyvalue": "org.matrix.custom.html",
|
||||
},
|
||||
{
|
||||
"keytitle": "formatted_body",
|
||||
"keyvalue": {
|
||||
"resolved": "message_body",
|
||||
},
|
||||
},
|
||||
|
||||
]
|
||||
|
||||
method = "PUT"
|
||||
@@ -39,9 +65,9 @@ path = [
|
||||
{"resolved": "room_id"},
|
||||
"/send/m.room.message/",
|
||||
{"resolved": "message_id"},
|
||||
"?user_id=@rmass_",
|
||||
{"resolved": "sender"},
|
||||
":loxthelion.com&ts=",
|
||||
"?user_id=",
|
||||
{"resolved": "matrixuser"},
|
||||
"&ts=",
|
||||
{"resolved": "timestamp"},
|
||||
"000"
|
||||
]
|
||||
|
||||
@@ -7,9 +7,11 @@ kind = "action"
|
||||
showstatus = True
|
||||
|
||||
resolve = {
|
||||
"get": {
|
||||
"sender": ["messages", 0, "senderId"],
|
||||
"username": ["profile", "username"],
|
||||
}
|
||||
}
|
||||
keys = [
|
||||
{
|
||||
"keytitle": "type",
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3OTIwNDA4ODgsIm5iZiI6MTc5MjA0MDcwOCwic3ViIjoiMjM4MzAyIiwidXNlcm5hbWUiOiJYeHhvdGlxIiwidXNlclR5cGUiOjEsInN0YWdlTmFtZSI6Ilh4eG90aXEiL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