Compare commits
No commits in common. "9f1f7fb18e861b483010416b339eef0286b36466" and "0be6b8b43583b1207b811e7b143bf7bc209738e8" have entirely different histories.
9f1f7fb18e
...
0be6b8b435
2
.gitignore
vendored
2
.gitignore
vendored
@ -10,5 +10,3 @@ ignore/
|
|||||||
plugins/signatures.json
|
plugins/signatures.json
|
||||||
|
|
||||||
.venv/
|
.venv/
|
||||||
|
|
||||||
user_data/
|
|
3
main.py
3
main.py
@ -1040,9 +1040,6 @@ def settings():
|
|||||||
if success == None:
|
if success == None:
|
||||||
success = ""
|
success = ""
|
||||||
|
|
||||||
if not os.path.exists(".git"):
|
|
||||||
return render_template("settings.html", account=account,sync=account_module.getNodeSync(),
|
|
||||||
error=error,success=success,version="Error")
|
|
||||||
info = gitinfo.get_git_info()
|
info = gitinfo.get_git_info()
|
||||||
branch = info['refs']
|
branch = info['refs']
|
||||||
if branch != "main":
|
if branch != "main":
|
||||||
|
@ -34,45 +34,6 @@ functions = {
|
|||||||
"type": "text"
|
"type": "text"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"disable":{
|
|
||||||
"name": "Disable Automations",
|
|
||||||
"type": "default",
|
|
||||||
"description": "Disable Automations for this wallet",
|
|
||||||
"params": {},
|
|
||||||
"returns": {
|
|
||||||
"Status":
|
|
||||||
{
|
|
||||||
"name": "Status",
|
|
||||||
"type": "text"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"enable":{
|
|
||||||
"name": "Enable Automations",
|
|
||||||
"type": "default",
|
|
||||||
"description": "Enable Automations for this wallet",
|
|
||||||
"params": {},
|
|
||||||
"returns": {
|
|
||||||
"Status":
|
|
||||||
{
|
|
||||||
"name": "Status",
|
|
||||||
"type": "text"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"list":{
|
|
||||||
"name": "List Disabled Wallets",
|
|
||||||
"type": "default",
|
|
||||||
"description": "List wallets with automations disabled",
|
|
||||||
"params": {},
|
|
||||||
"returns": {
|
|
||||||
"wallets":
|
|
||||||
{
|
|
||||||
"name": "List of wallets",
|
|
||||||
"type": "list"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,43 +43,16 @@ started = False
|
|||||||
def automation(params, authentication):
|
def automation(params, authentication):
|
||||||
global started
|
global started
|
||||||
|
|
||||||
wallet = authentication.split(":")[0]
|
|
||||||
if os.path.exists(f"user_data/{wallet}.autoRenew"):
|
|
||||||
return {"Status": "Automations disabled"}
|
|
||||||
|
|
||||||
if started:
|
if started:
|
||||||
return {"Status": "Automations running"}
|
return {"Status": "Auto Renews running"}
|
||||||
started = True
|
started = True
|
||||||
|
|
||||||
threading.Thread(target=automations_background, args=(authentication,)).start()
|
threading.Thread(target=automations_background, args=(authentication,)).start()
|
||||||
return {"Status": "Starting Automations..."}
|
return {"Status": "Started Auto Renews"}
|
||||||
|
|
||||||
def disable(params, authentication):
|
|
||||||
# Create walletname file in user_data
|
|
||||||
wallet = authentication.split(":")[0]
|
|
||||||
with open(f"user_data/{wallet}.autoRenew", "w") as f:
|
|
||||||
f.write("disabled")
|
|
||||||
return {"Status": "Disabled Automations"}
|
|
||||||
|
|
||||||
def enable(params, authentication):
|
|
||||||
# Delete walletname file in user_data
|
|
||||||
wallet = authentication.split(":")[0]
|
|
||||||
if os.path.exists(f"user_data/{wallet}.autoRenew"):
|
|
||||||
os.remove(f"user_data/{wallet}.autoRenew")
|
|
||||||
|
|
||||||
return {"Status": "Enabled Automations"}
|
|
||||||
|
|
||||||
def list(params, authentication):
|
|
||||||
wallets = []
|
|
||||||
for file in os.listdir("user_data"):
|
|
||||||
if file.endswith(".autoRenew"):
|
|
||||||
wallets.append(file[:-10])
|
|
||||||
return {"wallets": wallets}
|
|
||||||
|
|
||||||
# Background function to run the automations
|
# Background function to run the automations
|
||||||
def automations_background(authentication):
|
def automations_background(authentication):
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
print("Running automations")
|
||||||
# Get account details
|
# Get account details
|
||||||
account_name = account.check_account(authentication)
|
account_name = account.check_account(authentication)
|
||||||
password = ":".join(authentication.split(":")[1:])
|
password = ":".join(authentication.split(":")[1:])
|
||||||
@ -130,17 +64,12 @@ def automations_background(authentication):
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if os.path.exists(f"user_data/{account_name}.autoRenew"):
|
|
||||||
print("Skipping Automations")
|
|
||||||
time.sleep(300)
|
|
||||||
continue
|
|
||||||
print("Running automations")
|
|
||||||
try:
|
try:
|
||||||
# Try to select and login to the wallet
|
# Try to select and login to the wallet
|
||||||
response = account.hsw.rpc_selectWallet(account_name)
|
response = account.hsw.rpc_selectWallet(account_name)
|
||||||
if response['error'] is not None:
|
if response['error'] is not None:
|
||||||
return
|
return
|
||||||
response = account.hsw.rpc_walletPassphrase(password,30)
|
response = account.hsw.rpc_walletPassphrase(password,10)
|
||||||
if response['error'] is not None:
|
if response['error'] is not None:
|
||||||
return
|
return
|
||||||
# Try to send the batch of all renew, reveal and redeem actions
|
# Try to send the batch of all renew, reveal and redeem actions
|
||||||
|
Loading…
Reference in New Issue
Block a user