diff --git a/core/apirequest/__pycache__/execute.cpython-314.pyc b/core/apirequest/__pycache__/execute.cpython-314.pyc index 1bb3756..9c200e9 100644 Binary files a/core/apirequest/__pycache__/execute.cpython-314.pyc and b/core/apirequest/__pycache__/execute.cpython-314.pyc differ diff --git a/core/apirequest/execute.py b/core/apirequest/execute.py index 90fb841..a2a0df4 100644 --- a/core/apirequest/execute.py +++ b/core/apirequest/execute.py @@ -22,7 +22,7 @@ def executeRequest(action, outputs, resolved): # session.cookies.set( # sessioncookies[cookie_name] = response[cookie_key], - print(request) + #print(request) #print(response.status_code) #print(response.text) return response, outputs diff --git a/core/execution/action/__pycache__/action.cpython-314.pyc b/core/execution/action/__pycache__/action.cpython-314.pyc index c67c1c3..bb2910e 100644 Binary files a/core/execution/action/__pycache__/action.cpython-314.pyc and b/core/execution/action/__pycache__/action.cpython-314.pyc differ diff --git a/core/execution/action/action.py b/core/execution/action/action.py index bbbd704..524f051 100644 --- a/core/execution/action/action.py +++ b/core/execution/action/action.py @@ -3,10 +3,18 @@ from core.runtime.runtimecontract import buildRuntimeAttr, buildPreRuntimeAttr def buildAction (action, outputs): - outputs, resolved = buildPreRuntimeAttr(action, outputs) + #outputs, resolved = buildPreRuntimeAttr(action, outputs) - response, outputs = executeRequest(action, outputs, resolved) - - outputs, response = buildRuntimeAttr(action, outputs, response) + if hasattr(action, "recursive"): + for item in outputs[action.recursive["source"]]: + outputs[action.recursive["label"]] = item + outputs, resolved = buildPreRuntimeAttr(action, outputs) + response, outputs = executeRequest(action, outputs, resolved) + outputs, response = buildRuntimeAttr(action, outputs, response) + + else: + outputs, resolved = buildPreRuntimeAttr(action, outputs) + response, outputs = executeRequest(action, outputs, resolved) + outputs, response = buildRuntimeAttr(action, outputs, response) return outputs, response diff --git a/core/execution/operation/__pycache__/operation.cpython-314.pyc b/core/execution/operation/__pycache__/operation.cpython-314.pyc index d5c874a..0823dbe 100644 Binary files a/core/execution/operation/__pycache__/operation.cpython-314.pyc and b/core/execution/operation/__pycache__/operation.cpython-314.pyc differ diff --git a/core/execution/operation/operation.py b/core/execution/operation/operation.py index fed0a94..69158d9 100644 --- a/core/execution/operation/operation.py +++ b/core/execution/operation/operation.py @@ -2,7 +2,7 @@ import logging from core.runtime.managefailure import manageFailure from core.execution.action.action import buildAction from core.runtime.skipstep import skipStep -from core.runtime.recursiveactions import recursiveAction +from core.runtime.recursive import recursiveSet def buildOperation(definition): actions = definition.actions @@ -15,7 +15,7 @@ def buildOperation(definition): continue if action == "recursiveset": - outputs = recursiveAction(definition, outputs) + outputs = recursiveSet(definition, outputs) else: outputs, response = buildAction(action, outputs) diff --git a/core/manager/__init__.py b/core/manager/__init__.py deleted file mode 100644 index 5762ccb..0000000 --- a/core/manager/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from . import manager diff --git a/core/manager/__pycache__/__init__.cpython-314.pyc b/core/manager/__pycache__/__init__.cpython-314.pyc deleted file mode 100644 index 24adde1..0000000 Binary files a/core/manager/__pycache__/__init__.cpython-314.pyc and /dev/null differ diff --git a/core/manager/__pycache__/manager.cpython-314.pyc b/core/manager/__pycache__/manager.cpython-314.pyc deleted file mode 100644 index 94c0514..0000000 Binary files a/core/manager/__pycache__/manager.cpython-314.pyc and /dev/null differ diff --git a/core/manager/manager.py b/core/manager/manager.py deleted file mode 100644 index 4b124f8..0000000 --- a/core/manager/manager.py +++ /dev/null @@ -1,25 +0,0 @@ -from datetime import datetime -from core.operation.operation import buildOperation - -def buildManager(definition): - operations = definition.operations - - current_time = datetime.now().time() - - for operation in operations: - if hasattr(operation, "role") and operation.role == "activate": - if definition.uptime <= current_time <= definition.downtime: - while True: - current_time = datetime.now().time() - outputs = buildOperation(operation) - - if hasattr(operation, "role") and operation.role == "deactivate": - if definition.downtime <= current_time <= definition.uptime: - while True: - current_time = datetime.now().time() - outputs = buildOperation(operation) - -# if hasattr(operation, "role") and role == offline: -# outputs = buildOperation(operation) - - diff --git a/core/runtime/__pycache__/recursive.cpython-314.pyc b/core/runtime/__pycache__/recursive.cpython-314.pyc new file mode 100644 index 0000000..2826d94 Binary files /dev/null and b/core/runtime/__pycache__/recursive.cpython-314.pyc differ diff --git a/core/runtime/__pycache__/recursiveactions.cpython-314.pyc b/core/runtime/__pycache__/recursiveactions.cpython-314.pyc index 1f6f99a..4c597c3 100644 Binary files a/core/runtime/__pycache__/recursiveactions.cpython-314.pyc and b/core/runtime/__pycache__/recursiveactions.cpython-314.pyc differ diff --git a/core/runtime/recursiveactions.py b/core/runtime/recursive.py similarity index 50% rename from core/runtime/recursiveactions.py rename to core/runtime/recursive.py index 7b8a7b5..956a9cf 100644 --- a/core/runtime/recursiveactions.py +++ b/core/runtime/recursive.py @@ -1,5 +1,20 @@ from core.execution.action.action import buildAction +def recursiveSet(definition, outputs): + recursiveset = definition.recursiveset["actions"] + for item in outputs[definition.recursiveset["source"]]: + outputs[definition.recursiveset["outputlabel"]] = item + #outputs["recursive"] = item + + for job in recursiveset: + outputs, response = buildAction(job, outputs) + + print(outputs["profile"]) + print(outputs["messages"]) + return outputs + +from core.execution.action.action import buildAction + def recursiveAction(definition, outputs): recursiveset = definition.recursiveset["actions"] for item in outputs[definition.recursiveset["source"]]: @@ -12,4 +27,3 @@ def recursiveAction(definition, outputs): print(outputs["profile"]) print(outputs["messages"]) return outputs - diff --git a/plugins/rmass/actions/__pycache__/synapseassignspace.cpython-314.pyc b/plugins/rmass/actions/__pycache__/synapseassignspace.cpython-314.pyc index 2ea2173..32a7559 100644 Binary files a/plugins/rmass/actions/__pycache__/synapseassignspace.cpython-314.pyc and b/plugins/rmass/actions/__pycache__/synapseassignspace.cpython-314.pyc differ diff --git a/plugins/rmass/actions/__pycache__/synapseassignusername.cpython-314.pyc b/plugins/rmass/actions/__pycache__/synapseassignusername.cpython-314.pyc index 910c14b..1ea7691 100644 Binary files a/plugins/rmass/actions/__pycache__/synapseassignusername.cpython-314.pyc and b/plugins/rmass/actions/__pycache__/synapseassignusername.cpython-314.pyc differ diff --git a/plugins/rmass/actions/__pycache__/synapsecreatedmroom.cpython-314.pyc b/plugins/rmass/actions/__pycache__/synapsecreatedmroom.cpython-314.pyc index d5313b1..361085a 100644 Binary files a/plugins/rmass/actions/__pycache__/synapsecreatedmroom.cpython-314.pyc and b/plugins/rmass/actions/__pycache__/synapsecreatedmroom.cpython-314.pyc differ diff --git a/plugins/rmass/actions/__pycache__/synapsepushmessages.cpython-314.pyc b/plugins/rmass/actions/__pycache__/synapsepushmessages.cpython-314.pyc index a648b28..cca4eaf 100644 Binary files a/plugins/rmass/actions/__pycache__/synapsepushmessages.cpython-314.pyc and b/plugins/rmass/actions/__pycache__/synapsepushmessages.cpython-314.pyc differ diff --git a/plugins/rmass/actions/__pycache__/synapseregister.cpython-314.pyc b/plugins/rmass/actions/__pycache__/synapseregister.cpython-314.pyc index 9f06ac3..7696ee5 100644 Binary files a/plugins/rmass/actions/__pycache__/synapseregister.cpython-314.pyc and b/plugins/rmass/actions/__pycache__/synapseregister.cpython-314.pyc differ diff --git a/plugins/rmass/actions/synapseassignspace.py b/plugins/rmass/actions/synapseassignspace.py index 2ca22dd..91c582c 100644 --- a/plugins/rmass/actions/synapseassignspace.py +++ b/plugins/rmass/actions/synapseassignspace.py @@ -6,8 +6,6 @@ kind = "action" showstatus = True -astoken = os.environ["AS_TOKEN"] - resolve = { "sender": ["messages", 0, "senderId"], "space_id": ["space_id"], @@ -25,11 +23,6 @@ keys = [ method = "PUT" -#path = [ -# "https://loxthelion.com/_matrix/client/v3/profile/rmass_", -# {"resolved": "sender"}, -# {"suffix": "/displayname"}, -#] path = [ "https://loxthelion.com/_matrix/client/v3/rooms/", {"resolved": "space_id"}, @@ -46,6 +39,3 @@ headers = { "Content-Type": "application/json", } -#outputs = { -# "user_id": "user_id", -#} diff --git a/plugins/rmass/actions/synapseassignusername.py b/plugins/rmass/actions/synapseassignusername.py index 51ef75a..09871cc 100644 --- a/plugins/rmass/actions/synapseassignusername.py +++ b/plugins/rmass/actions/synapseassignusername.py @@ -10,15 +10,9 @@ astoken = os.environ["AS_TOKEN"] resolve = { "sender": ["messages", 0, "senderId"], - #"messageid": ["message", "id"], "username": ["profile", "username"], - #"location": ["profile", "location"], } keys = [ - #{ - # "keytitle": "type", - # "keyvalue": "m.login.application_service", - #}, { "keytitle": "displayname", "keyvalue": { @@ -29,11 +23,6 @@ keys = [ method = "PUT" -#path = [ -# "https://loxthelion.com/_matrix/client/v3/profile/rmass_", -# {"resolved": "sender"}, -# {"suffix": "/displayname"}, -#] path = [ "https://loxthelion.com/_matrix/client/v3/profile/@rmass_", {"resolved": "sender"}, @@ -50,6 +39,3 @@ headers = { "Content-Type": "application/json", } -#outputs = { -# "user_id": "user_id", -#} diff --git a/plugins/rmass/actions/synapsecreatedmroom.py b/plugins/rmass/actions/synapsecreatedmroom.py index 0a5e1d7..8b8b17b 100644 --- a/plugins/rmass/actions/synapsecreatedmroom.py +++ b/plugins/rmass/actions/synapsecreatedmroom.py @@ -6,14 +6,11 @@ kind = "action" showstatus = True -astoken = os.environ["AS_TOKEN"] - resolve = { "sender": ["messages", 0, "senderId"], - #"messageid": ["message", "id"], "username": ["profile", "username"], - #"location": ["profile", "location"], } + keys = [ { "keytitle": "name", diff --git a/plugins/rmass/actions/synapsepushmessages.py b/plugins/rmass/actions/synapsepushmessages.py index 48de958..9a94b14 100644 --- a/plugins/rmass/actions/synapsepushmessages.py +++ b/plugins/rmass/actions/synapsepushmessages.py @@ -6,13 +6,17 @@ kind = "action" showstatus = True +recursive = { + "source": "messages", + "label": "messageitem", +} + resolve = { - "sender": ["messages", 0, "senderId"], - "message_id": ["messages", 0, "id"], - #"username": ["profile", "username"], - "message_body": ["messages", 0, "text"], + "sender": ["messageitem", "senderId"], + "message_id": ["messageitem", "id"], + "message_body": ["messageitem", "text"], "room_id": ["dmroom_id"], - #"location": ["profile", "location"], + "timestamp": ["messageitem", "createdAt"], } keys = [ { @@ -36,7 +40,9 @@ path = [ {"resolved": "message_id"}, "?user_id=@rmass_", {"resolved": "sender"}, - ":loxthelion.com", + ":loxthelion.com&ts=", + {"resolved": "timestamp"}, + "000" ] headers = { diff --git a/plugins/rmass/actions/synapseregister.py b/plugins/rmass/actions/synapseregister.py index 18f6316..bb52524 100644 --- a/plugins/rmass/actions/synapseregister.py +++ b/plugins/rmass/actions/synapseregister.py @@ -6,13 +6,9 @@ kind = "action" showstatus = True -astoken = os.environ["AS_TOKEN"] - resolve = { "sender": ["messages", 0, "senderId"], - #"messageid": ["message", "id"], "username": ["profile", "username"], - #"location": ["profile", "location"], } keys = [ { diff --git a/plugins/rmass/manager.py b/plugins/rmass/manager.py deleted file mode 100644 index 34b8ba2..0000000 --- a/plugins/rmass/manager.py +++ /dev/null @@ -1,24 +0,0 @@ -import os -from datetime import datetime -from . import setavailableoperation - -operations = [ - setavailableoperation, - #setunavailableoperation - #setnotsetoperation -] - -uptime = datetime.strptime( - os.environ["TIME_UPTIME"], - "%H:%M" -).time - -downtime = datetime.strptime( - os.environ["TIME_UPTIME"], - "%H:%M" -).time - -offline = datetime.strptime( - os.environ["TIME_OFFLINE"], - "%H:%M" -).time diff --git a/plugins/rmass/operations/manageoperation.py b/plugins/rmass/operations/manageoperation.py deleted file mode 100644 index 672afff..0000000 --- a/plugins/rmass/operations/manageoperation.py +++ /dev/null @@ -1,7 +0,0 @@ -from . import getcsrf, login, checkavailability - -actions = [ - getcsrf, - login, - checkavailability, -] diff --git a/tokens.json b/tokens.json index c4b53c4..93acca1 100644 --- a/tokens.json +++ b/tokens.json @@ -1 +1 @@ -{"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3OTIwMTA1MDUsIm5iZiI6MTc5MjAxMDMyNSwic3ViIjoiMjM4MzAyIiwidXNlcm5hbWUiOiJYeHhvdGlxIiwidXNlclR5cGUiOjEsInN0YWdlTmFtZSI6Ilh4eG90aXEiLCJhcHByb3ZlZCI6MSwibG9jYXRpb25JZCI6NDcyLCJzZWFyY2hDaXR5IjoiYXRsYW50YSIsImNvdW50cnlTaG9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FCbcFB7fWdvLL7Wm3TmBS8XN-lL-UyYGT1zGbmr_kDLpJ06I9-RtcKvkrX52cQKDHqfFplg", "refresh_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3OTQ2MDgwNTYsIm5iZiI6MTc5MjAxNTk5NiwianRpIjoiLy9xblJvU3Voc3F2ZVRXUENURkRoRlVjRjhCTCsvV2hYZzJLVFErblN0az0iLCJpc3MiOiJodHRwczovL3JlbnRtYXNzZXVyLmNvbSIsImlhdCI6MTc5MjAxNjA1Niwic3ViIjoiMjM4MzAyIn0.4nTN0v_hXVE2XwCIS5ZH6zGp1TE3F9aQbOEasiSFu-Nvc_1fT4MsrXL9nr1FGgo_5N6uSfbgYAOioa7fyzucJA"} \ No newline at end of file