Added user avatar assignment
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
name = "Get User Avatar"
|
||||
|
||||
kind = "action"
|
||||
|
||||
alias = "getavatar"
|
||||
|
||||
showstatus = True
|
||||
|
||||
isrequest = True
|
||||
|
||||
method = "GET"
|
||||
|
||||
#Used to resolve path for recursive handling. Path location must match the location of the recursiveset data from pullmessage operation
|
||||
resolve = {
|
||||
"get": {
|
||||
"avatar": ["messageheaders", "userCard", "userPhoto"],
|
||||
},
|
||||
"construct": {
|
||||
"avatarpath": [
|
||||
"https://rentmasseur.com",
|
||||
{"resolved": "avatar"},
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
#To add resolution suffix, second item must be a dictionary. References the "path" library under resolved
|
||||
path = [
|
||||
{"resolved": "avatarpath"},
|
||||
]
|
||||
|
||||
headers = {
|
||||
"Authorization": {
|
||||
"output": "access_token",
|
||||
"prefix": "Bearer ",
|
||||
},
|
||||
}
|
||||
|
||||
image = "useravatar"
|
||||
@@ -0,0 +1,30 @@
|
||||
name = "Upload Avatar to Synapse"
|
||||
|
||||
kind = "action"
|
||||
|
||||
alias = "uploadavatar"
|
||||
|
||||
showstatus = True
|
||||
|
||||
isrequest = True
|
||||
|
||||
method = "POST"
|
||||
|
||||
#To add resolution suffix, second item must be a dictionary. References the "path" library under resolved
|
||||
path = [
|
||||
"https://loxthelion.com/_matrix/media/v3/upload?filename=avatar.jpg",
|
||||
]
|
||||
|
||||
headers = {
|
||||
"Authorization": {
|
||||
"os": "AS_TOKEN",
|
||||
"prefix": "Bearer ",
|
||||
},
|
||||
"Content-Type": "image/jpeg",
|
||||
}
|
||||
|
||||
requestdata = "useravatar"
|
||||
|
||||
outputs = {
|
||||
"uploadimage": "content_uri",
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
import os
|
||||
|
||||
name = "Synapse Assign Avatar"
|
||||
|
||||
kind = "action"
|
||||
|
||||
showstatus = True
|
||||
|
||||
#astoken = os.environ["AS_TOKEN"]
|
||||
|
||||
resolve = {
|
||||
"get": {
|
||||
"sender": ["messageheaders", "userCard", "id"],
|
||||
"avatar": ["uploadimage"],
|
||||
"username": ["messageheaders", "userCard", "username"],
|
||||
#"username": ["pullmessages", 0, "userCard", "username"],
|
||||
},
|
||||
"construct": {
|
||||
"matrixuser": [
|
||||
"@rmass_",
|
||||
{"resolved": "sender"},
|
||||
":loxthelion.com",
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
keys = [
|
||||
{
|
||||
"keytitle": "avatar_url",
|
||||
"keyvalue": {
|
||||
"resolved": "avatar",
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
method = "PUT"
|
||||
|
||||
path = [
|
||||
"https://loxthelion.com/_matrix/client/v3/profile/",
|
||||
{"resolved": "matrixuser"},
|
||||
"/avatar_url?user_id=",
|
||||
{"resolved": "matrixuser"},
|
||||
]
|
||||
|
||||
headers = {
|
||||
"Authorization": {
|
||||
"os": "AS_TOKEN",
|
||||
"prefix": "Bearer ",
|
||||
},
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user