diff --git a/plugins/rmass/actions/__pycache__/synapseassignspace.cpython-314.pyc b/plugins/rmass/actions/__pycache__/synapseassignspace.cpython-314.pyc new file mode 100644 index 0000000..2ea2173 Binary files /dev/null and b/plugins/rmass/actions/__pycache__/synapseassignspace.cpython-314.pyc differ diff --git a/plugins/rmass/actions/__pycache__/synapsecreatespace.cpython-314.pyc b/plugins/rmass/actions/__pycache__/synapsecreatespace.cpython-314.pyc new file mode 100644 index 0000000..fb15541 Binary files /dev/null and b/plugins/rmass/actions/__pycache__/synapsecreatespace.cpython-314.pyc differ diff --git a/plugins/rmass/actions/__pycache__/synapsegetroomid.cpython-314.pyc b/plugins/rmass/actions/__pycache__/synapsegetroomid.cpython-314.pyc index 4e0c534..fb90a1b 100644 Binary files a/plugins/rmass/actions/__pycache__/synapsegetroomid.cpython-314.pyc and b/plugins/rmass/actions/__pycache__/synapsegetroomid.cpython-314.pyc differ diff --git a/plugins/rmass/actions/__pycache__/synapsegetspaceid.cpython-314.pyc b/plugins/rmass/actions/__pycache__/synapsegetspaceid.cpython-314.pyc new file mode 100644 index 0000000..8f3ebcc Binary files /dev/null and b/plugins/rmass/actions/__pycache__/synapsegetspaceid.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 56607c9..a648b28 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/synapseassignspace.py b/plugins/rmass/actions/synapseassignspace.py new file mode 100644 index 0000000..2ca22dd --- /dev/null +++ b/plugins/rmass/actions/synapseassignspace.py @@ -0,0 +1,51 @@ +import os + +name = "Synapse Assign Space" + +kind = "action" + +showstatus = True + +astoken = os.environ["AS_TOKEN"] + +resolve = { + "sender": ["messages", 0, "senderId"], + "space_id": ["space_id"], + "username": ["profile", "username"], + "room_id": ["dmroom_id"], +} +keys = [ + { + "keytitle": "via", + "keyvalue": [ + "loxthelion.com", + ], + } +] + +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"}, + "/state/m.space.child/", + {"resolved": "room_id"}, + "?user_id=@rmass_bridge_test:loxthelion.com" +] + +headers = { + "Authorization": { + "os": "AS_TOKEN", + "prefix": "Bearer ", + }, + "Content-Type": "application/json", +} + +#outputs = { +# "user_id": "user_id", +#} diff --git a/plugins/rmass/actions/synapsecreatespace.py b/plugins/rmass/actions/synapsecreatespace.py new file mode 100644 index 0000000..35e848e --- /dev/null +++ b/plugins/rmass/actions/synapsecreatespace.py @@ -0,0 +1,74 @@ +import os + +name = "Synapse Create Space" + +kind = "action" + +showstatus = True + +resolve = { + "sender": ["messages", 0, "senderId"], + #"messageid": ["message", "id"], + "username": ["profile", "username"], + "locationname": ["profile", "location"], + "locationcode": ["profile", "searchCity"], +} +keys = [ + { + "keytitle": "name", + "keyvalue": { + "resolved": "locationname", + }, + }, + { + "keytitle": "room_alias_name", + "keyvalue": { + "resolved": "locationcode", + "prefix": "rmass_spacetest_", + }, + }, + { + "keytitle": "visibility", + "keyvalue": "private", + }, + { + "keytitle": "creation_content", + "keyvalue": { + "type": "m.space", + }, + }, + { + "keytitle": "invite", + "keyvalue": ["@lyncoln:loxthelion.com"], + }, + #{ + #"keytitle": "power_level_content_override", + #"keyvalue": { + #"users": { + #"@lyncoln:loxthelion.com": 100, + #"@rmass_:loxthelion.com": 100, + #}, + #}, + #} +] + +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_test:loxthelion.com" +] + +headers = { + "Authorization": { + "os": "AS_TOKEN", + "prefix": "Bearer ", + }, + "Content-Type": "application/json", +} + +outputs = { + "space_id": "room_id", +} diff --git a/plugins/rmass/actions/synapsegetroomid.py b/plugins/rmass/actions/synapsegetroomid.py index 77f1e07..265481c 100644 --- a/plugins/rmass/actions/synapsegetroomid.py +++ b/plugins/rmass/actions/synapsegetroomid.py @@ -6,15 +6,8 @@ kind = "action" showstatus = True -#astoken = os.environ["AS_TOKEN"] - resolve = { "sender": ["messages", 0, "senderId"], - #"message_id": ["messages", 0, "id"], - #"username": ["profile", "username"], - #"message_body": ["messages", 0, "text"], - #"room_id": ["room_id"], - #"location": ["profile", "location"], } method = "GET" @@ -34,5 +27,5 @@ headers = { } outputs = { - "room_id": "room_id", + "dmroom_id": "room_id", } diff --git a/plugins/rmass/actions/synapsegetspaceid.py b/plugins/rmass/actions/synapsegetspaceid.py new file mode 100644 index 0000000..705d033 --- /dev/null +++ b/plugins/rmass/actions/synapsegetspaceid.py @@ -0,0 +1,32 @@ +import os + +name = "Synapse Get Space ID" + +kind = "action" + +showstatus = True + +resolve = { + "sender": ["messages", 0, "senderId"], + "locationcode": ["profile", "searchCity"], +} + +method = "GET" + +path = [ + "https://loxthelion.com/_matrix/client/v3/directory/room/%23rmass_spacetest_", + {"resolved": "locationcode"}, + "%3Aloxthelion.com", +] + +headers = { + "Authorization": { + "os": "AS_TOKEN", + "prefix": "Bearer ", + }, + "Content-Type": "application/json", +} + +outputs = { + "space_id": "room_id", +} diff --git a/plugins/rmass/actions/synapsepushmessages.py b/plugins/rmass/actions/synapsepushmessages.py index 9d077b9..48de958 100644 --- a/plugins/rmass/actions/synapsepushmessages.py +++ b/plugins/rmass/actions/synapsepushmessages.py @@ -6,14 +6,12 @@ kind = "action" showstatus = True -#astoken = os.environ["AS_TOKEN"] - resolve = { "sender": ["messages", 0, "senderId"], "message_id": ["messages", 0, "id"], #"username": ["profile", "username"], "message_body": ["messages", 0, "text"], - "room_id": ["room_id"], + "room_id": ["dmroom_id"], #"location": ["profile", "location"], } keys = [ diff --git a/plugins/rmass/operations/__pycache__/pullmessagelist.cpython-314.pyc b/plugins/rmass/operations/__pycache__/pullmessagelist.cpython-314.pyc index 2e7780a..2fd1d38 100644 Binary files a/plugins/rmass/operations/__pycache__/pullmessagelist.cpython-314.pyc and b/plugins/rmass/operations/__pycache__/pullmessagelist.cpython-314.pyc differ diff --git a/plugins/rmass/operations/pullmessagelist.py b/plugins/rmass/operations/pullmessagelist.py index a0ba417..7f01d37 100644 --- a/plugins/rmass/operations/pullmessagelist.py +++ b/plugins/rmass/operations/pullmessagelist.py @@ -1,4 +1,4 @@ -from plugins.rmass.actions import pullmessagelist, refresh_tokens, getmessage, checkavailable, synapseregister, synapseassignusername, synapsecreatedmroom, synapsegetroomid, synapsepushmessages +from plugins.rmass.actions import pullmessagelist, refresh_tokens, getmessage, checkavailable, synapseregister, synapseassignusername, synapsecreatespace, synapsegetspaceid, synapsecreatedmroom, synapsegetroomid, synapseassignspace, synapsepushmessages name = "Get Message List" @@ -14,6 +14,6 @@ actions = [ recursiveset = { "source": "emails", "outputlabel": "messageheaders", - "actions": [getmessage, synapseregister, synapseassignusername, synapsecreatedmroom, synapsegetroomid, synapsepushmessages], + "actions": [getmessage, synapseregister, synapseassignusername, synapsecreatespace, synapsegetspaceid, synapsecreatedmroom, synapsegetroomid, synapseassignspace, synapsepushmessages], } diff --git a/tokens.json b/tokens.json index 039c316..c4b53c4 100644 --- a/tokens.json +++ b/tokens.json @@ -1 +1 @@ -{"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3OTIwMDY2MTgsIm5iZiI6MTc5MjAwNjQzOCwic3ViIjoiMjM4MzAyIiwidXNlcm5hbWUiOiJYeHhvdGlxIiwidXNlclR5cGUiOjEsInN0YWdlTmFtZSI6Ilh4eG90aXEiLCJhcHByb3ZlZCI6MSwibG9jYXRpb25JZCI6NDcyLCJzZWFyY2hDaXR5IjoiYXRsYW50YSIsImNvdW50cnlTaG9ydCI6IlVTIiw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XSqJ7YjADFtoB5xA_GgfkL5fp6TSSPFpzMpKEhggDnlttZXQ_82-av-LXaW4A", "refresh_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3OTQ2MDIzODUsIm5iZiI6MTc5MjAxMDMyNSwianRpIjoiMGdHdnpEZFdjNjdUdlJDZU9GbC9yRkp5VGJ4WS9oUGo2Yk5pWDR0bzFXWT0iLCJpc3MiOiJodHRwczovL3JlbnRtYXNzZXVyLmNvbSIsImlhdCI6MTc5MjAxMDM4NSwic3ViIjoiMjM4MzAyIn0.N921TJnAA6G_Patf-4qtQMNKQlBHGoIu-A1lbTWTvJGZv2LFArCUjv9DW071iezjY2PuECgdoNVPiwsTHOOJTg"} \ No newline at end of file