v1 server and lifecycle manager working. execution contract added

This commit is contained in:
Lyncoln
2026-10-08 09:31:29 -04:00
commit f4742f00e0
108 changed files with 750 additions and 0 deletions
+1
View File
@@ -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.
+1
View File
@@ -0,0 +1 @@
from . import login, getcsrf, refresh_tokens, checkavailable, setavailable, setunavailable, setnotset
+30
View File
@@ -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: []
}
+13
View File
@@ -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"
}
+47
View File
@@ -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"
+51
View File
@@ -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,
],
}
+47
View File
@@ -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"
}
+24
View File
@@ -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}"
+26
View File
@@ -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}"
+24
View File
@@ -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
+2
View File
@@ -0,0 +1,2 @@
from . import login, checkavailable, setavailable
@@ -0,0 +1,11 @@
from plugins.rmass.actions import login, getcsrf, refresh_tokens, checkavailable
name = "Availability check"
kind = "operation"
actions = [
refresh_tokens,
checkavailable,
]
+10
View File
@@ -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,
]
+23
View File
@@ -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"