mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
fix: sync
This commit is contained in:
@@ -201,7 +201,6 @@ abstract final class ICloud {
|
||||
static Future<void> sync() async {
|
||||
final result = await download(relativePath: Miscs.bakFileName);
|
||||
if (result != null) {
|
||||
_logger.warning('Download backup failed: $result');
|
||||
await backup();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -99,7 +99,6 @@ abstract final class Webdav {
|
||||
static Future<void> sync() async {
|
||||
final result = await download(relativePath: Miscs.bakFileName);
|
||||
if (result != null) {
|
||||
_logger.warning('Download failed: $result');
|
||||
await backup();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import 'package:logging/logging.dart';
|
||||
import 'package:toolbox/data/model/server/private_key_info.dart';
|
||||
import 'package:toolbox/data/model/server/server_private_info.dart';
|
||||
import 'package:toolbox/data/model/server/snippet.dart';
|
||||
import 'package:toolbox/data/res/misc.dart';
|
||||
import 'package:toolbox/data/res/provider.dart';
|
||||
import 'package:toolbox/data/res/rebuild.dart';
|
||||
import 'package:toolbox/data/res/store.dart';
|
||||
@@ -74,7 +75,7 @@ class Backup {
|
||||
|
||||
static Future<String> backup([String? name]) async {
|
||||
final result = _diyEncrypt(json.encode(Backup.loadFromStore().toJson()));
|
||||
final path = '${Paths.doc}/${name ?? 'srvbox_bak.json'}';
|
||||
final path = '${Paths.doc}/${name ?? Miscs.bakFileName}';
|
||||
await File(path).writeAsString(result);
|
||||
return path;
|
||||
}
|
||||
|
||||
@@ -19,5 +19,5 @@ abstract final class Miscs {
|
||||
|
||||
static const jsonEncoder = JsonEncoder.withIndent(' ');
|
||||
|
||||
static const bakFileName = 'srvbox_backup.json';
|
||||
static const bakFileName = 'srvbox_bak.json';
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ import 'package:toolbox/data/model/server/server_private_info.dart';
|
||||
import 'package:toolbox/data/model/server/snippet.dart';
|
||||
import 'package:toolbox/data/model/ssh/virtual_key.dart';
|
||||
import 'package:toolbox/data/res/build_data.dart';
|
||||
import 'package:toolbox/data/res/misc.dart';
|
||||
import 'package:toolbox/data/res/provider.dart';
|
||||
import 'package:toolbox/data/res/store.dart';
|
||||
import 'package:toolbox/data/res/url.dart';
|
||||
@@ -64,7 +65,7 @@ void _runInZone(void Function() body) {
|
||||
Future<void> _initApp() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
await Paths.init(BuildData.name, bakName: 'srvbox');
|
||||
await Paths.init(BuildData.name, bakName: Miscs.bakFileName);
|
||||
await _initData();
|
||||
_setupDebug();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user