From b1297225c74eadde972fda3756b0082201f91bf8 Mon Sep 17 00:00:00 2001
From: Pizza <33816021+PizzaCow@users.noreply.github.com>
Date: Wed, 1 Apr 2026 22:14:30 -0600
Subject: [PATCH] =?UTF-8?q?v0.04:=20Guacamole=20deployed=20+=20integrated?=
=?UTF-8?q?=20=E2=80=94=20green=20chips=20open=20SSH/RDP/VNC=20sessions?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
templates/index.html | 36 +++++++++++++++++++++++++-----------
1 file changed, 25 insertions(+), 11 deletions(-)
diff --git a/templates/index.html b/templates/index.html
index 2a5fa30..855925b 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -624,8 +624,8 @@ const FILE_PROTO_LABELS = {
// Ports that open in Guacamole (green chips)
const GUAC_PORTS = new Set([22, 3389, 5900, 5901, 5902, 5903]);
const GUAC_PROTOCOLS = {22: 'ssh', 3389: 'rdp', 5900: 'vnc', 5901: 'vnc', 5902: 'vnc', 5903: 'vnc'};
-// Set this to your Guacamole URL once deployed, e.g. 'http://100.97.92.103:9090/guacamole'
-const GUAC_URL = null; // null = show green chip but no link yet
+// Guacamole is running on the same host as TailScan
+const GUAC_URL = 'http://100.99.195.16:8085/guacamole';
function buildChips(ip, ports) {
return ports.map(p => {
@@ -636,15 +636,8 @@ function buildChips(ip, ports) {
if (isGuac) {
const proto = GUAC_PROTOCOLS[p.port];
- const tip = GUAC_URL
- ? `${escHtml(p.service)} — open in Guacamole (${proto.toUpperCase()})`
- : `${escHtml(p.service)} — Guacamole not deployed yet`;
- if (GUAC_URL) {
- const href = `${GUAC_URL}/#/client/${btoa('#' + proto + '\0c\0' + 'default')}`;
- return `${p.port}${tip}`;
- } else {
- return `${p.port}${tip}`;
- }
+ const tip = `${escHtml(p.service)} — open in Guacamole (${proto.toUpperCase()})`;
+ return `${p.port}${tip}`;
} else if (isCopyparty) {
const tUrl = encodeURIComponent(`http://${ip}:${p.port}/`);
@@ -828,6 +821,27 @@ function showError(msg) {
`;
}
+// ── Guacamole ─────────────────────────────────────────────────────────────────
+
+async function openGuac(ip, port, proto) {
+ // Show loading cursor
+ document.body.style.cursor = 'wait';
+ try {
+ const r = await fetch(`/api/guac-connect?ip=${encodeURIComponent(ip)}&port=${port}&proto=${proto}`);
+ if (!r.ok) {
+ const err = await r.json().catch(() => ({detail: r.statusText}));
+ alert(`Guacamole error: ${err.detail || r.statusText}`);
+ return;
+ }
+ const d = await r.json();
+ window.open(d.url, '_blank');
+ } catch(e) {
+ alert(`Failed to connect to Guacamole: ${e}`);
+ } finally {
+ document.body.style.cursor = '';
+ }
+}
+
// ── Theme ─────────────────────────────────────────────────────────────────────
const THEMES = ['default', 'rosepine'];