mirror of
https://github.com/mynodebtc/mynode.git
synced 2024-11-12 16:39:15 +00:00
Add way to update public IP independently
This commit is contained in:
parent
e8af64d3b7
commit
897a317491
|
@ -518,9 +518,9 @@ def internal_error(error):
|
|||
# Disable browser caching
|
||||
@app.after_request
|
||||
def set_response_headers(response):
|
||||
response.headers['Cache-Control'] = 'no-cache, no-store, must-revalidate'
|
||||
response.headers['Pragma'] = 'no-cache'
|
||||
response.headers['Expires'] = '0'
|
||||
#response.headers['Cache-Control'] = 'no-cache, no-store, must-revalidate'
|
||||
#response.headers['Pragma'] = 'no-cache'
|
||||
#response.headers['Expires'] = '0'
|
||||
return response
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -536,6 +536,8 @@ if __name__ == "__main__":
|
|||
lnd_thread.start()
|
||||
drive_thread = BackgroundThread(update_device_info, 60)
|
||||
drive_thread.start()
|
||||
public_ip_thread = BackgroundThread(find_public_ip, 60*60*3) # 3-hour repeat
|
||||
public_ip_thread.start()
|
||||
checkin_thread = BackgroundThread(check_in, 60*60*24) # Per-day checkin
|
||||
checkin_thread.start()
|
||||
|
||||
|
|
|
@ -176,6 +176,7 @@ def get_latest_version_page():
|
|||
def check_in_page():
|
||||
check_logged_in()
|
||||
check_in()
|
||||
find_public_ip()
|
||||
return redirect("/settings")
|
||||
|
||||
@mynode_settings.route("/settings/reset-blockchain")
|
||||
|
|
|
@ -134,9 +134,19 @@ def update_lnd_info_thread():
|
|||
print("CAUGHT update_lnd_info_thread EXCEPTION: " + str(e))
|
||||
|
||||
|
||||
# Check every 3 hours
|
||||
def find_public_ip():
|
||||
global public_ip
|
||||
|
||||
# Get public IP
|
||||
try:
|
||||
public_ip = get('https://mynodebtc.com/device_api/get_public_ip.php').text
|
||||
except Exception as e:
|
||||
public_ip = "Failed to find public IP. Click on the refresh button above."
|
||||
|
||||
|
||||
# Checkin every 24 hours
|
||||
def check_in():
|
||||
global public_ip
|
||||
|
||||
# Check in
|
||||
product_key = get_product_key()
|
||||
|
@ -147,12 +157,6 @@ def check_in():
|
|||
"product_key": product_key
|
||||
}
|
||||
|
||||
# Get public IP
|
||||
try:
|
||||
public_ip = get('https://mynodebtc.com/device_api/get_public_ip.php').text
|
||||
except Exception as e:
|
||||
public_ip = "Failed to find public IP. Click on the refresh button above."
|
||||
|
||||
# Check for new version
|
||||
update_latest_version()
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from flask import Blueprint, render_template, session, abort, Markup, request, redirect, send_from_directory, url_for, flash
|
||||
from thread_functions import get_public_ip, check_in
|
||||
from thread_functions import get_public_ip, check_in, find_public_ip
|
||||
from device_info import is_community_edition
|
||||
from settings import read_ui_settings
|
||||
from user_management import check_logged_in
|
||||
|
@ -88,4 +88,5 @@ def page_download_ovpn():
|
|||
def check_in_page():
|
||||
check_logged_in()
|
||||
check_in()
|
||||
find_public_ip()
|
||||
return redirect("/vpn-info")
|
Loading…
Reference in New Issue
Block a user