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();
|
||||
|
||||
Reference in New Issue
Block a user