Minor fixes
This commit is contained in:
parent
699d28da17
commit
441031a4ac
4 changed files with 16 additions and 14 deletions
|
|
@ -19,7 +19,7 @@ import qrcode
|
|||
from flask_babel import lazy_gettext as _l
|
||||
|
||||
CHANGES_REQUIRING_RESTART = ['wifi_password', 'ssid', 'enable_access_point', 'enable_chat', 'enable_delta_chat', 'butterbox_hostname', 'ssh_access_settings', 'root_account_settings', 'root_password']
|
||||
|
||||
RASPAP_INSTALLED = os.path.exists("/var/www/html/raspap")
|
||||
|
||||
def gen_username() -> str:
|
||||
words = top_n_list("en", 5000)
|
||||
|
|
@ -84,13 +84,13 @@ def index():
|
|||
enable_chat = get_setting("enable_chat")
|
||||
enable_file_viewer = get_setting("enable_file_viewer")
|
||||
enable_deltachat = get_setting("enable_deltachat")
|
||||
enable_wifi_sharing = get_setting("enable_wifi_sharing")
|
||||
service_array = []
|
||||
usb_inserted = False # actual test of whether USB is inserted
|
||||
if os.path.exists(app.config["BUTTERBOX_USB_PATH"]):
|
||||
usb_inserted = True
|
||||
usb_has_maps = False # actual test of whether USB has maps folder
|
||||
usb_has_appstore = False # actual test of whether USB has an appstore
|
||||
#enable_wifi_sharing = get_setting("enable_wifi_sharing")
|
||||
#if enable_wifi_sharing == 'true':
|
||||
# service_array.append({"name": _l("Share Access"), "image": url_for("static", filename="images/share-icon.svg"), "url": url_for("share")})
|
||||
if enable_deltachat == 'true':
|
||||
|
|
@ -211,7 +211,6 @@ def step2():
|
|||
@app.route('/step3', methods=['GET', 'POST'])
|
||||
def step3():
|
||||
form = Step3Form()
|
||||
|
||||
step3_bool_settings = ['enable_wifi_sharing', 'enable_access_point']
|
||||
step3_settings = ['ssid', 'wifi_password']
|
||||
if not form.is_submitted():
|
||||
|
|
@ -221,13 +220,15 @@ def step3():
|
|||
getattr(form, s).data = get_setting(s)
|
||||
if form.validate_on_submit():
|
||||
if form.submit.data:
|
||||
for s in (step3_bool_settings + step3_settings):
|
||||
for s in (step3_settings + step3_bool_settings):
|
||||
setting_value = getattr(form, s).data
|
||||
if s in step3_bool_settings:
|
||||
setting_value = str(setting_value).lower()
|
||||
set_setting(s, setting_value)
|
||||
db.session.commit()
|
||||
return redirect(url_for('step4'))
|
||||
if get_setting("first_setup") == "true":
|
||||
return render_template('step3.html', form=form, get_setting=get_setting)
|
||||
return render_template('step3.html', raspap_installed=RASPAP_INSTALLED, form=form, get_setting=get_setting)
|
||||
return redirect(url_for('admin'))
|
||||
|
||||
|
||||
|
|
@ -278,7 +279,6 @@ def admin():
|
|||
@app.route('/admin_settings', methods=['GET', 'POST'])
|
||||
@login_required
|
||||
def admin_settings():
|
||||
raspap_installed = os.path.exists("/var/www/html/raspap")
|
||||
form = SettingsForm()
|
||||
populate_settings = ['butterbox_name', 'wifi_password', 'ssid', 'root_account_settings', 'ssh_access_settings', 'root_password', 'admin_password']
|
||||
bool_settings = ['enable_access_point','enable_file_viewer', 'enable_chat', 'enable_deltachat', 'enable_wifi_sharing']
|
||||
|
|
@ -337,7 +337,7 @@ def admin_settings():
|
|||
set_setting('apply_changes', "true")
|
||||
dump_settings("settings.txt")
|
||||
flash(_("⚠️ Changes applied! If needed, the system will restart. This may take up to two minutes."))
|
||||
return render_template('admin.html', raspap_installed=raspap_installed, get_setting=get_setting, form=form)
|
||||
return render_template('admin.html', raspap_installed=RASPAP_INSTALLED, get_setting=get_setting, form=form)
|
||||
|
||||
|
||||
@app.route('/messaging', methods=['GET', 'POST'])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue