feat: Add toggle for dashboard widget
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import json
|
||||
import account
|
||||
import requests
|
||||
import os
|
||||
|
||||
# Plugin Data
|
||||
info = {
|
||||
@@ -27,9 +28,17 @@ functions = {
|
||||
}
|
||||
}
|
||||
|
||||
def main(params, authentication):
|
||||
info = account.hsd.getInfo()
|
||||
if not os.path.exists("user_data/public_info.json"):
|
||||
with open("user_data/public_info.json", "w") as f:
|
||||
json.dump({"enabled": False}, f)
|
||||
|
||||
def main(params, authentication):
|
||||
with open("user_data/public_info.json", "r") as f:
|
||||
multiwallet = json.load(f)
|
||||
if not multiwallet['enabled']:
|
||||
return {"status": None}
|
||||
|
||||
info = account.hsd.getInfo()
|
||||
status = f"Version: {info['version']}<br>Inbound Connections: {info['pool']['inbound']}<br>Outbound Connections: {info['pool']['outbound']}<br>"
|
||||
if info['pool']['public']['listen']:
|
||||
status += f"Public Node: Yes<br>Host: {info['pool']['public']['host']}<br>Port: {info['pool']['public']['port']}<br>"
|
||||
@@ -38,4 +47,19 @@ def main(params, authentication):
|
||||
status += f"Agent: {info['pool']['agent']}<br>Services: {info['pool']['services']}<br>"
|
||||
|
||||
return {"status": status}
|
||||
|
||||
|
||||
def enable(params, authentication):
|
||||
with open("user_data/public_info.json", "r") as f:
|
||||
multiwallet = json.load(f)
|
||||
multiwallet['enabled'] = True
|
||||
with open("user_data/public_info.json", "w") as f:
|
||||
json.dump(multiwallet, f)
|
||||
return {"result": "Success"}
|
||||
|
||||
def disable(params, authentication):
|
||||
with open("user_data/public_info.json", "r") as f:
|
||||
multiwallet = json.load(f)
|
||||
multiwallet['enabled'] = False
|
||||
with open("user_data/public_info.json", "w") as f:
|
||||
json.dump(multiwallet, f)
|
||||
return {"result": "Success"}
|
||||
Reference in New Issue
Block a user