feat: Auto-update with ZIP portable (v1.7.5)
Some checks failed
CI / run (push) Has been cancelled

- Add update notification dialog on startup
- Implement portable ZIP update mechanism with robocopy
- Auto-restart after update
- Remove update banner, show dialog directly
- Fix Windows Server compatibility
This commit is contained in:
Umbrix Admin
2026-01-20 13:43:51 +03:00
parent 0b46de4fa8
commit 5989a67239
2 changed files with 37 additions and 8 deletions

View File

@@ -213,13 +213,14 @@ class NewVersionDialog extends HookConsumerWidget with PresLogger {
final updateScript = '''
@echo off
echo Waiting for application to close...
timeout /t 3 /nobreak > nul
timeout /t 2 /nobreak > nul
echo Updating files...
xcopy /E /Y "${tempDir.path}\\*" "$appDir\\"
robocopy "${tempDir.path}" "$appDir" /E /IS /IT /COPY:DAT /DCOPY:DAT /R:3 /W:1
echo Cleanup...
rmdir /S /Q "${tempDir.path}"
del "$savePath"
echo Starting application...
start "" "$exePath"
@@ -233,16 +234,16 @@ del "%~f0"
if (context.mounted) {
CustomToast.success('Обновление установлено! Приложение перезагрузится...').show(context);
await Future.delayed(const Duration(milliseconds: 500));
context.pop();
}
// Запустить скрипт и закрыть приложение
await Process.start('cmd', ['/c', scriptPath], mode: ProcessStartMode.detached);
// Запустить скрипт в фоне
Process.start('cmd', ['/c', 'start', '/min', scriptPath], mode: ProcessStartMode.detached);
// Задержка перед выходом
Future.delayed(const Duration(seconds: 1), () {
exit(0);
});
// Немедленный выход из приложения
await Future.delayed(const Duration(milliseconds: 200));
exit(0);
return;
} catch (e) {