feat: keyboard-interactive auth (#349)
This commit is contained in:
@@ -9,4 +9,6 @@ class AppProvider extends ChangeNotifier {
|
||||
}
|
||||
|
||||
bool moveBg = true;
|
||||
|
||||
BuildContext? ctx;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import 'package:dartssh2/dartssh2.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:toolbox/core/extension/ssh_client.dart';
|
||||
import 'package:toolbox/core/extension/stringx.dart';
|
||||
import 'package:toolbox/core/utils/auth.dart';
|
||||
import 'package:toolbox/core/utils/platform/path.dart';
|
||||
import 'package:toolbox/data/model/app/shell_func.dart';
|
||||
import 'package:toolbox/data/model/server/system.dart';
|
||||
@@ -278,15 +279,14 @@ class ServerProvider extends ChangeNotifier {
|
||||
s.client = await genClient(
|
||||
spi,
|
||||
timeout: Duration(seconds: Stores.setting.timeout.fetch()),
|
||||
onKeyboardInteractive: (_) => KeybordInteractive.defaultHandle(spi),
|
||||
);
|
||||
final time2 = DateTime.now();
|
||||
final spentTime = time2.difference(time1).inMilliseconds;
|
||||
if (spi.jumpId == null) {
|
||||
Loggers.app.info('Connected to ${spi.name} in $spentTime ms.');
|
||||
} else {
|
||||
Loggers.app.info(
|
||||
'Connected to ${spi.name} via jump server in $spentTime ms.',
|
||||
);
|
||||
Loggers.app.info('Jump to ${spi.name} in $spentTime ms.');
|
||||
}
|
||||
} catch (e) {
|
||||
TryLimiter.inc(sid);
|
||||
@@ -316,6 +316,11 @@ class ServerProvider extends ChangeNotifier {
|
||||
s.status.err = e.toString();
|
||||
_setServerState(s, ServerState.failed);
|
||||
return;
|
||||
} on SSHAuthFailError catch (e) {
|
||||
TryLimiter.inc(sid);
|
||||
s.status.err = e.toString();
|
||||
_setServerState(s, ServerState.failed);
|
||||
return;
|
||||
} catch (e) {
|
||||
Loggers.app.warning('Write script to ${spi.name} by shell', e);
|
||||
|
||||
@@ -351,6 +356,8 @@ class ServerProvider extends ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
if (s.state == ServerState.connecting) return;
|
||||
|
||||
/// Keep [finished] state, or the UI will be refreshed to [loading] state
|
||||
/// instead of the '$Temp | $Uptime'.
|
||||
/// eg: '32C | 7 days'
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
class BuildData {
|
||||
static const String name = "ServerBox";
|
||||
static const int build = 876;
|
||||
static const int build = 877;
|
||||
static const String engine = "3.19.6";
|
||||
static const String buildAt = "2024-04-26 23:44:14";
|
||||
static const int modifications = 4;
|
||||
static const String buildAt = "2024-05-07 15:17:19";
|
||||
static const int modifications = 15;
|
||||
static const int script = 45;
|
||||
}
|
||||
|
||||
@@ -70,5 +70,6 @@ abstract final class GithubIds {
|
||||
'zj1123581321',
|
||||
'pctoolsx',
|
||||
'pgs666',
|
||||
'FHU-yezi',
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user