From ccace2ce81e729a31c0450f455d89f6990ae8e18 Mon Sep 17 00:00:00 2001 From: iliajie Date: Mon, 31 Oct 2022 16:25:50 +0200 Subject: [PATCH 01/12] Add config option to make bash prompt look nice (user dependent) --- xterm/index.cgi | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/xterm/index.cgi b/xterm/index.cgi index a738977c8..df9693a64 100644 --- a/xterm/index.cgi +++ b/xterm/index.cgi @@ -186,6 +186,26 @@ if ($user eq "root" && $in{'user'}) { $user = $in{'user'}; } +# Terminal flavors +my ($ps1, $term_flavors); +if ($config{'flavors'}) { + # Optionally add colors to the prompt depending on the user type + if ($user eq "root") { + # magenta@blue ~# (for root) + $ps1 = "PS1='\\\\[\\\\033[1;35m\\\\]\\\\u\\\\[\\\\033[1;37m\\\\]". + "@\\\\[\\\\033[1;34m\\\\]\\\\h:\\\\[\\\\033[1;37m\\\\]". + "\\\\w\\\\[\\\\033[1;37m\\\\]\\\\\$\\\\[\\\\033[0m\\\\] '"; + } + else { + # green@blue ~$ (for regular users) + $ps1 = "PS1='\\\\[\\\\033[1;32m\\\\]\\\\u\\\\[\\\\033[1;37m\\\\]". + "@\\\\[\\\\033[1;34m\\\\]\\\\h:\\\\[\\\\033[1;37m\\\\]". + "\\\\w\\\\[\\\\033[1;37m\\\\]\\\\\$\\\\[\\\\033[0m\\\\] '"; + } + $term_flavors = "socket.send(\"alias ls='ls --color=auto'\\r\"); ". + "socket.send(\"$ps1\\r\");"; + } + # Check for directory to start the shell in my $dir = $in{'dir'}; @@ -217,6 +237,7 @@ my $term_script = < Date: Mon, 31 Oct 2022 16:26:49 +0200 Subject: [PATCH 02/12] Add actual config option --- xterm/config | 1 + xterm/config.info | 1 + 2 files changed, 2 insertions(+) diff --git a/xterm/config b/xterm/config index a14fe8590..7fa735415 100644 --- a/xterm/config +++ b/xterm/config @@ -1 +1,2 @@ base_port=555 +flavors=1 \ No newline at end of file diff --git a/xterm/config.info b/xterm/config.info index c153edef2..440521e9c 100644 --- a/xterm/config.info +++ b/xterm/config.info @@ -1,2 +1,3 @@ base_port=Base port number for WebSockets connections,0,5 size=Terminal width and height in characters,3,Automatic,5,,,Static (80x24) +flavors=Enable inbuilt command prompt color customization,1,1-Yes,0-No From bf745995027c9ac688065f778412285fc1dd168e Mon Sep 17 00:00:00 2001 From: iliajie Date: Mon, 31 Oct 2022 16:27:10 +0200 Subject: [PATCH 03/12] Add much smoother terminal initial load --- xterm/index.cgi | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/xterm/index.cgi b/xterm/index.cgi index df9693a64..d74038af5 100644 --- a/xterm/index.cgi +++ b/xterm/index.cgi @@ -113,6 +113,19 @@ body[style='height:100%'] { #terminal + script ~ * { display: none } +#terminal > .terminal { + visibility: hidden; + animation: .15s fadeIn; + animation-fill-mode: forwards; +} +\@keyframes fadeIn { + 99% { + visibility: hidden; + } + 100% { + visibility: visible; + } +} EOF From 1a296d9579beffe8e66c108e53bcdcb0ecfd3049 Mon Sep 17 00:00:00 2001 From: iliajie Date: Mon, 31 Oct 2022 16:29:58 +0200 Subject: [PATCH 04/12] Fix to tell SPA themes what's up --- xterm/index.cgi | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/xterm/index.cgi b/xterm/index.cgi index d74038af5..68a636dc0 100644 --- a/xterm/index.cgi +++ b/xterm/index.cgi @@ -270,11 +270,13 @@ print "