Exemplo n.º 1
0
def page_lnd_lndconnect():
    # Load page
    if request.method == 'GET':
        return redirect(url_for(".page_lnd"))

    p = pam.pam()
    pw = request.form.get('password_lndconnect')
    from_homepage = request.form.get('lndconnect_from_homepage')
    if pw == None or p.authenticate("admin", pw) == False:
        if from_homepage != None:
            flash("Invalid Password", category="error")
            return redirect("/")
        else:
            flash("Invalid Password", category="error")
            return redirect(url_for(".page_lnd"))

    lndconnect_local_grpc_text = get_text_contents(
        "/tmp/mynode_lndconnect/lndconnect_local_grpc.txt")
    lndconnect_local_rest_text = get_text_contents(
        "/tmp/mynode_lndconnect/lndconnect_local_rest.txt")
    lndconnect_tor_grpc_text = get_text_contents(
        "/tmp/mynode_lndconnect/lndconnect_tor_grpc.txt")
    lndconnect_tor_rest_text = get_text_contents(
        "/tmp/mynode_lndconnect/lndconnect_tor_rest.txt")
    if is_community_edition():
        lndconnect_tor_grpc_text = "Premium Feature"
        lndconnect_tor_rest_text = "Premium Feature"

    lndconnect_local_grpc_img = get_image_contents(
        "/tmp/mynode_lndconnect/lndconnect_local_grpc.png")
    lndconnect_local_rest_img = get_image_contents(
        "/tmp/mynode_lndconnect/lndconnect_local_rest.png")
    lndconnect_tor_grpc_img = get_image_contents(
        "/tmp/mynode_lndconnect/lndconnect_tor_grpc.png")
    lndconnect_tor_rest_img = get_image_contents(
        "/tmp/mynode_lndconnect/lndconnect_tor_rest.png")
    if is_community_edition():
        lndconnect_tor_grpc_img = get_image_contents(
            "/var/www/mynode/static/images/dots.png")
        lndconnect_tor_rest_img = get_image_contents(
            "/var/www/mynode/static/images/dots.png")

    # Show lndconnect page
    templateData = {
        "title": "myNode Lightning Wallet",
        "lndconnect_local_grpc_text": lndconnect_local_grpc_text,
        "lndconnect_local_rest_text": lndconnect_local_rest_text,
        "lndconnect_tor_grpc_text": lndconnect_tor_grpc_text,
        "lndconnect_tor_rest_text": lndconnect_tor_rest_text,
        "lndconnect_local_grpc_img": lndconnect_local_grpc_img,
        "lndconnect_local_rest_img": lndconnect_local_rest_img,
        "lndconnect_tor_grpc_img": lndconnect_tor_grpc_img,
        "lndconnect_tor_rest_img": lndconnect_tor_rest_img
    }
    return render_template('lndconnect.html', **templateData)
Exemplo n.º 2
0
def page_vpn_info():
    check_logged_in()

    # Check if we are premium
    if is_community_edition():
        return redirect("/")

    # Check if port is forwarded
    port_forwarded = False
    ip = get_public_ip()
    if subprocess.call(["nc", "-v", "-u", "-w", "1", ip, "51194"]) == 0:
        port_forwarded = True

    # Get status
    status = "Setting up..."
    vpn_file_exists = False
    if os.path.isfile("/home/pivpn/ovpns/mynode_vpn.ovpn"):
        vpn_file_exists = True
        status = "Running"

    templateData = {
        "title": "myNode VPN Info",
        "status": status,
        "vpn_file_exists": vpn_file_exists,
        "port_forwarded": port_forwarded,
        "public_ip": ip,
        "port": "51194",
        "ui_settings": read_ui_settings()
    }
    return render_template('vpn_info.html', **templateData)
