v1 server and lifecycle manager working. execution contract added
This commit is contained in:
@@ -0,0 +1 @@
|
||||
from . import actions, operations
|
||||
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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
from . import login, getcsrf, refresh_tokens, checkavailable, setavailable, setunavailable, setnotset
|
||||
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.
@@ -0,0 +1,30 @@
|
||||
name = "Availability check"
|
||||
|
||||
kind = "action"
|
||||
|
||||
showstatus = False
|
||||
|
||||
method = "GET"
|
||||
|
||||
path = "https://rentmasseur.com/api/v1/account/keeponline"
|
||||
|
||||
outputs = {
|
||||
"message": "message",
|
||||
"validTo": "validTo",
|
||||
}
|
||||
|
||||
headers = {
|
||||
"Authorization": {
|
||||
"output": "access_token",
|
||||
"prefix": "Bearer ",
|
||||
},
|
||||
}
|
||||
|
||||
prints = {
|
||||
"Status": "message",
|
||||
"Time Remaining": "validTo",
|
||||
}
|
||||
|
||||
recoverPolicy = {
|
||||
KeyError: []
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
name = "Get CSRF token"
|
||||
|
||||
kind = "action"
|
||||
|
||||
showstatus = True
|
||||
|
||||
method = "GET"
|
||||
|
||||
path = "https://rentmasseur.com/api/v1/login"
|
||||
|
||||
outputs = {
|
||||
"csrf_token": "csrf"
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import os
|
||||
|
||||
name = "Login"
|
||||
|
||||
kind = "action"
|
||||
|
||||
showstatus = True
|
||||
|
||||
username = os.environ["RM_USER"]
|
||||
password = os.environ["RM_PASS"]
|
||||
|
||||
keys = [
|
||||
{
|
||||
"keytitle": "email",
|
||||
"keyvalue": username,
|
||||
},
|
||||
{
|
||||
"keytitle": "password",
|
||||
"keyvalue": password,
|
||||
},
|
||||
{
|
||||
"keytitle": "csrf",
|
||||
"keyvalue": {
|
||||
"outputs": "csrf_token",
|
||||
},
|
||||
},
|
||||
{
|
||||
"keytitle": "remember",
|
||||
"keyvalue": 1,
|
||||
},
|
||||
]
|
||||
|
||||
method = "POST"
|
||||
|
||||
path = "https://rentmasseur.com/api/v1/login"
|
||||
|
||||
outputs = {
|
||||
"access_token": "accessToken",
|
||||
"refresh_token": "refreshToken",
|
||||
}
|
||||
|
||||
savedata = [
|
||||
"access_token",
|
||||
"refresh_token",
|
||||
]
|
||||
|
||||
savepath = "/home/david/tokens.json"
|
||||
@@ -0,0 +1,51 @@
|
||||
from . import getcsrf, login
|
||||
|
||||
name = "Token refresh"
|
||||
|
||||
showstatus = True
|
||||
|
||||
method = "GET"
|
||||
|
||||
path = "https://rentmasseur.com/api/v1/refresh/tokens"
|
||||
|
||||
headers = {
|
||||
"Authorization": {
|
||||
"output": "refresh_token",
|
||||
"prefix": "Bearer ",
|
||||
},
|
||||
}
|
||||
|
||||
domainname="rentmasseur.com"
|
||||
|
||||
cookies = {
|
||||
"accessToken": {
|
||||
"output": "access_token",
|
||||
},
|
||||
"refeshToken": {
|
||||
"output": "refresh_token",
|
||||
},
|
||||
}
|
||||
|
||||
loaddata = [
|
||||
"access_token",
|
||||
"refresh_token",
|
||||
]
|
||||
|
||||
savedata = [
|
||||
"access_token",
|
||||
"refresh_token",
|
||||
]
|
||||
|
||||
savepath = "/home/david/tokens.json"
|
||||
|
||||
outputs = {
|
||||
"access_token": "accessToken",
|
||||
"refresh_token": "refreshToken",
|
||||
}
|
||||
|
||||
recoverPolicy = {
|
||||
FileNotFoundError: [
|
||||
getcsrf,
|
||||
login,
|
||||
],
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
import os
|
||||
|
||||
name = "Set availability"
|
||||
|
||||
kind = "action"
|
||||
|
||||
id = "setavailable"
|
||||
|
||||
showstatus = True
|
||||
|
||||
skipstep = {
|
||||
"checkavailable": "validTo >= 3600"
|
||||
}
|
||||
|
||||
availabletime = int(os.environ.get("AVAILABLE_DURATION",3))
|
||||
|
||||
duration = availabletime - 1
|
||||
|
||||
keys = [
|
||||
{
|
||||
"keytitle": "option",
|
||||
"keyvalue": 1,
|
||||
},
|
||||
{
|
||||
"keytitle": "duration",
|
||||
"keyvalue": duration,
|
||||
},
|
||||
]
|
||||
|
||||
method = "PUT"
|
||||
|
||||
path = "https://rentmasseur.com/api/v1/account/dashboard/availability"
|
||||
|
||||
headers = {
|
||||
"Authorization": {
|
||||
"output": "access_token",
|
||||
"prefix": "Bearer ",
|
||||
},
|
||||
}
|
||||
|
||||
outputs = {
|
||||
"available_until": "validTo"
|
||||
}
|
||||
|
||||
prints = {
|
||||
"Available until": "available_until"
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import os
|
||||
|
||||
name = "Unset Availability"
|
||||
|
||||
kind = "action"
|
||||
|
||||
availabletime = int(os.environ.get("AVAILABLE_DURATION",3))
|
||||
|
||||
duration = availabletime - 5
|
||||
|
||||
|
||||
|
||||
keys = [
|
||||
{
|
||||
"keytitle": "online",
|
||||
"keyvalue": 0,
|
||||
},
|
||||
]
|
||||
|
||||
method = "PUT"
|
||||
|
||||
path = "https://rentmasseur.com/api/v1/account/dashboard/availability"
|
||||
|
||||
#headers = "Authorization:" f"Bearer {access_token}"
|
||||
@@ -0,0 +1,26 @@
|
||||
import os
|
||||
|
||||
unavailabletime = int(os.environ.get("AVAILABLE_DURATION",3))
|
||||
|
||||
duration = unavailabletime - 1
|
||||
|
||||
name = "Set Unavailable"
|
||||
|
||||
kind = "action"
|
||||
|
||||
keys = [
|
||||
{
|
||||
"keytitle": "online",
|
||||
"keyvalue": 2,
|
||||
},
|
||||
{
|
||||
"keytitle": "duration",
|
||||
"keytitle": duration,
|
||||
},
|
||||
]
|
||||
|
||||
method = "PUT"
|
||||
|
||||
path = "https://rentmasseur.com/api/v1/account/dashboard/availability"
|
||||
|
||||
#headers = "Authorization:" f"Bearer {access_token}"
|
||||
@@ -0,0 +1,24 @@
|
||||
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
|
||||
@@ -0,0 +1,2 @@
|
||||
from . import login, checkavailable, setavailable
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,11 @@
|
||||
from plugins.rmass.actions import login, getcsrf, refresh_tokens, checkavailable
|
||||
|
||||
name = "Availability check"
|
||||
|
||||
kind = "operation"
|
||||
|
||||
actions = [
|
||||
refresh_tokens,
|
||||
checkavailable,
|
||||
]
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
from plugins.rmass.actions import getcsrf, login
|
||||
|
||||
name = "Login"
|
||||
|
||||
kind = "operation"
|
||||
|
||||
actions = [
|
||||
getcsrf,
|
||||
login,
|
||||
]
|
||||
@@ -0,0 +1,7 @@
|
||||
from . import getcsrf, login, checkavailability
|
||||
|
||||
actions = [
|
||||
getcsrf,
|
||||
login,
|
||||
checkavailability,
|
||||
]
|
||||
@@ -0,0 +1,23 @@
|
||||
from plugins.rmass.actions import login, getcsrf, setavailable, checkavailable, refresh_tokens
|
||||
|
||||
name = "Set Available"
|
||||
|
||||
kind = "operation"
|
||||
|
||||
actions = [
|
||||
refresh_tokens,
|
||||
checkavailable,
|
||||
setavailable,
|
||||
]
|
||||
|
||||
sleeptime = 180
|
||||
|
||||
skipstep = {
|
||||
setavailable: {
|
||||
"output": "validTo",
|
||||
"operator": ">=",
|
||||
"value": 3600,
|
||||
}
|
||||
}
|
||||
|
||||
role = "activate"
|
||||
Reference in New Issue
Block a user