190 build - улучшение работы всего сервиса. часть 1

This commit is contained in:
2026-10-21 13:23:38 +03:00
parent e4bedb1264
commit c6dcfcf533
44 changed files with 5391 additions and 0 deletions

View File

@@ -77,6 +77,21 @@ def prepare_ui_storage(settings_dir: Path, *, filenames: tuple[str, ...], legacy
if not valid:
raise ValueError(f"Не удалось перенести настройки интерфейса: {source.name} повреждён")
atomic_write(destination, content)
<<<<<<< HEAD
# Import recovery history exactly once. Otherwise every restart resurrects
# old backups that rolling retention already removed.
old_backups = settings_dir / "backups"
new_backups = directory / "backups"
new_backups.mkdir(exist_ok=True)
marker = directory / ".ui_backups_migrated_v1.json"
if not marker.exists():
for filename in (*filenames, legacy_filename):
for source in old_backups.glob(Path(filename).stem + "_*.json"):
destination = new_backups / source.name
if not destination.exists():
shutil.copy2(source, destination)
atomic_write(marker, json.dumps({"completed": True, "version": 1}))
=======
# Preserve the previous recovery history as well as the current config.
old_backups = settings_dir / "backups"
new_backups = directory / "backups"
@@ -86,4 +101,5 @@ def prepare_ui_storage(settings_dir: Path, *, filenames: tuple[str, ...], legacy
destination = new_backups / source.name
if not destination.exists():
shutil.copy2(source, destination)
>>>>>>> e4bedb1264fca8a6bc8a41f0ca1ff67b176c6651
return directory