feat: improve desktop path selection and USB connection recovery

This commit is contained in:
tongtong committed 2026-11-13 03:14:00 +08:00
1 parent 5aa575f182
commit 6490665af8
28 files changed
+846 -51

No files matched your search

+18 -3
View File
@@ -47,13 +47,28 @@ class ManagerModel extends ChangeNotifier {
Future<void> init() async {
await action(() async {
await repository.init();
agents.savePath = (key, value) async {
repository.settings.agentPaths[key] = value;
await repository.save();
};
await agents.initialize(
adminFile: repository.root == null
? p.join(p.dirname(Platform.resolvedExecutable), 'admin.env')
: p.join(repository.root!.path, 'config', 'private', 'admin.env'),
adminFile:
repository.settings.agentPaths['admin'] ??
(repository.root == null
? p.join(p.dirname(Platform.resolvedExecutable), 'admin.env')
: p.join(
repository.root!.path,
'config',
'private',
'admin.env',
)),
server: repository.settings.server,
origin: repository.settings.origin,
);
agents.configPath =
repository.settings.agentPaths['configPath'] ?? agents.configPath;
agents.enrollmentPath =
repository.settings.agentPaths['enroll'] ?? agents.enrollmentPath;
notice = '准备就绪';
});
await refresh();