Add setting to toggle pass warning
This commit is contained in:
parent
c711e8e7dd
commit
2ddeafcd23
|
@ -633,15 +633,6 @@ def set_flask_session_timeout(days, hours):
|
|||
set_file_contents("/home/bitcoin/.mynode/flask_session_timeout", "{},{}".format(days, hours))
|
||||
os.system("sync")
|
||||
|
||||
def get_randomize_balances():
|
||||
return os.path.isfile('/home/bitcoin/.mynode/randomize_balances')
|
||||
|
||||
def set_randomize_balances(randomize):
|
||||
if randomize:
|
||||
touch("/home/bitcoin/.mynode/randomize_balances")
|
||||
else:
|
||||
delete_file("rm -f /home/bitcoin/.mynode/randomize_balances")
|
||||
|
||||
def is_www_python3():
|
||||
return os.path.isfile('/home/bitcoin/.mynode/.www_use_python3')
|
||||
|
||||
|
|
|
@ -309,7 +309,7 @@ def get_lightning_balance_info():
|
|||
if channel_num >= 0 and wallet_num >= 0:
|
||||
balance_data["total_balance"] = format_sat_amount(channel_num + wallet_num)
|
||||
|
||||
if get_randomize_balances():
|
||||
if settings_file_exists("randomize_balances"):
|
||||
channel_num = random.randint(40000,1000000)
|
||||
wallet_num = random.randint(100000,1500000)
|
||||
balance_data["channel_balance"] = format_sat_amount(channel_num)
|
||||
|
|
|
@ -568,7 +568,7 @@ def index():
|
|||
"swap_usage": get_swap_usage(),
|
||||
"device_temp": get_device_temp(),
|
||||
"upgrade_available": upgrade_available,
|
||||
"hide_password_warning": hide_password_warning(),
|
||||
"hide_password_warning": settings_file_exists("hide_password_warning"),
|
||||
"has_changed_password": has_changed_password(),
|
||||
"ui_settings": read_ui_settings()
|
||||
}
|
||||
|
|
|
@ -88,7 +88,8 @@ def page_settings():
|
|||
"netdata_enabled": is_service_enabled("netdata"),
|
||||
"www_python3": is_www_python3(),
|
||||
"uas_usb": is_uas_usb_enabled(),
|
||||
"randomize_balances": get_randomize_balances(),
|
||||
"randomize_balances": settings_file_exists("randomize_balances"),
|
||||
"hide_password_warning": settings_file_exists("hide_password_warning"),
|
||||
"is_uploader_device": is_uploader(),
|
||||
"download_rate": download_rate,
|
||||
"upload_rate": upload_rate,
|
||||
|
@ -1173,15 +1174,19 @@ def page_enable_enable_www_python3():
|
|||
flash("WWW Python 3 Setting Updated", category="message")
|
||||
return redirect("/settings")
|
||||
|
||||
@mynode_settings.route("/settings/enable_randomize_balances")
|
||||
def page_enable_enable_randomize_balances():
|
||||
@mynode_settings.route("/settings/toggle_setting")
|
||||
def page_toggle_setting():
|
||||
check_logged_in()
|
||||
|
||||
name = request.args.get('name')
|
||||
enable = request.args.get('enable')
|
||||
if enable == "1":
|
||||
set_randomize_balances(True)
|
||||
create_settings_file(name)
|
||||
elif enable == "0":
|
||||
delete_settings_file(name)
|
||||
else:
|
||||
set_randomize_balances(False)
|
||||
flash("Error Updating Setting", category="error")
|
||||
return redirect("/settings")
|
||||
|
||||
flash("Randomize Balance Setting Updated", category="message")
|
||||
flash("Setting Updated", category="message")
|
||||
return redirect("/settings")
|
|
@ -506,11 +506,26 @@
|
|||
enabled=$('#randomize_balances_checkbox').is(":checked")
|
||||
if (enabled)
|
||||
{
|
||||
window.location.href='/settings/enable_randomize_balances?enable=1'
|
||||
window.location.href='/settings/toggle_setting?name=randomize_balances&enable=1'
|
||||
}
|
||||
else
|
||||
{
|
||||
window.location.href='/settings/enable_randomize_balances?enable=0'
|
||||
window.location.href='/settings/toggle_setting?name=randomize_balances&enable=0'
|
||||
}
|
||||
});
|
||||
|
||||
$('#hide_password_warning_checkbox').change(function () {
|
||||
$("#hide_password_warning_button").show();
|
||||
});
|
||||
$("#hide_password_warning_button").on("click", function() {
|
||||
enabled=$('#hide_password_warning_checkbox').is(":checked")
|
||||
if (enabled)
|
||||
{
|
||||
window.location.href='/settings/toggle_setting?name=hide_password_warning&enable=1'
|
||||
}
|
||||
else
|
||||
{
|
||||
window.location.href='/settings/toggle_setting?name=hide_password_warning&enable=0'
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1327,6 +1342,18 @@
|
|||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="settings_block_subheader">Hide Password Warning</div>
|
||||
This hides the default password warning for taking screenshots.
|
||||
<br/><br/>
|
||||
<label class="switch">
|
||||
<input type="checkbox" id="hide_password_warning_checkbox" {% if hide_password_warning %}checked{% endif %}>
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
<br/><br/>
|
||||
<button id="hide_password_warning_button" style="display: none;" class="ui-button ui-widget ui-corner-all settings_button_small">Save</button>
|
||||
|
||||
<div class="divider"></div>
|
||||
|
||||
<div class="settings_block_subheader">Uploader Device</div>
|
||||
This disables most features and prioritize sharing QuickSync files. It can be reversed later.
|
||||
<br/>
|
||||
|
|
Loading…
Reference in New Issue
Block a user