Extended initialize to include login and lifecycle controlled loops. Loaded tokens into necessary action modules
This commit is contained in:
+41
-4
@@ -1,5 +1,42 @@
|
|||||||
from core.server.server import startServer
|
import threading
|
||||||
#import login
|
|
||||||
|
|
||||||
#login
|
from core.server.server import startServer
|
||||||
startServer()
|
from core.execution.createthread import buildThread
|
||||||
|
from plugins.rmass.monitors import rmassmonitor
|
||||||
|
from plugins.rmass.actions import refresh_tokens
|
||||||
|
|
||||||
|
import login
|
||||||
|
|
||||||
|
lifecycles ={}
|
||||||
|
|
||||||
|
try:
|
||||||
|
lifecycles[rmassmonitor.name] = {}
|
||||||
|
lifecycles[rmassmonitor.name]["mode"] = "continuous"
|
||||||
|
thread, lifecycles = buildThread(rmassmonitor, lifecycles)
|
||||||
|
except ConnectionError:
|
||||||
|
print("Connection Error caught. Recovering")
|
||||||
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
|
lifecycles[refresh_tokens.name] = {}
|
||||||
|
lifecycles[refresh_tokens.name]["mode"] = "continuous"
|
||||||
|
thread, lifecycles = buildThread(refresh_tokens, lifecycles)
|
||||||
|
except ConnectionError:
|
||||||
|
print("Connection Error caught. Recovering")
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
#lifecycles = {}
|
||||||
|
#try:
|
||||||
|
# lifecycles[rmassmonitor.name] = lifecycles
|
||||||
|
# lifecycles[rmassmonitor.name]["mode"] = "continuous"
|
||||||
|
# thread, lifecycles = buildThread(rmassmonitor, lifecycles)
|
||||||
|
#except ConnectionError:
|
||||||
|
# print("Connection Error caught. Recovering")
|
||||||
|
# pass
|
||||||
|
|
||||||
|
thread = threading.Thread(
|
||||||
|
target=startServer,
|
||||||
|
#args=(module, lifecycles)
|
||||||
|
)
|
||||||
|
thread.start()
|
||||||
@@ -37,7 +37,6 @@ savedata = [
|
|||||||
"refresh_token",
|
"refresh_token",
|
||||||
]
|
]
|
||||||
|
|
||||||
#savepath = "/rmmanager/tokens.json"
|
|
||||||
savepath = os.environ["TOKEN_STORE"]
|
savepath = os.environ["TOKEN_STORE"]
|
||||||
|
|
||||||
outputs = {
|
outputs = {
|
||||||
@@ -51,3 +50,39 @@ recoverPolicy = {
|
|||||||
login,
|
login,
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sleeptime = 120
|
||||||
|
|
||||||
|
#saverow = {
|
||||||
|
# "table": "credentials",
|
||||||
|
# "columns": [
|
||||||
|
# {"rmass_token_name": "TEXT PRIMARY KEY"},
|
||||||
|
#
|
||||||
|
# {"rmass_token_hash": "TEXT NOT NULL"},
|
||||||
|
# ],
|
||||||
|
# "rowitems": [
|
||||||
|
# "access_token"
|
||||||
|
# {"outputs": "access_token"},
|
||||||
|
# "refresh_token"
|
||||||
|
# {"outputs": "refresh_token"},
|
||||||
|
# ],
|
||||||
|
#}
|
||||||
|
|
||||||
|
#readrow = {
|
||||||
|
# "table": "credentials",
|
||||||
|
# "columns": [
|
||||||
|
# {"rmass_token_name": "TEXT PRIMARY KEY"},
|
||||||
|
# {"rmass_token_hash": "TEXT NOT NULL"},
|
||||||
|
# ],
|
||||||
|
# "searchcolumn": "rmass_token_name",
|
||||||
|
# "rowsearchvalue": [
|
||||||
|
# "refresh_token",
|
||||||
|
# ],
|
||||||
|
# "columnnumber": 0,
|
||||||
|
# "export": {
|
||||||
|
# #0: "refresh_token",
|
||||||
|
# 1: "refresh_token",
|
||||||
|
# #2: "db_dm_room",
|
||||||
|
# #3: "db_avatar_hash",
|
||||||
|
# }
|
||||||
|
#}
|
||||||
|
|||||||
@@ -8,10 +8,6 @@ id = "setavailable"
|
|||||||
|
|
||||||
showstatus = True
|
showstatus = True
|
||||||
|
|
||||||
#skipstep = {
|
|
||||||
# "checkavailable": "validTo >= 3600"
|
|
||||||
#}
|
|
||||||
|
|
||||||
resolve = {
|
resolve = {
|
||||||
"get": {
|
"get": {
|
||||||
"availabletime": ["availabletime"],
|
"availabletime": ["availabletime"],
|
||||||
@@ -64,3 +60,10 @@ recoverPolicy = {
|
|||||||
# "print": "Availabile time above threshold. Skipping Set Available...",
|
# "print": "Availabile time above threshold. Skipping Set Available...",
|
||||||
# },
|
# },
|
||||||
#]
|
#]
|
||||||
|
|
||||||
|
loaddata = [
|
||||||
|
"access_token",
|
||||||
|
#"refresh_token",
|
||||||
|
]
|
||||||
|
|
||||||
|
savepath = os.environ["TOKEN_STORE"]
|
||||||
@@ -15,7 +15,7 @@ isrequest = True
|
|||||||
|
|
||||||
method = "GET"
|
method = "GET"
|
||||||
|
|
||||||
refreshrate = int(os.environ.get("MONITOR_INTERVAL", 10))
|
refreshrate = int(os.environ.get("MONITOR_INTERVAL", 30))
|
||||||
|
|
||||||
path = "https://rentmasseur.com/api/v1/account/keeponline"
|
path = "https://rentmasseur.com/api/v1/account/keeponline"
|
||||||
|
|
||||||
@@ -59,6 +59,7 @@ filters = [
|
|||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
sleeptime = 10
|
||||||
|
|
||||||
#prints = {
|
#prints = {
|
||||||
# "Status": "message",
|
# "Status": "message",
|
||||||
@@ -68,3 +69,10 @@ filters = [
|
|||||||
#recoverPolicy = {
|
#recoverPolicy = {
|
||||||
# KeyError: []
|
# KeyError: []
|
||||||
#}
|
#}
|
||||||
|
|
||||||
|
loaddata = [
|
||||||
|
"access_token",
|
||||||
|
"refresh_token",
|
||||||
|
]
|
||||||
|
|
||||||
|
savepath = os.environ["TOKEN_STORE"]
|
||||||
Reference in New Issue
Block a user