* fix(ssh): Modify the return type of execWithPwd to include the output content Adjust the return type of the `execWithPwd` method to `(int?, String)` so that it can simultaneously return the exit code and output content Fix the issue in ContainerNotifier where the return result of execWithPwd is not handled correctly Ensure that server operations (shutdown/restart/suspend) are correctly pending until the command execution is completed * refactor(container): Change single error handling to multiple error lists Support the simultaneous display of multiple container operation errors, enhancing error handling capabilities * fix(container): Adjust the layout width and optimize the handling of text overflow Adjust the width calculation for the container page layout, changing from subtracting a fixed value to subtracting a smaller value to improve the layout Add overflow ellipsis processing to the text to prevent anomalies when the text is too long * Revert "refactor(container): Change single error handling to multiple error lists" This reverts commit 72aaa173f5ceabc952ab5c28e024451ac1309920. * feat(container): Add Podman Docker emulation detection function Add detection for Podman Docker emulation in the container module. When detected, a prompt message will be displayed and users will be advised to switch to Podman settings. Updated the multilingual translation files to support the new features. * fix: Fix error handling in SSH client and container operations Fix the issue where the SSH client does not handle stderr when executing commands Error handling for an empty client in the container addition operation Fix the issue where null may be returned during server page operations * fix(container): Check if client is empty before running the command When the client is null, directly return an error to avoid null pointer exception * fix: Revert `stderr` ignore * fix(container): Detect Podman simulation in advance and optimize error handling Move the Podman simulation detection to the initial parsing stage to avoid redundant checks Remove duplicated error handling code and simplify the logic * fix(container): Fix the error handling logic during container command execution Increase the inspection of error outputs, including handling situations such as sudo password prompts and Podman not being installed * refactor(macOS): Remove unused path_provider_foundation plugin
65 lines
1.5 KiB
Dart
65 lines
1.5 KiB
Dart
import 'package:fl_lib/fl_lib.dart';
|
|
import 'package:server_box/core/extension/context/locale.dart';
|
|
|
|
enum SSHErrType { unknown, connect, auth, noPrivateKey, chdir, segements, writeScript, getStatus }
|
|
|
|
class SSHErr extends Err<SSHErrType> {
|
|
const SSHErr({required super.type, super.message});
|
|
|
|
@override
|
|
String? get solution => switch (type) {
|
|
SSHErrType.chdir => l10n.needHomeDir,
|
|
SSHErrType.auth => l10n.authFailTip,
|
|
SSHErrType.writeScript => l10n.writeScriptFailTip,
|
|
SSHErrType.noPrivateKey => l10n.noPrivateKeyTip,
|
|
_ => null,
|
|
};
|
|
}
|
|
|
|
enum ContainerErrType {
|
|
unknown,
|
|
noClient,
|
|
notInstalled,
|
|
invalidVersion,
|
|
cmdNoPrefix,
|
|
segmentsNotMatch,
|
|
parsePs,
|
|
parseImages,
|
|
parseStats,
|
|
podmanDetected,
|
|
}
|
|
|
|
class ContainerErr extends Err<ContainerErrType> {
|
|
const ContainerErr({required super.type, super.message});
|
|
|
|
@override
|
|
String? get solution => null;
|
|
}
|
|
|
|
enum ICloudErrType { generic, notFound, multipleFiles }
|
|
|
|
class ICloudErr extends Err<ICloudErrType> {
|
|
const ICloudErr({required super.type, super.message});
|
|
|
|
@override
|
|
String? get solution => null;
|
|
}
|
|
|
|
enum WebdavErrType { generic, notFound }
|
|
|
|
class WebdavErr extends Err<WebdavErrType> {
|
|
const WebdavErr({required super.type, super.message});
|
|
|
|
@override
|
|
String? get solution => null;
|
|
}
|
|
|
|
enum PveErrType { unknown, net, loginFailed }
|
|
|
|
class PveErr extends Err<PveErrType> {
|
|
const PveErr({required super.type, super.message});
|
|
|
|
@override
|
|
String? get solution => null;
|
|
}
|