This commit is contained in:
@@ -185,6 +185,27 @@ function wireTerminalActions() {
|
||||
if (button) button.addEventListener('click', runLocalTerminalCommand);
|
||||
}
|
||||
|
||||
async function runSshCommand() {
|
||||
const host = document.getElementById('ssh-host').value;
|
||||
const user = document.getElementById('ssh-user').value || null;
|
||||
const command = document.getElementById('ssh-command').value;
|
||||
const output = document.getElementById('ssh-output');
|
||||
output.textContent = 'Connecting…';
|
||||
try {
|
||||
const tauri = window.__TAURI__?.core;
|
||||
if (!tauri) throw new Error('Tauri bridge unavailable in browser preview');
|
||||
const result = await tauri.invoke('run_ssh_command', { host, user, port: 22, command });
|
||||
output.textContent = [`ssh ${host} ${command}`, `exit ${result.exit_code}`, result.stdout, result.stderr].filter(Boolean).join('\n');
|
||||
} catch (error) {
|
||||
output.textContent = String(error);
|
||||
}
|
||||
}
|
||||
|
||||
function wireSshActions() {
|
||||
const button = document.getElementById('run-ssh');
|
||||
if (button) button.addEventListener('click', runSshCommand);
|
||||
}
|
||||
|
||||
async function boot() {
|
||||
const [dashboard, features] = await Promise.all([
|
||||
invokeOrFallback('wallet_dashboard', fallbackDashboard),
|
||||
@@ -195,6 +216,7 @@ async function boot() {
|
||||
wireVaultActions();
|
||||
wireSettingsActions();
|
||||
wireTerminalActions();
|
||||
wireSshActions();
|
||||
}
|
||||
|
||||
boot();
|
||||
|
||||
@@ -159,6 +159,22 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="panel terminal-panel">
|
||||
<div class="panel-heading">
|
||||
<div>
|
||||
<p class="eyebrow">SSH</p>
|
||||
<h3>Run a remote command</h3>
|
||||
</div>
|
||||
<button id="run-ssh" class="primary" type="button">SSH run</button>
|
||||
</div>
|
||||
<div class="ssh-grid">
|
||||
<input id="ssh-host" placeholder="host" value="example.com" />
|
||||
<input id="ssh-user" placeholder="user optional" value="" />
|
||||
<input id="ssh-command" placeholder="command" value="uptime" />
|
||||
</div>
|
||||
<pre id="ssh-output" class="runtime-output">SSH runtime is wired through system ssh with BatchMode and timeout.</pre>
|
||||
</section>
|
||||
|
||||
<section class="panel feature-panel">
|
||||
<div class="panel-heading">
|
||||
<div>
|
||||
|
||||
@@ -317,3 +317,9 @@ h3 { margin-bottom: 0; font-size: 18px; }
|
||||
.settings-form { margin-top: 18px; padding-top: 16px; border-top: 1px solid #edf1fb; display: grid; gap: 8px; }
|
||||
.settings-form label { color: #62708f; font-weight: 800; }
|
||||
.settings-form select { flex: 1; min-width: 0; border: 1px solid #dfe6f6; border-radius: 14px; padding: 11px 12px; color: #253052; background: #f8faff; }
|
||||
|
||||
|
||||
.ssh-grid { margin-top: 18px; display: grid; grid-template-columns: 1fr 0.7fr 1.2fr; gap: 10px; }
|
||||
.ssh-grid input { min-width: 0; border: 1px solid #dfe6f6; border-radius: 14px; padding: 12px 14px; color: #253052; background: #f8faff; }
|
||||
.runtime-output { min-height: 100px; margin: 12px 0 0; padding: 16px; border-radius: 18px; color: #b9fbcf; background: #12182b; white-space: pre-wrap; overflow: auto; font: 13px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }
|
||||
@media (max-width: 720px) { .ssh-grid { grid-template-columns: 1fr; } }
|
||||
|
||||
Reference in New Issue
Block a user