Coverage for seedboxsync/front/views/settings/nas.py: 100%
19 statements
« prev ^ index » next coverage.py v7.16.1, created at 2026-09-26 17:14 +0000
« prev ^ index » next coverage.py v7.16.1, created at 2026-09-26 17:14 +0000
1#
2# Copyright (C) 2015-2026 Guillaume Kulakowski <guillaume@kulakowski.fr>
3#
4# For the full copyright and license information, please view the LICENSE
5# file that was distributed with this source code.
6#
7"""SeedboxSync Flask view for settings NAS."""
9from flask import render_template
10from seedboxsync.core import current_app
11from seedboxsync.front.babel import gettext as _
12from seedboxsync.front.forms import SettingsNasForm
13from seedboxsync.front.login_manager import login_required
14from seedboxsync.front.utils import save_settings_form, toast
15from seedboxsync.front.views import bp_settings as bp
18@bp.route("/nas", methods=("GET", "POST"))
19@login_required # type: ignore[untyped-decorator]
20def nas() -> str:
21 """
22 Render and process the NAS storage settings form.
24 Configures local destination paths and storage parameters.
26 Returns:
27 str: Rendered HTML template for the NAS settings page.
28 """
29 form = SettingsNasForm(data=current_app.seedboxsync_config)
31 if form.validate_on_submit():
32 try:
33 save_settings_form(form)
34 toast(_("Configuration saved successfully."), _("Local (NAS)"), "success")
35 except Exception as e:
36 current_app.logger.exception("Failed to save configuration.", exc_info=e)
37 toast(_("Failed to save configuration."), _("Local (NAS)"), "danger")
39 return render_template("settings/nas.html", form=form)