mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 15:24:35 +01:00
fix: imported servers from ssh config are the same (#882)
This commit is contained in:
@@ -63,6 +63,7 @@ abstract final class SSHConfig {
|
|||||||
void addServer() {
|
void addServer() {
|
||||||
if (currentHost != null && currentHost != '*' && hostname != null) {
|
if (currentHost != null && currentHost != '*' && hostname != null) {
|
||||||
final spi = Spi(
|
final spi = Spi(
|
||||||
|
id: ShortId.generate(),
|
||||||
name: currentHost,
|
name: currentHost,
|
||||||
ip: hostname,
|
ip: hostname,
|
||||||
port: port,
|
port: port,
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:fl_lib/fl_lib.dart';
|
import 'package:fl_lib/fl_lib.dart';
|
||||||
|
import 'package:get_it/get_it.dart';
|
||||||
import 'package:server_box/data/store/container.dart';
|
import 'package:server_box/data/store/container.dart';
|
||||||
import 'package:server_box/data/store/history.dart';
|
import 'package:server_box/data/store/history.dart';
|
||||||
import 'package:server_box/data/store/private_key.dart';
|
import 'package:server_box/data/store/private_key.dart';
|
||||||
@@ -6,25 +7,34 @@ import 'package:server_box/data/store/server.dart';
|
|||||||
import 'package:server_box/data/store/setting.dart';
|
import 'package:server_box/data/store/setting.dart';
|
||||||
import 'package:server_box/data/store/snippet.dart';
|
import 'package:server_box/data/store/snippet.dart';
|
||||||
|
|
||||||
|
final GetIt getIt = GetIt.instance;
|
||||||
|
|
||||||
abstract final class Stores {
|
abstract final class Stores {
|
||||||
static final setting = SettingStore.instance;
|
static SettingStore get setting => getIt<SettingStore>();
|
||||||
static final server = ServerStore.instance;
|
static ServerStore get server => getIt<ServerStore>();
|
||||||
static final container = ContainerStore.instance;
|
static ContainerStore get container => getIt<ContainerStore>();
|
||||||
static final key = PrivateKeyStore.instance;
|
static PrivateKeyStore get key => getIt<PrivateKeyStore>();
|
||||||
static final snippet = SnippetStore.instance;
|
static SnippetStore get snippet => getIt<SnippetStore>();
|
||||||
static final history = HistoryStore.instance;
|
static HistoryStore get history => getIt<HistoryStore>();
|
||||||
|
|
||||||
/// All stores that need backup
|
/// All stores that need backup
|
||||||
static final List<HiveStore> _allBackup = [
|
static List<HiveStore> get _allBackup => [
|
||||||
SettingStore.instance,
|
setting,
|
||||||
ServerStore.instance,
|
server,
|
||||||
ContainerStore.instance,
|
container,
|
||||||
PrivateKeyStore.instance,
|
key,
|
||||||
SnippetStore.instance,
|
snippet,
|
||||||
HistoryStore.instance,
|
history,
|
||||||
];
|
];
|
||||||
|
|
||||||
static Future<void> init() async {
|
static Future<void> init() async {
|
||||||
|
getIt.registerLazySingleton<SettingStore>(() => SettingStore.instance);
|
||||||
|
getIt.registerLazySingleton<ServerStore>(() => ServerStore.instance);
|
||||||
|
getIt.registerLazySingleton<ContainerStore>(() => ContainerStore.instance);
|
||||||
|
getIt.registerLazySingleton<PrivateKeyStore>(() => PrivateKeyStore.instance);
|
||||||
|
getIt.registerLazySingleton<SnippetStore>(() => SnippetStore.instance);
|
||||||
|
getIt.registerLazySingleton<HistoryStore>(() => HistoryStore.instance);
|
||||||
|
|
||||||
await Future.wait(_allBackup.map((store) => store.init()));
|
await Future.wait(_allBackup.map((store) => store.init()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -682,6 +682,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.0.0"
|
version: "4.0.0"
|
||||||
|
get_it:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: get_it
|
||||||
|
sha256: a4292e7cf67193f8e7c1258203104eb2a51ec8b3a04baa14695f4064c144297b
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "8.2.0"
|
||||||
glob:
|
glob:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -65,6 +65,7 @@ dependencies:
|
|||||||
url: https://github.com/lppcg/fl_lib
|
url: https://github.com/lppcg/fl_lib
|
||||||
ref: v1.0.345
|
ref: v1.0.345
|
||||||
flutter_gbk2utf8: ^1.0.1
|
flutter_gbk2utf8: ^1.0.1
|
||||||
|
get_it: ^8.2.0
|
||||||
|
|
||||||
dependency_overrides:
|
dependency_overrides:
|
||||||
# webdav_client_plus:
|
# webdav_client_plus:
|
||||||
@@ -77,7 +78,7 @@ dependency_overrides:
|
|||||||
# path: ../fl_lib
|
# path: ../fl_lib
|
||||||
# fl_build:
|
# fl_build:
|
||||||
# path: ../fl_build
|
# path: ../fl_build
|
||||||
gtk:
|
gtk: # TODO: remove it after fixed in upstream
|
||||||
git:
|
git:
|
||||||
url: https://github.com/lollipopkit/gtk.dart
|
url: https://github.com/lollipopkit/gtk.dart
|
||||||
ref: v0.0.36
|
ref: v0.0.36
|
||||||
|
|||||||
Reference in New Issue
Block a user