soxogvv commited on
Commit
2fde893
Β·
verified Β·
1 Parent(s): a74b29d

Upload 2 files

Browse files
Files changed (2) hide show
  1. public/app.js +38 -1
  2. public/index.html +37 -0
public/app.js CHANGED
@@ -453,4 +453,41 @@ async function ensureShellularRunning() {
453
  })();
454
 
455
  // Expose for inline onclick in HTML
456
- window.restartShellular = restartShellular;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
453
  })();
454
 
455
  // Expose for inline onclick in HTML
456
+ window.restartShellular = restartShellular;
457
+ /* ── SSH / Termius credentials ───────────────────────────────────────────────── */
458
+ let sshRevealed = false;
459
+
460
+ window.toggleSshPass = function () {
461
+ sshRevealed = !sshRevealed;
462
+ const el = $('ssh-pass');
463
+ const btn = $('ssh-reveal');
464
+ el.classList.toggle('ssh-blur', !sshRevealed);
465
+ btn.textContent = sshRevealed ? 'Hide' : 'Show';
466
+ };
467
+
468
+ async function pollSshInfo() {
469
+ if (!token) { setTimeout(pollSshInfo, 1500); return; }
470
+ try {
471
+ const res = await authFetch('/api/ssh-info');
472
+ if (!res || !res.ok) { setTimeout(pollSshInfo, 5000); return; }
473
+ const d = await res.json();
474
+
475
+ if (d.ready) {
476
+ $('ssh-host').textContent = d.host;
477
+ $('ssh-port').textContent = d.port;
478
+ $('ssh-user').textContent = d.username;
479
+ $('ssh-pass').textContent = d.password;
480
+ $('ssh-waiting').classList.add('hidden');
481
+ $('ssh-creds').classList.remove('hidden');
482
+ // Tunnel is up β€” no need to keep polling
483
+ } else {
484
+ // Not ready yet β€” keep polling every 4 s
485
+ setTimeout(pollSshInfo, 4000);
486
+ }
487
+ } catch {
488
+ setTimeout(pollSshInfo, 5000);
489
+ }
490
+ }
491
+
492
+ // Kick off SSH polling shortly after page load
493
+ setTimeout(pollSshInfo, 800);
public/index.html CHANGED
@@ -105,6 +105,43 @@
105
  <button class="btn btn-primary" onclick="restartShellular()">Try again</button>
106
  </div>
107
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  </section>
109
 
110
  <!-- First-time setup card (hidden once secrets are saved) -->
 
105
  <button class="btn btn-primary" onclick="restartShellular()">Try again</button>
106
  </div>
107
  </div>
108
+
109
+ <!-- ── SSH / Termius credentials ───────────────────────────────── -->
110
+ <div class="ssh-box">
111
+ <div class="ssh-box-title">
112
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="ssh-icon"><rect x="2" y="11" width="20" height="11" rx="2" ry="2"/><path d="M7 11V7a5 5 0 0 1 10 0v4"/></svg>
113
+ SSH Β· Termius Access
114
+ </div>
115
+
116
+ <div id="ssh-waiting" class="ssh-waiting">
117
+ <div class="loader loader-sm"></div>
118
+ <span>Opening tunnel&hellip;</span>
119
+ </div>
120
+
121
+ <div id="ssh-creds" class="ssh-creds hidden">
122
+ <div class="ssh-row">
123
+ <span class="ssh-label">Host</span>
124
+ <code id="ssh-host" class="ssh-val"></code>
125
+ <button class="btn-copy" data-target="ssh-host">Copy</button>
126
+ </div>
127
+ <div class="ssh-row">
128
+ <span class="ssh-label">Port</span>
129
+ <code id="ssh-port" class="ssh-val"></code>
130
+ <button class="btn-copy" data-target="ssh-port">Copy</button>
131
+ </div>
132
+ <div class="ssh-row">
133
+ <span class="ssh-label">User</span>
134
+ <code id="ssh-user" class="ssh-val">root</code>
135
+ <button class="btn-copy" data-target="ssh-user">Copy</button>
136
+ </div>
137
+ <div class="ssh-row">
138
+ <span class="ssh-label">Password</span>
139
+ <code id="ssh-pass" class="ssh-val ssh-blur"></code>
140
+ <button id="ssh-reveal" class="btn-copy" onclick="toggleSshPass()">Show</button>
141
+ <button class="btn-copy" data-target="ssh-pass">Copy</button>
142
+ </div>
143
+ </div>
144
+ </div>
145
  </section>
146
 
147
  <!-- First-time setup card (hidden once secrets are saved) -->