fix(container): Parsing results in sudo mode (#1031)

* docs(l10n): fix un-updated English translation

* feat(container): Add support for requiring a sudo password

Add support for sudo password verification for Docker container operations, including:
1. Added ContainerErrType.sudoPasswordRequired error type
2. Add password prompt text in multi-language files
3. Modify the SSH execution logic to correctly handle the input of sudo password
4. Implement password caching and verification mechanism

* feat(container): Add sudo password error handling logic

Add a new error type `sudoPasswordIncorrect` to handle situations where the sudo password is incorrect

Modify the password verification logic in the SSH client, and return a specific error code when a password error is detected

Update multilingual files to support password error prompt information

* fix(ssh): Remove unnecessary stderr parameter and improve sudo command handling

Clean up the no longer needed stderr parameter in the SSH client, which was originally used to handle sudo password prompts

Unify the sudo command construction logic, always use the _buildSudoCmd method, and add stderr redirection
Clear cached passwords when passwords are incorrect

* fix(container): Improved sudo command handling and Podman simulation detection

Fix the sudo command processing logic, remove the masking of stderr to capture password errors

Override the detection logic simulated by Podman

Refactor the command building logic to support sh wrapping of multi-line commands

* fix(container): Improve the prompt message for sudo password errors

Update the sudo password error prompt messages for all languages to more accurately reflect situations of incorrect password or lack of permission

Fix the password error detection logic for both the SSH client and container providers simultaneously

* refactor(container): Remove unused sudo and password parameters in exec method

Simplify the exec method signature by removing the sudo and password parameters that are no longer needed, as these functions are no longer in use

* feat: Add new contributors and optimize container command handling

Add two new contributors to the GithubIds list and refactor the container command processing logic:
1. Simplify the command wrapping logic and uniformly use `sh -c` for processing
2. Specific error handling when adding a sudo password incorrectly
3. Remove redundant conditional checks and temporary variables
This commit is contained in:
GT610
2026-01-29 18:07:20 +08:00
committed by GitHub
parent d5e1d89394
commit 9281a578e7
30 changed files with 278 additions and 52 deletions

View File

@@ -192,6 +192,12 @@ class AppLocalizationsZh extends AppLocalizations {
String get containerTrySudoTip =>
'例如:在应用内将用户设置为 aaa但是 Docker 安装在root用户下这时就需要启用此选项';
@override
String get containerSudoPasswordRequired => '需要 sudo 密码才能访问 Docker。请输入您的密码。';
@override
String get containerSudoPasswordIncorrect => 'sudo 密码错误或无权限。请重试。';
@override
String get convert => '转换';
@@ -1182,6 +1188,12 @@ class AppLocalizationsZhTw extends AppLocalizationsZh {
String get containerTrySudoTip =>
'例如App 內設定使用者為 aaa但是 Docker 安裝在 root 使用者,這時就需要開啟此選項';
@override
String get containerSudoPasswordRequired => '需要 sudo 密碼才能存取 Docker。請輸入您的密碼。';
@override
String get containerSudoPasswordIncorrect => 'sudo 密碼錯誤或無權限。請重試。';
@override
String get convert => '轉換';