Exemplo n.º 3
0
def page_tor():
    check_logged_in()
    mynode_onion_hostname = "..."
    mynode_onion_password = "******"

    # Check if we are premium
    if is_community_edition():
        return redirect("/")

    # Get Onion URLs
    try:
        if os.path.isfile("/var/lib/tor/mynode/hostname"):
            with open("/var/lib/tor/mynode/hostname") as f:
                contents = f.read().split()
                mynode_onion_hostname = contents[0]
                mynode_onion_password = contents[1]
    except:
        mynode_onion_hostname = "error"
        mynode_onion_password = "******"

    # Services
    services = []
    services.append({"service": "myNode Web", "port": "80", "guide": ""})
    services.append({"service": "LND Hub", "port": "3000", "guide": ""})
    services.append({
        "service": "BTC RPC Explorer",
        "port": "3002",
        "guide": ""
    })
    services.append({"service": "LND Admin", "port": "3004", "guide": ""})
    services.append({
        "service": "Ride the Lightning",
        "port": "3010",
        "guide": ""
    })
    services.append({
        "service": "Bitcoin API (REST)",
        "port": "8332",
        "guide": ""
    })
    services.append({
        "service": "LND API (gRPC)",
        "port": "10009",
        "guide": ""
    })
    services.append({
        "service": "LND API (REST)",
        "port": "10080",
        "guide": ""
    })
    services.append({
        "service": "Electrum Server",
        "port": "50001",
        "guide": "https://mynodebtc.com/guide/electrum_server_tor"
    })
    services.append({
        "service": "Electrum Server",
        "port": "50002",
        "guide": "https://mynodebtc.com/guide/electrum_server_tor"
    })

    # App links
    rpc_password = get_bitcoin_rpc_password()
    fully_noded_link = "btcrpc://*****:*****@{}:8332?label=myNode%20Tor&v2password={}".format(
        rpc_password, mynode_onion_hostname, mynode_onion_password)

    # Load page
    templateData = {
        "title": "myNode Tor Services",
        "mynode_onion_hostname": mynode_onion_hostname,
        "mynode_onion_password": mynode_onion_password,
        "services": services,
        "fully_noded_link": fully_noded_link,
        "ui_settings": read_ui_settings()
    }
    return render_template('tor.html', **templateData)
Exemplo n.º 4
0
def page_tor():
    mynode_onion_hostname = "..."
    mynode_onion_password = "******"

    # Check if we are premium
    if is_community_edition():
        return redirect("/")

    # Get Onion URLs
    try:
        if os.path.isfile("/var/lib/tor/mynode/hostname"):
            with open("/var/lib/tor/mynode/hostname") as f:
                contents = f.read().split()
                mynode_onion_hostname = contents[0]
                mynode_onion_password = contents[1]
    except:
        mynode_onion_hostname = "error"
        mynode_onion_password = "******"

    services = []
    services.append({"service": "myNode Web", "port": "80", "guide": ""})
    services.append({"service": "LND Hub", "port": "3000", "guide": ""})
    services.append({
        "service": "BTC RPC Explorer",
        "port": "3002",
        "guide": ""
    })
    services.append({"service": "LND Admin", "port": "3004", "guide": ""})
    services.append({
        "service": "Ride the Lightning",
        "port": "3010",
        "guide": ""
    })
    services.append({
        "service": "Bitcoin API (REST)",
        "port": "8332",
        "guide": ""
    })
    services.append({
        "service": "LND API (gRPC)",
        "port": "10009",
        "guide": ""
    })
    services.append({
        "service": "LND API (REST)",
        "port": "10080",
        "guide": ""
    })
    services.append({
        "service": "Electrum Server",
        "port": "50001",
        "guide": "https://mynodebtc.com/guide/electrum_server_tor"
    })
    services.append({
        "service": "Electrum Server",
        "port": "50002",
        "guide": "https://mynodebtc.com/guide/electrum_server_tor"
    })

    # Load page
    templateData = {
        "title": "myNode Tor Services",
        "mynode_onion_hostname": mynode_onion_hostname,
        "mynode_onion_password": mynode_onion_password,
        "services": services
    }
    return render_template('tor.html', **templateData)