fd
This commit is contained in:
@@ -10,7 +10,7 @@ from textual.screen import ModalScreen
|
||||
from textual.widgets import Static, Button, Input, Label, ListView, ListItem, Rule, Select, Checkbox
|
||||
from pathlib import Path
|
||||
|
||||
from SYS.config import load_config, save_config, reload_config, global_config, count_changed_entries, ConfigSaveConflict
|
||||
from SYS.config import load_config, save_config, save_config_and_verify, reload_config, global_config, count_changed_entries, ConfigSaveConflict
|
||||
from SYS.database import db
|
||||
from SYS.logger import log, debug
|
||||
from Store.registry import _discover_store_classes, _required_keys_for
|
||||
@@ -1739,7 +1739,10 @@ class ConfigModal(ModalScreen):
|
||||
@work(thread=True)
|
||||
def _save_background(self, cfg: Dict[str, Any], changed: int) -> None:
|
||||
try:
|
||||
saved_entries = save_config(cfg)
|
||||
# Use the verified save path which will check that crucial keys
|
||||
# (like AllDebrid API keys) persisted to disk. This ensures the UI
|
||||
# surface reports a failure immediately if post-save verification fails.
|
||||
saved_entries = save_config_and_verify(cfg)
|
||||
try:
|
||||
appobj = self.app
|
||||
except Exception:
|
||||
@@ -1758,6 +1761,17 @@ class ConfigModal(ModalScreen):
|
||||
appobj.call_from_thread(self._on_save_complete, False, str(exc), changed, 0)
|
||||
else:
|
||||
self._on_save_complete(False, str(exc), changed, 0)
|
||||
except Exception as exc:
|
||||
# Bubble up verification/other save errors back to the UI so the
|
||||
# user knows persistent storage failed.
|
||||
try:
|
||||
appobj = self.app
|
||||
except Exception:
|
||||
appobj = None
|
||||
if appobj and hasattr(appobj, 'call_from_thread'):
|
||||
appobj.call_from_thread(self._on_save_complete, False, str(exc), changed, 0)
|
||||
else:
|
||||
self._on_save_complete(False, str(exc), changed, 0)
|
||||
except Exception as exc:
|
||||
try:
|
||||
appobj = self.app
|
||||
|
||||
Reference in New Issue
Block a user