mcp-ssh-manager 4.1.0 → 4.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +138 -0
- package/CLAUDE.md +3 -5
- package/Formula/ssh-manager.rb +2 -2
- package/INSTALLATION.md +4 -0
- package/README.md +22 -4
- package/cli/codex.js +67 -0
- package/cli/guard.js +69 -0
- package/cli/lib/config.sh +102 -37
- package/cli/ssh-manager +13 -0
- package/cli/ssh-manager.js +1 -1
- package/desktop/electron/electron-builder.yml +3 -0
- package/desktop/electron/locale.mjs +34 -0
- package/desktop/electron/main.js +52 -65
- package/desktop/electron/native-menu.mjs +44 -0
- package/desktop/electron/native.zh-CN.json +58 -0
- package/desktop/electron/package-lock.json +2 -2
- package/desktop/electron/package.json +1 -1
- package/desktop/electron/smoke-test.mjs +11 -1
- package/dist/ui/app.css +1 -1
- package/dist/ui/app.js +123 -115
- package/docs/MIGRATION.md +1 -1
- package/docs/SECURITY_MODES.md +15 -8
- package/docs/SEO.md +1 -1
- package/package.json +15 -3
- package/scripts/test-upgrade-from-published.mjs +24 -2
- package/server.json +2 -2
- package/src/audit.js +6 -15
- package/src/background-job.js +44 -0
- package/src/backup-manager.js +24 -29
- package/src/config-loader.js +5 -1
- package/src/database-manager.js +13 -31
- package/src/dump-guard.js +79 -0
- package/src/health-monitor.js +8 -4
- package/src/index.js +183 -21
- package/src/logger.js +3 -1
- package/src/quiet-stderr.js +15 -0
- package/src/ssh-guard.js +344 -0
- package/src/ssh-manager.js +51 -0
- package/src/tunnel-manager.js +14 -4
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
|
|
5
|
+
// Strings of the application's own native surfaces (menus, tray, notifications)
|
|
6
|
+
// in Chinese. English is the key itself, so English needs no catalogue.
|
|
7
|
+
const messages = JSON.parse(fs.readFileSync(new URL('./native.zh-CN.json', import.meta.url), 'utf8'));
|
|
8
|
+
|
|
9
|
+
/** The language a system locale asks for: Chinese for any `zh` tag, English otherwise. */
|
|
10
|
+
export function languageForLocale(locale) {
|
|
11
|
+
return /^zh(?:[-_]|$)/i.test(String(locale ?? '')) ? 'zh-CN' : 'en';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Which language the native menus and notifications speak.
|
|
16
|
+
*
|
|
17
|
+
* The choice saved from the interface (Options -> Appearance) always wins. Until
|
|
18
|
+
* somebody has chosen, the system language decides. The system locale is a
|
|
19
|
+
* parameter, not a lookup, so this module stays importable from plain Node (the
|
|
20
|
+
* tests do) and never needs Electron: the application passes `app.getLocale()`.
|
|
21
|
+
*/
|
|
22
|
+
export function nativeLanguage({ home = process.env.SSH_MANAGER_HOME || path.join(os.homedir(), '.ssh-manager'), systemLocale = '' } = {}) {
|
|
23
|
+
try {
|
|
24
|
+
const preferences = JSON.parse(fs.readFileSync(path.join(home, 'preferences.json'), 'utf8'));
|
|
25
|
+
const saved = preferences['ssh-manager.language'];
|
|
26
|
+
if (saved === 'en' || saved === 'zh-CN') return saved;
|
|
27
|
+
} catch { /* no preferences yet, or unreadable: fall through to the system */ }
|
|
28
|
+
return languageForLocale(systemLocale);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function nativeText(message, values = {}, language = nativeLanguage()) {
|
|
32
|
+
const text = language === 'en' ? message : messages[message] || message;
|
|
33
|
+
return text.replace(/\{\{(\w+)\}\}/g, (match, key) => String(values[key] ?? match));
|
|
34
|
+
}
|
package/desktop/electron/main.js
CHANGED
|
@@ -30,9 +30,20 @@ import { createRequire } from 'module';
|
|
|
30
30
|
import electronUpdater from 'electron-updater';
|
|
31
31
|
import { fileURLToPath, pathToFileURL } from 'url';
|
|
32
32
|
import { localShellLaunch, localShellName } from './local-shell.mjs';
|
|
33
|
+
import { nativeLanguage, nativeText } from './locale.mjs';
|
|
34
|
+
import { applicationMenuTemplate } from './native-menu.mjs';
|
|
33
35
|
|
|
34
36
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
35
37
|
|
|
38
|
+
/**
|
|
39
|
+
* The language of the menus, tray and notifications: the one chosen in the
|
|
40
|
+
* interface, else the system's. Read each time, because it can change while the
|
|
41
|
+
* application runs. `app.getLocale()` is only meaningful once the app is ready,
|
|
42
|
+
* and every caller runs after that.
|
|
43
|
+
*/
|
|
44
|
+
const nativeLang = () => nativeLanguage({ systemLocale: app.getLocale() });
|
|
45
|
+
const text = (message, values) => nativeText(message, values, nativeLang());
|
|
46
|
+
|
|
36
47
|
/**
|
|
37
48
|
* The engine lives two directories up in the repository, and inside
|
|
38
49
|
* `app.asar.unpacked` in a packaged build. Resolved rather than assumed,
|
|
@@ -194,7 +205,7 @@ function updateSnapshot() {
|
|
|
194
205
|
const appUpdates = {
|
|
195
206
|
snapshot: updateSnapshot,
|
|
196
207
|
check: async () => {
|
|
197
|
-
if (!updaterActive) throw new Error('Updates are turned off in this build');
|
|
208
|
+
if (!updaterActive) throw new Error(text('Updates are turned off in this build'));
|
|
198
209
|
await electronUpdater.autoUpdater.checkForUpdates();
|
|
199
210
|
},
|
|
200
211
|
download: async () => { await electronUpdater.autoUpdater.downloadUpdate(); },
|
|
@@ -310,46 +321,18 @@ function createWindow(url) {
|
|
|
310
321
|
mainWindow.on('closed', () => { mainWindow = null; });
|
|
311
322
|
}
|
|
312
323
|
|
|
324
|
+
/** The language the application menu was last built in. */
|
|
325
|
+
let menuLanguage = null;
|
|
326
|
+
|
|
313
327
|
/** A menu with the shortcuts a terminal-adjacent app is expected to have. */
|
|
314
328
|
function buildMenu(url) {
|
|
315
|
-
|
|
316
|
-
Menu.setApplicationMenu(Menu.buildFromTemplate(
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
label: 'Open in browser',
|
|
323
|
-
accelerator: 'CmdOrCtrl+B',
|
|
324
|
-
// The tokenised URL is genuinely useful outside the app — a second
|
|
325
|
-
// screen, a different browser, devtools you are used to.
|
|
326
|
-
click: () => void shell.openExternal(url),
|
|
327
|
-
},
|
|
328
|
-
{ type: 'separator' },
|
|
329
|
-
isMac ? { role: 'close' } : { role: 'quit' },
|
|
330
|
-
],
|
|
331
|
-
},
|
|
332
|
-
{ role: 'editMenu' },
|
|
333
|
-
{
|
|
334
|
-
label: 'View',
|
|
335
|
-
submenu: [
|
|
336
|
-
{ role: 'reload' },
|
|
337
|
-
{ role: 'forceReload' },
|
|
338
|
-
{ role: 'toggleDevTools' },
|
|
339
|
-
{ type: 'separator' },
|
|
340
|
-
{ role: 'resetZoom' },
|
|
341
|
-
{ role: 'zoomIn' },
|
|
342
|
-
{ role: 'zoomOut' },
|
|
343
|
-
{ type: 'separator' },
|
|
344
|
-
{ role: 'togglefullscreen' },
|
|
345
|
-
],
|
|
346
|
-
},
|
|
347
|
-
{ role: 'windowMenu' },
|
|
348
|
-
{
|
|
349
|
-
role: 'help',
|
|
350
|
-
submenu: [{ label: 'Check for Updates…', click: () => void appUpdates.check().catch(() => { /* shown in Options → Updates */ }) }],
|
|
351
|
-
},
|
|
352
|
-
]));
|
|
329
|
+
menuLanguage = nativeLang();
|
|
330
|
+
Menu.setApplicationMenu(Menu.buildFromTemplate(applicationMenuTemplate({
|
|
331
|
+
isMac: process.platform === 'darwin',
|
|
332
|
+
language: menuLanguage,
|
|
333
|
+
onOpenBrowser: () => void shell.openExternal(url),
|
|
334
|
+
onCheckUpdates: () => void appUpdates.check().catch(() => { /* shown in Options → Updates */ }),
|
|
335
|
+
})));
|
|
353
336
|
}
|
|
354
337
|
|
|
355
338
|
/**
|
|
@@ -398,8 +381,8 @@ function announce(pending) {
|
|
|
398
381
|
|
|
399
382
|
const notification = new Notification({
|
|
400
383
|
title: request.destructive
|
|
401
|
-
?
|
|
402
|
-
:
|
|
384
|
+
? text('{{v0}}: destructive command waiting', { v0: request.server })
|
|
385
|
+
: text('{{v0}}: waiting for your decision', { v0: request.server }),
|
|
403
386
|
body: String(request.command || request.tool || '').slice(0, 220),
|
|
404
387
|
// Destructive requests stay on screen. `rm -rf` on production and
|
|
405
388
|
// `systemctl status` are not the same interruption, and a banner that
|
|
@@ -437,11 +420,15 @@ function refreshTray() {
|
|
|
437
420
|
// An unreadable vault is the interface's problem to report, not the tray's.
|
|
438
421
|
}
|
|
439
422
|
|
|
423
|
+
// The application menu follows the language chosen in the interface, which
|
|
424
|
+
// can change while the app runs. Rebuild it only when that happens.
|
|
425
|
+
if (menuLanguage !== nativeLang()) buildMenu(plane.url);
|
|
426
|
+
|
|
440
427
|
// Rebuilding a menu the user may have open is disruptive, and this runs on a
|
|
441
428
|
// timer, so only touch it when something actually moved.
|
|
442
429
|
const signature = JSON.stringify([
|
|
443
430
|
pending.map(r => r.id), shells.map(t => t.server),
|
|
444
|
-
running.map(s => s.id), servers, update.status, update.percent,
|
|
431
|
+
running.map(s => s.id), servers, update.status, update.percent, nativeLang(),
|
|
445
432
|
]);
|
|
446
433
|
if (signature === trayState) return;
|
|
447
434
|
trayState = signature;
|
|
@@ -468,7 +455,7 @@ function refreshTray() {
|
|
|
468
455
|
const template = [...updateMenuItems()];
|
|
469
456
|
|
|
470
457
|
if (pending.length) {
|
|
471
|
-
template.push({ label:
|
|
458
|
+
template.push({ label: text('{{v0}} waiting for your decision', { v0: pending.length }), enabled: false });
|
|
472
459
|
for (const request of pending.slice(0, 6)) {
|
|
473
460
|
template.push({
|
|
474
461
|
label: ` ${request.server} · ${brief(request.command)}`,
|
|
@@ -477,14 +464,14 @@ function refreshTray() {
|
|
|
477
464
|
}
|
|
478
465
|
template.push({ type: 'separator' });
|
|
479
466
|
} else {
|
|
480
|
-
template.push({ label: 'Nothing is waiting', enabled: false });
|
|
467
|
+
template.push({ label: text('Nothing is waiting'), enabled: false });
|
|
481
468
|
template.push({ type: 'separator' });
|
|
482
469
|
}
|
|
483
470
|
|
|
484
471
|
if (shells.length || running.length) {
|
|
485
|
-
template.push({ label: 'Open right now', enabled: false });
|
|
472
|
+
template.push({ label: text('Open right now'), enabled: false });
|
|
486
473
|
for (const shell of shells.slice(0, 5)) {
|
|
487
|
-
template.push({ label:
|
|
474
|
+
template.push({ label: text(' Shell on {{v0}}', { v0: shell.server }), click: focus });
|
|
488
475
|
}
|
|
489
476
|
for (const stream of running.slice(0, 5)) {
|
|
490
477
|
template.push({
|
|
@@ -497,22 +484,22 @@ function refreshTray() {
|
|
|
497
484
|
|
|
498
485
|
if (servers.length) {
|
|
499
486
|
template.push({
|
|
500
|
-
label:
|
|
487
|
+
label: text('Servers ({{v0}})', { v0: servers.length }),
|
|
501
488
|
submenu: servers.slice(0, 12).map(name => ({ label: name, click: focus })),
|
|
502
489
|
});
|
|
503
490
|
template.push({ type: 'separator' });
|
|
504
491
|
}
|
|
505
492
|
|
|
506
493
|
template.push(
|
|
507
|
-
{ label: 'Show SSH Manager', click: focus },
|
|
508
|
-
{ label: 'Open in browser', click: () => plane && void shell.openExternal(plane.url) },
|
|
494
|
+
{ label: text('Show SSH Manager'), click: focus },
|
|
495
|
+
{ label: text('Open in browser'), click: () => plane && void shell.openExternal(plane.url) },
|
|
509
496
|
{ type: 'separator' },
|
|
510
|
-
{ label: 'Quit SSH Manager', click: () => app.quit() },
|
|
497
|
+
{ label: text('Quit SSH Manager'), click: () => app.quit() },
|
|
511
498
|
);
|
|
512
499
|
|
|
513
500
|
tray.setContextMenu(Menu.buildFromTemplate(template));
|
|
514
501
|
tray.setToolTip(pending.length
|
|
515
|
-
?
|
|
502
|
+
? text('SSH Manager — {{v0}} waiting for your decision', { v0: pending.length })
|
|
516
503
|
: 'SSH Manager');
|
|
517
504
|
|
|
518
505
|
// The count beside the icon, and on the dock. Only when it is not zero: a
|
|
@@ -596,8 +583,8 @@ function announceUpdate(version) {
|
|
|
596
583
|
try { fs.writeFileSync(marker, `${version}\n`); } catch { /* it will say it again next time; harmless */ }
|
|
597
584
|
if (!Notification.isSupported()) return;
|
|
598
585
|
const notification = new Notification({
|
|
599
|
-
title:
|
|
600
|
-
body: 'Open Options → Updates to download it. Nothing is installed until you restart.',
|
|
586
|
+
title: text('SSH Manager {{v0}} is available', { v0: version }),
|
|
587
|
+
body: text('Open Options → Updates to download it. Nothing is installed until you restart.'),
|
|
601
588
|
silent: true,
|
|
602
589
|
});
|
|
603
590
|
notification.on('click', () => {
|
|
@@ -617,23 +604,23 @@ function updateMenuItems() {
|
|
|
617
604
|
const { autoUpdater } = electronUpdater;
|
|
618
605
|
switch (update.status) {
|
|
619
606
|
case 'checking':
|
|
620
|
-
return [{ label: 'Checking for updates…', enabled: false }, { type: 'separator' }];
|
|
607
|
+
return [{ label: text('Checking for updates…'), enabled: false }, { type: 'separator' }];
|
|
621
608
|
case 'available':
|
|
622
609
|
return [{
|
|
623
|
-
label:
|
|
610
|
+
label: text('Update to {{v0}}', { v0: update.version }),
|
|
624
611
|
click: () => autoUpdater.downloadUpdate().catch(() => { /* reported by the error handler */ }),
|
|
625
612
|
}, { type: 'separator' }];
|
|
626
613
|
case 'downloading':
|
|
627
|
-
return [{ label:
|
|
614
|
+
return [{ label: text('Downloading update… {{v0}}%', { v0: update.percent }), enabled: false },
|
|
628
615
|
{ type: 'separator' }];
|
|
629
616
|
case 'ready':
|
|
630
617
|
return [{
|
|
631
|
-
label:
|
|
618
|
+
label: text('Restart to update to {{v0}}', { v0: update.version }),
|
|
632
619
|
click: () => autoUpdater.quitAndInstall(),
|
|
633
620
|
}, { type: 'separator' }];
|
|
634
621
|
default:
|
|
635
622
|
return updaterActive
|
|
636
|
-
? [{ label: 'Check for Updates…', click: () => void appUpdates.check().catch(() => { /* shown in Options → Updates */ }) },
|
|
623
|
+
? [{ label: text('Check for Updates…'), click: () => void appUpdates.check().catch(() => { /* shown in Options → Updates */ }) },
|
|
637
624
|
{ type: 'separator' }]
|
|
638
625
|
: [];
|
|
639
626
|
}
|
|
@@ -738,7 +725,7 @@ app.whenReady().then(async () => {
|
|
|
738
725
|
const { url } = await startControlPlane();
|
|
739
726
|
if (smokeTest) {
|
|
740
727
|
const { runSmokeTest } = await import('./smoke-test.mjs');
|
|
741
|
-
await runSmokeTest({ app, BrowserWindow, url, root: engineRoot(), localShellProvider });
|
|
728
|
+
await runSmokeTest({ app, BrowserWindow, Menu, url, root: engineRoot(), localShellProvider });
|
|
742
729
|
app.quit();
|
|
743
730
|
return;
|
|
744
731
|
}
|
|
@@ -762,13 +749,13 @@ app.whenReady().then(async () => {
|
|
|
762
749
|
// box confidently suggested another copy was running, which sent the reader
|
|
763
750
|
// looking in the wrong place entirely.
|
|
764
751
|
const guess = /Cannot find (package|module)/i.test(error.message)
|
|
765
|
-
? 'The application is missing part of itself. This is a packaging fault, '
|
|
766
|
-
+ 'not something you can fix here — please report it with this message.'
|
|
752
|
+
? text('The application is missing part of itself. This is a packaging fault, '
|
|
753
|
+
+ 'not something you can fix here — please report it with this message.')
|
|
767
754
|
: error.code === 'EADDRINUSE' || /already running|EADDRINUSE/i.test(error.message)
|
|
768
|
-
? 'Another copy is already running, or a stale socket is in the way.'
|
|
769
|
-
: 'The socket path may be too long for this system, or the port could '
|
|
770
|
-
+ 'not be opened.';
|
|
771
|
-
dialog.showErrorBox('SSH Manager could not start', `${error.message}\n\n${guess}`);
|
|
755
|
+
? text('Another copy is already running, or a stale socket is in the way.')
|
|
756
|
+
: text('The socket path may be too long for this system, or the port could '
|
|
757
|
+
+ 'not be opened.');
|
|
758
|
+
dialog.showErrorBox(text('SSH Manager could not start'), `${error.message}\n\n${guess}`);
|
|
772
759
|
app.quit();
|
|
773
760
|
}
|
|
774
761
|
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { nativeLanguage, nativeText } from './locale.mjs';
|
|
2
|
+
|
|
3
|
+
// Electron's aggregate menu roles generate English child labels regardless of
|
|
4
|
+
// the in-app language. Keep individual roles for native shortcuts and behavior,
|
|
5
|
+
// and supply each visible label from the same saved preference as the UI.
|
|
6
|
+
export function applicationMenuTemplate({ isMac, onOpenBrowser, onCheckUpdates, language = nativeLanguage() }) {
|
|
7
|
+
const text = message => nativeText(message, {}, language);
|
|
8
|
+
const item = (role, label) => ({ role, label: text(label) });
|
|
9
|
+
const separator = () => ({ type: 'separator' });
|
|
10
|
+
return [
|
|
11
|
+
...(isMac ? [{ label: 'SSH Manager', submenu: [
|
|
12
|
+
item('about', 'About SSH Manager'), separator(),
|
|
13
|
+
{ role: 'services', label: text('Services'), submenu: [] }, separator(),
|
|
14
|
+
item('hide', 'Hide SSH Manager'), item('hideOthers', 'Hide Others'),
|
|
15
|
+
item('unhide', 'Show All'), separator(), item('quit', 'Quit SSH Manager'),
|
|
16
|
+
] }] : []),
|
|
17
|
+
{ label: text('File'), submenu: [
|
|
18
|
+
{ label: text('Open in browser'), accelerator: 'CmdOrCtrl+B', click: onOpenBrowser },
|
|
19
|
+
separator(), isMac ? item('close', 'Close') : item('quit', 'Quit'),
|
|
20
|
+
] },
|
|
21
|
+
{ label: text('Edit'), submenu: [
|
|
22
|
+
item('undo', 'Undo'), item('redo', 'Redo'), separator(),
|
|
23
|
+
item('cut', 'Cut'), item('copy', 'Copy'), item('paste', 'Paste'),
|
|
24
|
+
item('pasteAndMatchStyle', 'Paste and Match Style'), item('delete', 'Delete'),
|
|
25
|
+
item('selectAll', 'Select All'),
|
|
26
|
+
...(isMac ? [separator(), { label: text('Speech'), submenu: [
|
|
27
|
+
item('startSpeaking', 'Start Speaking'), item('stopSpeaking', 'Stop Speaking'),
|
|
28
|
+
] }] : []),
|
|
29
|
+
] },
|
|
30
|
+
{ label: text('View'), submenu: [
|
|
31
|
+
item('reload', 'Reload'), item('forceReload', 'Force reload'),
|
|
32
|
+
item('toggleDevTools', 'Developer tools'), separator(),
|
|
33
|
+
item('resetZoom', 'Actual size'), item('zoomIn', 'Zoom in'), item('zoomOut', 'Zoom out'),
|
|
34
|
+
separator(), item('togglefullscreen', 'Toggle fullscreen'),
|
|
35
|
+
] },
|
|
36
|
+
{ label: text('Window'), submenu: [
|
|
37
|
+
item('minimize', 'Minimize'), item('zoom', 'Zoom'),
|
|
38
|
+
...(isMac ? [separator(), item('front', 'Bring All to Front')] : [item('close', 'Close')]),
|
|
39
|
+
] },
|
|
40
|
+
{ role: 'help', label: text('Help'), submenu: [
|
|
41
|
+
{ label: text('Check for Updates…'), click: onCheckUpdates },
|
|
42
|
+
] },
|
|
43
|
+
];
|
|
44
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Copy": "复制",
|
|
3
|
+
"Checking for updates…": "正在检查更新…",
|
|
4
|
+
"Close": "关闭",
|
|
5
|
+
"Nothing is waiting": "暂无待审批请求",
|
|
6
|
+
"File": "文件",
|
|
7
|
+
"View": "视图",
|
|
8
|
+
"Edit": "编辑",
|
|
9
|
+
"Window": "窗口",
|
|
10
|
+
"Help": "帮助",
|
|
11
|
+
"Open in browser": "在浏览器中打开",
|
|
12
|
+
"Check for Updates…": "检查更新…",
|
|
13
|
+
"Show SSH Manager": "显示 SSH Manager",
|
|
14
|
+
"Quit SSH Manager": "退出 SSH Manager",
|
|
15
|
+
"Open right now": "当前已打开",
|
|
16
|
+
"Updates are turned off in this build": "此版本已关闭更新",
|
|
17
|
+
"{{v0}}: destructive command waiting": "{{v0}}:破坏性命令等待审批",
|
|
18
|
+
"{{v0}}: waiting for your decision": "{{v0}}:等待审批",
|
|
19
|
+
"{{v0}} waiting for your decision": "{{v0}} 项请求等待审批",
|
|
20
|
+
" Shell on {{v0}}": " {{v0}} 的终端",
|
|
21
|
+
"Servers ({{v0}})": "服务器({{v0}})",
|
|
22
|
+
"SSH Manager — {{v0}} waiting for your decision": "SSH Manager — {{v0}} 项请求等待审批",
|
|
23
|
+
"SSH Manager {{v0}} is available": "SSH Manager {{v0}} 可供更新",
|
|
24
|
+
"Open Options → Updates to download it. Nothing is installed until you restart.": "打开“设置 → 更新”下载。重启时才会安装。",
|
|
25
|
+
"Update to {{v0}}": "更新至 {{v0}}",
|
|
26
|
+
"Downloading update… {{v0}}%": "正在下载更新… {{v0}}%",
|
|
27
|
+
"Restart to update to {{v0}}": "重启并更新至 {{v0}}",
|
|
28
|
+
"Reload": "重新加载",
|
|
29
|
+
"Force reload": "强制重新加载",
|
|
30
|
+
"Developer tools": "开发者工具",
|
|
31
|
+
"Actual size": "实际大小",
|
|
32
|
+
"Zoom in": "放大",
|
|
33
|
+
"Zoom out": "缩小",
|
|
34
|
+
"Toggle fullscreen": "切换全屏",
|
|
35
|
+
"Quit": "退出",
|
|
36
|
+
"About SSH Manager": "关于 SSH Manager",
|
|
37
|
+
"Services": "服务",
|
|
38
|
+
"Hide SSH Manager": "隐藏 SSH Manager",
|
|
39
|
+
"Hide Others": "隐藏其他应用",
|
|
40
|
+
"Show All": "全部显示",
|
|
41
|
+
"Undo": "撤销",
|
|
42
|
+
"Redo": "重做",
|
|
43
|
+
"Cut": "剪切",
|
|
44
|
+
"Paste": "粘贴",
|
|
45
|
+
"Paste and Match Style": "粘贴并匹配样式",
|
|
46
|
+
"Delete": "删除",
|
|
47
|
+
"Select All": "全选",
|
|
48
|
+
"Speech": "语音",
|
|
49
|
+
"Start Speaking": "开始朗读",
|
|
50
|
+
"Stop Speaking": "停止朗读",
|
|
51
|
+
"Minimize": "最小化",
|
|
52
|
+
"Zoom": "缩放",
|
|
53
|
+
"Bring All to Front": "全部置于前台",
|
|
54
|
+
"SSH Manager could not start": "SSH Manager 无法启动",
|
|
55
|
+
"The application is missing part of itself. This is a packaging fault, not something you can fix here — please report it with this message.": "应用缺少部分组件。这是打包问题,无法在此修复,请附上此消息反馈。",
|
|
56
|
+
"Another copy is already running, or a stale socket is in the way.": "另一个实例已在运行,或有残留的套接字占用了路径。",
|
|
57
|
+
"The socket path may be too long for this system, or the port could not be opened.": "套接字路径在此系统上可能过长,或端口无法打开。"
|
|
58
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ssh-manager-desktop",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "ssh-manager-desktop",
|
|
9
|
-
"version": "4.
|
|
9
|
+
"version": "4.2.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"electron-updater": "^6.8.9",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Runs only through --release-smoke-test, with an isolated directory supplied
|
|
2
2
|
// by scripts/smoke-desktop.mjs. Exercise the packaged code, UI and native PTY.
|
|
3
3
|
import assert from 'node:assert/strict';
|
|
4
|
+
import { applicationMenuTemplate } from './native-menu.mjs';
|
|
4
5
|
import { spawn } from 'node:child_process';
|
|
5
6
|
import fs from 'node:fs';
|
|
6
7
|
import path from 'node:path';
|
|
@@ -123,9 +124,18 @@ export async function verifyEngineAnswers(engine, { timeoutMs = 30000, stage = (
|
|
|
123
124
|
}
|
|
124
125
|
}
|
|
125
126
|
|
|
126
|
-
export async function runSmokeTest({ app, BrowserWindow, url, root, localShellProvider }) {
|
|
127
|
+
export async function runSmokeTest({ app, BrowserWindow, Menu, url, root, localShellProvider }) {
|
|
127
128
|
const stage = createStages();
|
|
128
129
|
stage('control plane started');
|
|
130
|
+
for (const language of ['zh-CN', 'en']) {
|
|
131
|
+
const menu = Menu.buildFromTemplate(applicationMenuTemplate({ isMac: process.platform === 'darwin', language }));
|
|
132
|
+
const items = menu.items.flatMap(item => [item, ...(item.submenu?.items || [])]);
|
|
133
|
+
assert.ok(items.some(item => item.label === (language === 'zh-CN' ? '帮助' : 'Help')), 'localized native help menu');
|
|
134
|
+
if (process.platform === 'darwin') {
|
|
135
|
+
assert.ok(items.some(item => item.label === (language === 'zh-CN' ? '退出 SSH Manager' : 'Quit SSH Manager')), 'localized native application submenu');
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
stage('native menus built in Chinese and English');
|
|
129
139
|
const page = new BrowserWindow({ show: false, webPreferences: { contextIsolation: true, nodeIntegration: false } });
|
|
130
140
|
const failures = [];
|
|
131
141
|
page.webContents.on('render-process-gone', (_event, details) => failures.push(details.reason));
|