Add a script to implement disabling services and changing various bits of config
This commit is contained in:
parent
ed1b03a609
commit
480bd7f845
2 changed files with 149 additions and 5 deletions
|
|
@ -16,7 +16,7 @@ import string
|
|||
import glob
|
||||
import time
|
||||
import qrcode
|
||||
from datetime import datetime
|
||||
from app.change_manager import CHANGES_REQUIRING_RESTART, check_settings
|
||||
|
||||
def gen_username() -> str:
|
||||
words = top_n_list("en", 5000)
|
||||
|
|
@ -156,10 +156,9 @@ def logout():
|
|||
@login_required
|
||||
def admin():
|
||||
form = SettingsForm()
|
||||
populate_settings = ['butterbox_name', 'wifi_password', 'ssid', 'butterbox_hostname']
|
||||
populate_settings = ['butterbox_name', 'wifi_password', 'ssid', 'butterbox_hostname', 'root_account_settings', 'ssh_access_settings']
|
||||
bool_settings = ['enable_access_point','enable_file_viewer', 'enable_map_viewer', 'enable_app_store', 'enable_chat', 'enable_deltachat', 'enable_wifi_sharing']
|
||||
populate_settings.extend(bool_settings)
|
||||
|
||||
if not form.is_submitted():
|
||||
for s in populate_settings:
|
||||
if s in bool_settings:
|
||||
|
|
@ -181,8 +180,7 @@ def admin():
|
|||
print(f"New value was changed for {s}. Existing value was {existing_value}, new value was {new_value}")
|
||||
set_setting(s, new_value)
|
||||
non_admin_settings_changed = True
|
||||
if s in ['butterbox_name', 'wifi_password', 'ssid', 'enable_access_point', 'enable_chat', 'enable_delta_chat', 'butterbox_hostname',
|
||||
'ssh_access_settings', 'root_account_settings']:
|
||||
if s in CHANGES_REQUIRING_RESTART:
|
||||
app.config['SETTINGS_CHANGED'] = True
|
||||
|
||||
new_logo = form.butterbox_logo.data
|
||||
|
|
@ -216,6 +214,7 @@ def admin():
|
|||
if form.apply_changes.data:
|
||||
set_setting('apply_changes', "true")
|
||||
dump_settings("settings.txt")
|
||||
check_settings()
|
||||
flash(_("⚠️ Changes applied! Please wait for the box to restart."))
|
||||
|
||||
return render_template('admin.html', get_setting=get_setting, form=form)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue