Terminal: show the live full working-directory path in the toolbar
Deploy Ladill Hosting / deploy (push) Successful in 45s

The toolbar showed a static ~/public_html. The jailed shell now reports its cwd
via OSC 7 each prompt (jail rcfile keeps the user's prompt + emits it); xterm
captures it and the toolbar shows the full path (/home/<user>/...), updating as
the user cd's. Launcher/rcfile committed in deployment/ for reproducibility.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
isaacclad
2026-06-27 07:53:48 +00:00
co-authored by Claude Opus 4.8
parent d7b47e67fb
commit 75ba450938
5 changed files with 31 additions and 3 deletions
+17
View File
@@ -25,6 +25,11 @@ window.hostingInteractiveTerminal = (config = {}) => {
termHasOutput: false,
currentPath: config.initialPath ?? '/public_html',
currentPathLabel: `Starting in ${config.initialPath === '/' ? `/home/${config.username ?? ''}` : `/home/${config.username ?? ''}${config.initialPath ?? '/public_html'}`}`,
// Full working-directory path shown in the toolbar; updated live from the
// shell's OSC 7 cwd report as the user navigates.
fullPath: config.initialPath === '/'
? `/home/${config.username ?? ''}`
: `/home/${config.username ?? ''}${config.initialPath ?? '/public_html'}`,
promptPath() {
if (this.currentPath === '/' || !this.currentPath) {
return '~';
@@ -79,6 +84,18 @@ window.hostingInteractiveTerminal = (config = {}) => {
this.fitAddon = new FitAddon();
this.term.loadAddon(this.fitAddon);
this.term.open(this.$refs.terminal);
// The shell reports its working directory via OSC 7 (file://host/path);
// capture it so the toolbar shows the live full path as the user cd's.
this.term.parser?.registerOscHandler(7, (data) => {
try {
let p = String(data || '').replace(/^file:\/\/[^/]*/, '');
p = decodeURIComponent(p);
if (p) {
this.fullPath = p.replace(/\/$/, '') || '/';
}
} catch (e) { /* ignore malformed cwd reports */ }
return true;
});
this.term.onData((data) => {
if (this.sessionId) {
this.queueInput(data);
@@ -24,7 +24,7 @@
<div class="flex items-center gap-2 pl-3">
<span class="font-mono text-xs text-white/40">{{ $account->username }}@ladill</span>
<span class="text-white/20">:</span>
<span class="font-mono text-xs text-emerald-400/80" x-text="promptPath()">~</span>
<span class="font-mono text-xs text-emerald-400/80" x-text="fullPath">~</span>
</div>
</div>