Prevent refresh of critical pages from applying twice

This commit is contained in:
Taylor Helsper 2020-05-12 21:16:24 -05:00
parent 13fa5d2548
commit a3afecd10b
2 changed files with 34 additions and 1 deletions

View File

@ -707,7 +707,6 @@ def page_logout():
@app.route("/about") @app.route("/about")
def page_about(): def page_about():
check_logged_in() check_logged_in()
check_and_mark_reboot_action("toggle_mainpage")
templateData = {"ui_settings": read_ui_settings()} templateData = {"ui_settings": read_ui_settings()}
return render_template('about.html', **templateData) return render_template('about.html', **templateData)

View File

@ -311,6 +311,8 @@ def page_status():
def upgrade_page(): def upgrade_page():
check_logged_in() check_logged_in()
check_and_mark_reboot_action("upgrade")
# Upgrade device # Upgrade device
t = Timer(1.0, upgrade_device) t = Timer(1.0, upgrade_device)
t.start() t.start()
@ -328,6 +330,8 @@ def upgrade_page():
def upgrade_beta_page(): def upgrade_beta_page():
check_logged_in() check_logged_in()
check_and_mark_reboot_action("upgrade_beta")
# Upgrade device # Upgrade device
t = Timer(1.0, upgrade_device_beta) t = Timer(1.0, upgrade_device_beta)
t.start() t.start()
@ -356,6 +360,9 @@ def check_in_page():
@mynode_settings.route("/settings/reset-blockchain") @mynode_settings.route("/settings/reset-blockchain")
def reset_blockchain_page(): def reset_blockchain_page():
check_logged_in() check_logged_in()
check_and_mark_reboot_action("reset_blockchain")
t = Timer(1.0, reset_blockchain) t = Timer(1.0, reset_blockchain)
t.start() t.start()
@ -371,6 +378,9 @@ def reset_blockchain_page():
@mynode_settings.route("/settings/restart-quicksync") @mynode_settings.route("/settings/restart-quicksync")
def restart_quicksync_page(): def restart_quicksync_page():
check_logged_in() check_logged_in()
check_and_mark_reboot_action("restart_quicksync")
t = Timer(1.0, restart_quicksync) t = Timer(1.0, restart_quicksync)
t.start() t.start()
@ -438,6 +448,9 @@ def rescan_blockchain_page():
@mynode_settings.route("/settings/reset-docker") @mynode_settings.route("/settings/reset-docker")
def reset_docker_page(): def reset_docker_page():
check_logged_in() check_logged_in()
check_and_mark_reboot_action("reset_docker")
t = Timer(1.0, reset_docker) t = Timer(1.0, reset_docker)
t.start() t.start()
@ -454,6 +467,9 @@ def reset_docker_page():
@mynode_settings.route("/settings/reset-electrs") @mynode_settings.route("/settings/reset-electrs")
def reset_electrs_page(): def reset_electrs_page():
check_logged_in() check_logged_in()
check_and_mark_reboot_action("reset_electrs")
t = Timer(1.0, reset_electrs) t = Timer(1.0, reset_electrs)
t.start() t.start()
@ -483,6 +499,8 @@ def factory_reset_page():
flash("Invalid Password", category="error") flash("Invalid Password", category="error")
return redirect(url_for(".page_settings")) return redirect(url_for(".page_settings"))
else: else:
check_and_mark_reboot_action("factory_reset")
t = Timer(2.0, factory_reset) t = Timer(2.0, factory_reset)
t.start() t.start()
@ -549,6 +567,8 @@ def page_lnd_delete_wallet():
flash("Invalid Password", category="error") flash("Invalid Password", category="error")
return redirect(url_for(".page_settings")) return redirect(url_for(".page_settings"))
check_and_mark_reboot_action("delete_lnd_data")
# Successful Auth # Successful Auth
delete_lnd_data() delete_lnd_data()
@ -575,6 +595,8 @@ def page_reset_tor():
flash("Invalid Password", category="error") flash("Invalid Password", category="error")
return redirect(url_for(".page_settings")) return redirect(url_for(".page_settings"))
else: else:
check_and_mark_reboot_action("reset_tor")
# Successful Auth # Successful Auth
reset_tor() reset_tor()
@ -595,6 +617,8 @@ def page_reset_tor():
def page_enable_btc_lnd_tor(): def page_enable_btc_lnd_tor():
check_logged_in() check_logged_in()
check_and_mark_reboot_action("enable_btc_lnd_tor")
enable = request.args.get('enable') enable = request.args.get('enable')
if enable == "1": if enable == "1":
enable_btc_lnd_tor() enable_btc_lnd_tor()
@ -618,6 +642,8 @@ def page_enable_btc_lnd_tor():
def page_enable_aptget_tor(): def page_enable_aptget_tor():
check_logged_in() check_logged_in()
check_and_mark_reboot_action("enable_aptget_tor")
enable = request.args.get('enable') enable = request.args.get('enable')
if enable == "1": if enable == "1":
enable_aptget_tor() enable_aptget_tor()
@ -663,6 +689,8 @@ def regen_electrs_certs_page():
def reinstall_app_page(): def reinstall_app_page():
check_logged_in() check_logged_in()
check_and_mark_reboot_action("reinstall_app")
app = request.args.get('app') app = request.args.get('app')
# Re-install app # Re-install app
@ -681,6 +709,9 @@ def reinstall_app_page():
@mynode_settings.route("/settings/toggle-uploader") @mynode_settings.route("/settings/toggle-uploader")
def toggle_uploader_page(): def toggle_uploader_page():
check_logged_in() check_logged_in()
check_and_mark_reboot_action("toggle_uploader")
# Toggle uploader # Toggle uploader
if is_uploader(): if is_uploader():
unset_uploader() unset_uploader()
@ -703,6 +734,9 @@ def toggle_uploader_page():
@mynode_settings.route("/settings/toggle-quicksync") @mynode_settings.route("/settings/toggle-quicksync")
def toggle_quicksync_page(): def toggle_quicksync_page():
check_logged_in() check_logged_in()
check_and_mark_reboot_action("toggle_quicksync")
# Toggle uploader # Toggle uploader
if is_quicksync_enabled(): if is_quicksync_enabled():
t = Timer(1.0, settings_disable_quicksync) t = Timer(1.0, settings_disable_quicksync)