def before_request(): # Ignore check for some pages - these are mostly methods that need # to run even in setup mode exclude_list = [ "warden.setup", "warden.testtor", "warden.gitreleases", "warden.realtime_btc", "warden.data_folder", "warden.testtor", "warden.checkservices", "warden.check_activity", "warden.warden_metadata", "warden.node_info" ] if request.endpoint in exclude_list: return need_setup = False # Check Tor tor = test_tor() need_setup = not tor['status'] # Get Services services = check_services() need_setup = not services['specter']['running'] # Are Wallets Found? specter_wallets = have_specter_wallets(load=False) need_setup = not specter_wallets # Transactions found? df = positions() need_setup = df.empty if need_setup: meta = { 'tor': tor, 'services': services, 'specter_wallets': specter_wallets, 'txs': df.empty } messages = json.dumps(meta) session['messages'] = messages return redirect(url_for("warden.setup"))
def setup(): need_setup = False # Check Tor tor = test_tor() need_setup = not tor['status'] # Get Services services = check_services() need_setup = not services['specter']['running'] # Are Wallets Found? specter_wallets = have_specter_wallets() need_setup = not specter_wallets # Transactions found? df = positions() need_setup = not df.empty meta = { 'tor': tor, 'services': services, 'specter_wallets': specter_wallets, 'txs': not df.empty, 'need_setup': need_setup, } messages = json.dumps(meta) session['messages'] = messages templateData = { "title": "System Status", "donated": donate_check(), "messages": json.loads(session['messages']), "specter": specter_update() } return (render_template('warden/warden_empty.html', **templateData))
def jinja_shared(): from warden.warden import check_services from warden.warden_pricing_engine import test_tor values = { 'services': check_services(load=True, expiry=90), 'tor': test_tor() } return dict(values)
def node_info(): data = specter_update(load=True) status = { 'info': data['info'], 'bitcoin': data['network_info'], 'services': check_services(load=True), 'last_update': data['last_update'] } return simplejson.dumps(status, ignore_nan=True)
def checkservices(): services = check_services() return simplejson.dumps(services, ignore_nan=True)