This commit is contained in:
@@ -136,6 +136,30 @@ function wireVaultActions() {
|
||||
if (button) button.addEventListener('click', saveDemoVault);
|
||||
}
|
||||
|
||||
async function runLocalTerminalCommand() {
|
||||
const command = document.getElementById('terminal-command').value;
|
||||
const output = document.getElementById('terminal-output');
|
||||
output.textContent = 'Running…';
|
||||
try {
|
||||
const tauri = window.__TAURI__?.core;
|
||||
if (!tauri) throw new Error('Tauri bridge unavailable in browser preview');
|
||||
const result = await tauri.invoke('run_local_command', { command, cwd: null });
|
||||
output.textContent = [
|
||||
`$ ${command}`,
|
||||
`exit ${result.exit_code}`,
|
||||
result.stdout ? `stdout:\n${result.stdout}` : '',
|
||||
result.stderr ? `stderr:\n${result.stderr}` : ''
|
||||
].filter(Boolean).join('\n');
|
||||
} catch (error) {
|
||||
output.textContent = String(error);
|
||||
}
|
||||
}
|
||||
|
||||
function wireTerminalActions() {
|
||||
const button = document.getElementById('run-terminal');
|
||||
if (button) button.addEventListener('click', runLocalTerminalCommand);
|
||||
}
|
||||
|
||||
async function boot() {
|
||||
const [dashboard, features] = await Promise.all([
|
||||
invokeOrFallback('wallet_dashboard', fallbackDashboard),
|
||||
@@ -144,6 +168,7 @@ async function boot() {
|
||||
renderDashboard(dashboard);
|
||||
renderFeatures(features);
|
||||
wireVaultActions();
|
||||
wireTerminalActions();
|
||||
}
|
||||
|
||||
boot();
|
||||
|
||||
@@ -132,6 +132,20 @@
|
||||
</article>
|
||||
</section>
|
||||
|
||||
<section class="panel terminal-panel">
|
||||
<div class="panel-heading">
|
||||
<div>
|
||||
<p class="eyebrow">Local terminal</p>
|
||||
<h3>Run a local shell command</h3>
|
||||
</div>
|
||||
<button id="run-terminal" class="primary" type="button">Run</button>
|
||||
</div>
|
||||
<div class="terminal-form">
|
||||
<input id="terminal-command" value="printf 'hello from Rabby local terminal'" />
|
||||
<pre id="terminal-output">Local command runtime is wired through Tauri.</pre>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="panel feature-panel">
|
||||
<div class="panel-heading">
|
||||
<div>
|
||||
|
||||
@@ -306,3 +306,9 @@ h3 { margin-bottom: 0; font-size: 18px; }
|
||||
.hero-grid,
|
||||
.two-column { grid-template-columns: 1fr; }
|
||||
}
|
||||
|
||||
|
||||
.terminal-panel { margin-bottom: 16px; }
|
||||
.terminal-form { margin-top: 18px; display: grid; gap: 12px; }
|
||||
.terminal-form input { width: 100%; border: 1px solid #dfe6f6; border-radius: 14px; padding: 12px 14px; color: #253052; background: #f8faff; font: 14px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; }
|
||||
.terminal-form pre { min-height: 120px; margin: 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; }
|
||||
|
||||
Reference in New Issue
Block a user