Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(desktop): 显示可读的本机设备名称 (#3312)

Dash5163c73d9de0
diff --git a/apps/desktop/src/renderer/__tests__/mobileDownloadDialog.test.tsx b/apps/desktop/src/renderer/__tests__/mobileDownloadDialog.test.tsx
index c8f6219a7c..2d45d80bc2 100644
--- a/apps/desktop/src/renderer/__tests__/mobileDownloadDialog.test.tsx
+++ b/apps/desktop/src/renderer/__tests__/mobileDownloadDialog.test.tsx
@@ -202,7 +202,7 @@ describe('resolveMobileRemotePresentation', () => {
remoteEnabled: false,
linkedMobileCount: 0,
otherDeviceCount: 0,
- selfDeviceId: 'desktop-device-1',
+ selfDeviceName: 'Studio Mac',
});
expect(
resolveMobileRemotePresentation({
@@ -242,7 +242,7 @@ describe('resolveMobileRemotePresentation', () => {
remoteEnabled: true,
linkedMobileCount: 1,
otherDeviceCount: 1,
- selfDeviceId: 'desktop-device-1',
+ selfDeviceName: 'Studio Mac',
linkedMobileName: 'My iPhone',
});
});
@@ -279,7 +279,7 @@ describe('resolveMobileRemotePresentation', () => {
).toMatchObject({
layout: 'checking',
remoteEnabled: true,
- selfDeviceId: null,
+ selfDeviceName: null,
});
});
});
@@ -425,7 +425,8 @@ describe('MobileDownloadDialog', () => {
expect(await screen.findByText('sidebar.mobileDownload.myDevices')).toBeTruthy();
expect(screen.getByText('My iPhone')).toBeTruthy();
- expect(screen.getByText('sidebar.mobileDownload.deviceId')).toBeTruthy();
+ expect(screen.getByTitle('Studio Mac')).toBeTruthy();
+ expect(screen.getByText('sidebar.mobileDownload.deviceName')).toBeTruthy();
expect(screen.getByTestId('mobile-download-qr-card').dataset.compact).toBe('true');
fireEvent.click(screen.getByRole('button', { name: /sidebar\.mobileDownload\.myDevices/ }));
expect(onOpenDevices).toHaveBeenCalledTimes(1);
diff --git a/apps/desktop/src/renderer/components/sidebar/MobileDownloadDialog.tsx b/apps/desktop/src/renderer/components/sidebar/MobileDownloadDialog.tsx
index 9f01c43b85..69f00738e1 100644
--- a/apps/desktop/src/renderer/components/sidebar/MobileDownloadDialog.tsx
+++ b/apps/desktop/src/renderer/components/sidebar/MobileDownloadDialog.tsx
@@ -33,7 +33,7 @@ export interface MobileRemotePresentation {
remoteEnabled: boolean;
linkedMobileCount: number;
otherDeviceCount: number;
- selfDeviceId: string | null;
+ selfDeviceName: string | null;
linkedMobileName: string | null;
previewDevices: DeviceLinkDeviceView[];
}
@@ -56,7 +56,7 @@ export function resolveMobileRemotePresentation(
remoteEnabled: snapshot.enabled,
linkedMobileCount: 0,
otherDeviceCount: 0,
- selfDeviceId: null,
+ selfDeviceName: null,
linkedMobileName: null,
previewDevices: [],
};
@@ -81,7 +81,7 @@ export function resolveMobileRemotePresentation(
remoteEnabled: snapshot.enabled,
linkedMobileCount: linkedMobileDevices.length,
otherDeviceCount: otherDevices.length,
- selfDeviceId: selfDevice?.deviceId ?? null,
+ selfDeviceName: selfDevice?.name ?? null,
linkedMobileName: linkedMobileDevices[0]?.name ?? null,
previewDevices,
};
@@ -593,13 +593,13 @@ export function MobileDownloadDialog({
<span className="text-13 font-medium leading-[1.385] text-[var(--confirm-title)]">
{t('sidebar.mobileDownload.allowControl')}
</span>
- {remotePresentation?.selfDeviceId ? (
+ {remotePresentation?.selfDeviceName ? (
<span
- className="mt-0.5 truncate font-mono text-10 leading-[1.4] text-[var(--confirm-desc)]"
- title={remotePresentation.selfDeviceId}
+ className="mt-0.5 truncate text-11 leading-[1.4] text-[var(--confirm-desc)]"
+ title={remotePresentation.selfDeviceName}
>
- {t('sidebar.mobileDownload.deviceId', {
- id: remotePresentation.selfDeviceId,
+ {t('sidebar.mobileDownload.deviceName', {
+ name: remotePresentation.selfDeviceName,
})}
</span>
) : null}
diff --git a/apps/desktop/src/renderer/i18n/locales/en/common.json b/apps/desktop/src/renderer/i18n/locales/en/common.json
index e461bd7066..cce2d90bf7 100644
--- a/apps/desktop/src/renderer/i18n/locales/en/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/en/common.json
@@ -6390,7 +6390,7 @@
"myDevices": "My Devices",
"deviceOffline": "Offline",
"allowControl": "Allow same-account devices to control this machine",
- "deviceId": "This device · {{id}}",
+ "deviceName": "This device · {{name}}",
"remoteAction": {
"checking": "Checking…",
"unavailable": "Unavailable",
diff --git a/apps/desktop/src/renderer/i18n/locales/ja/common.json b/apps/desktop/src/renderer/i18n/locales/ja/common.json
index 2029b607ca..a367cefbfe 100644
--- a/apps/desktop/src/renderer/i18n/locales/ja/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ja/common.json
@@ -6388,7 +6388,7 @@
"myDevices": "自分のデバイス",
"deviceOffline": "オフライン",
"allowControl": "同じアカウントのデバイスによるこのマシンの操作を許可",
- "deviceId": "このデバイス · {{id}}",
+ "deviceName": "このデバイス · {{name}}",
"remoteAction": {
"checking": "確認中…",
"unavailable": "利用できません",
diff --git a/apps/desktop/src/renderer/i18n/locales/ko/common.json b/apps/desktop/src/renderer/i18n/locales/ko/common.json
index 41269d536f..24715f5603 100644
--- a/apps/desktop/src/renderer/i18n/locales/ko/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/ko/common.json
@@ -6388,7 +6388,7 @@
"myDevices": "내 기기",
"deviceOffline": "오프라인",
"allowControl": "동일 계정 기기에서 이 컴퓨터를 제어하도록 허용",
- "deviceId": "이 기기 · {{id}}",
+ "deviceName": "이 기기 · {{name}}",
"remoteAction": {
"checking": "확인 중…",
"unavailable": "사용할 수 없음",
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
index f592b92d98..68d07b5a0b 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-CN/common.json
@@ -6380,7 +6380,7 @@
"myDevices": "我的设备",
"deviceOffline": "离线",
"allowControl": "允许同账号设备控制本机",
- "deviceId": "本机 · {{id}}",
+ "deviceName": "本机 · {{name}}",
"remoteAction": {
"checking": "正在检查…",
"unavailable": "暂不可用",
diff --git a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
index e128e5e36f..ad675a4480 100644
--- a/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
+++ b/apps/desktop/src/renderer/i18n/locales/zh-TW/common.json
@@ -6380,7 +6380,7 @@
"myDevices": "我的裝置",
"deviceOffline": "離線",
"allowControl": "允許同帳號裝置控制本機",
- "deviceId": "本機 · {{id}}",
+ "deviceName": "本機 · {{name}}",
"remoteAction": {
"checking": "正在檢查…",
"unavailable": "暫不可用",