genbox 1.0.167 → 1.0.168
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/dist/commands/attach.js +21 -11
- package/package.json +1 -1
package/dist/commands/attach.js
CHANGED
|
@@ -249,12 +249,22 @@ function isTerminalInForeground(genboxName) {
|
|
|
249
249
|
return true; // On error, assume yes to not break functionality
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
|
-
// Show message in tmux status bar
|
|
253
|
-
function showTmuxMessage(ipAddress, keyPath, sessionName, message) {
|
|
252
|
+
// Show message in tmux status bar with styling
|
|
253
|
+
function showTmuxMessage(ipAddress, keyPath, sessionName, message, style = 'success') {
|
|
254
254
|
const controlPath = getControlPath(ipAddress);
|
|
255
|
+
// Style configurations
|
|
256
|
+
const styles = {
|
|
257
|
+
uploading: 'bg=colour214,fg=black,bold', // Orange/yellow for uploading
|
|
258
|
+
success: 'bg=colour34,fg=white,bold', // Nice green for success
|
|
259
|
+
error: 'bg=colour196,fg=white,bold', // Red for error
|
|
260
|
+
warning: 'bg=colour208,fg=black,bold', // Orange for warning
|
|
261
|
+
};
|
|
262
|
+
const duration = style === 'uploading' ? 30000 : 4000; // Long duration for uploading (will be replaced)
|
|
263
|
+
const msgStyle = styles[style];
|
|
255
264
|
try {
|
|
256
|
-
//
|
|
257
|
-
|
|
265
|
+
// Set message style and display message
|
|
266
|
+
const cmd = `tmux set-option -t ${sessionName} message-style '${msgStyle}' \\; display-message -t ${sessionName} -d ${duration} ' ${message.replace(/'/g, "\\'")} '`;
|
|
267
|
+
(0, child_process_1.execSync)(`ssh -i "${keyPath}" -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ControlPath=${controlPath} dev@${ipAddress} "${cmd}" 2>/dev/null`, { encoding: 'utf-8', timeout: 5000 });
|
|
258
268
|
}
|
|
259
269
|
catch {
|
|
260
270
|
// Fallback to macOS notification if tmux message fails
|
|
@@ -569,7 +579,7 @@ async function attachToSession(ipAddress, keyPath, sessionName, genboxName) {
|
|
|
569
579
|
// If file path was detected but file doesn't exist (e.g., macOS temp file was cleaned up)
|
|
570
580
|
if (extractResult.notFound) {
|
|
571
581
|
const fileName = path.basename(extractResult.notFound);
|
|
572
|
-
showTmuxMessage(ipAddress, keyPath, sessionName, '⚠ File not found: ' + fileName.substring(0, 30));
|
|
582
|
+
showTmuxMessage(ipAddress, keyPath, sessionName, '⚠ File not found: ' + fileName.substring(0, 30), 'warning');
|
|
573
583
|
return;
|
|
574
584
|
}
|
|
575
585
|
if (!extractResult.path) {
|
|
@@ -580,8 +590,8 @@ async function attachToSession(ipAddress, keyPath, sessionName, genboxName) {
|
|
|
580
590
|
if (uploadedPaths.has(localPath)) {
|
|
581
591
|
return;
|
|
582
592
|
}
|
|
583
|
-
// Show uploading message in tmux
|
|
584
|
-
showTmuxMessage(ipAddress, keyPath, sessionName, '📤 Uploading image...
|
|
593
|
+
// Show uploading message in tmux (orange background, stays until replaced)
|
|
594
|
+
showTmuxMessage(ipAddress, keyPath, sessionName, '📤 Uploading image...', 'uploading');
|
|
585
595
|
// Upload the file (this happens in background, might cause brief pause)
|
|
586
596
|
const result = uploadFileSync(localPath, ipAddress, keyPath);
|
|
587
597
|
if (result.success) {
|
|
@@ -589,12 +599,12 @@ async function attachToSession(ipAddress, keyPath, sessionName, genboxName) {
|
|
|
589
599
|
uploadedPaths.add(result.remotePath); // Also track remote path to avoid re-detection
|
|
590
600
|
// Replace clipboard with remote path
|
|
591
601
|
setClipboard(result.remotePath);
|
|
592
|
-
// Show success in tmux
|
|
593
|
-
showTmuxMessage(ipAddress, keyPath, sessionName, '✓ Image ready!
|
|
602
|
+
// Show success in tmux (green background, replaces uploading message immediately)
|
|
603
|
+
showTmuxMessage(ipAddress, keyPath, sessionName, '✓ Image ready! Cmd+V to paste', 'success');
|
|
594
604
|
}
|
|
595
605
|
else {
|
|
596
|
-
// Show failure in tmux
|
|
597
|
-
showTmuxMessage(ipAddress, keyPath, sessionName, '✗ Upload failed: ' + (result.error || 'unknown'));
|
|
606
|
+
// Show failure in tmux (red background)
|
|
607
|
+
showTmuxMessage(ipAddress, keyPath, sessionName, '✗ Upload failed: ' + (result.error || 'unknown'), 'error');
|
|
598
608
|
}
|
|
599
609
|
}
|
|
600
610
|
catch {
|