mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-08-06 06:13:51 +08:00
✨ feat(connection-import): 支持导入 Navicat NCX 连接与密码
- 新增 Navicat NCX XML 解析与 v1/v2 密码解密能力 - 接入后端连接导入链路并补充导入失败提示 - 前端补充 NCX 格式识别、缺失密码提示与定向测试
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import type { ConnectionConfig, SavedConnection } from '../types';
|
||||
|
||||
export type ConnectionImportKind = 'app-managed-package' | 'encrypted-package' | 'legacy-json' | 'mysql-workbench-xml' | 'invalid';
|
||||
export type ConnectionImportKind = 'app-managed-package' | 'encrypted-package' | 'legacy-json' | 'mysql-workbench-xml' | 'navicat-ncx' | 'invalid';
|
||||
export type ConnectionPackageDialogSnapshot = {
|
||||
open: boolean;
|
||||
mode: 'export' | 'import';
|
||||
@@ -109,10 +109,19 @@ const isMySQLWorkbenchXML = (raw: string): boolean => (
|
||||
raw.includes('<data') && raw.includes('grt_format') && raw.includes('db.mgmt.Connection')
|
||||
);
|
||||
|
||||
const isNavicatNCX = (raw: string): boolean => (
|
||||
raw.includes('<Connection')
|
||||
&& raw.includes('ConnType=')
|
||||
&& raw.includes('ConnectionName=')
|
||||
);
|
||||
|
||||
export const detectConnectionImportKind = (raw: unknown): ConnectionImportKind => {
|
||||
if (typeof raw === 'string' && isMySQLWorkbenchXML(raw)) {
|
||||
return 'mysql-workbench-xml';
|
||||
}
|
||||
if (typeof raw === 'string' && isNavicatNCX(raw)) {
|
||||
return 'navicat-ncx';
|
||||
}
|
||||
|
||||
const parsed = parseConnectionImportRaw(raw);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user