Skip to content

Commit

Permalink
Terminal, minor
Browse files Browse the repository at this point in the history
  • Loading branch information
veniware committed May 16, 2024
1 parent 11fe033 commit a6b0bf4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
10 changes: 5 additions & 5 deletions Protest/Front/ssh.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class Ssh extends Terminal {
this.ConnectViaCredentials(
hostInput.value.trim(),
usernameInput.value.trim(),
passwordInput.value.trim()
passwordInput.value
);
};

Expand All @@ -89,7 +89,7 @@ class Ssh extends Terminal {
okButton.disabled =
hostInput.value.trim().length === 0 ||
usernameInput.value.trim().length === 0 ||
passwordInput.value.trim().length === 0;
passwordInput.value.length === 0;
};

hostInput.oninput();
Expand All @@ -98,16 +98,16 @@ class Ssh extends Terminal {
}

ConnectViaCredentials(target, username, password) {
const connectionString = `target=${target} un=${username} pw=${password}`;
const connectionString = `target=${target}\nun=${username}\npw=${password}`;
this.Connect(target, connectionString);
}

ConnectViaFile(target, file) {
const connectionString = `target=${target} file=${file}`;
const connectionString = `target=${target}\nfile=${file}`;
this.Connect(target, connectionString);
}

Connect(target, connectionString) { //overrides
Connect(target, connectionString) {
this.params.host = target;

this.statusBox.style.display = "initial";
Expand Down
2 changes: 1 addition & 1 deletion Protest/Front/terminal.css
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
background-color: var(--clr-accent);
box-shadow: var(--clr-accent) 0 0 2px;

transition: .4s;
transition: .25s;
}

.terminal-content:focus > .terminal-cursor {
Expand Down
11 changes: 10 additions & 1 deletion Protest/Front/terminal.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,16 @@ class Terminal extends Window {
}

switch(event.key) {
case "Enter" : this.ws.send("\r\n"); return;
case "Enter":
if (this instanceof Ssh) {
this.ws.send("\n");
return;
}
else {
this.ws.send("\r\n");
return;
}

case "Tab" : this.ws.send("\t"); return;
case "Backspace" : this.ws.send("\x08"); return;
case "Delete" : this.ws.send("\x1b[3~"); return;
Expand Down
2 changes: 1 addition & 1 deletion Protest/Protocols/Ssh.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static async void WebSocketHandler(HttpListenerContext ctx) {
WebSocketReceiveResult targetResult = await ws.ReceiveAsync(new ArraySegment<byte>(connectionBuffer), CancellationToken.None);
string connectionString = Encoding.Default.GetString(connectionBuffer, 0, targetResult.Count);

string[] lines = connectionString.Split(" ");
string[] lines = connectionString.Split("\n");
string target = String.Empty;
string file = null;
string username = String.Empty;
Expand Down

0 comments on commit a6b0bf4

Please sign in to comment.