@cluesmith/codev 1.4.8 → 1.4.9
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/package.json +1 -1
- package/templates/dashboard/js/tabs.js +12 -16
package/package.json
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
// Tab Management - Rendering, Selection, Overflow
|
|
2
2
|
|
|
3
|
+
// Get the base URL for ttyd/server connections (uses current hostname for remote access)
|
|
4
|
+
function getBaseUrl(port) {
|
|
5
|
+
return `http://${window.location.hostname}:${port}`;
|
|
6
|
+
}
|
|
7
|
+
|
|
3
8
|
// Build tabs from initial state
|
|
4
9
|
function buildTabsFromState() {
|
|
5
10
|
const previousTabIds = new Set(tabs.map(t => t.id));
|
|
@@ -83,7 +88,7 @@ function renderArchitect() {
|
|
|
83
88
|
// Only update iframe if port changed (avoid flashing on poll)
|
|
84
89
|
if (currentArchitectPort !== state.architect.port) {
|
|
85
90
|
currentArchitectPort = state.architect.port;
|
|
86
|
-
content.innerHTML = `<iframe src="
|
|
91
|
+
content.innerHTML = `<iframe src="${getBaseUrl(state.architect.port)}" title="Architect Terminal" allow="clipboard-read; clipboard-write"></iframe>`;
|
|
87
92
|
}
|
|
88
93
|
} else {
|
|
89
94
|
if (currentArchitectPort !== null) {
|
|
@@ -244,7 +249,7 @@ function renderTabContent() {
|
|
|
244
249
|
if (currentTabPort !== tab.port || currentTabType !== tab.type) {
|
|
245
250
|
currentTabPort = tab.port;
|
|
246
251
|
currentTabType = tab.type;
|
|
247
|
-
content.innerHTML = `<iframe src="
|
|
252
|
+
content.innerHTML = `<iframe src="${getBaseUrl(tab.port)}" title="${tab.name}" allow="clipboard-read; clipboard-write"></iframe>`;
|
|
248
253
|
}
|
|
249
254
|
}
|
|
250
255
|
|
|
@@ -257,7 +262,7 @@ function refreshFileTab(tabId) {
|
|
|
257
262
|
const content = document.getElementById('tab-content');
|
|
258
263
|
const iframe = content.querySelector('iframe');
|
|
259
264
|
if (iframe) {
|
|
260
|
-
iframe.src =
|
|
265
|
+
iframe.src = `${getBaseUrl(tab.port)}?t=${Date.now()}`;
|
|
261
266
|
}
|
|
262
267
|
}
|
|
263
268
|
}
|
|
@@ -481,20 +486,11 @@ function openInNewTab(tabId) {
|
|
|
481
486
|
const tab = tabs.find(t => t.id === tabId);
|
|
482
487
|
if (!tab) return;
|
|
483
488
|
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
showToast('Tab not ready', 'error');
|
|
488
|
-
return;
|
|
489
|
-
}
|
|
490
|
-
url = `http://localhost:${tab.port}`;
|
|
491
|
-
} else {
|
|
492
|
-
if (!tab.port) {
|
|
493
|
-
showToast('Tab not ready', 'error');
|
|
494
|
-
return;
|
|
495
|
-
}
|
|
496
|
-
url = `http://localhost:${tab.port}`;
|
|
489
|
+
if (!tab.port) {
|
|
490
|
+
showToast('Tab not ready', 'error');
|
|
491
|
+
return;
|
|
497
492
|
}
|
|
498
493
|
|
|
494
|
+
const url = getBaseUrl(tab.port);
|
|
499
495
|
window.open(url, '_blank', 'noopener,noreferrer');
|
|
500
496
|
}
|