diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 131d55d..84301b1 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -1709,7 +1709,11 @@ function App() { try { setPendingConnectionImportPayload(null); const importedViews = await importConnectionsPayload(raw, ''); - void message.success(`成功导入 ${importedViews.length} 个连接`); + if (importedViews.some(v => !v.hasPrimaryPassword)) { + void message.warning(`成功导入 ${importedViews.length} 个连接,部分连接未包含密码,请编辑对应连接并输入密码后保存`); + } else { + void message.success(`成功导入 ${importedViews.length} 个连接`); + } } catch (e: any) { if (isConnectionPackagePasswordRequiredError(e)) { setPendingConnectionImportPayload(raw); diff --git a/frontend/src/utils/connectionModalPresentation.test.ts b/frontend/src/utils/connectionModalPresentation.test.ts index 3cedede..0f15f6d 100644 --- a/frontend/src/utils/connectionModalPresentation.test.ts +++ b/frontend/src/utils/connectionModalPresentation.test.ts @@ -25,7 +25,7 @@ describe('connectionModalPresentation', () => { it('maps missing saved-connection errors to a secret-specific hint', () => { expect(normalizeConnectionSecretErrorMessage('saved connection not found: conn-1')).toBe( - '未找到当前连接对应的已保存密文,请编辑当前连接,并输入密码后保存', + '未找到当前连接对应的已保存密文,请重新填写密码并保存后再试', ); }); diff --git a/frontend/src/utils/connectionModalPresentation.ts b/frontend/src/utils/connectionModalPresentation.ts index b507c68..fbd841a 100644 --- a/frontend/src/utils/connectionModalPresentation.ts +++ b/frontend/src/utils/connectionModalPresentation.ts @@ -41,7 +41,7 @@ export const normalizeConnectionSecretErrorMessage = ( const lower = text.toLowerCase(); if (lower.includes('saved connection not found:')) { - return '未找到当前连接对应的已保存密文,请编辑当前连接,并输入密码后保存'; + return '未找到当前连接对应的已保存密文,请重新填写密码并保存后再试'; } if (lower.includes('secret store unavailable')) { return '系统密文存储当前不可用,请检查系统钥匙串或凭据管理器后再试'; diff --git a/internal/app/connection_secret_resolution.go b/internal/app/connection_secret_resolution.go index e1c7981..b923f11 100644 --- a/internal/app/connection_secret_resolution.go +++ b/internal/app/connection_secret_resolution.go @@ -38,13 +38,6 @@ func (a *App) resolveConnectionSecrets(config connection.ConnectionConfig) (conn resolved := mergeConnectionSecretBundleIntoConfig(base, bundle) resolved.ID = view.ID - if !connectionConfigCarriesInlineSecrets(config) && !bundle.hasAny() { - _, dailyExists, _ := repo.dailySecrets().GetConnection(view.ID) - if !dailyExists { - return resolved, fmt.Errorf("未找到当前连接对应的已保存密文,请编辑当前连接,并输入密码后保存") - } - } - return resolved, nil } @@ -110,9 +103,9 @@ func normalizeConnectionSecretResolutionError(config connection.ConnectionConfig if connectionMetadataLooksEmpty(config) { return fmt.Errorf("未找到已保存连接,可能已被删除,请刷新后重试") } - return fmt.Errorf("未找到当前连接对应的已保存密文,请编辑当前连接,并输入密码后保存") + return fmt.Errorf("未找到当前连接对应的已保存密文,请重新填写密码并保存后再试") case errors.Is(err, os.ErrNotExist): - return fmt.Errorf("未找到当前连接对应的已保存密文,请编辑当前连接,并输入密码后保存") + return fmt.Errorf("未找到当前连接对应的已保存密文,请重新填写密码并保存后再试") case strings.Contains(lower, "secret store unavailable"): return fmt.Errorf("系统密文存储当前不可用,请检查系统钥匙串或凭据管理器后再试") default: