Tweak public IP detection

This commit is contained in:
Taylor Helsper 2020-02-09 15:26:35 -06:00
parent 0905c9e746
commit c000d73d77
4 changed files with 7 additions and 6 deletions

View File

@ -220,7 +220,6 @@ def get_latest_version_page():
def check_in_page(): def check_in_page():
check_logged_in() check_logged_in()
check_in() check_in()
find_public_ip()
return redirect("/settings") return redirect("/settings")
@mynode_settings.route("/settings/reset-blockchain") @mynode_settings.route("/settings/reset-blockchain")

View File

@ -102,9 +102,9 @@
<div class="info_tile_header">Public IP Address</div> <div class="info_tile_header">Public IP Address</div>
<div class="info_tile_contents"> <div class="info_tile_contents">
{{public_ip}} {{public_ip}}
{% if 'Failed to find' in public_ip %} {% if 'Failed to find' in public_ip or 'not_detected' in public_ip %}
<br/> <br/>
<a href="/settings/check-in" class="ui-button ui-widget ui-corner-all settings_button_small">Refresh</a> <a href="/vpn-info/find-public-ip" class="ui-button ui-widget ui-corner-all settings_button_small">Refresh</a>
{% endif %} {% endif %}
</div> </div>
</div> </div>

View File

@ -140,7 +140,7 @@ def find_public_ip():
# Get public IP # Get public IP
try: try:
public_ip = get('https://mynodebtc.com/device_api/get_public_ip.php').text public_ip = get('http://mynodebtc.com/device_api/get_public_ip.php').text
except Exception as e: except Exception as e:
public_ip = "Failed to find public IP. " public_ip = "Failed to find public IP. "
@ -160,6 +160,9 @@ def check_in():
# Check for new version # Check for new version
update_latest_version() update_latest_version()
# Find public IP
find_public_ip()
# Check In # Check In
check_in_success = False check_in_success = False
while not check_in_success: while not check_in_success:

View File

@ -84,9 +84,8 @@ def page_download_ovpn():
# Download ovpn # Download ovpn
return send_from_directory(directory="/home/pivpn/ovpns/", filename="mynode_vpn.ovpn") return send_from_directory(directory="/home/pivpn/ovpns/", filename="mynode_vpn.ovpn")
@mynode_vpn.route("/vpn-info/check-in") @mynode_vpn.route("/vpn-info/find-public-ip")
def check_in_page(): def check_in_page():
check_logged_in() check_logged_in()
check_in()
find_public_ip() find_public_ip()
return redirect("/vpn-info") return redirect("/vpn-info")